1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets_remix/ChatDrawer-CubdiPvy.js","assets_remix/rolldown-runtime-B0Z9INg1.js","assets_remix/uiFramework-CmzQ-hQv.js","assets_remix/uiFramework-jDvqSYF5.css","assets_remix/src-BN6admL3.js","assets_remix/observability-KERHUmUI.js","assets_remix/schemas-BCv8FbkB.js","assets_remix/coerce-opsCHIWb.js","assets_remix/dist-CN1zt2w1.js","assets_remix/twilio-B9gO9xNu.js","assets_remix/ChatDrawer-DqD85AhP.css"])))=>i.map(i=>d[i]); 2import{a as e,t}from"./rolldown-runtime-B0Z9INg1.js";import{$ as n,B as r,C as i,D as a,E as o,H as s,J as c,K as l,L as u,M as d,N as f,P as p,R as m,S as h,T as g,U as _,V as v,X as y,Y as b,b as x,f as S,m as C,p as w,q as T,w as E,x as D,y as O,z as ee}from"./uiFramework-CmzQ-hQv.js";import{t as k}from"./buildEnvSchema-Bp5yVXIH.js";import{f as A,p as j,u as te}from"./dist-mmH4yOc3.js";import{a as ne,i as re,n as ie,r as ae,t as oe}from"./useNavbarBreakpoint-DY8lZZnb.js";import{n as se,t as ce}from"./ErrorMessage-9Vq9SLiO.js";var M;(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`})(M||={});var N;(function(e){e.IDENTIFY=`$identify`,e.GROUP_IDENTIFY=`$groupidentify`,e.REVENUE=`revenue_amount`})(N||={});var le=`AMP_unsent`,ue=`$default_instance`,P=`https://api2.amplitude.com/2/httpapi`,de=`https://api.eu.amplitude.com/2/httpapi`,fe=`https://api2.amplitude.com/batch`,pe=`https://api.eu.amplitude.com/batch`,me=`utm_campaign`,he=`utm_content`,ge=`utm_id`,_e=`utm_medium`,ve=`utm_source`,ye=`utm_term`,be=`dclid`,xe=`fbclid`,Se=`gbraid`,Ce=`gclid`,we=`ko_click_id`,Te=`li_fat_id`,Ee=`msclkid`,De=`rdt_cid`,Oe=`ttclid`,ke=`twclid`,Ae=`wbraid`,je={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},Me=`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`.split(`.`),Ne=[`authorization`,`cookie`,`set-cookie`],Pe=1e3,Fe=function(e){if(Object.keys(e).length>Pe)return!1;for(var t in e){var n=e[t];if(!Ie(t,n))return!1}return!0},Ie=function(e,t){var n,r;if(typeof e!=`string`)return!1;if(Array.isArray(t)){var i=!0;try{for(var a=o(t),s=a.next();!s.done;s=a.next()){var c=s.value;if(Array.isArray(c))return!1;if(typeof c==`object`)i&&=Fe(c);else if(![`number`,`string`].includes(typeof c))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}else if(t==null)return!1;else if(typeof t==`object`)return Fe(t);else if(![`number`,`string`,`boolean`].includes(typeof t))return!1;return!0},Le=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return O({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(F.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(F.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(F.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(F.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(F.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(F.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(F.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(F.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(F.UNSET,e,`-`),this},e.prototype.clearAll=function(){return this._properties={},this._properties[F.CLEAR_ALL]=`-`,this}
2,e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return r===void 0&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return this._properties[F.CLEAR_ALL]!==void 0||this._propertySet.has(t)?!1:e===F.ADD?typeof n==`number`:e!==F.UNSET&&e!==F.REMOVE?Ie(t,n):!0},e}(),F;(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`})(F||={});var Re=[F.CLEAR_ALL,F.UNSET,F.SET,F.SET_ONCE,F.ADD,F.APPEND,F.PREPEND,F.PREINSERT,F.POSTINSERT,F.REMOVE],ze=`Event tracked successfully`,Be=`Unexpected error occurred`,Ve=`Event rejected due to exceeded retry count`,He=`Event skipped due to optOut config`,Ue=`Event rejected due to missing API key`,We=`Client not initialized`,I;(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`})(I||={});var Ge=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=I.Unknown),{event:e,code:t,message:n}},L=function(){var e=`ampIntegrationContext`;if(typeof globalThis<`u`&&globalThis[e]!==void 0)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},Ke=function(e){return e?(e^Math.random()*16>>e/4).toString(16):`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,R)},qe=g([],i(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,`0`)}),R=function(e){var t=L();if(!t?.crypto?.getRandomValues)return Ke(e);var n=t.crypto.getRandomValues(new Uint8Array(16));return n[6]=n[6]&15|64,n[8]=n[8]&63|128,g([],i(n.entries()),!1).map(function(e){var t=i(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?`-${qe[r]}`:qe[r]}).join(``)},Je=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){return x(this,void 0,void 0,function(){var n;return h(this,function(r){switch(r.label){case 0:return e.name===void 0&&(e.name=R(),this.loggerProvider.warn(`Plugin name is undefined. 3 Generating a random UUID for plugin name: ${e.name}. 4 Set a name for the plugin to prevent it from being added multiple times.`)),n=e.name,this.pluginStatus.has(n)?(this.loggerProvider.warn(`Plugin with name ${n} already exists, skipping registration`),[2]):(e.type=e.type??`enrichment`,this.pluginStatus.set(n,`locked`),[4,e.setup?.call(e,t,this.client)]);case 1:return r.sent(),this.pluginStatus.get(n)===`locked`?(this.plugins.push(e),this.pluginStatus.set(n,`installed`),[2]):[2]}})})},e.prototype.deregister=function(e,t){return x(this,void 0,void 0,function(){var n,r;return h(this,function(i){switch(i.label){case 0:return this.pluginStatus.delete(e),n=this.plugins.findIndex(function(t){return t.name===e}),n===-1?(t.loggerProvider.warn(`Plugin with name ${e} does not exist, skipping deregistration`),[2]):(r=this.plugins[n],this.plugins.splice(n,1),[4,r.teardown?.call(r)]);case 1:return i.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){return e.teardown?.call(e)}),this.plugins=[],this.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return x(this,void 0,void 0,function(){var t,n,r,a,s,c,l,u,d,f,p,m,g,u,d,_,v,y,b,x,S,C;return h(this,function(h){switch(h.label){case 0:if(!e)return[2];t=i(e,1),n=t[0],r=i(e,2),a=r[1],this.loggerProvider.log(`Timeline.apply: Initial event`,n),s=this.plugins.filter(function(e){return e.type===`before`}),h.label=1;case 1:h.trys.push([1,6,7,8]),c=o(s),l=c.next(),h.label=2;case 2:return l.done?[3,5]:(u=l.value,u.execute?[4,u.execute(O({},n))]:[3,4]);case 3:if(d=h.sent(),d===null)return this.loggerProvider.log(`Timeline.apply: Event filtered out by before plugin '${String(u.name)}
4', event: ${JSON.stringify(n)}`),a({event:n,code:0,message:``}),[2];n=d,this.loggerProvider.log(`Timeline.apply: Event after before plugin '${String(u.name)}', event: ${JSON.stringify(n)}`),h.label=4;case 4:return l=c.next(),[3,2];case 5:return[3,8];case 6:return f=h.sent(),b={error:f},[3,8];case 7:try{l&&!l.done&&(x=c.return)&&x.call(c)}finally{if(b)throw b.error}return[7];case 8:p=this.plugins.filter(function(e){return e.type===`enrichment`||e.type===void 0}),h.label=9;case 9:h.trys.push([9,14,15,16]),m=o(p),g=m.next(),h.label=10;case 10:return g.done?[3,13]:(u=g.value,u.execute?[4,u.execute(O({},n))]:[3,12]);case 11:if(d=h.sent(),d===null)return this.loggerProvider.log(`Timeline.apply: Event filtered out by enrichment plugin '${String(u.name)}', event: ${JSON.stringify(n)}`),a({event:n,code:0,message:``}),[2];n=d,this.loggerProvider.log(`Timeline.apply: Event after enrichment plugin '${String(u.name)}', event: ${JSON.stringify(n)}`),h.label=12;case 12:return g=m.next(),[3,10];case 13:return[3,16];case 14:return _=h.sent(),S={error:_},[3,16];case 15:try{g&&!g.done&&(C=m.return)&&C.call(m)}finally{if(S)throw S.error}return[7];case 16:return v=this.plugins.filter(function(e){return e.type===`destination`}),this.loggerProvider.log(`Timeline.apply: Final event before destinations, event: ${JSON.stringify(n)}`),y=v.map(function(e){var t=O({},n);return e.execute(t).catch(function(e){return Ge(t,0,String(e))})}),Promise.all(y).then(function(e){var t=i(e,1)[0]||Ge(n,100,`Event not tracked, no destination plugins on the instance`);a(t)}),[2]}})})},e.prototype.flush=function(){return x(this,void 0,void 0,function(){var e,t,n,r=this;return h(this,function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return r.apply(e)}))];case 1:return i.sent(),t=this.plugins.filter(function(e){return e.type===`destination`}),n=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(n)];case 2:return i.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var n;(n=t.onIdentityChanged)==null||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;(n=t.onSessionIdChanged)==null||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;(n=t.onOptOutChanged)==null||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return x(this,void 0,void 0,function(){var t,n,r,i,a,s,c;return h(this,function(l){switch(l.label){case 0:l.trys.push([0,7,8,9]),t=o(this._optOutListeners),n=t.next(),l.label=1;case 1:if(n.done)return[3,6];r=n.value,l.label=2;case 2:return l.trys.push([2,4,,5]),[4,r(e)];case 3:return l.sent(),[3,5];case 4:return i=l.sent(),this.loggerProvider.error(`Error calling optOut listener`,i),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return a=l.sent(),s={error:a},[3,9];case 8:try{n&&!n.done&&(c=t.return)&&c.call(t)}finally{if(s)throw s.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;(t=e.onReset)==null||t.call(e)})},e}(),Ye=function(e,t,n){return O(O(O({},typeof e==`string`?{event_type:e}:e),n),t&&{event_properties:t})},Xe=function(e,t){return O(O({},t),{event_type:N.IDENTIFY,user_properties:e.getUserProperties()})},Ze=function(e,t,n,r){var i;return O(O({},r),{event_type:N.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[e]=t,i)})},Qe=function(e,t,n){var r,i=new Le;return i.set(e,t),O(O({},n),{event_type:N.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[e]=t,r)})},$e=function(e,t){return O(O({},t),{event_type:N.REVENUE,event_properties:e.getEventProperties()})},z=function(e){return{promise:e||Promise.resolve()}},et=function(){function e(e){e===void 0&&(e=`$default`),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Je(this),this.name=e}return e.prototype._init=function(e){return x(this,void 0,void 0,function(){var t=this;return h(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions(`q`,function(){return t.isReady=!0})];case 1:return n.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return x(this,void 0,void 0,function(){var n,r,i,a,s,c,l,u;return h(this,function(d){switch(d.label){case 0:n=this[e],this[e]=[],d.label=1;case 1:d.trys.push([1,8,9,10]),r=o(n),i=r.next(),d.label=2;case 2:return i.done?[3,7]:(a=i.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 i=r.next(),[3,2];case 7:return[3,10];case 8:return c=d.sent(),l={error:c},[3,10];case 9:try{i&&!i.done&&(u=r.return)&&u.call(r)}finally{if(l)throw l.error}
4return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e,t)]:[3,12];case 11:return d.sent(),[3,13];case 12:t?.(),d.label=13;case 13:return[2]}})})},e.prototype.track=function(e,t,n){var r=Ye(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),z(this.dispatch(r))},e.prototype.identify=function(e,t){var n=Xe(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),z(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=Ze(e,t,n,r);return z(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=Qe(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),z(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=$e(e,t);return z(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),z())},e.prototype._addPlugin=function(e){return z(this.timeline.register(e,this.config))},e.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),z())},e.prototype._removePlugin=function(e){return z(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(Ge(e,0,We));this.process(e).then(t)},e.prototype.dispatch=function(e){return x(this,void 0,void 0,function(){var t=this;return h(this,function(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t=this.userProperties??{},n=O({},t);if(e===void 0)return n;var r={};return Object.keys(e).forEach(function(t){Object.values(M).includes(t)||(r[t]=e[t])}),Re.forEach(function(t){if(Object.keys(e).includes(t)){var r=e[t];switch(t){case M.CLEAR_ALL:Object.keys(n).forEach(function(e){delete n[e]});break;case M.UNSET:Object.keys(r).forEach(function(e){delete n[e]});break;case M.SET:Object.assign(n,r)}}}),Object.assign(n,r),n},e.prototype.process=function(e){return x(this,void 0,void 0,function(){var t,n,r,t;return h(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.config.optOut?[2,Ge(e,0,He)]:(e.event_type===N.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)]);case 1:return t=i.sent(),t.code===200?this.config.loggerProvider.log(t.message):t.code===100?this.config.loggerProvider.warn(t.message):this.config.loggerProvider.error(t.message),[2,t];case 2:return n=i.sent(),r=String(n),this.config.loggerProvider.error(r),t=Ge(e,0,r),[2,t];case 3:return[2]}})})},e.prototype.setOptOut=function(e){if(!this.isReady){this.q.push(this._setOptOut.bind(this,!!e));return}this._setOptOut(e)},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=!!e,this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return z(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});if(t===void 0){this.config.loggerProvider.debug(`Cannot find plugin with name ${e}`);return}return t},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),tt=function(){function e(){this.productId=``,this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){try{var t=JSON.parse(JSON.stringify(e));Fe(t)&&(this.properties=t)}catch{}return this},e.prototype.getEventProperties=function(){var e=this.properties?O({},this.properties):{};return e[nt.REVENUE_PRODUCT_ID]=this.productId,e[nt.REVENUE_QUANTITY]=this.quantity,e[nt.REVENUE_PRICE]=this.price,e[nt.REVENUE_TYPE]=this.revenueType,e[nt.REVENUE_CURRENCY]=this.currency,e[nt.REVENUE]=this.revenue,e[nt.RECEIPT]=this.receipt,e[nt.RECEIPT_SIG]=this.receiptSig,e},e}(),nt;(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`})(nt||={});var rt=function(e,t){var n=Math.max(t,1);return e.reduce(function(e,t,r){var i=Math.floor(r/n);return e[i]||(e[i]=[]),e[i].push(t),e},[])},B;(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`})(B||={});var it=`Amplitude Logger `,at=function(){function e(){this.logLevel=B.None}return e.prototype.disable=function(){this.logLevel=B.None},e.prototype.enable=function(e){e===void 0&&(e=B.Warn),this.logLevel=e},e.prototype.log=function(){var e=[...arguments];this.logLevel<B.Verbose||console.log(`${it}[Log]: ${e.join(` `)}`)},e.prototype.warn=function(){var e=[...arguments];this.logLevel<B.Warn||console.warn(`${it}[Warn]: ${e.join(` `)}`)},e.prototype.error=function(){var e=[...arguments];this.logLevel<B.Error||console.error(`${it}[Error]: ${e.join(` `)}`)},e.prototype.debug=function(){var e=[...arguments];this.logLevel<B.Debug||console.log(`${it}[Debug]: ${e.join(` `)}`)},e}(),ot=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:ue,logLevel:B.Warn,loggerProvider:new at,offline:!1,optOut:!1,serverUrl:P,serverZone:`US`,useBatch:!1}},st=function(){function e(e){this._optOut=!1;var t=ot();this.apiKey=e.apiKey,this.flushIntervalMillis=e.flushIntervalMillis??t.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||t.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||t.flushQueueSize,this.instanceName=e.instanceName||t.instanceName,this.loggerProvider=e.loggerProvider||t.loggerProvider,this.logLevel=e.logLevel??t.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=e.offline===void 0?t.offline:e.offline,this.optOut=e.optOut??t.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||t.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=e.useBatch??t.useBatch,this.loggerProvider.enable(this.logLevel);var n=lt(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=n.serverZone,this.serverUrl=n.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e}
4,enumerable:!1,configurable:!0}),e}(),ct=function(e,t){return e===`EU`?t?pe:de:t?fe:P},lt=function(e,t,n){if(e===void 0&&(e=``),t===void 0&&(t=ot().serverZone),n===void 0&&(n=ot().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=[`US`,`EU`].includes(t)?t:ot().serverZone;return{serverZone:r,serverUrl:ct(r,n)}},ut=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function dt(e){return e>=200&&e<300}var ft=function(e){return e===void 0&&(e=0),(Error().stack||``).split(` 5`).slice(2+e).map(function(e){return e.trim()})},V=function(e){return function(){var t=O({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},pt=function(e,t){var n,r;t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``);try{for(var i=o(t.split(`.`)),a=i.next();!a.done;a=i.next()){var s=a.value;if(s in e)e=e[s];else return}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},H=function(e,t){return function(){var n,r,i={};try{for(var a=o(t),s=a.next();!s.done;s=a.next()){var c=s.value;i[c]=pt(e,c)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}},U=function(e,t,n,r,i){return i===void 0&&(i=null),function(){var a=[...arguments],o=n(),s=o.logger,c=o.logLevel;if(c&&c<B.Debug||!c||!s)return e.apply(i,a);var l={type:`invoke public method`,name:t,args:a,stacktrace:ft(1),time:{start:new Date().toISOString()},states:{}};r&&l.states&&(l.states.before=r());var u=e.apply(i,a);return u&&u.promise?u.promise.then(function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),s.debug(JSON.stringify(l,null,2))}):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),s.debug(JSON.stringify(l,null,2))),u}},mt=new Set([P,de,fe,pe]),ht=function(e,t){return t===void 0&&(t=!1),mt.has(e)?!0:t};function gt(e){return e instanceof Error?e.message:String(e)}function _t(e){var t=``;try{`body`in e&&(t=JSON.stringify(e.body,null,2))}catch{}return t}var vt=function(){function e(e){this.name=`amplitude`,this.type=`destination`,this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey=``,this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.diagnosticsClient=e?.diagnosticsClient}return e.prototype.setup=function(e){return x(this,void 0,void 0,function(){var t,n=this;return h(this,function(r){switch(r.label){case 0:return this.config=e,this.storageKey=`${le}_${this.config.apiKey.substring(0,10)}`,[4,this.config.storageProvider?.get(this.storageKey)];case 1:return t=r.sent(),t&&t.length>0&&Promise.all(t.map(function(e){return n.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||=R(),new Promise(function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,Ve),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(e.timeout===0?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline&&(this.scheduleId===null||this.scheduleId&&e>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e);return}},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return e===void 0&&(e=!1),x(this,void 0,void 0,function(){var t,n,r,i=this;return h(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(),t=[],n=[],this.queue.forEach(function(e){return e.timeout===0?t.push(e):n.push(e)}),r=rt(t,this.config.flushQueueSize),[4,r.reduce(function(t,n){return x(i,void 0,void 0,function(){return h(this,function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}})})},Promise.resolve())]);case 1:return a.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},e.prototype.send=function(e,t){var n;return t===void 0&&(t=!0),x(this,void 0,void 0,function(){var r,i,a,o,s,c;return h(this,function(l){switch(l.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,Ue)];r={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,E(t,[`extra`])}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new ut,l.label=1;case 1:return l.trys.push([1,3,,4]),i=lt(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,a=ht(i,this.config.enableRequestBodyCompression),[4,this.config.transportProvider.send(i,r,a)];case 2:return o=l.sent(),o===null?(this.fulfillRequest(e,0,Be),[2]):t?(this.handleResponse(o,e),[3,4]):(`body`in o?this.fulfillRequest(e,o.statusCode,`${o.status}: ${_t(o)}`):this.fulfillRequest(e,o.statusCode,o.status),[2]);case 3:return s=l.sent(),c=gt(s),this.config.loggerProvider.error(c),(n=this.diagnosticsClient)==null||n.recordEvent(`anal
5ytics.events.unsuccessful.from.catch.error`,{events:e.map(function(e){return e.event.event_type}),message:c,stack_trace:ft()}),this.handleResponse({status:I.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){var n;dt(e.statusCode)||(n=this.diagnosticsClient)==null||n.recordEvent(`analytics.events.unsuccessful`,{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:_t(e),stack_trace:ft()});var r=e.status;switch(r){case I.Success:this.handleSuccessResponse(e,t);break;case I.Invalid:this.handleInvalidResponse(e,t);break;case I.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case I.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn(`{code: 0, error: "Status '${r}' provided for ${t.length} events"}`),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,ze)},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith(`Invalid API key`)){this.fulfillRequest(t,e.statusCode,e.body.error);return}var r=g(g(g(g([],i(Object.values(e.body.eventsWithInvalidFields)),!1),i(Object.values(e.body.eventsWithMissingFields)),!1),i(Object.values(e.body.eventsWithInvalidIdLengths)),!1),i(e.body.silencedEvents),!1).flat(),a=new Set(r),o=t.filter(function(t,r){if(a.has(r)){n.fulfillRequest([t],e.statusCode,e.body.error);return}return!0});o.length>0&&this.config.loggerProvider.warn(_t(e));var s=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(s)},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(t.length===1){this.fulfillRequest(t,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(_t(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),a=e.body.throttledEvents,o=new Set(r),s=new Set(i),c=new Set(a),l=t.filter(function(t,r){if(t.event.user_id&&o.has(t.event.user_id)||t.event.device_id&&s.has(t.event.device_id)){n.fulfillRequest([t],e.statusCode,e.body.error);return}return c.has(r)&&(t.timeout=n.throttleTimeout),!0});l.length>0&&this.config.loggerProvider.warn(_t(e));var u=this.removeEventsExceedFlushMaxRetries(l);this.scheduleEvents(u)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){var r,i,a;dt(t)?(a=this.diagnosticsClient)==null||a.increment(`analytics.events.sent`,e.length):((r=this.diagnosticsClient)==null||r.increment(`analytics.events.dropped`,e.length),(i=this.diagnosticsClient)==null||i.recordEvent(`analytics.events.dropped`,{events:e.map(function(e){return e.event.event_type}),code:t,message:n,stack_trace:ft()})),this.removeEvents(e),e.forEach(function(e){return e.callback(Ge(e.event,t,n))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(e){return e.event});this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter(function(t){return!e.some(function(e){return e.event.insert_id===t.event.insert_id})}),this.saveEvents()},e}(),yt=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:bt(),platform:`Web`,os:void 0,deviceModel:void 0}},e}(),bt=function(){return typeof navigator<`u`&&(navigator.languages&&navigator.languages[0]||navigator.language)||``},xt=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(t){e(t)}),this.queue=[])},e}(),St=function(){return St=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},St.apply(this,arguments)};function Ct(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);
5if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function wt(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}var Tt=function(e,t){var n,r,i=[`string`,`number`,`boolean`,`undefined`],a=typeof e;if(a!==typeof t)return!1;try{for(var o=Ct(i),s=o.next();!s.done;s=o.next())if(s.value===a)return e===t}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(e==null&&t==null)return!0;if(e==null||t==null||e.length!==t.length)return!1;var c=Array.isArray(e),l=Array.isArray(t);if(c!==l)return!1;if(c&&l){for(var u=0;u<e.length;u++)if(!Tt(e[u],t[u]))return!1}else{if(!Tt(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var d=!0;return Object.keys(e).forEach(function(n){Tt(e[n],t[n])||(d=!1)}),d}return!0},Et=`$set`,Dt=`$unset`,Ot=`$clearAll`;Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var kt=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=St({},this.identity.userProperties),n=St(St({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,i,a,o,s,c=n.userProperties||{};try{for(var l=Ct(Object.entries(e)),u=l.next();!u.done;u=l.next()){var d=wt(u.value,2),f=d[0],p=d[1];switch(f){case Et:try{for(var m=(i=void 0,Ct(Object.entries(p))),h=m.next();!h.done;h=m.next()){var g=wt(h.value,2),_=g[0],v=g[1];c[_]=v}}catch(e){i={error:e}}finally{try{h&&!h.done&&(a=m.return)&&a.call(m)}finally{if(i)throw i.error}}break;case Dt:try{for(var y=(o=void 0,Ct(Object.keys(p))),b=y.next();!b.done;b=y.next()){var _=b.value;delete c[_]}}catch(e){o={error:e}}finally{try{b&&!b.done&&(s=y.return)&&s.call(y)}finally{if(o)throw o.error}}break;case Ot:c={}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return n.userProperties=c,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return St({},this.identity)},e.prototype.setIdentity=function(e){var t=St({},this.identity);this.identity=St({},e),Tt(t,this.identity)||this.listeners.forEach(function(t){t(e)})},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),At=typeof globalThis<`u`?globalThis:typeof global<`u`?global:self,jt=function(){function e(){this.identityStore=new kt,this.eventBridge=new xt,this.applicationContextProvider=new yt}return e.getInstance=function(t){return At.analyticsConnectorInstances||={},At.analyticsConnectorInstances[t]||(At.analyticsConnectorInstances[t]=new e),At.analyticsConnectorInstances[t]},e}(),Mt=function(e){return e===void 0&&(e=ue),jt.getInstance(e)},Nt=function(e,t){Mt(t).identityStore.editIdentity().setUserId(e).commit()},Pt=function(e,t){Mt(t).identityStore.editIdentity().setDeviceId(e).commit()},Ft=function(){function e(){this.name=`identity`,this.type=`before`,this.identityStore=Mt().identityStore}return e.prototype.execute=function(e){return x(this,void 0,void 0,function(){var t;return h(this,function(n){return t=e.user_properties,t&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return x(this,void 0,void 0,function(){return h(this,function(t){return e.instanceName&&(this.identityStore=Mt(e.instanceName).identityStore),[2]})})},e}(),It=function(e,t){return t===void 0&&(t=Date.now()),Date.now()-t>e},Lt=function(e,t,n){return t===void 0&&(t=``),n===void 0&&(n=10),[`AMP`,t,e.substring(0,n)].filter(
5Boolean).join(`_`)},Rt=function(e){return`amp_${e.substring(0,6)}`},zt=function(){if(typeof navigator>`u`)return``;var e=navigator.userLanguage;return navigator.languages?.[0]??navigator.language??e??``},Bt=function(){var e=L();return e?.location?.search?e.location.search.substring(1).split(`&`).filter(Boolean).reduce(function(e,t){var n=t.split(`=`,2),r=Vt(n[0]),i=Vt(n[1]);return i&&(e[r]=i),e},{}):{}},Vt=function(e){e===void 0&&(e=``);try{return decodeURIComponent(e)}catch{return``}},Ht=function(e,t){return!t||!t.length||t.some(function(t){return typeof t==`string`?e===t:e.match(t)})},W=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){t?.error(`Malformed URI sequence: `,e)}return n},Ut=function(e){var t=0;if(e.length===0)return t;for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);t=(t<<5)-t+r,t|=0}return t},Wt=function(e,t){var n=Ut(e.toString());return Math.abs(n)*31%1e5/1e5<t},Gt=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},Kt=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return x(this,void 0,void 0,function(){return h(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return x(this,void 0,void 0,function(){return h(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return x(this,void 0,void 0,function(){var t;return h(this,function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return t=n.sent(),[2,t?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return x(this,void 0,void 0,function(){return h(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return x(this,void 0,void 0,function(){return h(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return x(this,void 0,void 0,function(){return h(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),qt=function(){return L()?.navigator?.locks},Jt=function(){function e(e,t){t===void 0&&(t={}),this.options=O({},e),this.config=t}return e.prototype.isEnabled=function(){return x(this,void 0,void 0,function(){var t,n,r,i,a=this;return h(this,function(o){switch(o.label){case 0:return t=`AMP_TEST`,n=O({},this.options),r=new e(n),i=String(Date.now()),[4,r.transaction(t,function(e){var n,r;try{e.set(i);var o=e.get()===i;return!o&&a.config.diagnosticsClient&&((n=a.config.diagnosticsClient)==null||n.recordEvent(`cookies.isEnabled.failure`,{reason:`Test Value mismatch`,testKey:t,testValue:i,sync:!0})),o}catch(e){if(a.config.diagnosticsClient){var s=e instanceof Error?e.message:String(e);(r=a.config.diagnosticsClient)==null||r.recordEvent(`cookies.isEnabled.failure`,{reason:`Cookie getter/setter failed`,testKey:t,testValue:i,error:s,sync:!0})}return!1}finally{e.set(null)}})];case 1:return[2,o.sent()]}})})},e.prototype.get=function(e){return x(this,void 0,void 0,function(){var t;return h(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:return t=n.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var n=Zt(t);if(n===void 0){console.error(`Amplitude Logger [Error]: Failed to decode cookie value for key: ${e}, value: ${t}`);return}return JSON.parse(n)}catch{console.error(`Amplitude Logger [Error]: Failed to parse cookie value for key: ${e}, value: ${t}`);return}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,n;return x(this,void 0,void 0,function(){var r,i,a,s,c,l,u,d,f;return h(this,function(p){switch(p.label){case 0:r=L(),i=r,p.label=1;case 1:return p.trys.push([1,4,,5]),a=i?.cookieStore,a?[4,a.getAll(e)]:[3,3];case 2:if(s=p.sent(),s){s.length>1&&((t=this.config.diagnosticsClient)==null||t.recordEvent(`cookies.duplicate`,{cookies:s.map(function(e){return e.domain})}),(n=this.config.diagnosticsClient)==null||n.increment(`cookies.duplicate.occurrence.cookieStore`));try{for(c=o(s),l=c.next();!l.done;l=c.next())if(u=l.value,Qt(u.domain,this.options.domain))return[2,u.value]}catch(e){d={error:e}}finally{try{l&&!l.done&&(f=c.return)&&f.call(c)}finally{if(d)throw d.error}}}p.label=3;case 3:return[3,5];case 4:return p.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t=this,n=((L()?.document)?.cookie.split(`; `)??[]).filter(function(t){return t.indexOf(e+`=`)===0}),r=void 0,i=this.config.duplicateResolverFn;
5if(typeof i==`function`&&n.length>1&&(r=n.find(function(n){var r;try{var a=i(n.substring(e.length+1));return a||(r=t.config.diagnosticsClient)==null||r.increment(`cookies.duplicate.occurrence.document.cookie`),a}catch{return!1}})),r||=n[0],r)return r.substring(e.length+1)},e.prototype.set=function(e,t){return x(this,void 0,void 0,function(){return h(this,function(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){try{var n=L();if(!n||!n.document||typeof n.btoa!=`function`||typeof n.encodeURIComponent!=`function`)return;var r=this.options.expirationDays??0,i=t===null?-1:r,a=void 0;if(i){var o=new Date;o.setTime(o.getTime()+i*24*60*60*1e3),a=o}var s=`${e}=${n.btoa(n.encodeURIComponent(JSON.stringify(t)))}`;a&&(s+=`; expires=${a.toUTCString()}`),s+=`; path=/`,this.options.domain&&(s+=`; domain=${this.options.domain}`),this.options.secure&&(s+=`; Secure`),this.options.sameSite&&(s+=`; SameSite=${this.options.sameSite}`),n.document.cookie=s}catch(t){var c=t instanceof Error?t.message:String(t);console.error(`Amplitude Logger [Error]: Failed to set cookie for key: ${e}. Error: ${c}`)}},e.prototype.remove=function(e){return x(this,void 0,void 0,function(){return h(this,function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}})})},e.prototype.reset=function(){return x(this,void 0,void 0,function(){return h(this,function(e){return[2]})})},e.isDomainWritable=function(t){return x(this,void 0,void 0,function(){var n,r,i,a;return h(this,function(o){switch(o.label){case 0:if(e.cachedTlds[t])return[2,!0];n={domain:`.`+t},r=`AMP_TLDTEST`,i=new e(n),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i.transaction(r,function(n){if(e.cachedTlds[t])return!0;try{n.set(1);var r=!!n.get();return r&&(e.cachedTlds[t]=!0),r}finally{n.set(null)}})];case 2:return a=o.sent(),[2,!!a];case 3:return o.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return x(this,void 0,void 0,function(){var n,r,i=this;return h(this,function(a){switch(a.label){case 0:if(n=qt(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n.request(`com.amplitude:cookie-lock:${e}`,r)];case 2:return[2,a.sent()];case 3:return a.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),Yt=function(e){try{return decodeURIComponent(atob(e))}catch{return}},Xt=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch{return}},Zt=function(e){return Yt(e)??Xt(e)},Qt=function(e,t){if(e===``&&t===``)return!0;if(!e||!t)return!1;var n=e.startsWith(`.`)?e.substring(1):e,r=t.startsWith(`.`)?t.substring(1):t;return n.toLowerCase()===r.toLowerCase()},$t=function(e,t,n){return t===void 0&&(t=``),n===void 0&&(n=10),[`AMP`,t,e.substring(0,n)].filter(Boolean).join(`_`)},en=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return x(this,void 0,void 0,function(){var t,n,r,i;return h(this,function(a){switch(a.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r=`AMP_TEST`,a.label=1;case 1:return a.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return a.sent(),[4,n.get(r)];case 3:return i=a.sent(),[2,i===t];case 4:return a.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return a.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return x(this,void 0,void 0,function(){var t;return h(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return t=n.sent(),t?[2,JSON.parse(t)]:[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(e){return x(this,void 0,void 0,function(){return h(this,function(t){return[2,this.storage?.getItem(e)||void 0]})})},e.prototype.set=function(e,t){var n;return x(this,void 0,void 0,function(){return h(this,function(r){try{(n=this.storage)==null||n.setItem(e,JSON.stringify(t))}catch{}return[2]})})},e.prototype.remove=function(e){var t;return x(this,void 0,void 0,function(){return h(this,function(n){try{(t=this.storage)==null||t.removeItem(e)}catch{}return[2]})})},e.prototype.reset=function(){var e;return x(this,void 0,void 0,function(){return h(this,function(t){try{(e=this.storage)==null||e.clear()}catch{}return[2]})})},e}(),tn=10,nn=1,G={TAGS:`tags`,COUNTERS:`counters`,HISTOGRAMS:`histograms`,EVENTS:`events`,INTERNAL:`internal`},rn={LAST_FLUSH_TIMESTAMP:`last_flush_timestamp`},an=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName=`AMP_diagnostics_${e.substring(0,10)}`}return e.isSupported=function(){return L()?.indexedDB!==void 0},e.prototype.getDB=function(){return x(this,void 0,void 0,function(){return h(this,function(e){return this.dbPromise||=this.openDB(),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,n){var r=indexedDB.open(e.dbName,nn);r.onerror=function(){e.dbPromise=null,n(Error(`Failed to open IndexedDB`))},r.onsuccess=function(){var n=r.result;
5n.onclose=function(){e.dbPromise=null,e.logger.debug(`DiagnosticsStorage: DB connection closed.`)},n.onerror=function(t){e.logger.debug(`DiagnosticsStorage: A global database error occurred.`,t),n.close()},t(n)},r.onupgradeneeded=function(){var t=r.result;if(!t){e.logger.debug(`DiagnosticsStorage: Missing DB during upgrade.`);return}e.createTables(t)}})},e.prototype.createTables=function(e){e.objectStoreNames.contains(G.TAGS)||e.createObjectStore(G.TAGS,{keyPath:`key`}),e.objectStoreNames.contains(G.COUNTERS)||e.createObjectStore(G.COUNTERS,{keyPath:`key`}),e.objectStoreNames.contains(G.HISTOGRAMS)||e.createObjectStore(G.HISTOGRAMS,{keyPath:`key`}),e.objectStoreNames.contains(G.EVENTS)||e.createObjectStore(G.EVENTS,{keyPath:`id`,autoIncrement:!0}).createIndex(`time_idx`,`time`,{unique:!1}),e.objectStoreNames.contains(G.INTERNAL)||e.createObjectStore(G.INTERNAL,{keyPath:`key`})},e.prototype.setTags=function(e){return x(this,void 0,void 0,function(){var t,n,r,a,o=this;return h(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return t=s.sent(),n=t.transaction([G.TAGS],`readwrite`),r=n.objectStore(G.TAGS),[2,new Promise(function(t){var a=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug(`DiagnosticsStorage: Failed to set tags`,e),t()},a.forEach(function(e){var t=i(e,2),n=t[0],a=t[1],s=r.put({key:n,value:a});s.onerror=function(e){o.logger.debug(`DiagnosticsStorage: Failed to set tag`,n,a,e)}})})];case 2:return a=s.sent(),this.logger.debug(`DiagnosticsStorage: Failed to set tags`,a),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return x(this,void 0,void 0,function(){var t,n,r,a,o=this;return h(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return t=s.sent(),n=t.transaction([G.COUNTERS],`readwrite`),r=n.objectStore(G.COUNTERS),[2,new Promise(function(t){var a=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug(`DiagnosticsStorage: Failed to increment counters`,e),t()},a.forEach(function(e){var t=i(e,2),n=t[0],a=t[1],s=r.get(n);s.onsuccess=function(){var e=s.result,t=e?e.value:0,i=r.put({key:n,value:t+a});i.onerror=function(e){o.logger.debug(`DiagnosticsStorage: Failed to update counter`,n,e)}},s.onerror=function(e){o.logger.debug(`DiagnosticsStorage: Failed to read existing counter`,n,e)}})})];case 2:return a=s.sent(),this.logger.debug(`DiagnosticsStorage: Failed to increment counters`,a),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return x(this,void 0,void 0,function(){var t,n,r,a,o=this;return h(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return t=s.sent(),n=t.transaction([G.HISTOGRAMS],`readwrite`),r=n.objectStore(G.HISTOGRAMS),[2,new Promise(function(t){var a=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug(`DiagnosticsStorage: Failed to set histogram stats`,e),t()},a.forEach(function(e){var t=i(e,2),n=t[0],a=t[1],s=r.get(n);s.onsuccess=function(){var e=s.result,t=e?{key:n,count:e.count+a.count,min:Math.min(e.min,a.min),max:Math.max(e.max,a.max),sum:e.sum+a.sum}:{key:n,count:a.count,min:a.min,max:a.max,sum:a.sum},i=r.put(t);i.onerror=function(e){o.logger.debug(`DiagnosticsStorage: Failed to set histogram stats`,n,e)}},s.onerror=function(e){o.logger.debug(`DiagnosticsStorage: Failed to read existing histogram stats`,n,e)}})})];case 2:return a=s.sent(),this.logger.debug(`DiagnosticsStorage: Failed to set histogram stats`,a),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return x(this,void 0,void 0,function(){var t,n,r,i,a=this;return h(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e.length===0?[2]:[4,this.getDB()];case 1:return t=o.sent(),n=t.transaction([G.EVENTS],`readwrite`),r=n.objectStore(G.EVENTS),[2,new Promise(function(t){n.oncomplete=function(){t()},n.onabort=function(e){a.logger.debug(`DiagnosticsStorage: Failed to add event records`,e),t()};var i=r.count();i.onsuccess=function(){var t=i.result,n=Math.max(0,tn-t);n<e.length&&a.logger.debug(`DiagnosticsStorage: Only added ${n} of ${e.length}
5 events due to storage limit`),e.slice(0,n).forEach(function(e){var t=r.add(e);t.onerror=function(e){a.logger.debug(`DiagnosticsStorage: Failed to add event record`,e)}})},i.onerror=function(e){a.logger.debug(`DiagnosticsStorage: Failed to count existing events`,e)}})];case 2:return i=o.sent(),this.logger.debug(`DiagnosticsStorage: Failed to add event records`,i),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return x(this,void 0,void 0,function(){var n,r,i,a;return h(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=o.sent(),r=n.transaction([G.INTERNAL],`readwrite`),i=r.objectStore(G.INTERNAL),[2,new Promise(function(n,a){r.onabort=function(){return a(Error(`Failed to set internal value`))};var o=i.put({key:e,value:t});o.onsuccess=function(){return n()},o.onerror=function(){return a(Error(`Failed to set internal value`))}})];case 2:return a=o.sent(),this.logger.debug(`DiagnosticsStorage: Failed to set internal value`,a),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return x(this,void 0,void 0,function(){var t,n,r,i;return h(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([G.INTERNAL],`readonly`),r=n.objectStore(G.INTERNAL),[2,new Promise(function(t,i){n.onabort=function(){return i(Error(`Failed to get internal value`))};var a=r.get(e);a.onsuccess=function(){return t(a.result)},a.onerror=function(){return i(Error(`Failed to get internal value`))}})];case 2:return i=a.sent(),this.logger.debug(`DiagnosticsStorage: Failed to get internal value`,i),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return x(this,void 0,void 0,function(){var e,t;return h(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(rn.LAST_FLUSH_TIMESTAMP)];case 1:return e=n.sent(),[2,e?parseInt(e.value,10):void 0];case 2:return t=n.sent(),this.logger.debug(`DiagnosticsStorage: Failed to get last flush timestamp`,t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return x(this,void 0,void 0,function(){var t;return h(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(rn.LAST_FLUSH_TIMESTAMP,e.toString())];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.debug(`DiagnosticsStorage: Failed to set last flush timestamp`,t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).clear();i.onsuccess=function(){return n()},i.onerror=function(){return r(Error(`Failed to clear table ${t}`))}})},e.prototype.getAllAndClear=function(){return x(this,void 0,void 0,function(){var e,t,n,r,a,o,s,c;return h(this,function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=l.sent(),t=e.transaction([G.TAGS,G.COUNTERS,G.HISTOGRAMS,G.EVENTS],`readwrite`),[4,Promise.all([this.getAllFromStore(t,G.TAGS),this.getAllFromStore(t,G.COUNTERS),this.getAllFromStore(t,G.HISTOGRAMS),this.getAllFromStore(t,G.EVENTS)])];case 2:return n=i.apply(void 0,[l.sent(),4]),r=n[0],a=n[1],o=n[2],s=n[3],[4,Promise.all([this.clearTable(t,G.COUNTERS),this.clearTable(t,G.HISTOGRAMS),this.clearTable(t,G.EVENTS)])];case 3:return l.sent(),[2,{tags:r,counters:a,histogramStats:o,events:s}];case 4:return c=l.sent(),this.logger.debug(`DiagnosticsStorage: Failed to get all and clear data`,c),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).getAll();i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r(Error(`Failed to get all from ${t}`))}})},e}(),on=`__AMPLITUDE_SCRIPT_URL__`,sn=`sdk.error.uncaught`,cn=function(){var e=L();if(!e)return[];var t=e[on];return Array.isArray(t)?t:typeof t==`string`?[t]:[]},ln=function(e){var t=L();if(!(!t||typeof t.addEventListener!=`function`)){var n=function(e){var t=e.error instanceof Error?e.error:void 0,n=t?.stack,r=un({filename:e.filename,stack:n});r&&i({type:`error`,message:e.message,stack:n,filename:e.filename,errorName:t?.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:r}})},r=function(e){var t=e.reason instanceof Error?e.reason:void 0,n=t?.stack,r=dn(n),a=un({filename:r,stack:n});a&&i({type:`unhandledrejection`,message:t?.message??fn(e.reason),stack:n,filename:r,errorName:t?.name,metadata:{isTrusted:e.isTrusted,matchReason:a}})},i=function(t){e.recordEvent(sn,O({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};
5t.addEventListener(`error`,n,!0),t.addEventListener(`unhandledrejection`,r,!0)}},un=function(e){var t,n,r=cn();if(r.length!==0)try{for(var i=o(r),a=i.next();!a.done;a=i.next()){var s=a.value;if(e.filename&&e.filename.includes(s))return`filename`;if(e.stack&&e.stack.includes(s))return`stack`}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},dn=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},fn=function(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return`[object Object]`}},pn=1e3,mn=3e5,hn=`https://diagnostics.prod.us-west-2.amplitude.com/v1/capture`,gn=`https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture`,_n=function(){function e(e,t,n,r){n===void 0&&(n=`US`),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl=n===`US`?hn:gn,this.logger.debug(`DiagnosticsClient: Initializing with options`,JSON.stringify(r,null,2)),this.config=O({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=Wt(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,an.isSupported()?this.storage=new an(e,t):this.logger.debug(`DiagnosticsClient: IndexedDB is not supported`),this.initializeFlushInterval(),this.shouldTrack&&(this.increment(`sdk.diagnostics.sampled.in.and.enabled`),ln(this))}return e.prototype.isStorageAndTrackEnabled=function(){return!!this.storage&&!!this.shouldTrack},e.prototype.setTag=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryTags).length>=1e4){this.logger.debug(`DiagnosticsClient: Early return setTags as reaching memory limit`);return}this.inMemoryTags[e]=t,this.startTimersIfNeeded()}},e.prototype.increment=function(e,t){if(t===void 0&&(t=1),this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryCounters).length>=1e4){this.logger.debug(`DiagnosticsClient: Early return increment as reaching memory limit`);return}this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()}},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryHistograms).length>=1e4){this.logger.debug(`DiagnosticsClient: Early return recordHistogram as reaching memory limit`);return}var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){if(this.isStorageAndTrackEnabled()){if(this.inMemoryEvents.length>=10){this.logger.debug(`DiagnosticsClient: Early return recordEvent as reaching memory limit`);return}this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()}},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug(`DiagnosticsClient: Failed to save all data to storage`,t)}).finally(function(){e.saveTimer=null})},pn),this.flushTimer||=setTimeout(function(){e._flush().catch(function(t){e.logger.debug(`DiagnosticsClient: Failed to flush`,t)}).finally(function(){e.flushTimer=null})},mn)},e.prototype.saveAllDataToStorage=function(){return x(this,void 0,void 0,function(){var e,t,n,r;return h(this,function(a){switch(a.label){case 0:return this.storage?(e=O({},this.inMemoryTags),t=O({},this.inMemoryCounters),n=O({},this.inMemoryHistograms),r=g([],i(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(n),this.storage.addEventRecords(r)])]):[2];case 1:return a.sent(),[2]}})})},e.prototype._flush=function(){return x(this,void 0,void 0,function(){var e,t,n,r,i,a,o,s,c,l;return h(this,function(u){switch(u.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return u.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=u.sent(),t=e.tags,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),a={},t.forEach(function(e){a[e.key]=e.value}),o={}
5,n.forEach(function(e){o[e.key]=e.value}),s={},r.forEach(function(e){s[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),c=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),Object.keys(o).length===0&&Object.keys(s).length===0&&c.length===0?[2]:(l={tags:a,histogram:s,counters:o,events:c},this.fetch(l),[2])}})})},e.prototype.fetch=function(e){return x(this,void 0,void 0,function(){var t,n;return h(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!L())throw Error(`DiagnosticsClient: Fetch is not supported`);return[4,fetch(this.serverUrl,{method:`POST`,headers:{"X-ApiKey":this.apiKey,"Content-Type":`application/json`},body:JSON.stringify(e)})];case 1:return t=r.sent(),t.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=r.sent(),this.logger.debug(`DiagnosticsClient: Failed to send diagnostics data. `,n),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return x(this,void 0,void 0,function(){var e,t,n;return h(this,function(r){switch(r.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return t=r.sent()||-1,t===-1?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(mn),[2]):(n=e-t,n>=3e5?(this._flush(),[2]):(this._setFlushTimer(mn-n),[2]))}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug(`DiagnosticsClient: Failed to flush`,e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug(`DiagnosticsClient: Setting sample rate to`,e),this.config.sampleRate=e,this.shouldTrack=Wt(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug(`DiagnosticsClient: Should track is`,this.shouldTrack)},e}(),vn=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){if(typeof e!=`object`)return null;var t=e.code||0,n=this.buildStatus(t);switch(n){case I.Success:return{status:n,statusCode:t,body:{eventsIngested:e.events_ingested??0,payloadSizeBytes:e.payload_size_bytes??0,serverUploadTime:e.server_upload_time??0}};case I.Invalid:return{status:n,statusCode:t,body:{error:e.error??``,missingField:e.missing_field??``,eventsWithInvalidFields:e.events_with_invalid_fields??{},eventsWithMissingFields:e.events_with_missing_fields??{},eventsWithInvalidIdLengths:e.events_with_invalid_id_lengths??{},epsThreshold:e.eps_threshold??0,exceededDailyQuotaDevices:e.exceeded_daily_quota_devices??{},silencedDevices:e.silenced_devices??[],silencedEvents:e.silenced_events??[],throttledDevices:e.throttled_devices??{},throttledEvents:e.throttled_events??[]}};case I.PayloadTooLarge:return{status:n,statusCode:t,body:{error:e.error??``}};case I.RateLimit:return{status:n,statusCode:t,body:{error:e.error??``,epsThreshold:e.eps_threshold??0,throttledDevices:e.throttled_devices??{},throttledUsers:e.throttled_users??{},exceededDailyQuotaDevices:e.exceeded_daily_quota_devices??{},exceededDailyQuotaUsers:e.exceeded_daily_quota_users??{},throttledEvents:e.throttled_events??[]}};case I.Timeout:default:return{status:n,statusCode:t}}},e.prototype.buildStatus=function(e){return dt(e)?I.Success:e===429?I.RateLimit:e===413?I.PayloadTooLarge:e===408?I.Timeout:e>=400&&e<500?I.Invalid:e>=500?I.Failed:I.Unknown},e}();function yn(){return typeof CompressionStream<`u`}function bn(e){return x(this,void 0,void 0,function(){var t,n;return h(this,function(r){switch(r.label){case 0:if(t=CompressionStream,t===void 0)return[2,void 0];r.label=1;case 1:return r.trys.push([1,3,,4]),n=new Blob([e]).stream().pipeThrough(new t(`gzip`)),[4,new Response(n).arrayBuffer()];case 2:return[2,r.sent()];case 3:return r.sent(),[2,void 0];case 4:return[2]}})})}var xn=function(){function e(e,t){this.key=`AMP_remote_config_${e.substring(0,10)}`,this.logger=t}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug(`Remote config localstorage failed to access: `,e),Promise.resolve(t)}if(e===null)return this.logger.debug(`Remote config localstorage gets null because the key does not exist`),Promise.resolve(t);try{var n=JSON.parse(e);return this.logger.debug(`Remote config localstorage parsed successfully: ${JSON.stringify(n)}`),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(e){return this.logger.debug(`Remote config localstorage failed to parse: `,e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug(`Remote config localstorage set successfully.`),Promise.resolve(!0)}catch(e){this.logger.debug(`Remote config localstorage failed to set: `,e)}return Promise.resolve(!1)},e}();function Sn(e,t){return new Promise(function(n,r){var i=function(){var e=Error(`Remote config custom fetch aborted by timeout`);e.name=`AbortError`,r(e)};t.addEventListener(`abort`,i,{once:!0}),e.then(function(e){t.removeEventListener(`abort`,i),n(e)},function(e){t.removeEventListener(`abort`,i),r(e)})})}
5var Cn={INVALID_API_KEY:401,FORBIDDEN:403,RATE_LIMIT:429},wn=1e3,Tn=3e5,En=function(){function e(e,t,n,r,i){n===void 0&&(n=`US`),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=e,this.serverUrl=r||(n===`US`?`https://sr-client-cfg.amplitude.com/config`:`https://sr-client-cfg.eu.amplitude.com/config`),this.logger=t,this.storage=new xn(e,t),this.customFetch=i}return e.prototype.subscribe=function(e,t,n){var r=R(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),t===`all`?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return t===-1?(this.logger.debug(`Remote config client unsubscribe failed because callback with id ${e} doesn't exist.`),!1):(this.callbackInfos.splice(t,1),this.logger.debug(`Remote config client unsubscribe succeeded removing callback with id ${e}.`),!0)},e.prototype.updateConfigs=function(){return x(this,void 0,void 0,function(){var e,t,n=this;return h(this,function(r){switch(r.label){case 0:return this.lastSuccessfulFetch&&(e=Date.now()-this.lastSuccessfulFetch,e<Tn)?(this.logger.debug(`Remote config client skipping updateConfigs: Too recent`),[2]):[4,this.getOrCreateFetchPromise()];case 1:return t=r.sent(),this.storage.setConfig(t),this.callbackInfos.forEach(function(e){n.sendCallback(e,t,`remote`)}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvalidApiKey?(this.logger.debug(`Remote config client skipping fetch: Invalid API key`),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(t){return t.remoteConfig!==null&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(e){return x(this,void 0,void 0,function(){var t,n,r,i=this;return h(this,function(a){switch(a.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug(`Remote config client subscription all mode fetched from remote: ${JSON.stringify(t)}`),i.sendCallback(e,t,`remote`),i.storage.setConfig(t)}),n=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,n])];case 1:return r=a.sent(),r!==void 0&&(this.logger.debug(`Remote config client subscription all mode fetched from cache: ${JSON.stringify(r)}`),r.remoteConfig===null?this.logger.debug(`Remote config client skips sending c
5allback because cache is empty (first time user).`):this.sendCallback(e,r,`cache`)),[4,t];case 2:return a.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return x(this,void 0,void 0,function(){var n,r,r;return h(this,function(i){switch(i.label){case 0:n=new Promise(function(e,n){setTimeout(function(){n(`Timeout exceeded`)},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug(`Remote config client subscription wait for remote mode returns from remote.`),this.sendCallback(e,r,`remote`),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug(`Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache.`),[4,this.storage.fetchConfig()];case 4:return r=i.sent(),r.remoteConfig===null?(this.logger.debug(`Remote config client subscription wait for remote mode failed to fetch cache.`),this.sendCallback(e,r,`remote`)):(this.logger.debug(`Remote config client subscription wait for remote mode returns a cached copy.`),this.sendCallback(e,r,`cache`)),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,n){e.lastCallback=new Date;var r=e.key?e.key.split(`.`).reduce(function(e,t){return e===null?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig;e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return e===void 0&&(e=3),t===void 0&&(t=wn),x(this,void 0,void 0,function(){var n,r,i,a,o,s,c=this;return h(this,function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,o,s,l,u,d,f,p,m,g,_;return h(this,function(h){switch(h.label){case 0:i=!0,o=new AbortController,s=setTimeout(function(){return o.abort()},t),h.label=1;case 1:return h.trys.push([1,10,11,12]),l=a.getUrlParams(),u={Accept:`*/*`},a.customFetch?[4,Sn(a.customFetch({url:l,method:`GET`,headers:u,signal:o.signal}),o.signal)]:[3,3];case 2:return f=h.sent(),[3,5];case 3:return[4,fetch(l,{method:`GET`,headers:u,signal:o.signal})];case 4:f=h.sent(),h.label=5;case 5:return d=f,p=d.ok||d.status>=200&&d.status<300,p?[3,7]:[4,d.text()];case 6:return m=h.sent(),a.logger.debug(`Remote config client fetch with retry time ${e} failed with ${d.status}: ${m}`),d.status===Cn.INVALID_API_KEY||d.status===Cn.FORBIDDEN?(a.logger.error(`Remote config client fetch failed with ${d.status}. Invalid API key; future fetches will be skipped.`),a.isLastFetchInvalidApiKey=!0,i=!1):d.status>=400&&d.status<500&&d.status!==Cn.RATE_LIMIT&&(i=!1),[3,9];case 7:return[4,d.json()];case 8:return g=h.sent(),[2,{value:{remoteConfig:g,lastFetch:new Date}}];case 9:return[3,12];case 10:return _=h.sent(),_ instanceof Error&&_.name===`AbortError`?a.logger.debug(`Remote config client fetch with retry time ${e} timed out after ${t}ms`):a.logger.debug(`Remote config client fetch with retry time ${e} is rejected because: `,_),[3,12];case 11:return clearTimeout(s),[7];case 12:return i?r<e-1?[4,new Promise(function(e){return setTimeout(e,c.getJitterDelay(n))})]:[3,14]:[2,`break`];case 13:h.sent(),h.label=14;case 14:return[2]}})},a=this,o=0,l.label=1;case 1:return o<e?[5,i(o)]:[3,4];case 2:if(s=l.sent(),typeof s==`object`)return[2,s.value];if(s===`break`)return[3,4];l.label=3;case 3:return o++,[3,1];case 4:return[2,r]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),n=new URLSearchParams;return n.append(`config_group`,e.CONFIG_GROUP),`${this.serverUrl}/${t}?${n.toString()}`},e.CONFIG_GROUP=`browser`,e}(),Dn=L()?.console,On={},kn={},An=!1;function jn(e){return!Dn||typeof Dn[e]!=`function`?!1:kn[e]?!0:(kn[e]=Dn[e],Dn[e]=function(){var t=[...arguments];try{if(On[e]&&!An){An=!0;var n=On[e];n&&n.forEach(function(n){try{n(e,t)}catch{}})}}catch{}return An=!1,kn[e].apply(Dn,t)},!0)}function Mn(e,t){if(!jn(e))return Error(`Console override failed`);On[e]?On[e].push(t):On[e]=[t]}function Nn(e){var t,n;try{for(var r=o(Object.values(On)),i=r.next();!i.done;i=r.next())for(var a=i.value,s=a.length-1;s>=0;s--)if(a[s]===e){a.splice(s,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}}function Pn(){var e,t;try{for(var n=o(Object.entries(kn)),r=n.next();!r.done;r=n.next()){var a=i(r.value,2),s=a[0],c=a[1];c&&(Dn[s]=c)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}kn={},On={}}var Fn={addListener:Mn,removeListener:Nn,_restoreConsole:Pn},In=[`a`,`button`,`input`,`select`,`textarea`,`label`,`video`,`audio`,`[contenteditable="true" i]`,`[data-amp-default-track]`,`.amp-default-track`],Ln=`data-amp-track-`,Rn=[`div`,`span`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],zn=g([`input[type="button"]`,`input[type="submit"]`,`input[type="reset"]`,`input[type="image"]`,`input[type="file"]`],i([`a`,`button`,`[role="button"]`,`[role="link"]`,`[role="menuitem"]`,`[role="menuitemcheckbox"]`,`[role="menuitemradio"]`,`[role="option"]`,`[role="tab"]`,`[role="treeitem"]`,`[contenteditable="true" i]`]),!1),Bn=zn,Vn=zn,Hn=[`*`],Un=1e3;function Wn(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e==null}function Gn(e,t,n){e&&Kn({json:e,allowlist:t.map(qn),excludelist:n.map(qn),ancestors:[]})}function Kn(e){var t,n,r=e.json,a=e.targetObject,s=e.allowlist,c=e.excludelist,l=e.ancestors,u=e.parentObject,d=e.targetKey;a||=r;var f=Object.keys(a);try{for(var p=o(f),m=p.next();!m.done;m=p.next()){var h=m.value,_=g(g([],i(l),!1),[h],!1);Wn(a[h])?(!Yn(_,s)||Yn(_,c))&&delete a[h]:Kn({json:r,targetObject:a[h],allowlist:s,excludelist:c,ancestors:_,parentObject:a,targetKey:h})}}catch(e){t={error:e}}finally{try{m&&!m.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}Object.keys(a).length===0&&u&&d&&delete u[d]}function qn(e){return e.startsWith(`/`)&&(e=e.slice(1)),e.split(`/`).map(function(e){return e.replace(/~0/g,`~`).replace(/~1/g,`/`)})}function Jn(e,t,n,r){if(n===void 0&&(n=0),r===void 0&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&t[r]===`**`;)r++;return r===t.length}var i=t[r];
5if(i===`**`){if(r+1===t.length)return!0;for(var a=n;a<=e.length;a++)if(Jn(e,t,a,r+1))return!0;return!1}return i===`*`||i===e[n]?Jn(e,t,n+1,r+1):!1}function Yn(e,t){return t.some(function(t){return Jn(e,t)})}var Xn=500,Zn=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;e===void 0&&(e=[]);var r=this.request.headers,a={};if(Array.isArray(r))r.forEach(function(e){var t=i(e,2),n=t[0];a[n]=t[1]});else if(r instanceof Headers)r.forEach(function(e,t){a[t]=e});else if(typeof r==`object`&&r)try{for(var s=o(Object.entries(r)),c=s.next();!c.done;c=s.next()){var l=i(c.value,2),u=l[0];a[u]=l[1]}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return ar(a,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if(typeof this._bodySize==`number`)return this._bodySize;if(L()?.TextEncoder){var e=this.request.body;return this._bodySize=$n(e,100),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(e,t){return e===void 0&&(e=[]),t===void 0&&(t=[]),x(this,void 0,void 0,function(){var n;return h(this,function(r){return e.length===0?[2,null]:(n=this.body,[2,nr(n,e,t)])})})},e}(),Qn=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return e===void 0&&(e=[]),ar(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return $n(this.bodyRaw,100)},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(e,t){return e===void 0&&(e=[]),t===void 0&&(t=[]),x(this,void 0,void 0,function(){var n;return h(this,function(r){return e.length===0?[2,null]:(n=this.body,[2,nr(n,e,t)])})})},e}();function $n(e,t){var n,r,a,s=L()?.TextEncoder;if(s&&e!=null){var c;if(typeof e==`string`)c=e,a=new s().encode(c).length;else if(typeof Blob<`u`&&e instanceof Blob)c=e,a=c.size;else if(typeof URLSearchParams<`u`&&e instanceof URLSearchParams)c=e,a=new s().encode(c.toString()).length;else if(ArrayBuffer.isView(e))c=e,a=c.byteLength;else if(e instanceof ArrayBuffer)c=e,a=c.byteLength;else if(typeof FormData<`u`&&e instanceof FormData){var l=e,u=0,d=0;try{for(var f=o(l.entries()),p=f.next();!p.done;p=f.next()){var m=i(p.value,2),h=m[0],g=m[1];if(u+=h.length,typeof g==`string`)u+=new s().encode(g).length;else if(typeof Blob<`u`&&g instanceof Blob)u+=g.size;else return;if(++d>=t)return}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}a=u}else if(typeof ReadableStream<`u`&&e instanceof ReadableStream){c=e;return}return a}}var er=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(e===void 0&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,r={};return(t=n?.forEach)==null||t.call(n,function(e,t){r[t]=e}),ar(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e;if(this._bodySize!==void 0)return this._bodySize;var t=((e=this.response.headers)?.get)?.call(e,`content-length`),n=t?parseInt(t,10):void 0;return this._bodySize=n,n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return x(this,void 0,void 0,function(){var e,t,n;return h(this,function(r){switch(r.label){case 0:this.clonedResponse||=this.response.clone(),r.label=1;case 1:return r.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise(function(e){return setTimeout(function(){return e(null)},Xn)}),[4,Promise.race([e,t])];case 2:return n=r.sent(),[2,n];case 3:return r.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=[]),x(this,void 0,void 0,function(){var n;return h(this,function(r){switch(r.label){case 0:return e.length===0?[2,null]:[4,this.text()];case 1:return n=r.sent(),[2,nr(n,e,t)]}})})},e}(),tr=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size}
5,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(e===void 0&&(e=[]),!this.headersString)return{};var r={},a=this.headersString.split(`\r 6`);try{for(var s=o(a),c=s.next();!c.done;c=s.next()){var l=c.value,u=i(l.split(`: `),2),d=u[0],f=u[1];d&&f&&(r[d]=f)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return ar(r,{allow:e})},e.prototype.json=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=[]),x(this,void 0,void 0,function(){var n;return h(this,function(r){return e.length===0?[2,null]:(n=this.getJson(),n?(Gn(n,e,t),[2,n]):[2,null])})})},e}();function nr(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return Gn(r,t,n),r}catch{return null}}var rr;(function(e){e.REDACT=`redact`,e.REMOVE=`remove`})(rr||={});var ir=`[REDACTED]`,ar=function(e,t){var n,r,a=t.allow,s=a===void 0?[]:a,c=t.strategy,l=c===void 0?rr.REMOVE:c,u=g([],i(Ne),!1),d={},f=function(t){var n=t.toLowerCase();u.find(function(e){return e.toLowerCase()===n})?l===rr.REDACT&&(d[t]=ir):s.find(function(e){return e.toLowerCase()===n})?d[t]=e[t]:l===rr.REDACT&&(d[t]=ir)};try{for(var p=o(Object.keys(e)),m=p.next();!m.done;m=p.next()){var h=m.value;f(h)}}catch(e){n={error:e}}finally{try{m&&!m.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return d},or=function(){function e(e,t,n,r,i,a,o,s,c,l,u){o===void 0&&(o=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=a,this.status=o,this.duration=s,this.responseWrapper=c,this.error=l,this.endTime=u}return e.prototype.toSerializable=function(){var e={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:this.requestWrapper?.headers(g([],i(Me),!1)),requestBodySize:this.requestWrapper?.bodySize,responseHeaders:this.responseWrapper?.headers(g([],i(Me),!1)),responseBodySize:this.responseWrapper?.bodySize};return Object.fromEntries(Object.entries(e).filter(function(e){var t=i(e,2);return t[0],t[1]!==void 0}))},e}();function sr(e){return typeof e==`object`&&!!e&&`url`in e&&`method`in e}var cr=function(){function e(e,t){t===void 0&&(t=R()),this.callback=e,this.id=t}return e}();function lr(e){try{e()}catch{}}var ur=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=L();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=L();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){if(this.logger||=t,this.eventCallbacks.set(e.id,e),!this.isObserving){var n=this.globalScope?.XMLHttpRequest?.prototype?.open,r=this.globalScope?.XMLHttpRequest?.prototype?.send,i=this.globalScope?.XMLHttpRequest?.prototype?.setRequestHeader;n&&r&&i&&this.observeXhr(n,r,i);var a=this.globalScope?.fetch;a&&this.observeFetch(a),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach(function(n){try{n.callback(e)}catch(e){lr(function(){var n;(n=t.logger)==null||n.debug(`an unexpected error occurred while triggering event callbacks`,e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,a,o){if(a!==void 0&&o!==void 0){var s,c=`GET`;if(sr(t)?(s=t.url,c=t.method):s=(t?.toString)?.call(t),s)try{var l=new URL(s);s=`${l.protocol}//${l.host}${l.pathname}${l.search}${l.hash}`}catch{}c=n?.method||c;var u,d;r&&(u=r.status),i&&(d={name:i.name||`UnknownError`,message:i.message||`An unknown error occurred`},u=0);var f=Math.floor(performance.now()-o),p=Math.floor(a+f),m=new or(e,c,a,a,s,n,u,f,r,d,p);this.triggerEventCallbacks(m)}},e.prototype.getTimestamps=function(){return{startTime:Date.now?.call(Date),durationStart:(performance==null?void 0:performance.now)?.call(performance)}},e.prototype.observeFetch=function(e){var t=this;!this.globalScope||!e||(this.globalScope.fetch=function(n,r){return x(t,void 0,void 0,function(){var t,i,a,o,s=this;return h(this,function(c){switch(c.label){case 0:try{t=this.getTimestamps()}catch(e){lr(function(){return s.logger?.debug(`an unexpected error occurred while retrieving timestamps`,e)})}c.label=1;case 1:return c.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=c.sent(),[3,4];case 3:return o=c.sent(),a=o,[3,4];case 4:try{this.handleNetworkRequestEvent(`fetch`,n,r?new Zn(r):void 0,i?new er(i):void 0,a,t?.startTime,t?.durationStart)}catch(e){lr(function(){return s.logger?.debug(`an unexpected error occurred while handling fetch`,e)})}if(i)return[2,i];throw a}})})})},e.createXhrJsonParser=function(e,t){return function(){try{if(e.responseType===`json`){if(t.globalScope?.structuredClone)return t.globalScope.structuredClone(e.response)}else if([`text`,``].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&n.name===`InvalidStateError`&&lr(function(){return t.logger?.debug(`unexpected error when retrieving responseText. responseType='${e.responseType}'`)}),null}return null}},e.prototype.observeXhr=function(t,n,r){if(!(!this.globalScope||!t||!n)){var a=this.globalScope.XMLHttpRequest.prototype,o=this;a.open=function(){var e=[...arguments],n=this,r=i(e,2),a=r[0],s=r[1];try{n.$$AmplitudeAnalyticsEvent=O({method:a,url:(s?.toString)?.call(s),headers:{}},o.getTimestamps())}catch(e){lr(function(){return o.logger?.debug(`an unexpected error occurred while calling xhr open`,e)})}return t.apply(n,e)},a.send=function(){var t=[...arguments],r=this,i=r,a=e.createXhrJsonParser(r,o),s=t[0],c=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener(`loadend`,function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader(`content-length`),n=new tr(i.status,e,t?parseInt(t,10):void 0,a),r=i.$$AmplitudeAnalyticsEvent.headers,l=new Qn(s,r);c.status=i.status,o.handleNetworkRequestEvent(`xhr`,{url:c.url,method:c.method},l,n,void 0,c.startTime,c.durationStart)}catch(e){lr(function(){return o.logger?.debug(`an unexpected error occurred while handling xhr send`,e)}
6)}}),n.apply(i,t)},a.setRequestHeader=function(e,t){var n=this;try{var i=n.$$AmplitudeAnalyticsEvent;i&&(i.headers[e]=t)}catch(e){lr(function(){return o.logger?.debug(`an unexpected error occurred while calling xhr setRequestHeader`,e)})}r.apply(n,[e,t])}}},e}()),dr=function(e,t){return e?.map(function(e){if(e.urls?.length&&e.hosts?.length){var n=JSON.stringify(e.hosts),r=JSON.stringify(e.urls);return t?.warn(`Found network capture rule with both urls='${r}' and hosts='${n}' set. Definition of urls takes precedence over hosts, so ignoring hosts.`),O(O({},e),{hosts:void 0})}return e})},fr=function(){function e(){}return e.prototype.parse=function(){return x(this,void 0,void 0,function(){return h(this,function(e){return[2,O(O(O(O({},je),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=Bt();return{utm_campaign:e[me],utm_content:e[he],utm_id:e[ge],utm_medium:e[_e],utm_source:e[ve],utm_term:e[ye]}},e.prototype.getReferrer=function(){var e={referrer:void 0,referring_domain:void 0};try{e.referrer=document.referrer||void 0,e.referring_domain=e.referrer?.split(`/`)[2]??void 0}catch{}return e},e.prototype.getClickIds=function(){var e,t=Bt();return e={},e[be]=t[be],e[xe]=t[xe],e[Se]=t[Se],e[Ce]=t[Ce],e[we]=t[we],e[Te]=t[Te],e[Ee]=t[Ee],e[De]=t[De],e[Oe]=t[Oe],e[ke]=t[ke],e[Ae]=t[Ae],e},e}(),pr=`data-amp-mask`,mr=`*****`,hr=/\b(?:\d[ -]*?){13,16}\b/,gr=/(\d{3}-?\d{2}-?\d{4})/g,_r=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,vr=function(e,t){var n,r;if(t===void 0&&(t=[]),typeof e!=`string`)return``;var i=e;i=i.replace(hr,mr),i=i.replace(gr,mr),i=i.replace(_r,mr);try{for(var a=o(t),s=a.next();!s.done;s=a.next()){var c=s.value;try{i=i.replace(c,mr)}catch{}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i},yr=function(e){if(typeof document>`u`||!document.title)return``;var t=document.querySelector(`title`);return t&&t.hasAttribute(`data-amp-mask`)?mr:e?e(document.title):document.title},br=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Observable=void 0;var t=e=>!!Symbol[e],n=e=>t(e)?Symbol[e]:`@@`+e,r=n(`iterator`),i=n(`observable`),a=n(`species`);function o(e,t){let n=e[t];if(n!=null){if(typeof n!=`function`)throw TypeError(n+` is not a function`);return n}}function s(e){let t=e.constructor;return t!==void 0&&(t=t[a],t===null&&(t=void 0)),t===void 0?_:t}function c(e){return e instanceof _}function l(e){l.log?l.log(e):setTimeout(()=>{throw e})}function u(e){Promise.resolve().then(()=>{try{e()}catch(e){l(e)}})}function d(e){let t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,t))try{if(typeof t==`function`)t();else{let e=o(t,`unsubscribe`);e&&e.call(t)}}catch(e){l(e)}}function f(e){e._observer=void 0,e._queue=void 0,e._state=`closed`}function p(e){let t=e._queue;if(t){e._queue=void 0,e._state=`ready`;for(let n=0;n<t.length&&(m(e,t[n].type,t[n].value),e._state!==`closed`);++n);}}function m(e,t,n){e._state=`running`;let r=e._observer;try{let i=o(r,t);switch(t){case`next`:i&&i.call(r,n);break;case`error`:if(f(e),i)i.call(r,n);else throw n;break;case`complete`:f(e),i&&i.call(r)}}catch(e){l(e)}e._state===`closed`?d(e):e._state===`running`&&(e._state=`ready`)}function h(e,t,n){if(e._state!==`closed`){if(e._state===`buffering`){e._queue.push({type:t,value:n});return}if(e._state!==`ready`){e._state=`buffering`,e._queue=[{type:t,value:n}],u(()=>p(e));return}m(e,t,n)}}var g=class{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state=`initializing`;let n=this,r={get closed(){return n._state===`closed`},next(e){h(n,`next`,e)},error(e){h(n,`error`,e)},complete(){h(n,`complete`)}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}this._state===`initializing`&&(this._state=`ready`)}get closed(){return this._state===`closed`}unsubscribe(){this._state!==`closed`&&(f(this),d(this))}},_=class e{constructor(t){if(!(this instanceof e))throw TypeError(`Observable cannot be called as a function`);if(typeof t!=`function`)throw TypeError(`Observable initializer must be a function`);this._subscriber=t}subscribe(e){return(typeof e!=`object`||!e)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new g(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if(typeof e!=`function`){n(TypeError(e+` is not a function`));return}function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if(typeof e!=`function`)throw TypeError(e+` is not a function`);return new(s(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if(typeof e!=`function`)throw TypeError(e+` is not a function`);return new(s(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if(typeof e!=`function`)throw TypeError(e+` is not a function`);let t=s(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(a){let o=!r;if(r=!0,!o||n)try{i=e(i,a)}catch(e){return t.error(e)}else i=a},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(TypeError(`Cannot reduce an empty sequence`));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=s(this);return new t(n=>{let r,i=0;function a(o){r=o.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):a(t.from(e[i++]))}})}return a(this),()=>{r&&=(r.unsubscribe(),void 0)}})}flatMap(e){if(typeof e!=`function`)throw TypeError(e+` is not a function`);let t=s(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let o=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(o);e>=0&&r.splice(e,1),a()}});r.push(o)},error(e){n.error(e)},complete(){a()}});function a(){i.closed&&r.length===0&&n.complete()}return()=>
6{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[i](){return this}static from(n){let a=typeof this==`function`?this:e;if(n==null)throw TypeError(n+` is not an object`);let s=o(n,i);if(s){let e=s.call(n);if(Object(e)!==e)throw TypeError(e+` is not an object`);return c(e)&&e.constructor===a?e:new a(t=>e.subscribe(t))}if(t(`iterator`)&&(s=o(n,r),s))return new a(e=>{u(()=>{if(!e.closed){for(let t of s.call(n))if(e.next(t),e.closed)return;e.complete()}})});if(Array.isArray(n))return new a(e=>{u(()=>{if(!e.closed){for(let t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}})});throw TypeError(n+` is not observable`)}static of(...t){return new(typeof this==`function`?this:e)(e=>{u(()=>{if(!e.closed){for(let n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}})})}static get[a](){return this}};e.Observable=_,Object.defineProperty(_,Symbol(`extensions`),{value:{symbol:i,hostReportError:l},configurable:!0})})),K=e(t(((e,t)=>{t.exports=br().Observable}))());function xr(e,t){return new K.default(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function Sr(e,t){return new K.default(function(n){var r=!1,i=new Set,a=function(){var e,t;r=!0;try{for(var n=o(i),a=n.next();!a.done;a=n.next()){var s=a.value;try{s.unsubscribe()}catch{}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},s=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),a())},complete:function(){i.delete(t),!r&&i.size===0&&(n.complete(),a(),r=!0)}});i.add(t)};return s(e),s(t),a})}function q(e){var t=new Set,n=null;function r(){n?.unsubscribe(),n=null,t.clear()}return new K.default(function(i){return t.add(i),n===null&&(n=e.subscribe({next:function(e){var n,r,i;try{for(var a=o(t),s=a.next();!s.done;s=a.next()){var c=s.value;(i=c.next)==null||i.call(c,e)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}},error:function(e){var n,i,a;try{for(var s=o(t),c=s.next();!c.done;c=s.next()){var l=c.value;(a=l.error)==null||a.call(l,e)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,i;try{for(var a=o(t),s=a.next();!s.done;s=a.next()){var c=s.value;(i=c.complete)==null||i.call(c)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),t.size===0&&n&&(n.unsubscribe(),n=null)}})}var Cr=e(t(((e,t)=>{var n=Object.prototype.hasOwnProperty;function r(e){return`[Throws: `+(e?e.message:`?`)+`]`}function i(e,t){if(n.call(e,t))try{return e[t]}catch(e){return r(e)}return e[t]}function a(e){var t=[];function n(e){if(typeof e!=`object`||!e)return e;if(t.indexOf(e)!==-1)return`[Circular]`;if(t.push(e),typeof e.toJSON==`function`)try{var a=n(e.toJSON());return t.pop(),a}catch(e){return r(e)}if(Array.isArray(e)){var o=e.map(n);return t.pop(),o}var s=Object.keys(e).reduce(function(t,r){return t[r]=n(i(e,r)),t},{});return t.pop(),s}return n(e)}t.exports=function(e,t,n){return JSON.stringify(a(e),t,n)},t.exports.ensureProperties=a}))()),wr=Cr.default||Cr,Tr=`https://app.amplitude.com`,Er={US:Tr,EU:`https://app.eu.amplitude.com`,STAGING:`https://apps.stag2.amplitude.com`},Dr=`https://cdn.amplitude.com/libs/background-capture-1.0.3.js.gz`,Or=function(e){return document.querySelector(`script[src="${CSS.escape(e)}"]`)?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement(`script`);i.type=`text/javascript`,i.async=!0,i.src=e,i.addEventListener(`load`,function(){t({status:!0})},{once:!0}),i.addEventListener(`error`,function(){n({status:!1,message:`Failed to load the script ${e}`})}),(r=document.head)==null||r.appendChild(i)}catch(e){n(e)}})};function kr(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}var Ar,jr=`__AMPLITUDE_MESSENGER_INSTANCE__`,Mr=`__AMPLITUDE_MESSENGER__`,Nr=function(){function e(e){var t=(e===void 0?{}:e).origin,n=t===void 0?Tr:t;this[Ar]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;(n=(t=this.logger)?.debug)==null||n.call(t,`Message sent: `,JSON.stringify(e)),(i=(r=window.opener)?.postMessage)==null||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;n===void 0&&(n={timeout:15e3});var i=kr(),a={id:i,action:e,args:t};return new Promise(function(t,o){r.requestCallbacks[i]={resolve:t,reject:o},r.notify(a),n.timeout>0&&setTimeout(function(){o(Error(`${e} timed out (id: ${i})`)),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;if(!this.requestCallbacks[e.id]){(t=this.logger)==null||t.warn(`No callback found for request id: ${e.id}`);return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},e.prototype.registerActionHandler=function(e,t){var n,r,i,a;this.actionHandlers.has(e)&&((a=(i=this.logger)?.warn)==null||a.call(i,`Overwriting existing action handler for: ${e}`)),this.actionHandlers.set(e,t);var s=this.pendingMessages.get(e);if(s){this.pendingMessages.delete(e);try{for(var c=o(s),l=c.next();!l.done;l=c.next()){var u=l.value;t(u)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return x(this,void 0,void 0,function(){var t,n,r;return h(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e),t)return[2,t];n=Or(e).then(function(){}),this.scriptLoadPromises.set(e,n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.scriptLoadPromises.delete(e),r;case 4:return[2]}})})},e.prototype.setup=function(e){var t=this,n,r,i=e===void 0?{}:e,a=i.logger,o=i.endpoint;a&&(this.logger=a),o&&this.endpoint===`https://app.amplitude.com`&&(this.endpoint=o
6),!this.isSetup&&(this.isSetup=!0,(r=(n=this.logger)?.debug)==null||r.call(n,`Setting up messenger`),this.messageHandler=function(e){var n,r,i,a;if((r=(n=t.logger)?.debug)==null||r.call(n,`Message received: `,JSON.stringify(e)),t.endpoint===e.origin){var o=e.data,s=o?.action;if(s){if(`id`in o&&o.id)(a=(i=t.logger)?.debug)==null||a.call(i,`Received Response to previous request: `,JSON.stringify(e)),t.handleResponse(o);else{if(s===`ping`){t.notify({action:`pong`});return}var c=t.actionHandlers.get(s);if(c)c(o.data);else{var l=t.pendingMessages.get(s)??[];l.push(o.data),t.pendingMessages.set(s,l)}}}}},window.addEventListener(`message`,this.messageHandler),this.notify({action:`page-loaded`}))},e.prototype.destroy=function(){this.messageHandler&&=(window.removeEventListener(`message`,this.messageHandler),null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=L();e?.[Mr]===this&&delete e[Mr]},e}();Ar=jr;function Pr(e){return typeof e==`object`&&!!e&&jr in e&&e[jr]===!0}function Fr(e){var t=L(),n=t?.[Mr];if(Pr(n))return n;var r=new Nr(e);return t&&(t[Mr]=r),r}var Ir=`__AMPLITUDE_BACKGROUND_CAPTURE__`;function Lr(e,t){var n=e;if(n[Ir]!==!0){n[Ir]=!0;var r=t?.scriptUrl??Dr,i=null,a=function(t,n){var r,i;t===`background-capture-complete`&&((i=(r=e.logger)?.debug)==null||i.call(r,`Background capture complete`),e.notify({action:`background-capture-complete`,data:n}))};e.registerActionHandler(`initialize-background-capture`,function(){var t,n;(n=(t=e.logger)?.debug)==null||n.call(t,`Initializing background capture (external script)`);var o=new URL(r,e.endpoint).toString();e.loadScriptOnce(o).then(function(){var t,n;(n=(t=e.logger)?.debug)==null||n.call(t,`Background capture script loaded (external)`),i=(window==null?void 0:window.amplitudeBackgroundCapture)?.call(window,{messenger:e,onBackgroundCapture:a}),e.notify({action:`background-capture-loaded`})}).catch(function(){var t;(t=e.logger)==null||t.warn(`Failed to initialize background capture`)})}),e.registerActionHandler(`close-background-capture`,function(){var e;(e=i?.close)==null||e.call(i),i=null})}}var Rr={always:`always`,ifEmptyCampaign:`ifEmptyCampaign`};function zr(){return typeof L()?.chrome?.runtime?.id==`string`}function Br(){return L()?.navigator?.product===`ReactNative`}function Vr(e,t,n){var r,i,a=[];try{for(var s=o(t??[]),c=s.next();!c.done;c=s.next()){var l=c.value;try{a.push(new RegExp(l))}catch(e){n.warn(`Invalid regex pattern: ${l}`,e)}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return e.concat(a)}function Hr(e,t){var n,r;if(!(typeof e!=`object`||!e||!e.captureRules?.length)){var i=O({},e),a=i.captureRules??[];try{for(var s=o(a),c=s.next();!c.done;c=s.next()){var l=c.value;l.urls=Vr(l.urls??[],l.urlsRegex,t),delete l.urlsRegex}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i}}function Ur(e){var t,n,r,a,s,c;if(!(typeof e!=`object`||!e)&&!Array.isArray(e)){var l=Object.keys(e);try{for(var u=o(l),d=u.next();!d.done;d=u.next()){var f=d.value;try{var p=e[f];typeof p?.enabled==`boolean`&&(p.enabled?(delete p.enabled,Object.keys(p).length===0&&(e[f]=!0)):e[f]=!1),Ur(p)}catch{}}}catch(e){t={error:e}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}try{if(e.autocapture?.networkTracking?.captureRules?.length)try{for(var m=o(e.autocapture.networkTracking.captureRules),h=m.next();!h.done;h=m.next()){var _=h.value;try{for(var v=(s=void 0,o([`responseHeaders`,`requestHeaders`])),y=v.next();!y.done;y=v.next()){var b=y.value,x=_[b]??{},S=x.captureSafeHeaders,C=x.allowlist;if(!(!S&&!C)){if(C!==void 0&&!Array.isArray(C)){delete _[b];continue}_[b]=g(g([],i(S?Me:[]),!1),i(C??[]),!1)}}}catch(e){s={error:e}}finally{try{y&&!y.done&&(c=v.return)&&c.call(v)}finally{if(s)throw s.error}}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(a=m.return)&&a.call(m)}finally{if(r)throw r.error}}}catch{}var w=e.autocapture?.frustrationInteractions;w&&(w.rageClick&&(w.rageClicks=w.rageClick,delete w.rageClick),w.deadClick&&(w.deadClicks=w.deadClick,delete w.deadClick));try{var T=e.autocapture?.elementInteractions;if(T&&typeof T==`object`&&(T.viewportContentUpdated===!0&&(T.viewportContentUpdated={}),T.viewportContentUpdated===!1&&(T.viewportContentUpdated={enabled:!1}),T.exposureDuration!==void 0)){var E=T.viewportContentUpdated;E===void 0?T.viewportContentUpdated={exposureDuration:T.exposureDuration}:typeof E==`object`&&E.exposureDuration===void 0&&E.enabled!==!1&&(E.exposureDuration=T.exposureDuration),delete T.exposureDuration}}catch{}}}var Wr=e(n(),1),Gr=function(e,t){return typeof e==`boolean`?e:e?.[t]===!1?!1:!zr()||!!e?.[t]},Kr=function(e){return Gr(e,`attribution`)},qr=function(e){return Gr(e,`fileDownloads`)},Jr=function(e){return Gr(e,`formInteractions`)},Yr=function(e){return Gr(e,`pageViews`)},Xr=function(e){return Gr(e,`sessions`)},Zr=function(e){return Gr(e,`pageUrlEnrichment`)},Qr=function(e){return typeof e==`boolean`?e:!(typeof e!=`object`||e.networkTracking!==!0&&typeof e.networkTracking!=`object`)},$r=function(e){return typeof e==`boolean`?e:!(typeof e!=`object`||e.elementInteractions!==!0&&typeof e.elementInteractions!=`object`)},ei=function(e){return typeof e==`boolean`?e:typeof e==`object`&&e.webVitals===!0},ti=function(e){return typeof e==`boolean`?e:!(typeof e!=`object`||e.frustrationInteractions!==!0&&typeof e.frustrationInteractions!=`object`)},ni=function(e){return!(typeof e!=`object`||e.performanceTracking!==!0&&typeof e.performanceTracking!=`object`)},ri=function(e){if(typeof e.autocapture==`object`){var t=e.autocapture.performanceTracking;if(t===!0)return{mainThreadBlock:!0};if(typeof t==`object`&&t)return t}},ii=function(e){return typeof e==`boolean`?e:!!(typeof e==`object`&&e&&e.enabled!==!1)},ai=function(e){if($r(e.autocapture)&&typeof e.autocapture==`object`&&typeof e.autocapture.elementInteractions==`object`)return e.autocapture.elementInteractions},oi=function(e){if(ti(e.autocapture)&&typeof e.autocapture==`object`&&typeof e.autocapture.frustrationInteractions==`object`)return e.autocapture.frustrationInteractions},si=function(e){if(Qr(e.autocapture)){var t=void 0;
6return typeof e.autocapture==`object`&&typeof e.autocapture.networkTracking==`object`?t=e.autocapture.networkTracking:e.networkTrackingOptions&&(t=e.networkTrackingOptions),O(O({},t),{captureRules:dr(t?.captureRules,e.loggerProvider)})}},ci=function(e){var t=function(){return!1},n=void 0,r,i=e.pageCounter;return Yr(e.defaultTracking)&&(t=void 0,r=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&&(n=e.defaultTracking.pageViews.trackHistoryChanges),`eventType`in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(r=e.defaultTracking.pageViews.eventType))),{trackOn:t,trackHistoryChanges:n,eventType:r,pageCounter:i}},li=function(e){return Kr(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking==`object`&&e.defaultTracking.attribution&&typeof e.defaultTracking.attribution==`object`?O({},e.defaultTracking.attribution):{}},ui=function(e){if(Jr(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking==`object`&&typeof e.defaultTracking.formInteractions==`object`)return e.defaultTracking.formInteractions},di=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,a=r.args,o=r.resolve,s=e&&e[i];if(typeof s==`function`){var c=s.apply(e,a);typeof o==`function`&&o(c?.promise)}}return e},fi=function(e){var t=e;return t&&t._q!==void 0},pi=`2.45.5`,mi=`amplitude-ts`,hi=`Web`,gi=`$remote`,_i=function(){function e(){this.name=`@amplitude/plugin-context-browser`,this.type=`before`,this.library=`${mi}/${pi}`,typeof navigator<`u`&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){return x(this,void 0,void 0,function(){var t,n,r,i;return h(this,function(a){return t=new Date().getTime(),n=this.config.lastEventId??-1,r=e.event_id??n+1,this.config.lastEventId=r,e.time||(this.config.lastEventTime=t),i=O(O(O(O(O(O(O(O({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:t},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:hi}),this.config.trackingOptions.language&&{language:zt()}),this.config.trackingOptions.ipAddress&&{ip:gi}),{insert_id:R(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:r,library:this.library,user_agent:this.userAgent}),[2,i]})})},e}(),vi=1e3,yi=function(e){D(t,e);function t(t){var n=this,r,i;try{i=L()?.localStorage}catch(e){(r=t?.loggerProvider)==null||r.debug(`Failed to access localStorage. error=${JSON.stringify(e)}`),i=void 0}return n=e.call(this,i)||this,n.loggerProvider=t?.loggerProvider,n}return t.prototype.set=function(t,n){var r;return x(this,void 0,void 0,function(){var i;return h(this,function(a){switch(a.label){case 0:return Array.isArray(n)&&n.length>vi?(i=n.length-vi,[4,e.prototype.set.call(this,t,n.slice(0,vi))]):[3,2];case 1:return a.sent(),(r=this.loggerProvider)==null||r.error(`Failed to save ${i} events because the queue length exceeded ${vi}.`),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:a.sent(),a.label=4;case 4:return[2]}})})},t}(en),bi=function(e){D(t,e);function t(){return e.call(this,L()?.sessionStorage)||this}return t}(en),xi=function(e){D(t,e);function t(t){t===void 0&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return t.prototype.send=function(e,t,n){return n===void 0&&(n=!1),x(this,void 0,void 0,function(){var r=this;return h(this,function(a){return[2,new Promise(function(a,s){typeof XMLHttpRequest>`u`&&s(Error(`XHRTransport is not supported.`));var c=new XMLHttpRequest;c.open(`POST`,e,!0),c.onreadystatechange=function(){if(c.readyState===r.state.done){var e=c.responseText;try{a(r.buildResponse(JSON.parse(e)))}catch{a(r.buildResponse({code:c.status}))}}};var l={"Content-Type":`application/json`,Accept:`*/*`},u=JSON.stringify(t),d=n&&u.length>=2048&&yn(),f=function(e){var t,n;l=O(O({},r.customHeaders),l);try{for(var a=o(Object.entries(l)),s=a.next();!s.done;s=a.next()){var u=i(s.value,2),d=u[0],f=u[1];c.setRequestHeader(d,f)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}c.send(e)};(function(){return x(r,void 0,void 0,function(){var e;return h(this,function(t){switch(t.label){case 0:return d?[4,bn(u)]:[3,2];case 1:return e=t.sent(),e?(l[`Content-Encoding`]=`gzip`,f(e)):f(u),[3,3];case 2:f(u),t.label=3;case 3:return[2]}})})})().catch(s)})]})})},t}(vn),Si=function(e){D(t,e);function t(t,n,r){t===void 0&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=n!==!1,i.referrerPolicy=r,i}return t.prototype.send=function(e,t,n){return n===void 0&&(n=!1),x(this,void 0,void 0,function(){var r,i,a,o,s,c,l,u,d;return h(this,function(f){switch(f.label){case 0:if(typeof fetch>`u`)throw Error(`FetchTransport is not supported`);return r=JSON.stringify(t),i=n&&r.length>=2048&&yn(),a=r,o={"Content-Type":`application/json`,Accept:`*/*`},i?[4,bn(r)]:[3,2];case 1:s=f.sent(),s&&(o[`Content-Encoding`]=`gzip`,a=s),f.label=2;case 2:return o=O(O({},this.customHeaders),o),c=typeof a==`string`?a.length:a.byteLength,l={headers:o,body:a,method:`POST`,keepalive:this.enableKeepalive&&c<=16384},this.referrerPolicy&&(l.referrerPolicy=this.referrerPolicy),[4,fetch(e,l)];case 3:return u=f.sent(),[4,u.text()];case 4:d=f.sent();try{return[2,this.buildResponse(JSON.parse(d))]}catch{return[2,this.buildResponse({code:u.status})]}}})})},t}(vn),Ci=function(e){D(t,e);function t(){return e.call(this)||this}return t.prototype.send=function(e,t,n){return n===void 0&&(n=!1),x(this,void 0,void 0,function(){var n=this;return h(this,function(r){return[2,new Promise(function(r,i){var a=L();if(!a?.navigator.sendBeacon)throw Error(`SendBeaconTransport is not supported`);try{var o=JSON.stringify(t);return a.navigator.sendBeacon(e,o)?r(n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:o.length,server_upload_time:Date.now()})):r(n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(vn),wi=function(e,t,n){return n===void 0&&(n=!0),x(void 0,void 0,void 0,function(){var r,a,o,s,c,l,u,d,f;return h(this,function(p){switch(p.label){case 0:return r=Rt(e),[4,t.getRaw(r)];case 1:return a=p.sent(),a?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:p.sent(),p.label=3;case 3:return o=i(a.split(`.`),6),s=o[0],c=o[1],l=o[2],u=o[3],d=o[4],f=o[5],[2,{deviceId:s,userId:Ei(c),sessionId:Ti(u),lastEventId:Ti(f),lastEventTime:Ti(d),optOut:!!l}]}})})},Ti=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Ei=function(e){if(!(!atob||!escape||!e))try{return decodeURIComponent(escape(atob(e)))}catch{return}},J=`[Amplitude]`;`${J}`;var Di=`${J} Form Started`,Oi=`${J} Form Submitted`,ki=`${J} File Downloaded`,Ai=`session_start`,ji=`session_end`,Mi=`${J} File Extension`,Ni=`${J} File Name`,Pi=`${J} Link ID`,Fi=`${J} Link Text`,Ii=`${J} Link URL`,Li=`${J} Form ID`,Ri=`${J} Form Name`,zi=`${J} Form Destination`,Bi=`cookie`,Vi=function(e){var t=e.split(`.`);return t.length<=2?e:t.slice(t.length-2,t.length).join(`.`)},Hi=function(e){return Object.values(e).every(function(e){return!e})},Ui=function(e){var t=O(O({},e),{referring_domain:void 0,referrer:void 0});return Object.values(t).every(function(e){return!e})},Wi=function(e,t,n,r,i,a){i===void 0&&(i=!0),e.referrer;var o=e.referring_domain,s=E(e,[`referrer`,`referring_domain`]),c=t||{};c.referrer;var l=c.referring_domain,u=E(c,[`referrer`,`referring_domain`]),d=n.excludeInternalReferrers;if(d){var f=Yi(d,r);if(!(f instanceof TypeError)&&e.referring_domain&&$i(e.referring_domain,a)&&(f===`always`||f===`ifEmptyCampaign`&&Ui(e)))return Xi(f,e.referring_domain,r),!1}if(Gi(n.excludeReferrers,e.referring_domain))return r.debug(`This is not a new campaign because ${e.referring_domain} is in the exclude referrer list.`),!1;if(!i&&Hi(e)&&t)return r.debug(`This is not a new campaign because this is a direct traffic in the same session.`),!1;var p=JSON.stringify(s)!==JSON.stringify(u),m=Vi(o||``)!==Vi(l||``),h=!t||p||m;return h?r.debug(`This is a new campaign. An $identify event will be sent.`):r.debug(`This is not a new campaign because it's the same as the previous one.`),h},Gi=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=``),e.some(function(e){return e instanceof RegExp?e.test(t):e===t})},Ki=function(e,t){var n=t.startsWith(`.`)?t:`.${t}`;return!!(e.startsWith(`.`)?e:`.${e}`).endsWith(n)},qi=function(e,t){var n=O(O({},je),e);return Xe(Object.entries(n).reduce(function(e,n){var r=i(n,2),a=r[0],o=r[1];return e.setOnce(`initial_${a}
6`,o??t.initialEmptyValue??`EMPTY`),o?e.set(a,o):e.unset(a)},new Le))},Ji=function(e){var t=e;return t?(t.startsWith(`.`)&&(t=t.substring(1)),[RegExp(`${t.replace(`.`,`\\.`)}\$`)]):[]},Yi=function(e,t){if(e===!0)return Rr.always;if(typeof e==`object`){var n=e.condition;if(typeof n==`string`&&Object.keys(Rr).includes(n))return n;if(n===void 0)return Rr.always}var r=`Invalid configuration provided for attribution.excludeInternalReferrers: ${JSON.stringify(e)}`;return t.error(r),TypeError(r)};function Xi(e,t,n){var r=`This is not a new campaign because referring_domain=${t} is on the same domain as the current page and it is configured to exclude internal referrers`;e===`always`?n.debug(r):e===`ifEmptyCampaign`&&n.debug(`${r} with empty campaign parameters`)}var Zi=`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`.split(`,`),Qi=function(e){var t=e||L()?.location?.hostname;if(!t)return``;var n=t.split(`.`),r=n[n.length-1],i=n[n.length-2];return Zi.find(function(e){return t.endsWith(`.${e}`)})&&(r=n[n.length-2]+`.`+n[n.length-1],i=n[n.length-3]),i?`${i}.${r}`:r},$i=function(e,t){var n=L();return n?Ki(e,(t||``).trim()||Qi(n.location.hostname)):!1},ea=function(e){D(t,e);function t(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,ee,k,A,j,te,ne,re,ie,ae,oe,se,ce,M,N,le,ue){r===void 0&&(r=new Kt),i===void 0&&(i={domain:``,expiration:365,sameSite:`Lax`,secure:!1,upgrade:!0}),c===void 0&&(c=1e3),l===void 0&&(l=5),u===void 0&&(u=30),d===void 0&&(d=Bi),g===void 0&&(g=new at),_===void 0&&(_=B.Warn),y===void 0&&(y=!1),b===void 0&&(b=!1),C===void 0&&(C=``),w===void 0&&(w=`US`),D===void 0&&(D=18e5),O===void 0&&(O=new yi({loggerProvider:g})),ee===void 0&&(ee={ipAddress:!0,language:!0,platform:!0}),k===void 0&&(k=`fetch`),A===void 0&&(A=!1),j===void 0&&(j=!0),oe===void 0&&(oe=!0),se===void 0&&(se=0),le===void 0&&(le=!1);var P=this;P=e.call(this,{apiKey:t,storageProvider:O,transportProvider:ia(k)})||this,P.apiKey=t,P.appVersion=n,P.cookieOptions=i,P.defaultTracking=a,P.autocapture=o,P.flushIntervalMillis=c,P.flushMaxRetries=l,P.flushQueueSize=u,P.identityStorage=d,P.ingestionMetadata=f,P.instanceName=p,P.loggerProvider=g,P.logLevel=_,P.minIdLength=v,P.offline=y,P.partnerId=x,P.plan=S,P.serverUrl=C,P.serverZone=w,P.sessionTimeout=D,P.storageProvider=O,P.trackingOptions=ee,P.transport=k,P.useBatch=A,P.fetchRemoteConfig=j,P.networkTrackingOptions=ie,P.identify=ae,P.enableDiagnostics=oe,P.diagnosticsSampleRate=se,P.diagnosticsClient=ce,P.remoteConfig=M,P.topLevelDomain=N,P.enableRequestBodyCompression=le,P.customEnrichment=ue,P.version=pi,P._optOut=!1,P._cookieStorage=r,P.deviceId=s,P.lastEventId=m,P.lastEventTime=h,P.optOut=b,P.deferredSessionId=E,P.sessionId=T,P.pageCounter=ne,P.userId=te,P.debugLogsEnabled=re,P.loggerProvider.enable(re?B.Debug:P.logLevel),P.networkTrackingOptions=ie,P.identify=ae,P.enableDiagnostics=oe,P.diagnosticsSampleRate=se,P.diagnosticsClient=ce;var de=M?.fetchRemoteConfig??j;return P.remoteConfig=P.remoteConfig||{},P.remoteConfig.fetchRemoteConfig=de,P.fetchRemoteConfig=de,P.topLevelDomain=N||Qi(),P}return Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())}
6,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,e!==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(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof Jt&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Lt(this.apiKey),e)},t}(st),ta=function(e,t,n,r,i){return t===void 0&&(t={}),x(void 0,void 0,void 0,function(){var a,o,s,c,l,u,d,f,p,m,g,_,v,y,b,x,S,C,w,T,E;return h(this,function(h){switch(h.label){case 0:return a=t.identityStorage||`cookie`,o=``,a===`cookie`&&!t.cookieOptions?.domain&&t.cookieOptions?.domain!==``?[4,aa(void 0,r)]:[3,2];case 1:o=h.sent(),h.label=2;case 2:return s=O({domain:t.cookieOptions?.domain??o,expiration:365,sameSite:`Lax`,secure:!1,upgrade:!0},t.cookieOptions),c={duplicateResolverFn:function(e){var t=Zt(e);return t?Qt(JSON.parse(t).cookieDomain,s.domain):!1},diagnosticsClient:r},l=na(t.identityStorage,s,c),[4,wi(e,l,t.cookieOptions?.upgrade??!0)];case 3:return u=h.sent(),[4,l.get(Lt(e))];case 4:return d=h.sent(),f=Bt(),p=f.ampTimestamp?Number(f.ampTimestamp):void 0,m=!p||Date.now()<p,g=t.deviceId??(m?f.ampDeviceId??f.deviceId:void 0)??d?.deviceId??u.deviceId??R(),_=d?.lastEventId??u.lastEventId,v=d?.lastEventTime??u.lastEventTime,y=t.optOut??d?.optOut??u.optOut,b=d?.sessionId??u.sessionId,x=d?.deferredSessionId,S=t.userId??d?.userId??u.userId,n.previousSessionDeviceId=d?.deviceId??u.deviceId,n.previousSessionUserId=d?.userId??u.userId,C={ipAddress:t.trackingOptions?.ipAddress??!0,language:t.trackingOptions?.language??!0,platform:t.trackingOptions?.platform??!0},w=d?.pageCounter,T=d?.debugLogsEnabled,t.autocapture!==void 0&&(t.defaultTracking=t.autocapture),E=new ea(e,t.appVersion,l,s,t.defaultTracking,t.autocapture,g,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,a,t.ingestionMetadata,t.instanceName,_,v,i?.loggerProvider??t.loggerProvider,t.logLevel,t.minIdLength,t.offline,y,t.partnerId,t.plan,t.serverUrl,i?.serverZone??t.serverZone,b,x,t.sessionTimeout,t.storageProvider,C,t.transport,t.useBatch,t.fetchRemoteConfig,S,w,T,t.networkTrackingOptions,t.identify,i?.enableDiagnostics??t.enableDiagnostics,i?.diagnosticsSampleRate??n._diagnosticsSampleRate,r,t.remoteConfig,o,t.enableRequestBodyCompression,t.customEnrichment),[4,E.storageProvider.isEnabled()];case 5:return h.sent()||(E.loggerProvider.warn(`Storage provider ${E.storageProvider.constructor.name} is not enabled. Falling back to MemoryStorage.`),E.storageProvider=new Kt),[2,E]}})})},na=function(e,t,n){switch(e===void 0&&(e=Bi),t===void 0&&(t={}),e){case`localStorage`:return new yi;case`sessionStorage`:return new bi;case`none`:return new Kt;default:return new Jt(O(O({},t),{expirationDays:t.expiration}),n)}},ra=function(e){return e===void 0&&(e={}),e.remoteConfig?.fetchRemoteConfig===!0||e.remoteConfig?.fetchRemoteConfig!==!1&&e.fetchRemoteConfig!==!1},ia=function(e){var t=typeof e==`object`?e.type:e,n=typeof e==`object`?e.headers:void 0,r=typeof e==`object`?e.enableKeepalive:void 0,i=typeof e==`object`?e.referrerPolicy:void 0;return t===`xhr`?new xi(n):t===`beacon`?new Ci:new Si(n,r,i)},aa=function(e,t){return x(void 0,void 0,void 0,function(){var n,r,i,a,o,o,s,c,l;return h(this,function(u){switch(u.label){case 0:return[4,new Jt(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!u.sent()||!e&&(typeof location>`u`||!location.hostname)||(n=e??location.hostname,r=n.split(`.`),r.length===1))return[2,``];for(i=[],a=1,Zi.find(function(e){return n.endsWith(`.${e}`)})&&(a=2),o=r.length-a-1;o>
6=0;--o)i.push(r.slice(o).join(`.`));o=0,u.label=2;case 2:if(!(o<i.length))return[3,7];s=i[o],u.label=3;case 3:return u.trys.push([3,5,,6]),[4,Jt.isDomainWritable(s)];case 4:return c=u.sent(),c?[2,`.`+s]:[3,6];case 5:return l=u.sent(),t&&t.recordEvent(`cookies.tld.failure`,{reason:`Unexpected exception checking domain is writable: ${s}`,error:l instanceof Error?l.message:String(l)}),[3,6];case 6:return o++,[3,2];case 7:return t&&t.recordEvent(`cookies.tld.failure`,{reason:`Could not determine TLD for host ${n}`}),[2,``]}})})},oa=`[Amplitude] Page Viewed`,sa=`AMP_PAGE_VIEW`,ca=function(e){e===void 0&&(e={});var t,n=L(),r=void 0,a=!1,o,s,c=e.trackOn,l=e.trackHistoryChanges,u=e.eventType,d=u===void 0?oa:u,f=function(e){var t=e;try{t=decodeURI(e)}catch(e){r?.error(`Malformed URI sequence: `,e)}return t},p=function(e){return x(void 0,void 0,void 0,function(){var t,n,r;return h(this,function(i){switch(i.label){case 0:return t=f(typeof location<`u`&&location.href||``),r={event_type:d},n=[{}],[4,la()];case 1:return[2,(r.event_properties=O.apply(void 0,[O.apply(void 0,n.concat([i.sent()])),{"[Amplitude] Page Domain":typeof location<`u`&&location.hostname||``,"[Amplitude] Page Location":t,"[Amplitude] Page Path":typeof location<`u`&&f(location.pathname)||``,"[Amplitude] Page Title":yr(vr),"[Amplitude] Page URL":t.split(`?`)[0],"[Amplitude] Page View ID":e}]),r)]}})})},m=function(){return c===void 0||typeof c==`function`&&c()},g=typeof location<`u`?location.href:null,_=function(){return x(void 0,void 0,void 0,function(){var e,n,i,a,o;return h(this,function(c){switch(c.label){case 0:return e=location.href,n=da(l,e,g||``)&&m(),g=e,n?(i=void 0,s&&(i=R(),s.set(sa,{pageViewId:i})),r?.log(`Tracking page view event`),t==null?[3,3]:[3,1]):[3,4];case 1:return o=(a=t).track,[4,p(i)];case 2:o.apply(a,[c.sent()]),c.label=3;case 3:c.label=4;case 4:return[2]}})})},v=function(){_()};return{name:`@amplitude/plugin-page-view-tracking-browser`,type:`enrichment`,setup:function(e,c){return x(void 0,void 0,void 0,function(){var l,u,d;return h(this,function(f){switch(f.label){case 0:if(t=c,o=e,r=e.loggerProvider,r.log(`Installing @amplitude/plugin-page-view-tracking-browser`),a=!0,n){try{s=new en(n.sessionStorage)}catch{r?.debug(`sessionStorage is not available in this environment.`)}n.addEventListener(`popstate`,v),n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,n){var r=i(n,3),o=r[0],s=r[1],c=r[2];e.apply(t,[o,s,c]),a&&v()}})}return m()?(r.log(`Tracking page view event`),l=void 0,s&&(l=R(),s.set(sa,{pageViewId:l})),d=(u=t).track,[4,p(l)]):[3,2];case 1:d.apply(u,[f.sent()]),f.label=2;case 2:return[2]}})})},execute:function(e){return x(void 0,void 0,void 0,function(){var t,n,i;return h(this,function(a){switch(a.label){case 0:return c===`attribution`&&ua(e)?(r?.log(`Enriching campaign event to page view event with campaign parameters`),t=void 0,s?[4,s.get(sa)]:[3,2]):[3,4];case 1:n=a.sent(),t=n?.pageViewId,a.label=2;case 2:return[4,p(t)];case 3:i=a.sent(),e.event_type=i.event_type,e.event_properties=O(O({},e.event_properties),i.event_properties),a.label=4;case 4:return o&&e.event_type===d&&(o.pageCounter=o.pageCounter?o.pageCounter+1:1,e.event_properties=O(O({},e.event_properties),{"[Amplitude] Page Counter":o.pageCounter})),[2,e]}})})},teardown:function(){return x(void 0,void 0,void 0,function(){return h(this,function(e){return n&&(n.removeEventListener(`popstate`,v),a=!1),[2]})})}}},la=function(){return x(void 0,void 0,void 0,function(){var e;return h(this,function(t){switch(t.label){case 0:return e=Gt,[4,new fr().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},ua=function(e){if(e.event_type===`$identify`&&e.user_properties){var t=e.user_properties,n=t[M.SET]||{},r=t[M.UNSET]||{},a=g(g([],i(Object.keys(n)),!1),i(Object.keys(r)),!1);return Object.keys(je).every(function(e){return a.includes(e)})}return!1},da=function(e,t,n){switch(e){case`pathOnly`:if(n==``)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname;default:return t!==n}},fa=function(){var e,t=[],n=function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})},r=function(){t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;t?.removeEventListener(n,r)}),t=[]},i;return{name:`@amplitude/plugin-form-interaction-tracking-browser`,type:`enrichment`,setup:function(t,r){return x(void 0,void 0,void 0,function(){var a,o;return h(this,function(s){return i=ui(t),a=function(){if(!r){t.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 a=new WeakSet,o=function(e){if(!a.has(e)){a.add(e);var o=!1;n(e,`change`,function(){var t,n=ma(e);o||r.track(Di,(t={},t[Li]=pa(e.id),t[Ri]=pa(e.name),t[zi]=n,t)),o=!0}),n(e,`submit`,function(n){var a,s,c=ma(e);if(o||r.track(Di,(a={},a[Li]=pa(e.id),a[Ri]=pa(e.name),a[zi]=c,a)),o=!0,i?.shouldTrackSubmit!==void 0){if(typeof i.shouldTrackSubmit==`function`&&typeof SubmitEvent<`u`&&n instanceof SubmitEvent)try{if(!i.shouldTrackSubmit(n))return}catch{t.loggerProvider.warn(`shouldTrackSubmit callback threw an error, proceeding with tracking.`)}else t.loggerProvider.warn(`shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.`)}r.track(Oi,(s={},s[Li]=pa(e.id),s[Ri]=pa(e.name),s[zi]=c,s)),o=!1})}};
6Array.from(document.getElementsByTagName(`form`)).forEach(o),typeof MutationObserver<`u`&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){e.nodeName===`FORM`&&o(e),`querySelectorAll`in e&&typeof e.querySelectorAll==`function`&&Array.from(e.querySelectorAll(`form`)).map(o)})})}),e.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState===`complete`?a():(o=L(),o?o.addEventListener(`load`,a):t.loggerProvider.debug(`Form interaction tracking is not installed because global is undefined.`)),[2]})})},execute:function(e){return x(void 0,void 0,void 0,function(){return h(this,function(t){return[2,e]})})},teardown:function(){return x(void 0,void 0,void 0,function(){return h(this,function(t){return e?.disconnect(),r(),[2]})})}}},pa=function(e){if(typeof e==`string`)return e},ma=function(e){var t=e.getAttribute(`action`);try{t=new URL(encodeURI(t??``),window.location.href).href}catch{}return t},ha=function(){var e,t=[],n=function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})},r=function(){t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;t?.removeEventListener(n,r)}),t=[]};return{name:`@amplitude/plugin-file-download-tracking-browser`,type:`enrichment`,setup:function(t,r){return x(void 0,void 0,void 0,function(){var i,a;return h(this,function(o){return i=function(){if(!r){t.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 i=function(e){var t;try{t=new URL(e.href,window.location.href)}catch{return}var i=a.exec(t.href)?.[1];i&&n(e,`click`,function(){var n;i&&r.track(ki,(n={},n[Mi]=i,n[Ni]=t.pathname,n[Pi]=e.id,n[Fi]=e.text,n[Ii]=e.href,n))})},a=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;Array.from(document.getElementsByTagName(`a`)).forEach(i),typeof MutationObserver<`u`&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){e.nodeName===`A`&&i(e),`querySelectorAll`in e&&typeof e.querySelectorAll==`function`&&Array.from(e.querySelectorAll(`a`)).map(i)})})}),e.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState===`complete`?i():(a=L(),a?a.addEventListener(`load`,i):t.loggerProvider.debug(`File download tracking is not installed because global is undefined.`)),[2]})})},execute:function(e){return x(void 0,void 0,void 0,function(){return h(this,function(t){return[2,e]})})},teardown:function(){return x(void 0,void 0,void 0,function(){return h(this,function(t){return e?.disconnect(),r(),[2]})})}}},ga=!1,_a=function(e){ga||e.defaultTracking!==void 0||(e.loggerProvider.warn(`\`options.defaultTracking\` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to \`options.defaultTracking\`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example: 7 8amplitude.init(<YOUR_API_KEY>, { 9 defaultTracking: true, 10}); 11 12Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.`),ga=!0)},va=function(){var e=`@amplitude/plugin-network-checker-browser`,t=`before`,n=L(),r=[],i=function(e,t){n?.addEventListener&&(n?.addEventListener(e,t),r.push({type:e,handler:t}))},a=function(){r.forEach(function(e){var t=e.type,r=e.handler;n?.removeEventListener(t,r)}),r=[]};return{name:e,type:t,setup:function(e,t){return x(void 0,void 0,void 0,function(){return h(this,function(n){return typeof navigator>`u`?(e.loggerProvider.debug(`Network connectivity checker plugin is disabled because navigator is not available.`),e.offline=!1,[2]):(e.offline=!navigator.onLine,i(`online`,function(){e.offline!==!1&&(e.loggerProvider.debug(`Network connectivity changed to online.`),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),i(`offline`,function(){e.loggerProvider.debug(`Network connectivity changed to offline.`),e.offline=!0}),[2])})})},teardown:function(){return x(void 0,void 0,void 0,function(){return h(this,function(e){return a(),[2]})})}}};function ya(e,t){if(e){Ur(e);
12try{t.loggerProvider.debug(`Update browser config with remote configuration:`,wr(e));var n=e;if(n&&`autocapture`in n){if(typeof n.autocapture==`boolean`&&(t.autocapture=n.autocapture),typeof n.autocapture==`object`&&n.autocapture!==null){var r=O({},n.autocapture);if(t.autocapture===void 0&&(t.autocapture=n.autocapture),typeof n.autocapture.elementInteractions==`object`&&n.autocapture.elementInteractions!==null&&n.autocapture.elementInteractions.pageUrlAllowlistRegex?.length){r.elementInteractions=O({},n.autocapture.elementInteractions);var i=r.elementInteractions,a=i.pageUrlAllowlist??[],o=n.autocapture.elementInteractions.pageUrlAllowlistRegex;i.pageUrlAllowlist=Vr(a,o,t.loggerProvider),delete i.pageUrlAllowlistRegex}var s=Hr(n.autocapture.networkTracking,t.loggerProvider);s&&(r.networkTracking=s),typeof t.autocapture==`boolean`&&(t.autocapture=O({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},r)),typeof t.autocapture==`object`&&(t.autocapture=O(O({},t.autocapture),r))}t.defaultTracking=t.autocapture}`customEnrichment`in n&&n.customEnrichment!==null&&t.customEnrichment!==!1&&(t.customEnrichment=n.customEnrichment),t.loggerProvider.debug(`Browser config after remote config update:`,wr(t))}catch(e){t.loggerProvider.error(`Failed to apply remote configuration because of error: `,e)}}}var ba=`1.28.10`,xa=`@amplitude/plugin-autocapture-browser`,Sa=`@amplitude/plugin-frustration-browser`,Ca=`@amplitude/plugin-performance-browser`,wa=`[Amplitude] Dead Click`,Ta=`[Amplitude] Rage Click`,Ea=`[Amplitude] Error Click`,Da=`[Amplitude] Thrashed Cursor`,Oa=`[Amplitude] Main Thread Block`,ka=`[Amplitude] Element ID`,Aa=`[Amplitude] Element Class`,ja=`[Amplitude] Element Tag`,Ma=`[Amplitude] Element Text`,Na=`[Amplitude] Element Hierarchy`,Pa=`[Amplitude] Element Href`,Fa=`[Amplitude] Element Position Left`,Ia=`[Amplitude] Element Position Top`,La=`[Amplitude] Element Aria Label`,Ra=`[Amplitude] Element Attributes`,za=`[Amplitude] Element Path`,Ba=`[Amplitude] Element Parent Label`,Va=`[Amplitude] Page URL`,Ha=`[Amplitude] Page Title`,Ua=`[Amplitude] Viewport Height`,Wa=`[Amplitude] Viewport Width`,Ga=`[Amplitude] Max Page X`,Ka=`[Amplitude] Max Page Y`,qa=`[Amplitude] Page View ID`,Ja=`https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz`,Ya=`amp-visual-tagging-selector-highlight`,Xa=`data-amp-mask-attributes`,Za=`AMP_PAGE_VIEW`,Qa=[`input`,`select`,`textarea`],$a=function(e,t){return((window==null?void 0:window.getComputedStyle)?.call(window,e))?.getPropertyValue(`cursor`)===`pointer`&&t===`click`},eo=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&Ht(window.location.href,n)||!Ht(window.location.href,t))},to=function(e,t){return function(n,r){var i,a=e.shouldTrackEventResolver,o=((i=r?.tagName)?.toLowerCase)?.call(i);if(!o)return!1;if(a)return a(n,r);if(!eo(e))return!1;var s=String(r?.getAttribute(`type`))||``;if(typeof s==`string`)switch(s.toLowerCase()){case`hidden`:return!1;case`password`:return!1}if(t&&!t.some(function(e){return!!(r?.matches)?.call(r,e)}))return!1;switch(o){case`input`:case`select`:case`textarea`:return n===`change`||n===`click`;default:return n===`click`}}},no=function(e){var t,n=((t=e?.tagName)?.toLowerCase)?.call(t),r=e instanceof HTMLElement&&e.getAttribute(`contenteditable`)?.toLowerCase()===`true`;return!Qa.includes(n)&&!r},ro=function(e){return e?e.split(`,`).map(function(e){return e.trim()}).filter(function(e){return e.length>0&&e!==`id`&&e!==`class`}):[]},io=function(e,t){return Object.entries(e).reduce(function(e,n){var r=i(n,2),a=r[0],o=r[1];if(a.startsWith(t)){var s=a.replace(t,``);s&&(e[s]=o||``)}return e},{})},ao=function(e){return e==null||typeof e==`object`&&Object.keys(e).length===0||typeof e==`string`&&e.trim().length===0},oo=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return ao(r)||(t[n]=r),t},{})},so=function(){try{var e=(L()?.sessionStorage)?.getItem(Za);if(!e)return;var t=JSON.parse(e);if(typeof t.pageViewId==`string`)return t.pageViewId}catch{}},co=function(e,t){return e?t.some(function(t){return(e?.matches)?.call(e,t)})?e:co(e?.parentElement,t):null},lo=function(e){return!(e.event.target===null||!e.closestTrackedAncestor)};function uo(e){return e.type===`click`||e.type===`change`}var fo;(function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]=`LEFT_OR_TOUCH_CONTACT`,e[e.MIDDLE=1]=`MIDDLE`,e[e.RIGHT=2]=`RIGHT`})(fo||={});var po=`__AMPLITUDE_VISUAL_TAGGING__`;function mo(e,t){var n=e;if(n[po]!==!0){n[po]=!0;
12var r=t.dataExtractor,i=t.isElementSelectable,a=t.cssSelectorAllowlist,o=t.actionClickAllowlist,s=null,c=function(t){e.notify({action:`element-selected`,data:t})},l=function(t,n){t===`selector-mode-changed`?e.notify({action:`track-selector-mode-changed`,data:n}):t===`selector-moved`&&e.notify({action:`track-selector-moved`,data:n})};e.registerActionHandler(`initialize-visual-tagging-selector`,function(t){e.loadScriptOnce(Ja).then(function(){s=(window==null?void 0:window.amplitudeVisualTaggingSelector)?.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i(t?.actionType||`click`,e)},onTrack:l,onSelect:c,visualHighlightClass:Ya,messenger:e,cssSelectorAllowlist:a,actionClickAllowlist:o,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:ba}}}),e.notify({action:`selector-loaded`})}).catch(function(){var t;(t=e.logger)==null||t.warn(`Failed to initialize visual tagging selector`)})}),e.registerActionHandler(`close-visual-tagging-selector`,function(){var e;(e=s?.close)==null||e.call(s)})}}function ho(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(lo).filter(function(e){return r(`click`,e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){t?.track(`[Amplitude] Element Clicked`,e.targetElementProperties)})}function go(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,a=e.evaluateTriggers;return n.changeObservable.filter(lo).filter(function(e){return i(`change`,e.closestTrackedAncestor)}).map(function(e){return a(e)}).subscribe(function(e){t?.track(`[Amplitude] Element Changed`,r(`change`,e.closestTrackedAncestor))})}function _o(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,a=e.shouldTrackEvent,o=e.shouldTrackActionClick,s=n.clickObservable,c=n.mutationObservable,l=n.navigateObservable,u=Sr(s.filter(function(e){return!a(`click`,e.closestTrackedAncestor)}).map(function(e){return e.closestTrackedAncestor=co(e.event.target,r.actionClickAllowlist),e.closestTrackedAncestor!==null&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(lo).filter(function(e){return o(`click`,e.closestTrackedAncestor)}),l?Sr(c,l):c),d=null,f=null;return xr(u,function(e){if(d&&=(clearTimeout(d),null),e.type===`click`)return f=e,d=setTimeout(function(){d=null,f=null},500),Promise.resolve(null);if(f){var t=f;return f=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&t?.track(`[Amplitude] Element Clicked`,i(`click`,e.closestTrackedAncestor))})}function vo(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0},r=t.subscribe(function(){var e=L(),t=Math.floor(e?.scrollX??e?.pageXOffset??0),r=Math.floor(e?.scrollY??e?.pageYOffset??0);n.maxX=Math.max(n.maxX,t),n.maxY=Math.max(n.maxY,r)});return{unsubscribe:function(){r.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0}}}var yo=L(),bo=function(){return new K.default(function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},xo=function(e){return e===void 0&&(e=`click`),new K.default(function(t){var n,r=function(e){t.next(e)};return(n=L())==null||n.document.addEventListener(e,r,{capture:!0}),function(){var t;(t=L())==null||t.document.removeEventListener(e,r,{capture:!0})}})},So=function(){return new K.default(function(e){var t,n=function(t){e.next(t)};return(t=L())==null||t.addEventListener(`scroll`,n),function(){var e;(e=L())==null||e.removeEventListener(`scroll`,n)}})},Co=function(){return new K.default(function(e){var t=function(t){var n=[...arguments].slice(1),r=void 0;Array.isArray(n[0])&&typeof n[0][0]==`string`&&(r=n[0][0]),e.next({kind:`console`,message:r})};return Fn.addListener(`error`,t),function(){Fn.removeListener(t)}})},wo=function(e,t){return new K.default(function(n){var r=L();if(!r?.IntersectionObserver)return function(){};var i=new IntersectionObserver(function(e){e.forEach(function(e){n.next(e)})},{root:null,rootMargin:`0px`,threshold:1}),a=t.join(`,`);
12(r?.document.querySelectorAll(a)??[]).forEach(function(e){i.observe(e)});var o=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){e instanceof Element&&(e.matches(a)&&i.observe(e),e.querySelectorAll(a).forEach(function(e){i.observe(e)}))})})});return function(){o.unsubscribe(),i.disconnect()}})},To=function(){return new K.default(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:`error`};t.error instanceof Error||t.error instanceof DOMException?n=O(O({},n),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):typeof t.error==`string`&&(n.message=t.error),e.next(n)}};return yo.addEventListener(`error`,t),function(){yo.removeEventListener(`error`,t)}})},Eo=function(){return new K.default(function(e){var t=function(t){var n={kind:`unhandledrejection`};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):typeof t.reason==`string`&&(n.message=t.reason),e.next(n)};return yo.addEventListener(`unhandledrejection`,t),function(){yo.removeEventListener(`unhandledrejection`,t)}})},Do=function(){return Sr(Sr(To(),Eo()),Co())},Oo=function(){return new K.default(function(e){var t=function(t){e.next(t)},n={capture:!0};return yo.document.addEventListener(`mousemove`,t,n),function(){yo.document.removeEventListener(`mousemove`,t,n)}})},ko=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(e){return console.error(`Error matching event to filter`,e),!1}return!1},Ao=function(e,t){try{if(e.sourceType===`DOM_ELEMENT`){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch{return}},jo=function(e,t,n){e.forEach(function(e){if(typeof e!=`string`&&e.actionType===`ATTACH_EVENT_PROPERTY`){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})},Mo={"[Amplitude] Element Clicked":`click`,"[Amplitude] Element Changed":`change`},No=function(e){var t,n,r,i,a=Object.values(Mo).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return a;try{for(var s=o(e),c=s.next();!c.done;c=s.next()){var l=c.value;try{try{for(var u=(r=void 0,o(l.definition)),d=u.next();!d.done;d=u.next()){var f=Mo[d.value.event_type];f&&a[f].add(l.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}catch(e){console.warn(`Skipping Labeled Event due to malformed definition`,l?.id,e)}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a},Po=function(e){var t,n,r,i,a=new Map;try{for(var s=o(e),c=s.next();!c.done;c=s.next()){var l=c.value;try{for(var u=(r=void 0,o(l.conditions)),d=u.next();!d.done;d=u.next()){var f=d.value;if(f.type===`LABELED_EVENT`){var p=f.match.eventId,m=a.get(p);m||(m=[],a.set(p,m)),m.push(l)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a},Fo=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return Mo[t.event_type]===e.type&&t.filters.every(function(t){return ko(e,t)})})})},Io=function(e,t){var n,r,i,a,s=new Set;try{for(var c=o(e),l=c.next();!l.done;l=c.next()){var u=l.value,d=t.get(u.id);if(d)try{for(var f=(i=void 0,o(d)),p=f.next();!p.done;p=f.next()){var m=p.value;s.add(m)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return Array.from(s)},Lo=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=Io(Fo(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var a=o(i),s=a.next();!s.done;s=a.next()){var c=s.value;jo(c.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}(),Ro=function(e,t,n,r){return new Lo(e,t,n,r)},zo=new Set([`id`,`class`,`style`,`value`,`onclick`,`onchange`,`oninput`,`onblur`,`onsubmit`,`onfocus`,`onkeydown`,`onkeyup`,`onkeypress`,`data-reactid`,`data-react-checksum`,`data-reactroot`,Xa,pr]),Bo=[`type`],Vo=[`svg`,`path`,`g`],Ho=[`password`,`hidden`];function Uo(e,t){var n,r;if(e===null)return null;var i=String(e.tagName).toLowerCase(),a={tag:i},s=Array.from(e.parentElement?.children??[]);s.length&&(a.index=s.indexOf(e),a.indexOfType=s.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var c=(e.previousElementSibling?.tagName)?.toLowerCase();c&&(a.prevSib=String(c));var l=e.getAttribute(`id`);l&&(a.id=String(l));var u=Array.from(e.classList);u.length&&(a.classes=u);var d={},f=Array.from(e.attributes).filter(function(e){return!zo.has(e.name)}),p=!no(e);if(!Ho.includes(String(e.getAttribute(`type`)))&&!Vo.includes(i))try{for(var m=o(f),h=m.next();!h.done;h=m.next()){var g=h.value;
12if(!(p&&!Bo.includes(g.name))){if(t.has(g.name)){d[g.name]=mr;continue}d[g.name]=String(g.value).substring(0,128)}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}return Object.keys(d).length&&(a.attrs=d),a}function Wo(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&n.tagName!==`HTML`;)t.push(n),n=n.parentElement;return t}var Go=[/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/];function Ko(e,t){var n,r,i=[];try{for(var a=o(e),s=a.next();!s.done;s=a.next()){var c=s.value;try{i.push(new RegExp(c))}catch(e){var l=e instanceof Error?e.message:String(e);t?.warn(`@amplitude/element-selector: ignoring invalid autogenerated-id pattern "${c}" (${l})`)}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}function qo(e,t){var n,r;if(e==null||e===``)return!1;try{for(var i=o(t),a=i.next();!a.done;a=i.next())if(a.value.test(e))return!1}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0}var Jo=[/^(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 Yo(e,t){var n,r,i=[];try{for(var a=o(e),s=a.next();!s.done;s=a.next()){var c=s.value;try{i.push(new RegExp(c))}catch(e){var l=e instanceof Error?e.message:String(e);t?.warn(`@amplitude/element-selector: ignoring invalid unstable-class pattern "${c}" (${l})`)}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}function Xo(e,t){var n=e.getAttribute(t.explicitTrackingAttribute);if(n!==null&&n===``)return null;var r=e.getAttribute(`id`);return r===null||r===``||!qo(r,t.autogeneratedIdPatterns)?null:r}function Zo(e,t){return t.map(Qo).join(` > `)}function Qo(e){var t=e.tagName.toLowerCase(),n=e.parentElement;return n===null?t:`${t}:nth-of-type(${$o(e,n)})`}function $o(e,t){for(var n=0,r=0;r<t.children.length;r++){var i=t.children[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}var es={name:`explicitTrackingAttribute`,try:function(e,t){var n=t.config.explicitTrackingAttribute,r=e.getAttribute(n);return r===null||r===``?null:`[${n}=${JSON.stringify(r)}]`}};function ts(e){var t=globalThis.CSS;if(t&&typeof t.escape==`function`)return t.escape(e);for(var n=String(e),r=n.length,i=``,a=0;a<r;a++){var o=n.charCodeAt(a);if(o===0){i+=`�`;continue}if(o>=1&&o<=31||o===127||a===0&&o>=48&&o<=57||a===1&&o>=48&&o<=57&&n.charCodeAt(0)===45){i+=`\\${o.toString(16)} `;continue}if(a===0&&r===1&&o===45){i+=`\\-`;continue}if(o>=128||o===45||o===95||o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122){i+=n.charAt(a);continue}i+=`\\${n.charAt(a)}`}return i}function ns(e){return ts(e)}var rs=[es,{name:`stableId`,try:function(e,t){var n=Xo(e,t.config);return n===null?null:`${e.tagName.toLowerCase()}#${ns(n)}`}}];function is(e,t,n){var r,i;n===void 0&&(n={});var a=n.strategies??rs,s=n.scope??e.ownerDocument??document,c={scope:s,config:t},l=as(e,t.maxAncestorWalkDepth);try{for(var u=o(a),d=u.next();!d.done;d=u.next())for(var f=d.value,p=0;p<l.length;p++){var m=l[p],h=f.try(m,c);if(h!==null){if(p===0){if(os(s,h,e,f.name,n.logger))return h;continue}var g=`${h} > ${Zo(m,l.slice(0,p).reverse())}`;if(os(s,g,e,f.name,n.logger))return g}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return null}function as(e,t){for(var n=[],r=e;r!==null&&(n.push(r),!(t!==void 0&&n.length>t));)r=r.parentElement;return n}function os(e,t,n,r,i){var a;try{a=e.querySelectorAll(t)}catch(e){var o=e instanceof Error?e.message:String(e);return i?.debug(`@amplitude/element-selector: strategy "${r}" emitted a malformed selector "${t}" (${o})`),!1}return a.length===1&&a[0]===n}function ss(e,t,n){n===void 0&&(n={});for(var r=n.scope??e.ownerDocument??document,a=[],o=e,s=0;o!==null&&!(t.maxAncestorWalkDepth!==void 0&&s>t.maxAncestorWalkDepth);){var c=Xo(o,t);
12if(c!==null){var l=`${o.tagName.toLowerCase()}#${ns(c)}`,u=g([l],i(a),!1).join(` > `);if(us(r,u,e))return u}a.unshift(cs(o)),o=o.parentElement,s+=1}return a.join(` > `)}function cs(e){var t=e.tagName.toLowerCase(),n=e.parentElement;return n===null?t:`${t}:nth-of-type(${ls(e,n)})`}function ls(e,t){for(var n=0,r=0;r<t.children.length;r++){var i=t.children[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}function us(e,t,n){var r;try{r=e.querySelectorAll(t)}catch{return!1}return r.length===1&&r[0]===n}var ds=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),fs=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return``;for(var n=[],r=e;r;){var i=ps(r,!!t,r===e);if(!i||(n.push(i),i.optimized))break;r=r.parentElement}return n.reverse(),n.join(` > `)},ps=function(e,t,n){var r,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var a=e.getAttribute(`id`);if(t){if(a)return new ds(hs(a),!0);var s=e.tagName.toLowerCase();if(s===`body`||s===`head`||s===`html`)return new ds(s,!0)}var c=e.tagName.toLowerCase();if(a)return new ds(c+hs(a),!0);var l=e.parentNode;if(!l||l.nodeType===Node.DOCUMENT_NODE)return new ds(c,!0);for(var u=ms(e),d=!1,f=!1,p=-1,m=-1,h=l.children,g=0;h&&(p===-1||!f)&&g<h.length;++g){var _=h[g];if(_.nodeType===Node.ELEMENT_NODE){if(m+=1,_===e){p=m;continue}if(!f&&_.tagName.toLowerCase()===c){d=!0;var v=new Set(u);if(!v.size){f=!0;continue}for(var y=ms(_),b=0;b<y.length;++b){var x=y[b];if(v.has(x)&&(v.delete(x),!v.size)){f=!0;break}}}}}var S=c;if(n&&c.toLowerCase()===`input`&&e.getAttribute(`type`)&&!e.getAttribute(`id`)&&!e.getAttribute(`class`)&&(S+=`[type=`+ts(e.getAttribute(`type`)||``)+`]`),f)S+=`:nth-child(`+String(p+1)+`)`;else if(d)try{for(var C=o(u),w=C.next();!w.done;w=C.next()){var T=w.value;S+=`.`+ts(T.slice(1))}}catch(e){r={error:e}}finally{try{w&&!w.done&&(i=C.return)&&i.call(C)}finally{if(r)throw r.error}}return new ds(S,!1)},ms=function(e){var t=e.getAttribute(`class`);return t?t.split(/\s+/g).filter(Boolean).map(function(e){return`$`+e}):[]},hs=function(e){return`#`+ts(e)};function gs(e,t){try{return fs(e)}catch(e){var n=e instanceof Error?e.message:String(e);return t?.warn(`@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ${n}`),``}}var _s=Object.freeze({enabled:!1,explicitTrackingAttribute:`data-amp-track-id`,autogeneratedIdPatterns:g([],i(Go),!1),unstableClassPatterns:g([],i(Jo),!1),maxAncestorWalkDepth:void 0});function vs(e,t){if(!e)return bs();var n=bs();return typeof e.enabled==`boolean`&&(n.enabled=e.enabled),typeof e.explicitTrackingAttribute==`string`&&e.explicitTrackingAttribute!==``&&(n.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(n.autogeneratedIdPatterns=Ko(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(n.unstableClassPatterns=Yo(e.unstableClassPatterns,t)),n.maxAncestorWalkDepth=ys(e.maxAncestorWalkDepth),n}function ys(e){if(typeof e==`number`&&Number.isFinite(e)&&!(e<=0))return Math.floor(e)}function bs(){return{enabled:_s.enabled,explicitTrackingAttribute:_s.explicitTrackingAttribute,autogeneratedIdPatterns:g([],i(_s.autogeneratedIdPatterns),!1),unstableClassPatterns:g([],i(_s.unstableClassPatterns),!1),maxAncestorWalkDepth:_s.maxAncestorWalkDepth}}function xs(e,t){t===void 0&&(t={});var n=e,r=new Set,i=t.logger,a={strategies:t.strategies,scope:t.scope,logger:i};return{generate:function(e){if(!n.enabled)return gs(e,i);try{var r=is(e,n,a);return r===null?ss(e,n,{scope:t.scope??e.ownerDocument??document}):r}catch(t){var o=t instanceof Error?t.message:String(t);return i?.warn(`@amplitude/element-selector: strategy chain threw — falling back to legacy cssPath: ${o}`),gs(e,i)}},getConfig:function(){return n},updateConfig:function(e){var t,a;n=e;try{for(var s=o(r),c=s.next();!c.done;c=s.next()){var l=c.value;try{l(e)}catch(e){var u=e instanceof Error?e.message:String(e);i?.warn(`@amplitude/element-selector: onConfigChange subscriber threw — ${u}`)}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(t)throw t.error}}},onConfigChange:function(e){return r.add(e),function(){r.delete(e)}}}}var Ss;function Cs(){return Ss||=xs(vs()),Ss}var ws=function(){function e(e,t){var n,r,a=this;
12this.replaceSensitiveString=function(e){return vr(e,a.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,s=performance.now(),c=[];if(!e)return[];for(var l=Wo(e),u=new Map,d=l.length-1;d>=0;d--){var f=l[d];if(f){var p=ro(f.getAttribute(Xa)),m=d===l.length-1?[]:u.get(l[d+1])??new Set,h=new Set(g(g([],i(m),!1),i(p),!1));u.set(f,h)}}c=l.map(function(e){return Uo(e,u.get(e)??new Set)});var _=function(e){e?.attrs&&Object.entries(e.attrs).forEach(function(t){var n=i(t,2),r=n[0],o=n[1];e.attrs&&(e.attrs[r]=a.replaceSensitiveString(o))})};try{for(var v=o(c),y=v.next();!y.done;y=v.next()){var b=y.value;_(b)}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=v.return)&&n.call(v)}finally{if(t)throw t.error}}var x=performance.now();return(r=a.diagnosticsClient)==null||r.recordHistogram(`autocapturePlugin.getHierarchy`,x-s),c},this.getNearestLabel=function(e){var t=e.parentElement;if(!t)return``;var n;try{n=t.querySelector(`:scope>span,h1,h2,h3,h4,h5,h6`)}catch{n=null}return n?a.getText(n):a.getNearestLabel(t)},this.getElementPath=function(e){var t;if(!e)return``;var n=performance.now(),r=a.selectorEngine.generate(e),i=performance.now();return(t=a.diagnosticsClient)==null||t.recordHistogram(`autocapturePlugin.getElementPath`,i-n),r},this.updateSelectorConfig=function(e,t){if(e==null||typeof e.enabled!=`boolean`){t?.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` flag — keeping current engine state.");return}var n=a.selectorEngine.getConfig().enabled,r=vs(e,t);a.selectorEngine.updateConfig(r),!n&&r.enabled?t?.debug(`@amplitude/element-selector: engine enabled — now emitting new element-selector element paths for autocapture events.`):n&&!r.enabled&&t?.debug(`@amplitude/element-selector: engine disabled — reverting to legacy cssPath for element paths.`)},this.getEventProperties=function(e,t,n){var r,i,o=((i=t?.tagName)?.toLowerCase)?.call(i),s=typeof t.getBoundingClientRect==`function`?t.getBoundingClientRect():{left:null,top:null},c=a.getHierarchy(t),l=c[0]?.attrs,u=a.getNearestLabel(t),d=io(l??{},n),f=(r={},r[Na]=c,r[ja]=o,r[Ma]=a.getText(t),r[Fa]=s.left==null?null:Math.round(s.left),r[Ia]=s.top==null?null:Math.round(s.top),r[Ra]=d,r[za]=a.getElementPath(t),r[Ba]=u,r[Va]=W(window.location.href.split(`?`)[0]),r[Ha]=yr(a.replaceSensitiveString),r[Ua]=window.innerHeight,r[Wa]=window.innerWidth,r),p=so();if(p&&(f[qa]=p),f[ka]=t.getAttribute(`id`)||``,f[Aa]=t.getAttribute(`class`),f[La]=l?.[`aria-label`],o===`a`&&e===`click`&&t instanceof HTMLAnchorElement){var m=t.href.substring(0,128);f[Pa]=a.replaceSensitiveString(m)}return oo(f)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){i===void 0&&(i=!1);var o=a.addTypeAndTimestamp(e,t);if(uo(o)&&o.event.target!==null){if(i&&$a(o.event.target,o.type))return o.closestTrackedAncestor=o.event.target,o.targetElementProperties=a.getEventProperties(o.type,o.closestTrackedAncestor,r),o;var s=co(o.event.target,n);return s&&(o.closestTrackedAncestor=s,o.targetElementProperties=a.getEventProperties(o.type,s,r)),o}return o},this.extractDataFromDataSource=function(e,t){if(e.sourceType===`DOM_ELEMENT`){var n=Ao(e,t);return n?e.elementExtractType===`TEXT`?a.getText(n):e.elementExtractType===`ATTRIBUTE`&&e.attribute?n.getAttribute(e.attribute):void 0:void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r=`[${pr}], [contenteditable]`;if(!e.querySelector(r))return e.innerText;var i=``,s=Array.from(e.childNodes);try{for(var c=o(s),l=c.next();!l.done;l=c.next()){var u=l.value;if(u.nodeType===Node.TEXT_NODE){i+=u.textContent||``;continue}if(u instanceof Element){if(u.hasAttribute(`data-amp-mask`)||u.hasAttribute(`contenteditable`)){i+=mr;continue}i+=a.getTextWithMaskedDescendants(u)}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return i},this.getText=function(e){if(e.closest(`[data-amp-mask]`)!==null)return mr;var t=``;return t=e.querySelector(`[data-amp-mask], [contenteditable]`)?a.getTextWithMaskedDescendants(e):e.innerText||``,a.replaceSensitiveStr
12ing(t.substring(0,255)).replace(/\s+/g,` `).trim()},this.getEventTagProps=function(e){var t,n;if(!e)return{};var r=((n=e?.tagName)?.toLowerCase)?.call(n);return oo((t={},t[ja]=r,t[Ma]=a.getText(e),t[Va]=window.location.href.split(`?`)[0],t))},this.diagnosticsClient=t?.diagnosticsClient,this.selectorEngine=Cs();var s=e.maskTextRegex??[],c=[];try{for(var l=o(s),u=l.next();!u.done;u=l.next()){var d=u.value;if(c.length>=25)break;if(d instanceof RegExp)c.push(d);else if(`pattern`in d&&typeof d.pattern==`string`)try{c.push(new RegExp(d.pattern,`i`))}catch{}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=c}return e}(),Ts=`configs.analyticsSDK.browserSDK.autocapture.elementSelector`;function Es(e,t){var n=e.remoteConfigClient;if(!(!e.fetchRemoteConfig||!n)){var r=n.subscribe(Ts,`all`,function(n,r){e.loggerProvider.debug(`@amplitude/element-selector: remote-config delivery (source=${String(r)}) ${JSON.stringify(n)}`),t.updateSelectorConfig(n,e.loggerProvider)});return function(){n.unsubscribe(r)}}}function Ds(e){var t=e.allObservables,n=e.onExposure,r=e.dataExtractor,i=e.exposureDuration,a=i===void 0?150:i,o=new Map,s=new Map,c=t.exposureObservable.subscribe(function(e){var t=e,i=t.target;if(t.isIntersecting){if(!o.get(i)){var c=setTimeout(function(){o.set(i,!0),n(r.getElementPath(i)),s.set(i,null)},a);s.set(i,c)}}else if(!t.isIntersecting&&t.intersectionRatio<1){var c=s.get(i);c&&(clearTimeout(c),s.set(i,null))}});return{unsubscribe:function(){c.unsubscribe()},reset:function(){s.forEach(function(e){e&&clearTimeout(e)}),s.clear(),o.clear()}}}function Os(e){var t,n=e.amplitude,r=e.scrollTracker,i=e.currentElementExposed,a=e.elementExposedForPage,o=e.exposureTracker,s=e.isPageEnd,c=e.lastScroll,l=r.getState(),u=L(),d=u?.innerWidth??0,f=u?.innerHeight??0,p=(t={},t[Va]=W((u?.location?.href)?.split(`?`)[0]??``),t[Ga]=l.maxX+d,t[Ka]=l.maxY+f,t[Ua]=f,t[Wa]=d,t[`[Amplitude] Element Exposed`]=Array.from(i),t),m=so();if(m&&(p[qa]=m),i.size===0&&l.maxX===c.maxX&&l.maxY===c.maxY){s&&(r.reset(),a.clear(),o?.reset());return}n?.track(`[Amplitude] Viewport Content Updated`,p),c.maxX=l.maxX,c.maxY=l.maxY,i.clear(),s&&(r.reset(),a.clear(),o?.reset())}function ks(e,t,n,r){if(!t.has(e)){t.add(e),n.add(e);var i=Array.from(n);JSON.stringify(i).length>=18e3&&r(!1)}}var Y;(function(e){e.ClickObservable=`clickObservable`,e.ChangeObservable=`changeObservable`,e.NavigateObservable=`navigateObservable`,e.MutationObservable=`mutationObservable`,e.ScrollObservable=`scrollObservable`,e.ExposureObservable=`exposureObservable`,e.BrowserErrorObservable=`browserErrorObservable`,e.SelectionObservable=`selectionObservable`,e.MouseMoveObservable=`mouseMoveObservable`})(Y||={});var As=function(e,t){e===void 0&&(e={}),t?.diagnosticsClient.setTag(`plugin.autocapture.version`,`1.28.10`);var n=e.dataAttributePrefix,r=n===void 0?Ln:n,a=e.visualTaggingOptions,s=a===void 0?{enabled:!0}:a;e.cssSelectorAllowlist=e.cssSelectorAllowlist??In,e.actionClickAllowlist=e.actionClickAllowlist??Rn,e.debounceTime=e.debounceTime??0;var c=e.viewportContentUpdated?.enabled!==!1,l=e.viewportContentUpdated?.exposureDuration??e.exposureDuration??150;e.viewportContentUpdated=O(O({},e.viewportContentUpdated),{exposureDuration:l}),e.pageUrlExcludelist=e.pageUrlExcludelist?.reduce(function(e,t){if(typeof t==`string`&&e.push(t),t instanceof RegExp&&e.push(t),typeof t==`object`&&t&&`pattern`in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn(`Invalid regex pattern: ${t.pattern}`,n),e}return e},[]);var u=xa,d=`enrichment`,f=[],p=new ws(e,t),m=new Set,_=new Set,v,y=function(){var t,n=q(xo().map(function(t){return p.addAdditionalEventProperties(t,`click`,e.cssSelectorAllowlist,r)})),i=q(new K.default(function(t){var n,i=function(n){var i=p.addAdditionalEventProperties(n,`change`,e.cssSelectorAllowlist,r);t.next(i)};return(n=L())==null||n.document.addEventListener(`change`,i,{capture:!0}),function(){return L()?.document.removeEventListener(`change`,i)}})),a;window.navigation&&(a=q(new K.default(function(t){var n=function(n){var i=p.addAdditionalEventProperties(n,`navigate`,e.cssSelectorAllowlist,r);t.next(i)};return window.navigation.addEventListener(`navigate`,n),function(){window.navigation.removeEventListener(`navigate`,n)}})));var o=q(bo().map(function(t){return p.addAdditionalEventProperties(t,`mutation`,e.cssSelectorAllowlist,r)})),s=So(),c=wo(o,e.cssSelectorAllowlist);return t={},t[Y.ChangeObservable]=i,t[Y.ClickObservable]=n,t[Y.MutationObservable]=o,t[Y.NavigateObservable]=a,t[Y.ScrollObservable]=s,t[Y.ExposureObservable]=c,t},b=No(Object.values(e.pageActions?.labeledEvents??{})),S=Po(e.pageActions?.triggers??[]),C=Ro(b,S,p,e),w=function(t){t&&(e.pageActions=O(O({},e.pageActions),t),b=No(Object.values(e.pageActions.labeledEvents??{})),S=Po(e.pageActions.triggers??[]),C.update(b,S,e))};return{name:u,type:d,setup:function(t,n){return x(void 0,void 0,void 0,function(){var a,o,d,b,x,S,T,E,D,ee,k,A,j,te,ne,re,ie,ae,oe,se,ce,M;return h(this,function(h){return typeof document>`u`?[2]:(a=!1,o={maxX:void 0,maxY:void 0},t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe(`configs.analyticsSDK.pageActions`,`all`,function(e){w(e)}):t.loggerProvider.debug(`Remote config client is not provided, skipping remote config fetch`)),d=Es(t,p),d&&f.push({unsubscribe:d}),b=to(e,e.cssSelectorAllowlist),x=to(e,e.actionClickAllowlist),S=y(),T=ho({allObservables:S,amplitude:n,shouldTrackEvent:b,evaluateTriggers:C.evaluate.bind(C)}),f.push(T),E=go({allObservables:S,getEventProperties:function(){var e=[...arguments];
12return p.getEventProperties.apply(p,g(g([],i(e),!1),[r],!1))},amplitude:n,shouldTrackEvent:b,evaluateTriggers:C.evaluate.bind(C)}),f.push(E),D=_o({allObservables:S,options:e,getEventProperties:function(){var e=[...arguments];return p.getEventProperties.apply(p,g(g([],i(e),!1),[r],!1))},amplitude:n,shouldTrackEvent:b,shouldTrackActionClick:x}),D&&f.push(D),ee=vo({allObservables:S,amplitude:n}),f.push(ee),k={},A=L(),j=function(e){e&&a||(setTimeout(function(){a=!1},100),a=!0,Os({amplitude:n,scrollTracker:ee,currentElementExposed:_,elementExposedForPage:m,exposureTracker:k.exposure,isPageEnd:e,lastScroll:o}))},te=function(e){ks(e,m,_,j)},c&&(k.exposure=Ds({allObservables:S,onExposure:te,dataExtractor:p,exposureDuration:l}),k.exposure&&f.push(k.exposure),ne=function(){j(!0)},A?.addEventListener(`beforeunload`,ne),v=function(){A?.removeEventListener(`beforeunload`,ne)},f.push({unsubscribe:function(){return v()}}),re=S[Y.NavigateObservable],re?f.push(re.subscribe(function(){j(!0)})):A&&(ie=function(){j(!0)},A.addEventListener(`popstate`,ie),ae=A.history.pushState,A.history&&ae&&(A.history.pushState=new Proxy(ae,{apply:function(e,t,n){var r=i(n,3),a=r[0],o=r[1],s=r[2];e.apply(t,[a,o,s]),j(!0)}})),f.push({unsubscribe:function(){A.removeEventListener(`popstate`,ie),A.history&&ae&&(A.history.pushState=ae)}}))),(M=t?.loggerProvider)==null||M.log(`${u} has been successfully added.`),window.opener&&s.enabled&&(oe=e.cssSelectorAllowlist,se=e.actionClickAllowlist,ce=Fr(),mo(ce,{dataExtractor:p,isElementSelectable:to(e,g(g([],i(oe),!1),i(se),!1)),cssSelectorAllowlist:oe,actionClickAllowlist:se}),Lr(ce),ce.setup(O({logger:t?.loggerProvider},t?.serverZone&&{endpoint:Er[t.serverZone]}))),[2])})})},execute:function(e){return x(void 0,void 0,void 0,function(){return h(this,function(t){return[2,e]})})},teardown:function(){return x(void 0,void 0,void 0,function(){var e,t,n,r,i;return h(this,function(a){try{for(e=o(f),t=e.next();!t.done;t=e.next())n=t.value,n.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}},js=3e3,Ms=[`mutation`,`navigate`];function Ns(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,a=n.clickObservable,o=n.mutationObservable,s=n.navigateObservable,c=Sr(a.filter(function(e){return lo(e)&&i(`click`,e.closestTrackedAncestor)&&e.event.target instanceof Element&&e.event.target.closest(`a[target="_blank"]`)===null&&e.event.button===fo.LEFT_OR_TOUCH_CONTACT}),s?Sr(o,s):o),l=null;return xr(c,function(e){return l&&Ms.includes(e.type)?(clearTimeout(l),l=null,Promise.resolve(null)):e.type===`click`?l?Promise.resolve(null):new Promise(function(t){l=setTimeout(function(){t(e),l=null},js)}):Promise.resolve(null)}).subscribe(function(e){if(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track(wa,O(O({},r(`click`,e.closestTrackedAncestor)),n),{time:e.timestamp})}})}var Ps=4,Fs=Un,Is=50;function Ls(e,t){var n=t.event,r=n.pageX,i=n.pageY;e.yMin=Math.min(e.yMin??i,i),e.yMax=Math.max(e.yMax??i,i),e.xMin=Math.min(e.xMin??r,r),e.xMax=Math.max(e.xMax??r,r),e.isOutOfBounds=e.yMax-e.yMin>Is||e.xMax-e.xMin>Is}function Rs(e){if(e.length===0)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:O({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function zs(e,t){var n=e[Math.max(0,e.length-Ps+1)];return t.timestamp-n.timestamp>=Fs}function Bs(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}function Vs(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,a=r.clickObservable,o=r.selectionObservable,s=[],c={},l=null;function u(e){s=[],c={},e&&(Ls(c,e),s.push(e))}var d=xr(a.filter(function(e){return i(`click`,e.closestTrackedAncestor)}),function(e){return x(t,void 0,void 0,function(){var t;return h(this,function(n){return Ls(c,e),t=null,s.length===0||Bs(s,e)||zs(s,e)||c.isOutOfBounds?(l&&(t=Rs(s)),u(e)):s.push(e),l&&=(clearTimeout(l.timerId),l.resolve(t),null),s.length>=Ps?[2,new Promise(function(e){l={resolve:e,timerId:setTimeout(function(){e(Rs(s))},Fs)}})]:[2,null]})})}),f=o?.subscribe(function(){u()}),p=d.subscribe(function(e){e!==null&&n.track(Ta,e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){p.unsubscribe(),f?.unsubscribe()}}}var Hs=2e3;function Us(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackErrorClick,i=n.clickObservable,a=n.browserErrorObservable,o=i.filter(function(e){return lo(e)&&r(`click`,e.closestTrackedAncestor)&&e.event.target instanceof Element&&e.event.target.closest(`a[target="_blank"]`)===null&&e.event.button===fo.LEFT_OR_TOUCH_CONTACT}),s=null,c=null,l=function(){s!==null&&(clearTimeout(s),s=null),c=null};return Sr(o,a).subscribe(function(e){var n;if(e.type===`click`){l(),c=e,s=setTimeout(l,Hs);return}e.type===`error`&&c&&(t.track(Ea,O((n={},n[`[Amplitude] Kind`]=e.event.kind,n[`[Amplitude] Message`]=e.event.message,n[`[Amplitude] Stack`]=e.event.stack,n[`[Amplitude] Filename`]=e.event.filename,n[`[Amplitude] Line Number`]=e.event.lineNumber,n[`[Amplitude] Column Number`]=e.event.columnNumber,n),c.targetElementProperties)),l())})}var Ws;(function(e){e.INCREASING=`increasing`,e.DECREASING=`decreasing`})(Ws||={});var Gs;(function(e){e.X=`x`,e.Y=`y`})(Gs||={});var Ks=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new K.default(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var a={x:t.clientX,y:t.clientY};if(n===null){n=a;return}a.x>n.x?(r===Ws.DECREASING&&e.next(Gs.X),r=Ws.INCREASING):a.x<n.x&&(r===Ws.INCREASING&&e.next(Gs.X),r=Ws.DECREASING),a.y>n.y?(i===Ws.DECREASING&&e.next(Gs.Y),i=Ws.INCREASING):a.y<n.y&&(i===Ws.INCREASING&&e.next(Gs.Y),i=Ws.DECREASING),n=a})})};function qs(e){var t=+Date.now();e.startTime=e.startTime||t;var n=e.changes,r=e.changesThreshold;n.push(t),n.length>r&&n.shift()}function Js(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return t.length<n?!1:t[t.length-1]-t[0]<r}function Ys(e){e.changes=[],e.startTime=void 0}function Xs(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length&&!(i-t[r]<n);r++);r!==0&&(e.startTime=t[r],e.changes.splice(0,r))}function Zs(e,t){var n=void 0;if(Js(e)&&(n=e.startTime),Js(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}var Qs=20,$s=2e3,ec=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=n===void 0?Qs:n,i=e.thresholdMs,a=i===void 0?$s:i;return new K.default(function(e){var n={changes:[],changesThreshold:r,thresholdMs:a},i={changes:[],changesThreshold:r,thresholdMs:a},o=void 0,s=null;function c(){o!==void 0&&(e.next(o),o=void 0,s!==null&&clearTimeout(s),Ys(n),Ys(i))}return t.subscribe(function(e){s!==null&&clearTimeout(s),qs(e===Gs.X?n:i);var t=Zs(n,i);return t?(o||=t,s=setTimeout(function(){c(),s=null},a)):c(),Xs(n),Xs(i),function(){s!==null&&(clearTimeout(s),s=null)}})})},tc=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,a=i===void 0?Qs:i,o=e.thresholdMs,s=o===void 0?$s:o;return ec({mouseDirectionChangeObservable:Ks({allWindowObservables:r}),directionChanges:a,thresholdMs:s}).subscribe(function(e){eo(n)&&t.track(Da,void 0,{time:e})})};function nc(e,t,n,r){if(!r)return[];var i=e[t];return typeof i==`object`&&i&&`cssSelectorAllowlist`in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var rc=5,ic=4e3,ac=function(e){e===void 0&&(e={});var t=Sa,n=`enrichment`,r=[],a=e.errorClicks!==!1;e.errorClicks||(a=!1);var s=e.deadClicks!==!1&&e.deadClicks!==null,c=e.rageClicks!==!1&&e.rageClicks!==null,l=e.thrashedCursor!==!1&&e.thrashedCursor!==null;e.thrashedCursor||(l=!1);var u=nc(e,`rageClicks`,Hn,c),d=nc(e,`deadClicks`,Bn,s),f=nc(e,`errorClicks`,Vn,a),p=e.dataAttributePrefix??Ln,m=new ws(e),_=g([],i(new Set(g(g(g([],i(u),!1),i(d),!1),i(f),!1))),!1),v=function(){var e,t=q(xo(`pointerdown`).map(function(e){return m.addAdditionalEventProperties(e,`click`,_,p,!0)})),n=q(Do().map(function(e){return m.addTypeAndTimestamp(e,`error`)})),r=q(bo().map(function(e){return m.addAdditionalEventProperties(e,`mutation`,_,p)})),i;window.navigation&&(i=q(new K.default(function(e){var t=function(t){e.next(O(O({},t),{type:`navigate`}))};return window.navigation.addEventListener(`navigate`,t),function(){window.navigation.removeEventListener(`navigate`,t)}}).map(function(e){return m.addAdditionalEventProperties(e,`navigate`,_,p)})));var a=q(new K.default(function(e){var t=function(){var t=document.activeElement;if(t&&(t.tagName===`TEXTAREA`||t.tagName===`INPUT`)){var n=void 0,r=void 0;try{if(n=t.selectionStart,r=t.selectionEnd,n===r)return}catch{return}return e.next()}var i=window.getSelection();if(!(!i||i.isCollapsed))return e.next()};return window.document.addEventListener(`selectionchange`,t),function(){window.document.removeEventListener(`selectionchange`,t)}})),o=q(Oo());return e={},e[Y.ClickObservable]=t,e[Y.MutationObservable]=r,e[Y.NavigateObservable]=i,e[Y.BrowserErrorObservable]=n,e[Y.SelectionObservable]=a,e[Y.MouseMoveObservable]=o,e};return{name:t,type:n,setup:function(n,i){return x(void 0,void 0,void 0,function(){var o,g,_,y,b,x,S,C,w,T,E,D;return h(this,function(h){return typeof document>`u`?[2]:(o=v(),g=Es(n,m),g&&r.push({unsubscribe:g}),c&&(_=to(e,u),y=Vs({allObservables:o,amplitude:i,shouldTrackRageClick:_}),r.push(y)),s&&(b=to(e,d),x=Ns({amplitude:i,allObservables:o,getEventProperties:function(e,t){return m.getEventProperties(e,t,p)},shouldTrackDeadClick:b}),r.push(x)),a&&(S=to(e,f),C=Us({amplitude:i,allObservables:o,shouldTrackErrorClick:S}),r.push(C)),l&&(w=void 0,T=void 0,typeof e.thrashedCursor==`object`&&(w=e.thrashedCursor.directionChanges,T=e.thrashedCursor.threshold,w&&w<rc&&(n.loggerProvider.warn(`'thrashedCursor.directionChanges' of ${w} is below the minimum of ${rc}, setting to ${rc}`),w=rc),T&&T>ic&&(n.loggerProvider.warn(`'thrashedCursor.threshold' of ${T} is above the maximum of ${ic}, setting to ${ic}`),T=ic)),E=tc({amplitude:i,options:e,allObservables:o,directionChanges:w,thresholdMs:T}),r.push(E)),(D=n?.loggerProvider)==null||D.log(`${t} has been successfully added.`),[2])})})},execute:function(e){return x(void 0,void 0,void 0,function(){return h(this,function(t){return[2,e]})})},teardown:function(){return x(void 0,void 0,void 0,function(){var e,t,n,i,a;return h(this,function(s){try{for(e=o(r),t=e.next();!t.done;t=e.next())n=t.value,n.unsubscribe()}catch(e){i={error:e}}finally{try{t&&!t.done&&(a=e.return)&&a.call(e)}finally{if(i)throw i.error}}return[2]})})}}},oc=100,sc=1e4;function cc(e,t){var n=e.startTime+e.duration;return t.filter(function(t){return t.startTime<n&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}function lc(e,t){var n=cc(e,t),r=e.scripts??[],i=r.map(function(e){return e.sourceURL}
12).filter(Boolean),a=r.map(function(e){return e.sourceFunctionName}).filter(Boolean),o=r.map(function(e){return e.sourceCharPosition}).filter(function(e){return typeof e==`number`&&e>=0}),s=r.map(function(e){return e.invokerType}).filter(Boolean),c=r.map(function(e){return e.invoker}).filter(Boolean);return O(O(O(O(O(O(O({"[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":r.length}),i.length>0&&{"[Amplitude] Main Thread Block Script URLs":i}),a.length>0&&{"[Amplitude] Main Thread Block Script Functions":a}),o.length>0&&{"[Amplitude] Main Thread Block Script Positions":o}),s.length>0&&{"[Amplitude] Main Thread Block Invoker Types":s}),c.length>0&&{"[Amplitude] Main Thread Block Invokers":c})}function uc(e,t){var n=cc(e,t),r=e.attribution??[];return O(O({"[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}),r.length>0&&{"[Amplitude] Main Thread Block Attribution":r.map(function(e){return e.name})})}function dc(){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 fc(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,i=r===void 0?oc:r,a=dc();if(!a)return{unsubscribe:function(){}};var s=[],c=new PerformanceObserver(function(e){var t,n,r=performance.now();try{for(var i=o(e.getEntries()),a=i.next();!a.done;a=i.next()){var c=a.value;s.push(c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}for(var l=r-sc;s.length>0&&s[0].startTime<l;)s.shift()});try{c.observe({entryTypes:[`measure`]})}catch{}var l=new PerformanceObserver(function(e){var r,c;try{for(var l=o(e.getEntries()),u=l.next();!u.done;u=l.next()){var d=u.value;if(!eo(n))return;if(!(d.duration<i)){var f=a===`long-animation-frame`?lc(d,s):uc(d,s);t.track(Oa,f)}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(c=l.return)&&c.call(l)}finally{if(r)throw r.error}}});try{l.observe({entryTypes:[a]})}catch{return c.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){l.disconnect(),c.disconnect()}}}var pc=100,mc=function(e){e===void 0&&(e={});var t=Ca,n=`enrichment`,r=[],i=e.mainThreadBlock===!0||typeof e.mainThreadBlock==`object`&&e.mainThreadBlock!==null;return{name:t,type:n,setup:function(n,a){return x(void 0,void 0,void 0,function(){var o,s,c;return h(this,function(l){return typeof document>`u`?[2]:(i&&(o=pc,typeof e.mainThreadBlock==`object`&&e.mainThreadBlock.durationThreshold!==void 0&&(o=e.mainThreadBlock.durationThreshold),s=fc({amplitude:a,options:e,durationThreshold:o}),r.push(s)),(c=n?.loggerProvider)==null||c.log(`${t} performance tracking has been successfully added.`),[2])})})},execute:function(e){return x(void 0,void 0,void 0,function(){return h(this,function(t){return[2,e]})})},teardown:function(){return x(void 0,void 0,void 0,function(){var e,t,n,i,a;return h(this,function(s){try{for(e=o(r),t=e.next();!t.done;t=e.next())n=t.value,n.unsubscribe()}catch(e){i={error:e}}finally{try{t&&!t.done&&(a=e.return)&&a.call(e)}finally{if(i)throw i.error}}return[2]})})}}},hc=`@amplitude/plugin-network-capture-browser`,gc=`500-599`;function _c(e,t){var n=`^`+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,`\\$&`).replace(/\*/g,`.*`)+`$`;return new RegExp(n).test(e)}function vc(e,t){var n,r,a=t.split(`,`);try{for(var s=o(a),c=s.next();!c.done;c=s.next()){var l=c.value,u=i(l.split(`-`).map(Number),2),d=u[0],f=u[1];if(e===d&&f===void 0||e>=d&&e<=f)return!0}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return!1}function yc(e,t,n,r,i){if(!(e.hosts&&!e.hosts.find(function(e){return _c(t,e)}))&&!(r&&e.urls&&!Ht(r,e.urls))&&!(i&&e.methods&&!e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||e===`*`})))return!((n||n===0)&&!vc(n,e.statusCodeRange||gc))}function bc(e){var t=e.indexOf(`#`),n=t>
12=0?e.slice(t+1):``,r=t>=0?e.slice(0,t):e,i=r.indexOf(`?`),a=i>=0?r.slice(i+1):``,o=i>=0?r.slice(0,i):r;return{query:a,fragment:n,href:e,hrefWithoutQueryOrHash:o,host:o.match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i)?.[1]??``}}function xc(e){if(e)try{var t=L()?.location.href,n=new URL(e,t),r=n.searchParams.toString(),i=n.hash.replace(`#`,``),a=n.href,o=n.host;return n.hash=``,n.search=``,{query:r,fragment:i,href:a,hrefWithoutQueryOrHash:n.href,host:o}}catch{try{return bc(e)}catch{return}}}function Sc(e,t){if(e.includes(`amplitude.com`))try{var n=t.body;if(typeof n!=`string`)return!1;if(JSON.parse(n).events.find(function(e){return e.event_type===`[Amplitude] Network Request`}))return!0}catch{}return!1}function Cc(e){if(typeof e!=`object`||!e)return e?g([],i(Me),!1):void 0;if(e.length!==0)return e}function wc(e){return!e?.allowlist?.length&&!e?.blocklist?.length&&!e?.excludelist?.length}function Tc(e,t){t===void 0&&(t={});var n=xc(e.url);if(!n)return!1;var r=n.host;if(t.ignoreAmplitudeRequests!==!1&&(_c(r,`*.amplitude.com`)||_c(r,`amplitude.com`))||t.ignoreHosts?.find(function(e){return _c(r,e)})||!t.captureRules&&e.status!==void 0&&!vc(e.status,gc))return!1;if(t.captureRules){var a;if(g([],i(t.captureRules),!1).reverse().find(function(t){if(a=yc(t,r,e.status,e.url,e.method),a){var n=Cc(t.responseHeaders);if(e.responseWrapper&&n){var i=e.responseWrapper.headers(n);i&&(e.responseHeaders=i)}var o=Cc(t.requestHeaders);if(e.requestWrapper&&o){var s=e.requestWrapper.headers(o);s&&(e.requestHeaders=s)}if(e.responseWrapper&&t.responseBody&&!wc(t.responseBody)){var c=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,c)}if(e.requestWrapper&&t.requestBody&&!wc(t.requestBody)){var c=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,c)}}return a!==void 0}),!a)return!1}return!(e.requestWrapper&&Sc(r,e.requestWrapper))}function Ec(e,t,n,r){return x(this,void 0,void 0,function(){var a,o,s;return h(this,function(c){switch(c.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(a=i.apply(void 0,[c.sent(),2]),o=a[0],s=a[1],o)try{e[`[Amplitude] Request Body`]=JSON.stringify(o)}catch(e){r?.debug(`Failed to stringify request body`,e)}if(s)try{e[`[Amplitude] Response Body`]=JSON.stringify(s)}catch{r?.debug(`Failed to stringify response body`)}c.label=2;case 2:return n?.track(`[Amplitude] Network Request`,e),[2]}})})}function Dc(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return Tc(e.event,n)}).subscribe(function(e){var t,n=e.event,a=xc(n.url);if(a){var o=n.responseWrapper?.bodySize,s=n.requestWrapper?.bodySize;Ec((t={},t[`[Amplitude] URL`]=a.hrefWithoutQueryOrHash,t[`[Amplitude] URL Query`]=a.query,t[`[Amplitude] URL Fragment`]=a.fragment,t[`[Amplitude] Request Method`]=n.method,t[`[Amplitude] Status Code`]=n.status,t[`[Amplitude] Start Time`]=n.startTime,t[`[Amplitude] Completion Time`]=n.endTime,t[`[Amplitude] Duration`]=n.duration,t[`[Amplitude] Request Body Size`]=s,t[`[Amplitude] Response Body Size`]=o,t[`[Amplitude] Request Type`]=n.type,t[`[Amplitude] Request Headers`]=n.requestHeaders,t[`[Amplitude] Response Headers`]=n.responseHeaders,t),n,r,i)}})}var Oc;(function(e){e.NetworkObservable=`networkObservable`})(Oc||={});var kc,Ac=function(e){e===void 0&&(e={});var t=hc,n=`enrichment`,r,i=function(e,t){return{event:e,timestamp:Date.now(),type:t}},a=function(){var e,t=new K.default(function(e){var t=new cr(function(t){var n=i(t,`network`);e.next(n)});return ur.subscribe(t,r),function(){ur.unsubscribe(t)}});return e={},e[Oc.NetworkObservable]=t,e};return{name:t,type:n,setup:function(n,i){return x(void 0,void 0,void 0,function(){var o;return h(this,function(s){return typeof document>`u`&&!Br()?[2]:(o=a(),r=n?.loggerProvider,kc=Dc({allObservables:o,networkTrackingOptions:e,amplitude:i,loggerProvider:r}),r?.log(`${t} has been successfully added.`),[2])})})},execute:function(e){return x(void 0,void 0,void 0,function(){return h(this,function(t){return[2,e]})})},teardown:function(){return x(void 0,void 0,void 0,function(){return h(this,function(e){return kc.unsubscribe(),[2]})})}}},jc=`web-vitals-browser`,Mc=`[Amplitude] Web Vitals`,Nc=-1,Pc=e=>{addEventListener(`pageshow`,(t=>{t.persisted&&(Nc=t.timeStamp,e(t))}),!0)},X=(e,t,n,r)=>{let i,a;return o=>{t.value>=0&&(o||r)&&(a=t.value-(i??0),(a||i===void 0)&&(i=t.value,t.delta=a,t.rating=((e,t)=>e>t[1]?`poor`:e>t[0]?`needs-improvement`:`good`)(t.value,n),e(t)))}},Fc=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Ic=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Lc=()=>Ic()?.activationStart??0,Z=(e,t=-1)=>{let n=Ic(),r=`navigate`;return Nc>=0?r=`back-forward-cache`:n&&(document.prerendering||Lc()>0?r=`prerender`:document.wasDiscarded?r=`restore`:n.type&&(r=n.type.replace(/_/g,`-`))),{name:e,value:t,rating:`good`,delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:r}},Rc=new WeakMap;function zc(e,t){return Rc.get(e)||Rc.set(e,new t),Rc.get(e)}var Bc=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;let t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},Vc=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver((e=>{Promise.resolve().then((()=>{t(e.getEntries())}))}));return r.observe({type:e,buffered:!0,...n}),r}}catch{}},Hc=e=>{let t=!1;return()=>{t||=(e(),!0)}},Uc=-1,Wc=new Set,Gc=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,Kc=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of Wc)e();isFinite(Uc)||(Uc=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,Kc,!0))}},qc=()=>
12{if(Uc<0){let e=Lc();Uc=(document.prerendering?void 0:globalThis.performance.getEntriesByType(`visibility-state`).filter((t=>t.name===`hidden`&&t.startTime>e))[0]?.startTime)??Gc(),addEventListener(`visibilitychange`,Kc,!0),addEventListener(`prerenderingchange`,Kc,!0),Pc((()=>{setTimeout((()=>{Uc=Gc()}))}))}return{get firstHiddenTime(){return Uc},onHidden(e){Wc.add(e)}}},Jc=e=>{document.prerendering?addEventListener(`prerenderingchange`,(()=>e()),!0):e()},Yc=[1800,3e3],Xc=(e,t={})=>{Jc((()=>{let n=qc(),r,i=Z(`FCP`),a=Vc(`paint`,(e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Lc(),0),i.entries.push(t),r(!0)))}));a&&(r=X(e,i,Yc,t.reportAllChanges),Pc((n=>{i=Z(`FCP`),r=X(e,i,Yc,t.reportAllChanges),Fc((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},Zc=[.1,.25],Qc=(e,t={})=>{let n=qc();Xc(Hc((()=>{let r,i=Z(`CLS`,0),a=zc(t,Bc),o=e=>{for(let t of e)a.h(t);a.i>i.value&&(i.value=a.i,i.entries=a.o,r())},s=Vc(`layout-shift`,o);s&&(r=X(e,i,Zc,t.reportAllChanges),n.onHidden((()=>{o(s.takeRecords()),r(!0)})),Pc((()=>{a.i=0,i=Z(`CLS`,0),r=X(e,i,Zc,t.reportAllChanges),Fc((()=>r()))})),setTimeout(r))})))},$c=0,el=1/0,tl=0,nl=e=>{for(let t of e)t.interactionId&&(el=Math.min(el,t.interactionId),tl=Math.max(tl,t.interactionId),$c=tl?(tl-el)/7+1:0)},rl,il=()=>rl?$c:performance.interactionCount??0,al=()=>{`interactionCount`in performance||rl||(rl=Vc(`event`,nl,{type:`event`,buffered:!0,durationThreshold:0}))},ol=0,sl=class{u=[];l=new Map;m;p;v(){ol=il(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((il()-ol)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&e.entryType!==`first-input`)return;let t=this.u.at(-1),n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((e,t)=>t.P-e.P)),this.u.length>10){let e=this.u.splice(10);for(let t of e)this.l.delete(t.id)}this.p?.(n)}}},cl=e=>{let t=globalThis.requestIdleCallback||setTimeout;document.visibilityState===`hidden`?e():(e=Hc(e),addEventListener(`visibilitychange`,e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener(`visibilitychange`,e,{capture:!0})})))},ll=[200,500],ul=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=qc();Jc((()=>{al();let r,i=Z(`INP`),a=zc(t,sl),o=e=>{cl((()=>{for(let t of e)a.h(t);let t=a.L();t&&t.P!==i.value&&(i.value=t.P,i.entries=t.entries,r())}))},s=Vc(`event`,o,{durationThreshold:t.durationThreshold??40});r=X(e,i,ll,t.reportAllChanges),s&&(s.observe({type:`first-input`,buffered:!0}),n.onHidden((()=>{o(s.takeRecords()),r(!0)})),Pc((()=>{a.v(),i=Z(`INP`),r=X(e,i,ll,t.reportAllChanges)})))}))},dl=class{m;h(e){this.m?.(e)}},fl=[2500,4e3],pl=(e,t={})=>{Jc((()=>{let n=qc(),r,i=Z(`LCP`),a=zc(t,dl),o=e=>{t.reportAllChanges||(e=e.slice(-1));for(let t of e)a.h(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Lc(),0),i.entries=[t],r())},s=Vc(`largest-contentful-paint`,o);if(s){r=X(e,i,fl,t.reportAllChanges);let n=Hc((()=>{o(s.takeRecords()),s.disconnect(),r(!0)})),a=e=>{e.isTrusted&&(cl(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});Pc((n=>{i=Z(`LCP`),r=X(e,i,fl,t.reportAllChanges),Fc((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))},ml=[800,1800],hl=e=>{document.prerendering?Jc((()=>hl(e))):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,(()=>hl(e)),!0)},gl=(e,t={})=>{let n=Z(`TTFB`),r=X(e,n,ml,t.reportAllChanges);hl((()=>{let i=Ic();i&&(n.value=Math.max(i.responseStart-Lc(),0),n.entries=[i],r(!0),Pc((()=>{n=Z(`TTFB`,0),r=X(e,n,ml,t.reportAllChanges),r(!0)})))}))};function _l(e){var t=e.entries[0]?.startTime||0;return performance.timeOrigin+t}function vl(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(_l(e)),navigationStart:Math.floor(performance.timeOrigin)}}var yl=function(){var e=null,t=L(),n=t?.document,r=t?.location;return{name:jc,type:`enrichment`,setup:function(t,i){return x(void 0,void 0,void 0,function(){var a,o;return h(this,function(s){return n===void 0?[2]:(a=W(r?.href||``,t.loggerProvider),o={"[Amplitude] Page Domain":r?.hostname||``,"[Amplitude] Page Location":a,"[Amplitude] Page Path":W(r?.pathname||``,t.loggerProvider),"[Amplitude] Page Title":typeof document<`u`&&document.title||``,"[Amplitude] Page URL":W(a.split(`?`)[0],t.loggerProvider)},pl(function(e){o[`[Amplitude] LCP`]=vl(e)}),Xc(function(e){o[`[Amplitude] FCP`]=vl(e)}),ul(function(e){o[`[Amplitude] INP`]=vl(e)}),Qc(function(e){o[`[Amplitude] CLS`]=vl(e)}),gl(function(e){o[`[Amplitude] TTFB`]=vl(e)}),e=function(){n.visibilityState===`hidden`&&e&&(i.track(Mc,o),n.removeEventListener(`visibilitychange`,e),e=null)},n.addEventListener(`visibilitychange`,e),[2])})})},execute:function(e){return x(void 0,void 0,void 0,function(){return h(this,function(t){return[2,e]})})},teardown:function(){return x(void 0,void 0,void 0,function(){return h(this,function(t){return e&&n?.removeEventListener(`visibilitychange`,e),[2]})})}}},bl=function(){function e(e,t){this.shouldTrackNewCampaign=!1,this.options=O({initialEmptyValue:`EMPTY`,resetSessionOnNewCampaign:!1,excludeReferrers:Ji(t.cookieOptions?.domain||t.topLevelDomain),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=$t(t.apiKey,`MKTG`),this.webExpStorageKey=$t(t.apiKey,`MKTG_ORIGINAL`),this.currentCampaign=je,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log(`Installing web attribution tracking.`)}return e.prototype.init=function(){return x(this,void 0,void 0,function(){var e,t;return h(this,function(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return t=i.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||It(this.sessionTimeout,this.lastEventTime),Wi(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,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 x(this,void 0,void 0,function(){var e;return h(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return e=t.sent(),e?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||new fr().parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t=qi(this.currentCampaign,this.options);return e&&(t.event_id=e),t},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),xl=`[Amplitude] Attribution`,Sl=new Set([N.IDENTIFY,N.GROUP_IDENTIFY]),Cl=function(e){return Gt(e)},wl=function(e){e===void 0&&(e={});var t=e.fallbackAttributionEvent??!1,n=L(),r,i,a={},o=!1,s=!1,c,l,u,d,f=function(){return x(void 0,void 0,void 0,function(){var e;return h(this,function(n){switch(n.label){case 0:return[4,new fr().parse()];case 1:return e=n.sent(),a=Cl(e),t&&(i?.log(`Tracking attribution fallback event.`),r?.track(xl,a)),[2]}})})},p=function(){f()},m=function(e){return new Proxy(e,{apply:function(e,t,n){Reflect.apply(e,t,n),o&&p()}})};return{name:`@amplitude/plugin-event-property-attribution-browser`,type:`enrichment`,setup:function(e,t){return x(void 0,void 0,void 0,function(){return h(this,function(a){switch(a.label){case 0:return r=t,i=e.loggerProvider,o=!0,i.log(`Installing event property attribution tracking.`),[4,f()];case 1:if(a.sent(),!n)return[2];if(n.addEventListener(`popstate`,p),!s){if(c=Reflect.get(n.history,`pushState`),l=Reflect.get(n.history,`replaceState`),!c||!l)return[2];u=m(c),n.history.pushState=u,d=m(l),n.history.replaceState=d,s=!0}return[2]}})})},execute:function(e){return x(void 0,void 0,void 0,function(){return h(this,function(t){return Sl.has(e.event_type)||(e.event_properties=O(O({},a),e.event_properties)),[2,e]})})},teardown:function(){return x(void 0,void 0,void 0,function(){var e,t;return h(this,function(r){return n&&(n.removeEventListener(`popstate`,p),e=Reflect.get(n.history,`pushState`),t=Reflect.get(n.history,`replaceState`),s&&e===u&&c&&(n.history.pushState=c),s&&t===d&&l&&(n.history.replaceState=l)),o=!1,s=!1,c=void 0,l=void 0,u=void 0,d=void 0,a={},[2]})})}}},Tl=`AMP_CURRENT_PAGE`,El=`AMP_PREVIOUS_PAGE`,Dl=`AMP_URL_INFO`,Ol;(function(e){e.Direct=`direct`,e.Internal=`internal`,e.External=`external`})(Ol||={});var kl=new Set([N.IDENTIFY,N.GROUP_IDENTIFY,N.REVENUE]),Al=function(e){var t=(e===void 0?{}:e).internalDomains,n=t===void 0?[]:t,r=L(),a=void 0,o=!1,s=void 0,c=!1,l=!1,u=function(e){var t;try{var n=W(e,s);
12t=new URL(n).hostname}catch(e){s?.error(`Could not parse URL: `,e)}return t},d=function(e){var t=typeof location<`u`&&location.hostname||``,r=e?u(e):void 0;if(!r)return Ol.Direct;var i=n.some(function(e){return t.indexOf(e)!==-1}),a=n.some(function(e){return r.indexOf(e)!==-1});return t===r||a&&i?Ol.Internal:Ol.External},f=function(){return x(void 0,void 0,void 0,function(){var e,t,n,r,i;return h(this,function(s){switch(s.label){case 0:return a&&o?[4,a.get(Dl)]:[3,3];case 1:return e=s.sent(),t=W(typeof location<`u`&&location.href||``),n=e?.AMP_CURRENT_PAGE||``,r=void 0,r=t===n?e?.AMP_PREVIOUS_PAGE||``:n||document.referrer||``,[4,a.set(Dl,(i={},i[Tl]=t,i[El]=r,i))];case 2:s.sent(),s.label=3;case 3:return[2]}})})},p=function(){f()};return{name:`@amplitude/plugin-page-url-enrichment-browser`,type:`enrichment`,setup:function(e,t){return x(void 0,void 0,void 0,function(){var t,n,d,m,g,_,v,y;return h(this,function(h){switch(h.label){case 0:if(s=e.loggerProvider,s.log(`Installing @amplitude/plugin-page-url-enrichment-browser`),l=!0,!r)return[3,7];try{a=new en(r.sessionStorage)}catch{s?.debug(`sessionStorage is not available in this environment.`)}return[4,a?.isEnabled()];case 1:return o=h.sent()??!1,a&&o?(t=typeof document<`u`&&document.referrer||``,n=t?u(t):void 0,d=typeof location<`u`&&location.hostname||``,m=W(typeof location<`u`&&location.href||``),[4,a.get(Dl)]):[3,6];case 2:return g=h.sent(),_=g?.AMP_CURRENT_PAGE||``,v=!!n&&n!==d&&_!==m,v?[4,a.set(Dl,(y={},y[Tl]=m,y[El]=t,y))]:[3,4];case 3:return h.sent(),[3,6];case 4:return[4,f()];case 5:h.sent(),h.label=6;case 6:r.addEventListener(`popstate`,p),c||=(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=i(n,3),a=r[0],o=r[1],s=r[2];e.apply(t,[a,o,s]),l&&p()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=i(n,3),a=r[0],o=r[1],s=r[2];e.apply(t,[a,o,s]),l&&p()}}),!0),h.label=7;case 7:return[2]}})})},execute:function(e){return x(void 0,void 0,void 0,function(){var t,n,r;return h(this,function(i){switch(i.label){case 0:return t=W(typeof location<`u`&&location.href||``),a&&o?[4,a.get(Dl)]:[3,2];case 1:if(n=i.sent(),r=n?.AMP_PREVIOUS_PAGE||``,kl.has(e.event_type))return[2,e];e.event_properties=O(O({},e.event_properties||{}),{"[Amplitude] Page Domain":jl(e,`[Amplitude] Page Domain`,typeof location<`u`&&location.hostname||``),"[Amplitude] Page Location":jl(e,`[Amplitude] Page Location`,t),"[Amplitude] Page Path":jl(e,`[Amplitude] Page Path`,typeof location<`u`&&W(location.pathname)||``),"[Amplitude] Page Title":jl(e,`[Amplitude] Page Title`,yr(vr)),"[Amplitude] Page URL":jl(e,`[Amplitude] Page URL`,t.split(`?`)[0]),"[Amplitude] Previous Page Location":r,"[Amplitude] Previous Page Type":d(r)}),i.label=2;case 2:return[2,e]}})})},teardown:function(){return x(void 0,void 0,void 0,function(){return h(this,function(e){switch(e.label){case 0:return r&&(r.removeEventListener(`popstate`,p),l=!1),a&&o?[4,a.set(Dl,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function jl(e,t,n){return e.event_properties||={},e.event_properties[t]===void 0?n:e.event_properties[t]}var Ml=function(){var e,t,n;function r(e){return typeof e!=`object`||!e?!1:`body`in e&&typeof e.body==`string`}function i(t){if(t)try{var n=Function(`return `+t)();if(typeof n==`function`)return n;e?.error(`Custom enrichment body did not evaluate to a function`)}catch(t){e?.error(`Could not create custom enrichment function`,t)}return function(e){return e}}return{name:`@amplitude/plugin-custom-enrichment-browser`,type:`enrichment`,setup:function(a,o){return x(void 0,void 0,void 0,function(){var o;return h(this,function(s){return e=a.loggerProvider,e?.log(`Installing @amplitude/plugin-custom-enrichment-browser`),a.remoteConfig?.fetchRemoteConfig&&(a.remoteConfigClient?(o=a.remoteConfigClient.subscribe(`configs.analyticsSDK.browserSDK.customEnrichment`,`all`,function(e){n=e&&r(e)?i(e.body||``):i(``)}),t=function(){return a.remoteConfigClient?.unsubscribe(o)}):e?.debug(`Remote config client is not provided, skipping remote config fetch`)),[2]})})},execute:function(t){return x(void 0,void 0,void 0,function(){return h(this,function(r){if(n)try{return[2,n(t)??null]}catch(n){return e?.error(`Could not execute custom enrichment function`,n),[2,t]}return[2,t]})})},teardown:function(){return x(void 0,void 0,void 0,function(){return h(this,function(e){return t&&t(),[2]})})}}},Nl=`userProperty`,Pl=`eventProperty`,Fl=function(e){return e===`userProperty`||e===`eventProperty`},Il=[Nl,Pl],Ll=function(e){var t=g([],i(new Set((Array.isArray(e)?e:[e]).filter(Fl))),!1);return t.length>0?t:g([],i(Il),!1)},Rl=function(e,t){return Ll(e.trackingMethod).includes(t)},zl=function(e){return Rl(e,Nl)},Bl=function(e){return Rl(e,Pl)},Vl=-1,Hl=function(e){D(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return t.prototype.init=function(e,t,n){e===void 0&&(e=``);var r,i;return arguments.length>
122?(r=t,i=n):typeof t==`string`?(r=t,i=void 0):(r=t?.userId,i=t),z(this._init(O(O({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){return x(this,void 0,void 0,function(){var n,r,i,a,o,s,c,l,u,d,f,p,m,g,_,v=this;return h(this,function(y){switch(y.label){case 0:return this.initializing?[2]:(this.initializing=!0,n=ra(t),r=t.loggerProvider??new at,t.loggerProvider||r.enable(t.logLevel??B.Warn),i=t.serverZone??`US`,o=this._diagnosticsSampleRate,s=t.enableDiagnostics??!0,n?(a=new En(t.apiKey,r,i,t.remoteConfig?.serverUrl),[4,new Promise(function(e){a?.subscribe(`configs.diagnostics.browserSDK`,`all`,function(t,n,i){if(r.debug(`Diagnostics remote configuration received:`,JSON.stringify({remoteConfig:t,source:n,lastFetch:i},null,2)),t){var a=t.sampleRate;typeof a==`number`&&!isNaN(a)&&(o=a);var c=t.enabled;typeof c==`boolean`&&(s=c)}e()})})]):[3,2]);case 1:y.sent(),y.label=2;case 2:return c=new _n(t.apiKey,r,i,{enabled:s,sampleRate:o}),c.setTag(`library`,`${mi}/${pi}`),typeof navigator<`u`&&c.setTag(`user_agent`,navigator.userAgent),[4,ta(t.apiKey,t,this,c,{loggerProvider:r,serverZone:i,enableDiagnostics:s,diagnosticsSampleRate:o})];case 3:return l=y.sent(),n&&a?[4,new Promise(function(e){a?.subscribe(`configs.analyticsSDK.browserSDK`,`all`,function(t,n,r){l.loggerProvider.debug(`Remote configuration received:`,JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&ya(t,l),e()})})]:[3,5];case 4:y.sent(),y.label=5;case 5:return[4,e.prototype._init.call(this,l)];case 6:return y.sent(),this.logBrowserOptions(l),this.config.remoteConfigClient=a,u=li(this.config),Kr(this.config.defaultTracking)&&zl(u)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return x(v,void 0,void 0,function(){return h(this,function(t){switch(t.label){case 0:return e?[3,2]:(this.webAttribution=new bl(u,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new bl(u,this.config),[4,this.webAttribution.init()]):[3,8];case 7:y.sent(),y.label=8;case 8:return d=Bt(),f=d.ampTimestamp?Number(d.ampTimestamp):void 0,p=!f||Date.now()<f,m=p&&!Number.isNaN(Number(d.ampSessionId))?Number(d.ampSessionId):void 0,g=this.config.deferredSessionId,g===Vl&&!this.config.optOut&&(g=Date.now()),this.setSessionId(t.sessionId??m??g??this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return x(v,void 0,void 0,function(){return h(this,function(t){return!e&&this.config.deferredSessionId&&(this.config.deferredSessionId===Vl?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),_=Mt(t.instanceName),_.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===null?[3,10]:[4,this.add(va()).promise];case 9:y.sent(),y.label=10;case 10:return[4,this.add(new vt({diagnosticsClient:c})).promise];case 11:return y.sent(),[4,this.add(new _i).promise];case 12:return y.sent(),[4,this.add(new Ft).promise];case 13:return y.sent(),_a(this.config),qr(this.config.defaultTracking)?(this.config.loggerProvider.debug(`Adding file download tracking plugin`),[4,this.add(ha()).promise]):[3,15];case 14:y.sent(),y.label=15;case 15:return Jr(this.config.defaultTracking)?(this.config.loggerProvider.debug(`Adding form interaction plugin`),[4,this.add(fa()).promise]):[3,17];case 16:y.sent(),y.label=17;case 17:return Yr(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug(`Adding page view tracking plugin`),[4,this.add(ca(ci(this.config))).promise]):[3,20];case 18:return y.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return x(v,void 0,void 0,function(){return h(this,function(t){switch(t.label){case 0:return e?[2]:(this.config.loggerProvider.debug(`Adding page view tracking plugin`),[4,this.add(ca(ci(this.config))).promise]);case 1:return t.sent(),[2]}})})}),y.label=20;case 20:return Kr(this.config.defaultTracking)&&Bl(u)?(this.config.loggerProvider.debug(`Adding event property attribution plugin`),[4,this.add(wl(u)).promise]):[3,22];case 21:y.sent(),y.label=22;case 22:return $r(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding user interactions plugin (autocapture plugin)`),[4,this.add(As(ai(this.config),{diagnosticsClient:c})).promise]):[3,24];case 23:y.sent(),y.label=24;case 24:return ti(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding frustration interactions plugin`),[4,this.add(ac(oi(this.config))).promise]):[3,26];
12case 25:y.sent(),y.label=26;case 26:return Qr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding network tracking plugin`),[4,this.add(Ac(si(this.config))).promise]):[3,28];case 27:y.sent(),y.label=28;case 28:return ei(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding web vitals plugin`),[4,this.add(yl()).promise]):[3,30];case 29:y.sent(),y.label=30;case 30:return ni(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding performance tracking plugin`),[4,this.add(mc(ri(this.config))).promise]):[3,32];case 31:y.sent(),y.label=32;case 32:return Zr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding referrer page url plugin`),[4,this.add(Al()).promise]):[3,34];case 33:y.sent(),y.label=34;case 34:return ii(this.config.customEnrichment)?(this.config.loggerProvider.debug(`Adding custom enrichment plugin`),[4,this.add(Ml()).promise]):[3,36];case 35:y.sent(),y.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions(`dispatchQ`)];case 37:return y.sent(),_.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=E(t,[`time`]),i=typeof n==`number`?{time:n}:void 0;v.track(e.eventType,r,i)}),[2]}})})},t.prototype.getUserId=function(){return this.config?.userId},t.prototype.setUserId=function(e){if(!this.config){this.q.push(this.setUserId.bind(this,e));return}this.config.loggerProvider.debug(`function setUserId: `,e),(e!==this.config.userId||e===void 0)&&(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),Nt(e,this.config.instanceName))},t.prototype.getDeviceId=function(){return this.config?.deviceId},t.prototype.setDeviceId=function(e){if(!this.config){this.q.push(this.setDeviceId.bind(this,e));return}this.config.loggerProvider.debug(`function setDeviceId: `,e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),Pt(e,this.config.instanceName))},t.prototype.reset=function(){this.setDeviceId(R()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){return{deviceId:this.config?.deviceId,userId:this.config?.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){var t,n;if(`userId`in e&&this.setUserId(e.userId),`deviceId`in e&&e.deviceId&&this.setDeviceId(e.deviceId),`userProperties`in e){this.userProperties=e.userProperties;var r=new Le,a=e.userProperties??{};try{for(var s=o(Object.entries(a)),c=s.next();!c.done;c=s.next()){var l=i(c.value,2),u=l[0],d=l[1];r.set(u,d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}this.identify(r)}},t.prototype.getOptOut=function(){return this.config?.optOut},t.prototype.getSessionId=function(){return this.config?.sessionId},t.prototype.setSessionId=function(e){var t=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),z(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=e??Vl,z(Promise.resolve());if(e===void 0&&(e=Date.now()),e===this.config.sessionId)return z(Promise.resolve());this.config.loggerProvider.debug(`function setSessionId: `,e);var n=this.getSessionId();n!==e&&this.timeline.onSessionIdChanged(e);var r=this.config.lastEventTime,i=this.config.lastEventId??-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,Xr(this.config.defaultTracking)&&(n&&r&&t.push(this.track(ji,void 0,{device_id:this.previousSessionDeviceId,event_id:++i,session_id:n,time:r+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var a=this.trackCampaignEventIfNeeded(++i,t);return this.config.identify&&t.push(this.track(Xe(this.config.identify)).promise),Xr(this.config.defaultTracking)&&t.push(this.track(Ai,void 0,{event_id:a?++i:i,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,z(Promise.all(t))},t.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}this.config.lastEventTime=Date.now()},t.prototype.setTransport=function(e){if(!this.config){this.q.push(this.setTransport.bind(this,e));return}this.config.transportProvider=ia(e)},t.prototype.identify=function(t,n){if(fi(t)){var r=t._q;t._q=[],t=di(new Le,r)}
12return n?.user_id&&this.setUserId(n.user_id),n?.device_id&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(fi(r)){var a=r._q;r._q=[],r=di(new Le,a)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(fi(t)){var r=t._q;t._q=[],t=di(new tt,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!zl(this.webAttribution.options))return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log(`Tracking attribution.`),!0},t.prototype.process=function(t){return x(this,void 0,void 0,function(){var n,r,i;return h(this,function(a){return n=Date.now(),r=It(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type!==`session_start`&&t.event_type!==`session_end`&&(!t.session_id||t.session_id===this.getSessionId())&&(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log(`Created a new session for new campaign.`)):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=O(O({},e),{apiKey:e.apiKey.substring(0,10)+`********`});this.config.loggerProvider.debug(`Initialized Amplitude with BrowserConfig:`,wr(t))}catch(e){this.config.loggerProvider.error(`Error logging browser config`,e)}},t.prototype._setDiagnosticsSampleRate=function(e){if(!(e>1||e<0)&&!this.config){this._diagnosticsSampleRate=e;return}},t}(et),Q=function(){var e=new Hl;return{init:U(e.init.bind(e),`init`,V(e),H(e,[`config`])),add:U(e.add.bind(e),`add`,V(e),H(e,[`config.apiKey`,`timeline.plugins`])),remove:U(e.remove.bind(e),`remove`,V(e),H(e,[`config.apiKey`,`timeline.plugins`])),track:U(e.track.bind(e),`track`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),logEvent:U(e.logEvent.bind(e),`logEvent`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),identify:U(e.identify.bind(e),`identify`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),groupIdentify:U(e.groupIdentify.bind(e),`groupIdentify`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),setGroup:U(e.setGroup.bind(e),`setGroup`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),revenue:U(e.revenue.bind(e),`revenue`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),flush:U(e.flush.bind(e),`flush`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),getUserId:U(e.getUserId.bind(e),`getUserId`,V(e),H(e,[`config`,`config.userId`])),setUserId:U(e.setUserId.bind(e),`setUserId`,V(e),H(e,[`config`,`config.userId`])),getDeviceId:U(e.getDeviceId.bind(e),`getDeviceId`,V(e),H(e,[`config`,`config.deviceId`])),setDeviceId:U(e.setDeviceId.bind(e),`setDeviceId`,V(e),H(e,[`config`,`config.deviceId`])),reset:U(e.reset.bind(e),`reset`,V(e),H(e,[`config`,`config.userId`,`config.deviceId`])),getSessionId:U(e.getSessionId.bind(e),`getSessionId`,V(e),H(e,[`config`])),setSessionId:U(e.setSessionId.bind(e),`setSessionId`,V(e),H(e,[`config`])),extendSession:U(e.extendSession.bind(e),`extendSession`,V(e),H(e,[`config`])),setOptOut:U(e.setOptOut.bind(e),`setOptOut`,V(e),H(e,[`config`])),setTransport:U(e.setTransport.bind(e),`setTransport`,V(e),H(e,[`config`])),getIdentity:U(e.getIdentity.bind(e),`getIdentity`,V(e),H(e,[`config`])),setIdentity:U(e.setIdentity.bind(e),`setIdentity`,V(e),H(e,[`config`,`config.userId`,`config.deviceId`])),getOptOut:U(e.getOptOut.bind(e),`getOptOut`,V(e),H(e,[`config`])),_setDiagnosticsSampleRate:U(e._setDiagnosticsSampleRate.bind(e),`_setDiagnosticsSampleRate`,V(e),H(e,[`config`]))}}();Q.add,Q.extendSession,Q.flush,Q.getDeviceId,Q.getIdentity,Q.getOptOut,Q.getSessionId,Q.getUserId,Q.groupIdentify,Q.identify;var Ul=Q.init;Q.logEvent,Q.remove,Q.reset,Q.revenue,Q.setDeviceId,Q.setGroup,Q.setIdentity,Q.setOptOut,Q.setSessionId,Q.setTransport,Q.setUserId;var Wl=Q.track;Q._setDiagnosticsSampleRate;function Gl(e){return{init:()=>{let{apiKey:t}=e;if(!t){console.error(`Amplitude API key is missing`);return}Ul(t,{autocapture:{fileDownloads:!1,formInteractions:!1,pageViews:!1,sessions:!0},cookieOptions:{sameSite:`None`},minIdLength:1})},track:(e,t)=>{Wl(e,t)}}}var Kl=()=>{let e=k.STATIC_ANALYTICS_AMPLITUDE_APIKEY;return{amplitude:e?Gl({apiKey:e}):void 0}},$=p();function ql({children:e,trackEvent:t}){return(0,$.jsx)(A.Provider,{value:{trackEvent:t},children:e})}function Jl({children:e,services:t,siteName:n}){return(0,Wr.useEffect)(()=>
12{Object.values(t).forEach(e=>{e?.init()})},[t]),(0,$.jsx)(ql,{trackEvent:(e,r)=>{let i={...r,full_url:window.location.href,name:n,referrer:document.referrer?Yl(document.referrer):void 0,url:Yl(window.location.href)};Object.values(t).forEach(t=>{t?.track?.(e,i)})},children:e})}function Yl(e){let t=new URL(e);return t.pathname=t.pathname.replace(/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/g,`/UUID`).replace(/\/(\d+)\/(\d+)\/(\d+)/g,`/date`).replace(/\/(\d+)/g,`/ID`),t.search=``,t.hash=``,t.toString()}var Xl=[],Zl=e=>RegExp(e.replace(/\*/g,`.*`)+`$`),Ql=e=>{Xl=e.split(/[\s,]+/).map(Zl)},$l=(e,t,n,...r)=>{for(let i=Xl.length;i--;)if(Xl[i].test(e))return t({name:e,level:n,messages:r})},eu=e=>{let t=``,n=console[e.level===`fatal`?`error`:e.level];e.name&&(t+=`[${e.name}] `),typeof e.messages[0]==`object`?n(t,...e.messages):n(t+e.messages.shift(),...e.messages)},tu=(e,t)=>({fatal:$l.bind(0,e,t||=eu,`fatal`),error:$l.bind(0,e,t,`error`),warn:$l.bind(0,e,t,`warn`),debug:$l.bind(0,e,t,`debug`),info:$l.bind(0,e,t,`info`),log:$l.bind(0,e,t,`log`)}),nu=tu(``);nu.fatal,nu.error,nu.warn,nu.debug,nu.info,nu.log;var ru=`https://cdn.jobber.com`,iu={long:`/yr`,short:``},au=((e,t=`short`)=>{let n=new URL(ru);return n.pathname=`${iu[t]||iu.short}${e}`,n.toString()})(`/js/@datadog/browser-rum/6.32.0/bundle/datadog-rum.js`,`long`),ou=!0,su=!0,cu=!0,lu=`data-custom-action-name`;function uu({applicationId:e,clientToken:t,defaultPrivacyLevel:n,enabled:r=!1,environment:i,eventSource:a,serviceName:o,sessionReplaySampleRate:s,sessionSampleRate:c,version:l}){return r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`link`,{as:`script`,crossOrigin:`anonymous`,href:au,rel:`preload`}),(0,$.jsx)(`script`,{crossOrigin:`anonymous`,src:au,type:`text/javascript`}),(0,$.jsx)(`script`,{dangerouslySetInnerHTML:{__html:` 13 window.DD_RUM && window.DD_RUM.init({ 14 clientToken: "${t}", 15 applicationId: "${e}", 16 site: "datadoghq.com", 17 service: "${o}", 18 version: "${l}", 19 env: "${i}", 20 sessionSampleRate: ${c}, 21 sessionReplaySampleRate: ${s}, 22 trackUserInteractions: ${ou}, 23 trackResources: ${su}, 24 trackLongTasks: ${cu}, 25 defaultPrivacyLevel: "${n}", 26 enableExperimentalFeatures: ["feature_flags"], 27 actionNameAttribute: "${lu}", 28 startSessionReplayRecordingManually: true, 29 beforeSend: function (event, context) { 30 /* redact action names from click events, to avoid PII leakage */ 31 if (event.action && event.action.target && event.action.target.name) { 32 const pattern = /^\\[No Redact\\]/g; 33 const name = event.action.target.name; 34 event.action.target.name = name.match(pattern) ? name.replace(pattern, "") : "[REDACTED]"; 35 } 36 return true; 37 }, 38 }); 39 window.DD_RUM && window.DD_RUM.setGlobalContext({ 40 eventSource: "${a}", 41 }); 42 `},defer:!0,type:`text/javascript`})]}):null}var du=(0,Wr.createContext)(void 0);function fu({children:e,logger:t}){return(0,$.jsx)(du.Provider,{value:{logger:t},children:e})}function pu({bodyClassName:e,children:t}){let n=tu(`Browser`);return Ql(`Browser`),(0,$.jsxs)(`html`,{lang:`en`,children:[(0,$.jsxs)(`head`,{children:[(0,$.jsx)(`meta`,{charSet:`utf-8`}),(0,$.jsx)(`meta`,{content:`width=device-width, initial-scale=1`,name:`viewport`}),(0,$.jsx)(m,{}),(0,$.jsx)(u,{}),(0,$.jsx)(uu,{applicationId:k.STATIC_DATADOG_RUM_APPLICATION_ID,clientToken:k.STATIC_DATADOG_RUM_CLIENT_TOKEN,defaultPrivacyLevel:k.STATIC_DATADOG_RUM_DEFAULT_PRIVACY_LEVEL,enabled:k.STATIC_DATADOG_RUM_ENABLED,environment:k.STATIC_DATADOG_ENVIRONMENT,eventSource:k.STATIC_DATADOG_EVENT_SOURCE,serviceName:k.STATIC_DATADOG_SERVICE_NAME,sessionReplaySampleRate:k.STATIC_DATADOG_RUM_SESSION_REPLAY_SAMPLE_RATE,sessionSampleRate:k.STATIC_DATADOG_RUM_SESSION_SAMPLE_RATE,version:`9e68871f9b4622941d6b2ce28d7614561aaea55c`}),(0,$.jsx)(`script`,{async:!0,src:`https://www.googletagmanager.com/gtag/js?i
42d=G-${k.STATIC_GOOGLE_TAG_MANAGER_ID}`}),(0,$.jsx)(`script`,{dangerouslySetInnerHTML:{__html:` 43 window.dataLayer = window.dataLayer || []; 44 function gtag(){dataLayer.push(arguments);} 45 gtag('js', new Date()); 46 gtag('config', 'G-${k.STATIC_GOOGLE_TAG_MANAGER_ID}'); 47 `}})]}),(0,$.jsx)(`body`,{className:e,children:(0,$.jsxs)(fu,{logger:n,children:[t,(0,$.jsx)(v,{}),(0,$.jsx)(r,{})]})})]})}function mu(){let e=l();return(0,Wr.useEffect)(()=>{s(e)},[e]),s(e)?(0,$.jsx)(ce,{description:`Check the address for errors and try again`,heading:e.status.toString(),subheading:e.statusText}):e instanceof Error?(0,$.jsx)(ce,{description:e.message,subheading:`Error`}):(0,$.jsx)(ce,{subheading:`Unknown Error`})}function hu(){return(0,$.jsx)(`div`,{className:`absolute inset-0 space-y-4 bg-surface--background pt-32`,children:(0,$.jsx)(`div`,{className:`mx-auto max-w-96 text-center`,children:(0,$.jsxs)(C,{children:[(0,$.jsx)(w,{level:1,children:`Page not found`}),(0,$.jsx)(a,{children:`Please check the address and try again.`})]})})})}var gu=`/assets_remix/tailwind-CEyegk5z.css`,_u=(0,Wr.lazy)(()=>y(()=>import(`./ChatDrawer-CubdiPvy.js`).then(e=>e.n).then(e=>({default:e.ChatDrawer})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])));function vu(){return[{crossOrigin:`anonymous`,href:`https://fonts.googleapis.com`,rel:`preconnect`},{crossOrigin:`anonymous`,href:`https://fonts.gstatic.com`,rel:`preconnect`},{href:`https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&display=block`,rel:`stylesheet`},{href:S,rel:`stylesheet`},{href:f,rel:`stylesheet`},{href:`https://cdn.jobber.com/fonts/fonts.css`,rel:`stylesheet`},{href:gu,rel:`stylesheet`}]}var yu=c(function(){let e=(0,Wr.useMemo)(()=>Kl(),[]),{isPreview:t,siteData:n,siteName:r}=_(),i={primaryColor:n?.branding?.primaryColor,secondaryColor:n?.branding?.secondaryColor};return(0,$.jsx)(d,{reducedMotion:`user`,children:(0,$.jsx)(pu,{children:(0,$.jsx)(ie,{brandingOptions:i,children:(0,$.jsxs)(Jl,{services:e,siteName:r,children:[!t&&n&&(0,$.jsx)(xu,{siteData:n}),(0,$.jsx)(ee,{}),(0,$.jsx)(j,{children:!t&&n&&n.chatEnabled&&r&&(0,$.jsx)(_u,{businessName:n.businessName??``,websiteName:r})})]})})})})}),bu=b(function(){let e=l(),t=T(`root`)?.siteData,n={primaryColor:t?.branding?.primaryColor||null,secondaryColor:t?.branding?.secondaryColor||null};return s(e)&&e.status===404&&t?(0,$.jsx)(d,{reducedMotion:`user`,children:(0,$.jsx)(pu,{children:(0,$.jsxs)(ie,{brandingOptions:n,children:[(0,$.jsx)(xu,{siteData:t}),(0,$.jsx)(hu,{})]})})}):(0,$.jsx)(d,{reducedMotion:`user`,children:(0,$.jsx)(pu,{children:(0,$.jsx)(ie,{brandingOptions:n,children:(0,$.jsx)(se,{children:(0,$.jsx)(mu,{})})})})})}),xu=({siteData:e})=>{let t=e?.pages.map(e=>({group:e.group,id:e.id,path:e.path||`/`,title:e.title,order:e.order,templateType:e.templateType||``})).filter(e=>!te.includes(e.templateType)),{fullViewNavigation:n}=oe(t,{...e});return n?(0,$.jsx)(ne,{...e,fullViewNavigationMenu:(0,$.jsx)(ae,{pages:t})}):(0,$.jsx)(ne,{...e,hamburgerNavigationMenu:({onMenuClose:e})=>(0,$.jsx)(re,{onMenuClose:e,pages:t})})};export{bu as ErrorBoundary,yu as default,vu as links};
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.