"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[75538],{406663:function(e,t,n){n.d(t,{IH:function(){return nY},S1:function(){return nZ}});var r,i,o,s,a,u,c,l,d,f,h,p=n(212328),v=n(300491),g=n(478918),m=n(492336),y=n(594789),b=n(136314),_=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},[])},w=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=y.q.Unknown),{event:e,code:t,message:n}},S=n(76594),I=function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,I)};function E(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var C=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return e.prototype.setup=function(e){var t;return(0,m.__awaiter)(this,void 0,void 0,function(){var n,r=this;return(0,m.__generator)(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(b.f1,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map(function(e){return r.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=I()),new Promise(function(n){t.addToQueue({event:e,attempts:0,callback:function(e){return n(e)},timeout:0})})},e.prototype.getTryableList=function(e){var t=this;return e.filter(function(e){return e.attempts0&&t.schedule(e)})},e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,m.__awaiter)(this,void 0,void 0,function(){var t,n,r=this;return(0,m.__generator)(this,function(i){switch(i.label){case 0:if(this.config.offline)return this.config.loggerProvider.debug("Skipping flush while offline."),[2];return t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),[4,Promise.all(_(t,this.config.flushQueueSize).map(function(t){return r.send(t,e)}))];case 1:return i.sent(),this.scheduleTryable(n),[2]}})})},e.prototype.send=function(e,t){return void 0===t&&(t=!0),(0,m.__awaiter)(this,void 0,void 0,function(){var n,r,i,o;return(0,m.__generator)(this,function(s){switch(s.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,(0,m.__rest)(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new S.Dg,s.label=1;case 1:return s.trys.push([1,3,,4]),r=(0,S.RG)(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:if(null===(i=s.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t)return"body"in i?this.fulfillRequest(e,i.statusCode,"".concat(i.status,": ").concat(E(i))):this.fulfillRequest(e,i.statusCode,i.status),[2];return this.handleResponse(i,e),[3,4];case 3:var a;return o=(a=s.sent())instanceof Error?a.message:String(a),this.config.loggerProvider.error(o),this.handleResponse({status:y.q.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case y.q.Success:this.handleSuccessResponse(e,t);break;case y.q.Invalid:this.handleInvalidResponse(e,t);break;case y.q.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case y.q.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key")){this.fulfillRequest(t,e.statusCode,e.body.error);return}var r=new Set((0,m.__spreadArray)((0,m.__spreadArray)((0,m.__spreadArray)((0,m.__spreadArray)([],(0,m.__read)(Object.values(e.body.eventsWithInvalidFields)),!1),(0,m.__read)(Object.values(e.body.eventsWithMissingFields)),!1),(0,m.__read)(Object.values(e.body.eventsWithInvalidIdLengths)),!1),(0,m.__read)(e.body.silencedEvents),!1).flat()),i=t.filter(function(t,i){if(r.has(i)){n.fulfillRequest([t],e.statusCode,e.body.error);return}return!0});i.length>0&&this.config.loggerProvider.warn(E(e));var o=this.getTryableList(i);this.scheduleTryable(o)},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1===t.length){this.fulfillRequest(t,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(E(e)),this.config.flushQueueSize/=2;var n=this.getTryableList(t);this.scheduleTryable(n)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(r),a=new Set(i),u=new Set(o),c=t.filter(function(t,r){if(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)){n.fulfillRequest([t],e.statusCode,e.body.error);return}return u.has(r)&&(t.timeout=n.throttleTimeout),!0});c.length>0&&this.config.loggerProvider.warn(E(e));var l=this.getTryableList(c);this.scheduleTryable(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),r=this.getTryableList(n);this.scheduleTryable(r)},e.prototype.fulfillRequest=function(e,t,n){this.removeEvents(e),e.forEach(function(e){return e.callback(w(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}();(r=u||(u={})).SET="$set",r.SET_ONCE="$setOnce",r.ADD="$add",r.APPEND="$append",r.PREPEND="$prepend",r.REMOVE="$remove",r.PREINSERT="$preInsert",r.POSTINSERT="$postInsert",r.UNSET="$unset",r.CLEAR_ALL="$clearAll",(i=c||(c={})).REVENUE_PRODUCT_ID="$productId",i.REVENUE_QUANTITY="$quantity",i.REVENUE_PRICE="$price",i.REVENUE_TYPE="$revenueType",i.REVENUE="$revenue",(o=l||(l={})).IDENTIFY="$identify",o.GROUP_IDENTIFY="$groupidentify",o.REVENUE="revenue_amount";var k=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!T(t,n))return!1}return!0},T=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=(0,m.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;if(Array.isArray(a))return!1;if("object"==typeof a)i=i&&k(a);else if(!["number","string"].includes(typeof a))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else if(null==t)return!1;else if("object"==typeof t)return k(t);else if(!["number","string","boolean"].includes(typeof t))return!1;return!0},M=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return(0,m.__assign)({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(u.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(u.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(u.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(u.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(u.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(u.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(u.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(u.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(u.UNSET,e,b.q$),this},e.prototype.clearAll=function(){return this._properties={},this._properties[u.CLEAR_ALL]=b.q$,this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return!(void 0!==this._properties[u.CLEAR_ALL]||this._propertySet.has(t))&&(e===u.ADD?"number"==typeof n:e===u.UNSET||e===u.REMOVE||T(t,n))},e}(),O=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.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return k(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?(0,m.__assign)({},this.properties):{};return e[c.REVENUE_PRODUCT_ID]=this.productId,e[c.REVENUE_QUANTITY]=this.quantity,e[c.REVENUE_PRICE]=this.price,e[c.REVENUE_TYPE]=this.revenueType,e[c.REVENUE]=this.revenue,e},e}(),x=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,r;return(0,m.__awaiter)(this,void 0,void 0,function(){return(0,m.__generator)(this,function(i){switch(i.label){case 0:if(this.plugins.some(function(t){return t.name===e.name}))return t.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2];return void 0===e.name&&(e.name=I(),t.loggerProvider.warn("Plugin name is undefined. \n Generating a random UUID for plugin name: ".concat(e.name,". \n Set a name for the plugin to prevent it from being added multiple times."))),e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)];case 1:return i.sent(),this.plugins.push(e),[2]}})})},e.prototype.deregister=function(e){var t;return(0,m.__awaiter)(this,void 0,void 0,function(){var n,r;return(0,m.__generator)(this,function(i){switch(i.label){case 0:return n=this.plugins.findIndex(function(t){return t.name===e}),r=this.plugins[n],this.plugins.splice(n,1),[4,null===(t=r.teardown)||void 0===t?void 0:t.call(r)];case 1:return i.sent(),[2]}})})},e.prototype.reset=function(e){this.applying=!1,this.plugins.map(function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)}),this.plugins=[],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(0,m.__awaiter)(this,void 0,void 0,function(){var t,n,r,i,o,s,a,u,c,l,d,f,h,p;return(0,m.__generator)(this,function(v){switch(v.label){case 0:if(!e)return[2];t=(0,m.__read)(e,1)[0],n=(0,m.__read)(e,2)[1],r=this.plugins.filter(function(e){return"before"===e.type}),v.label=1;case 1:v.trys.push([1,6,7,8]),o=(i=(0,m.__values)(r)).next(),v.label=2;case 2:if(o.done)return[3,5];if(!(s=o.value).execute)return[3,4];return[4,s.execute((0,m.__assign)({},t))];case 3:if(null===(a=v.sent()))return n({event:t,code:0,message:""}),[2];t=a,v.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return d={error:v.sent()},[3,8];case 7:try{o&&!o.done&&(f=i.return)&&f.call(i)}finally{if(d)throw d.error}return[7];case 8:u=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),v.label=9;case 9:v.trys.push([9,14,15,16]),l=(c=(0,m.__values)(u)).next(),v.label=10;case 10:if(l.done)return[3,13];if(!(s=l.value).execute)return[3,12];return[4,s.execute((0,m.__assign)({},t))];case 11:if(null===(a=v.sent()))return n({event:t,code:0,message:""}),[2];t=a,v.label=12;case 12:return l=c.next(),[3,10];case 13:return[3,16];case 14:return h={error:v.sent()},[3,16];case 15:try{l&&!l.done&&(p=c.return)&&p.call(c)}finally{if(h)throw h.error}return[7];case 16:return Promise.all(this.plugins.filter(function(e){return"destination"===e.type}).map(function(e){var n=(0,m.__assign)({},t);return e.execute(n).catch(function(e){return w(n,0,String(e))})})).then(function(e){var r=(0,m.__read)(e,1)[0]||w(t,100,"Event not tracked, no destination plugins on the instance");n(r)}),[2]}})})},e.prototype.flush=function(){return(0,m.__awaiter)(this,void 0,void 0,function(){var e,t=this;return(0,m.__generator)(this,function(n){switch(n.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return t.apply(e)}))];case 1:return n.sent(),[4,Promise.all(this.plugins.filter(function(e){return"destination"===e.type}).map(function(e){return e.flush&&e.flush()}))];case 2:return n.sent(),[2]}})})},e}(),R=function(e,t){return(0,m.__assign)((0,m.__assign)({},t),{event_type:l.IDENTIFY,user_properties:e.getUserProperties()})},P=function(e,t,n,r){var i;return(0,m.__assign)((0,m.__assign)({},r),{event_type:l.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:((i={})[e]=t,i)})},N=function(e,t,n){var r,i=new M;return i.set(e,t),(0,m.__assign)((0,m.__assign)({},n),{event_type:l.IDENTIFY,user_properties:i.getUserProperties(),groups:((r={})[e]=t,r)})},D=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new x(this),this.name=e}return e.prototype._init=function(e){return(0,m.__awaiter)(this,void 0,void 0,function(){return(0,m.__generator)(this,function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}})})},e.prototype.runQueuedFunctions=function(e){return(0,m.__awaiter)(this,void 0,void 0,function(){var t,n,r,i,o,s;return(0,m.__generator)(this,function(a){switch(a.label){case 0:t=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,8,9,10]),r=(n=(0,m.__values)(t)).next(),a.label=2;case 2:if(r.done)return[3,7];if(!((i=(0,r.value)())&&"promise"in i))return[3,4];return[4,i.promise];case 3:return a.sent(),[3,6];case 4:return[4,i];case 5:a.sent(),a.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return o={error:a.sent()},[3,10];case 9:try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}return[7];case 10:if(!this[e].length)return[3,12];return[4,this.runQueuedFunctions(e)];case 11:a.sent(),a.label=12;case 12:return[2]}})})},e.prototype.track=function(e,t,n){var r=(0,m.__assign)((0,m.__assign)((0,m.__assign)({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t});return(0,g.S)(this.dispatch(r))},e.prototype.identify=function(e,t){var n=R(e,t);return(0,g.S)(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=P(e,t,n,r);return(0,g.S)(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=N(e,t,n);return(0,g.S)(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=(0,m.__assign)((0,m.__assign)({},t),{event_type:l.REVENUE,event_properties:e.getEventProperties()});return(0,g.S)(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),(0,g.S)())},e.prototype._addPlugin=function(e){return(0,g.S)(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)),(0,g.S)())},e.prototype._removePlugin=function(e){return(0,g.S)(this.timeline.deregister(e))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(w(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return(0,m.__awaiter)(this,void 0,void 0,function(){var t=this;return(0,m.__generator)(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.process=function(e){return(0,m.__awaiter)(this,void 0,void 0,function(){var t,n;return(0,m.__generator)(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),this.config.optOut)return[2,w(e,0,"Event skipped due to optOut config")];return[4,this.timeline.push(e)];case 1:return 200===(t=r.sent()).code?this.config.loggerProvider.log(t.message):100===t.code?this.config.loggerProvider.warn(t.message):this.config.loggerProvider.error(t.message),[2,t];case 2:return n=String(r.sent()),this.config.loggerProvider.error(n),[2,t=w(e,0,n)];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},e.prototype.flush=function(){return(0,g.S)(this.timeline.flush())},e}(),A=function(e,t){return"boolean"==typeof e?e:(null==e?void 0:e[t])!==!1},L=function(e){return A(e,"attribution")},j=function(e){return A(e,"pageViews")},q=function(e){return A(e,"sessions")},F=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},U=function(e){if(F(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},z=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return j(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}},B="dclid",W="fbclid",G="gbraid",V="gclid",K="ko_click_id",J="li_fat_id",H="msclkid",$="rtd_cid",Y="ttclid",Z="twclid",Q="wbraid",X={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,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},ee=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},et=function(e,t,n,r){void 0===r&&(r=!0),e.referrer;var i=e.referring_domain,o=(0,m.__rest)(e,["referrer","referring_domain"]),s=t||{},a=(s.referrer,s.referring_domain),u=(0,m.__rest)(s,["referrer","referring_domain"]);if(en(n.excludeReferrers,e.referring_domain)||!r&&Object.values(e).every(function(e){return!e})&&t)return!1;var c=JSON.stringify(o)!==JSON.stringify(u),l=ee(i||"")!==ee(a||"");return!t||c||l},en=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=""),e.some(function(e){return e instanceof RegExp?e.test(t):e===t})},er=function(e){var t=e;return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},ei=n(701522),eo=function(){var e,t=(0,ei.l)();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var n=t.split("=",2),r=es(n[0]),i=es(n[1]);return i&&(e[r]=i),e},{}):{}},es=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},ea=function(){function e(){}return e.prototype.parse=function(){return(0,m.__awaiter)(this,void 0,void 0,function(){return(0,m.__generator)(this,function(e){return[2,(0,m.__assign)((0,m.__assign)((0,m.__assign)((0,m.__assign)({},X),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=eo();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=eo();return(e={})[B]=t[B],e[W]=t[W],e[G]=t[G],e[V]=t[V],e[K]=t[K],e[J]=t[J],e[H]=t[H],e[$]=t[$],e[Y]=t[Y],e[Z]=t[Z],e[Q]=t[Q],e},e}(),eu=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},ec=function(){function e(e,t){var n,r,i,o;this.shouldTrackNewCampaign=!1,this.options=(0,m.__assign)({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:er(null===(n=t.cookieOptions)||void 0===n?void 0:n.domain)},e),this.storage=t.cookieStorage,this.storageKey=(r=t.apiKey,i="MKTG",void 0===o&&(o=10),[b.xp,i,r.substring(0,o)].filter(Boolean).join("_")),this.currentCampaign=X,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return(0,m.__awaiter)(this,void 0,void 0,function(){var e,t;return(0,m.__generator)(this,function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:if(t=m.__read.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||eu(this.sessionTimeout,this.lastEventTime),!et(this.currentCampaign,this.previousCampaign,this.options,e))return[3,3];return this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return(0,m.__awaiter)(this,void 0,void 0,function(){return(0,m.__generator)(this,function(e){switch(e.label){case 0:return[4,Promise.all([new ea().parse(),this.storage.get(this.storageKey)])];case 1:return[2,e.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r=(t=this.currentCampaign,n=this.options,R(Object.entries((0,m.__assign)((0,m.__assign)({},X),t)).reduce(function(e,t){var r,i=(0,m.__read)(t,2),o=i[0],s=i[1];return(e.setOnce("initial_".concat(o),null!==(r=null!=s?s:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),s)?e.set(o,s):e.unset(o)},new M)));return e&&(r.event_id=e),r},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),el=n(635657),ed=function(){function e(){this.name="identity",this.type="before",this.identityStore=(0,el.bM)().identityStore}return e.prototype.execute=function(e){return(0,m.__awaiter)(this,void 0,void 0,function(){var t;return(0,m.__generator)(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return(0,m.__awaiter)(this,void 0,void 0,function(){return(0,m.__generator)(this,function(t){return e.instanceName&&(this.identityStore=(0,el.bM)(e.instanceName).identityStore),[2]})})},e}(),ef=function(e,t){for(var n=0;n1e3))return[3,2];return i=n.length-1e3,[4,e.prototype.set.call(this,t,n.slice(0,1e3))];case 1:return o.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(1e3,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(eE),ek=function(e){function t(){var t;return e.call(this,null===(t=(0,ei.l)())||void 0===t?void 0:t.sessionStorage)||this}return(0,v.ZT)(t,e),t}(eE),eT=n(327704),eM=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return(0,v.ZT)(t,e),t.prototype.send=function(e,t){return(0,v.mG)(this,void 0,void 0,function(){var n=this;return(0,v.Jh)(this,function(r){return[2,new Promise(function(r,i){"undefined"==typeof XMLHttpRequest&&i(Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done){var e=o.responseText;try{r(n.buildResponse(JSON.parse(e)))}catch(e){r(n.buildResponse({code:o.status}))}}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))})]})})},t}(eT.d),eO=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,v.ZT)(t,e),t.prototype.send=function(e,t){return(0,v.mG)(this,void 0,void 0,function(){var n=this;return(0,v.Jh)(this,function(r){return[2,new Promise(function(r,i){var o=(0,ei.l)();if(!(null==o?void 0:o.navigator.sendBeacon))throw Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);if(o.navigator.sendBeacon(e,JSON.stringify(t)))return r(n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}));return r(n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(eT.d),ex=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},eR=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},eP="[Amplitude]",eN="".concat(eP," Form Started"),eD="".concat(eP," Form Submitted"),eA="".concat(eP," File Downloaded"),eL="session_start",ej="session_end",eq="".concat(eP," File Extension"),eF="".concat(eP," File Name"),eU="".concat(eP," Link ID"),ez="".concat(eP," Link Text"),eB="".concat(eP," Link URL"),eW="".concat(eP," Form ID"),eG="".concat(eP," Form Name"),eV="".concat(eP," Form Destination"),eK="cookie",eJ=function(e){function t(t,n,r,i,o,s,a,u,c,l,d,f,h,p,v,g,m,y,b,_,w,S,I,E,C,k,T,M,O,x,R,P,N,D){void 0===r&&(r=new em),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=eK),void 0===g&&(g=new ey.Y),void 0===m&&(m=eg.i.Warn),void 0===b&&(b=!1),void 0===_&&(_=!1),void 0===I&&(I=""),void 0===E&&(E="US"),void 0===k&&(k=18e5),void 0===T&&(T=new eC({loggerProvider:g})),void 0===M&&(M={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===x&&(x=!1),void 0===R&&(R=!1);var A=e.call(this,{apiKey:t,storageProvider:T,transportProvider:e$(O)})||this;return A.apiKey=t,A.appVersion=n,A.cookieOptions=i,A.defaultTracking=o,A.autocapture=s,A.flushIntervalMillis=u,A.flushMaxRetries=c,A.flushQueueSize=l,A.identityStorage=d,A.ingestionMetadata=f,A.instanceName=h,A.loggerProvider=g,A.logLevel=m,A.minIdLength=y,A.offline=b,A.partnerId=w,A.plan=S,A.serverUrl=I,A.serverZone=E,A.sessionTimeout=k,A.storageProvider=T,A.trackingOptions=M,A.transport=O,A.useBatch=x,A.fetchRemoteConfig=R,A._optOut=!1,A._cookieStorage=r,A.deviceId=a,A.lastEventId=p,A.lastEventTime=v,A.optOut=_,A.sessionId=C,A.pageCounter=N,A.userId=P,A.debugLogsEnabled=D,A.loggerProvider.enable(D?eg.i.Debug:A.logLevel),A}return(0,v.ZT)(t,e),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())},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,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,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled};this.cookieStorage.set(eb(this.apiKey),e)},t}(S.De),eH=function(e,t){switch(void 0===e&&(e=eK),void 0===t&&(t={}),e){case"localStorage":return new eC;case"sessionStorage":return new ek;case"none":return new em;default:return new e_((0,v.pi)((0,v.pi)({},t),{expirationDays:t.expiration}))}},e$=function(e){return"xhr"===e?new eM:"beacon"===e?new eO:new eI.V},eY=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},eZ=function(e){void 0===e&&(e={});var t,n,r,i=(0,ei.l)(),o=void 0,s=e.trackOn,a=e.trackHistoryChanges,u=e.eventType,c=void 0===u?"[Amplitude] Page Viewed":u,l=function(){return(0,m.__awaiter)(void 0,void 0,void 0,function(){var e,t;return(0,m.__generator)(this,function(n){switch(n.label){case 0:return t={event_type:c},e=[{}],[4,eQ()];case 1:return[2,(t.event_properties=m.__assign.apply(void 0,[m.__assign.apply(void 0,e.concat([n.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":"undefined"!=typeof location&&location.href||"","[Amplitude] Page Path":"undefined"!=typeof location&&location.pathname||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":"undefined"!=typeof location&&location.href.split("?")[0]||""}]),t)]}})})},d=function(){return void 0===s||"function"==typeof s&&s()},f="undefined"!=typeof location?location.href:null,h=function(){return(0,m.__awaiter)(void 0,void 0,void 0,function(){var e,n,r,i;return(0,m.__generator)(this,function(s){switch(s.label){case 0:if(n=e0(a,e=location.href,f||"")&&d(),f=e,!n)return[3,4];if(null==o||o.log("Tracking page view event"),null!=t)return[3,1];return[3,3];case 1:return i=(r=t).track,[4,l()];case 2:i.apply(r,[s.sent()]),s.label=3;case 3:s.label=4;case 4:return[2]}})})},p=function(){h()};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return(0,m.__awaiter)(void 0,void 0,void 0,function(){var a,u;return(0,m.__generator)(this,function(c){switch(c.label){case 0:if(t=s,r=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),i&&(i.addEventListener("popstate",p),n=i.history.pushState,i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,n){var r=(0,m.__read)(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),h()}})),!d())return[3,2];return o.log("Tracking page view event"),u=(a=t).track,[4,l()];case 1:u.apply(a,[c.sent()]),c.label=2;case 2:return[2]}})})},execute:function(e){return(0,m.__awaiter)(void 0,void 0,void 0,function(){var t;return(0,m.__generator)(this,function(n){switch(n.label){case 0:if(!("attribution"===s&&eX(e)))return[3,2];return null==o||o.log("Enriching campaign event to page view event with campaign parameters"),[4,l()];case 1:t=n.sent(),e.event_type=t.event_type,e.event_properties=(0,m.__assign)((0,m.__assign)({},e.event_properties),t.event_properties),n.label=2;case 2:return r&&e.event_type===c&&(r.pageCounter=r.pageCounter?r.pageCounter+1:1,e.event_properties=(0,m.__assign)((0,m.__assign)({},e.event_properties),{"[Amplitude] Page Counter":r.pageCounter})),[2,e]}})})},teardown:function(){return(0,m.__awaiter)(void 0,void 0,void 0,function(){return(0,m.__generator)(this,function(e){return i&&(i.removeEventListener("popstate",p),n&&(i.history.pushState=n)),[2]})})}}},eQ=function(){return(0,m.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,m.__generator)(this,function(t){switch(t.label){case 0:return e=eY,[4,new ea().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},eX=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[u.SET]||{},r=t[u.UNSET]||{},i=(0,m.__spreadArray)((0,m.__spreadArray)([],(0,m.__read)(Object.keys(n)),!1),(0,m.__read)(Object.keys(r)),!1);return Object.keys(X).every(function(e){return i.includes(e)})}return!1},e0=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},e1=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;null==t||t.removeEventListener(n,r)}),t=[]};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,r){return(0,v.mG)(void 0,void 0,void 0,function(){var i;return(0,v.Jh)(this,function(o){return null===(i=(0,ei.l)())||void 0===i||i.addEventListener("load",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("undefined"!=typeof document){var i=function(e){var t=!1;n(e,"change",function(){var n;t||r.track(eN,((n={})[eW]=e2(e.id),n[eG]=e2(e.name),n[eV]=e.action,n)),t=!0}),n(e,"submit",function(){var n,i;t||r.track(eN,((n={})[eW]=e2(e.id),n[eG]=e2(e.name),n[eV]=e.action,n)),r.track(eD,((i={})[eW]=e2(e.id),i[eG]=e2(e.name),i[eV]=e.action,i)),t=!1})};Array.from(document.getElementsByTagName("form")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"FORM"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(i)})})})).observe(document.body,{subtree:!0,childList:!0})}}),[2]})})},execute:function(e){return(0,v.mG)(void 0,void 0,void 0,function(){return(0,v.Jh)(this,function(t){return[2,e]})})},teardown:function(){return(0,v.mG)(void 0,void 0,void 0,function(){return(0,v.Jh)(this,function(t){return null==e||e.disconnect(),r(),[2]})})}}},e2=function(e){if("string"==typeof e)return e},e3=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;null==t||t.removeEventListener(n,r)}),t=[]};return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(t,r){return(0,v.mG)(void 0,void 0,void 0,function(){var i;return(0,v.Jh)(this,function(o){return null===(i=(0,ei.l)())||void 0===i||i.addEventListener("load",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("undefined"!=typeof document){var i=function(e){try{t=new URL(e.href,window.location.href)}catch(e){return}var t,i=o.exec(t.href),s=null==i?void 0:i[1];s&&n(e,"click",function(){var n;s&&r.track(eA,((n={})[eq]=s,n[eF]=t.pathname,n[eU]=e.id,n[ez]=e.text,n[eB]=e.href,n))})},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/;Array.from(document.getElementsByTagName("a")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(i)})})})).observe(document.body,{subtree:!0,childList:!0})}}),[2]})})},execute:function(e){return(0,v.mG)(void 0,void 0,void 0,function(){return(0,v.Jh)(this,function(t){return[2,e]})})},teardown:function(){return(0,v.mG)(void 0,void 0,void 0,function(){return(0,v.Jh)(this,function(t){return null==e||e.disconnect(),r(),[2]})})}}},e4=!1,e5=function(e){e4||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),e4=!0)},e6=function(){var e=(0,ei.l)(),t=[],n=function(n,r){e&&(e.addEventListener(n,r),t.push({type:n,handler:r}))},r=function(){t.forEach(function(t){var n=t.type,r=t.handler;e&&e.removeEventListener(n,r)}),t=[]};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return(0,v.mG)(void 0,void 0,void 0,function(){return(0,v.Jh)(this,function(r){return e.offline=!navigator.onLine,n("online",function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis)}),n("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2]})})},teardown:function(){return(0,v.mG)(void 0,void 0,void 0,function(){return(0,v.Jh)(this,function(e){return r(),[2]})})}}},e8=n(441063),e7=n(997172),e9=function(e,t){return(0,m.__awaiter)(void 0,void 0,void 0,function(){return(0,m.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,e7.X3)(e,1,{upgrade:function(e){t.forEach(function(t){e.objectStoreNames.contains(t)||e.createObjectStore(t)})}})];case 1:return[2,n.sent()]}})})},te=function(e){var t=e.loggerProvider,n=e.apiKey,r=e.configKeys;return(0,m.__awaiter)(void 0,void 0,void 0,function(){var e,i,o,s,a;return(0,m.__generator)(this,function(u){switch(u.label){case 0:return[4,e9(e="".concat(n.substring(0,10),"_amp_config"),r)];case 1:var c;return i=u.sent(),[4,(c="".concat(n.substring(0,10),"_amp_config_meta"),(0,m.__awaiter)(void 0,void 0,void 0,function(){return(0,m.__generator)(this,function(e){switch(e.label){case 0:return[4,(0,e7.X3)(c,1,{upgrade:function(e){e.objectStoreNames.contains("lastFetchedSessionId")||e.createObjectStore("lastFetchedSessionId")}})];case 1:return[2,e.sent()]}})}))];case 2:o=u.sent(),u.label=3;case 3:return u.trys.push([3,8,,9]),[4,o.get("lastFetchedSessionId","sessionId")];case 4:if(!((s=u.sent())&&Date.now()-s>=2592e5))return[3,7];return i.close(),[4,(0,e7.Lj)(e)];case 5:return u.sent(),[4,e9(e,r)];case 6:i=u.sent(),u.label=7;case 7:return[3,9];case 8:return a=u.sent(),t.warn("Failed to reset store: ".concat(a)),[3,9];case 9:return[2,{storeRemoteConfig:function(e,n){return(0,m.__awaiter)(void 0,void 0,void 0,function(){var r,s,a,u,c,l;return(0,m.__generator)(this,function(d){switch(d.label){case 0:if(d.trys.push([0,7,,8]),!n)return[3,2];return[4,o.put("lastFetchedSessionId",n,"sessionId")];case 1:d.sent(),d.label=2;case 2:for(u in r=function(t){var n,r;return(0,m.__generator)(this,function(o){switch(o.label){case 0:return n=e.configs[t],r=i.transaction(t,"readwrite"),[4,Promise.all((0,m.__spreadArray)((0,m.__spreadArray)([],(0,m.__read)(Object.keys(n).map(function(e){return r.store.put((0,m.__assign)({},n[e]),e)})),!1),[r.done],!1))];case 1:return o.sent(),[2]}})},s=e.configs,a=[],s)a.push(u);c=0,d.label=3;case 3:if(!(c=this.localConfig.flushMaxRetries)return[2,this.completeRequest({err:"Remote config fetch rejected due to exceeded retry count"})];if(e.aborted)return[2,this.completeRequest({err:tt})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0),a.label=1;case 1:return a.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey,config_keys:this.configKeys.join(",")}),r={headers:{"Content-Type":"application/json",Accept:"*/*"},method:"GET"},i="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(i,(0,m.__assign)((0,m.__assign)({},r),{signal:e}))];case 2:if(null===(o=a.sent()))return[2,this.completeRequest({err:"Unexpected error occurred"})];switch(new eT.d().buildStatus(o.status)){case y.q.Success:return this.attempts=0,[2,this.parseAndStoreConfig(o,t)];case y.q.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}return[3,4];case 3:if(s=a.sent(),e.aborted)return[2,this.completeRequest({err:tt})];return[2,this.completeRequest({err:s.message})];case 4:return[2]}})})},this.retryFetch=function(e,t){return(0,m.__awaiter)(r,void 0,void 0,function(){var n=this;return(0,m.__generator)(this,function(r){switch(r.label){case 0:return[4,new Promise(function(e){return setTimeout(e,n.attempts*n.retryTimeout)})];case 1:return r.sent(),[2,this.fetchRemoteConfig(e,t)]}})})},this.parseAndStoreConfig=function(e,t){return(0,m.__awaiter)(r,void 0,void 0,function(){var n;return(0,m.__generator)(this,function(r){switch(r.label){case 0:return[4,e.json()];case 1:if(n=r.sent(),!this.remoteConfigIDBStore)return[3,3];return[4,this.remoteConfigIDBStore.storeRemoteConfig(n,t)];case 2:r.sent(),r.label=3;case 3:return this.completeRequest({success:"Remote config successfully fetched"}),[2,n]}})})},this.localConfig=t,this.configKeys=n}return e.prototype.initialize=function(){return(0,m.__awaiter)(this,void 0,void 0,function(){var e;return(0,m.__generator)(this,function(t){switch(t.label){case 0:return e=this,[4,te({apiKey:this.localConfig.apiKey,loggerProvider:this.localConfig.loggerProvider,configKeys:this.configKeys})];case 1:return e.remoteConfigIDBStore=t.sent(),[2]}})})},e.prototype.getServerUrl=function(){return this.localConfig.serverZone===e8.J.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===e8.J.EU?"https://sr-client-cfg.eu.amplitude.com/config":"https://sr-client-cfg.amplitude.com/config"},e.prototype.completeRequest=function(e){var t=e.err,n=e.success;if(t)throw Error(t);n&&this.localConfig.loggerProvider.log(n)},e}(),tr=function(e){var t=e.localConfig,n=e.configKeys;return(0,m.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,m.__generator)(this,function(r){switch(r.label){case 0:return[4,(e=new tn({localConfig:t,configKeys:n})).initialize()];case 1:return r.sent(),[2,e]}})})},ti=function(){function e(e){this.config=e,this.config.loggerProvider.debug("Local configuration before merging with remote config",JSON.stringify(this.config,null,2))}return e.prototype.initialize=function(){return(0,v.mG)(this,void 0,void 0,function(){var e;return(0,v.Jh)(this,function(t){switch(t.label){case 0:return e=this,[4,tr({localConfig:this.config,configKeys:["analyticsSDK"]})];case 1:return e.remoteConfigFetch=t.sent(),[2]}})})},e.prototype.generateJoinedConfig=function(){var e,t,n,r,i;return(0,v.mG)(this,void 0,void 0,function(){var o,s,a;return(0,v.Jh)(this,function(u){switch(u.label){case 0:if(u.trys.push([0,3,,4]),!(s=this.remoteConfigFetch))return[3,2];return[4,this.remoteConfigFetch.getRemoteConfig("analyticsSDK","browserSDK",this.config.sessionId)];case 1:s=u.sent(),u.label=2;case 2:return o=s,this.config.loggerProvider.debug("Remote configuration:",JSON.stringify(o,null,2)),o&&"autocapture"in o&&("boolean"==typeof o.autocapture&&(this.config.autocapture=o.autocapture),"object"==typeof o.autocapture&&(void 0===this.config.autocapture&&(this.config.autocapture=o.autocapture),"boolean"==typeof this.config.autocapture&&(this.config.autocapture=(0,v.pi)({attribution:this.config.autocapture,fileDownloads:this.config.autocapture,formInteractions:this.config.autocapture,pageViews:this.config.autocapture,sessions:this.config.autocapture,elementInteractions:this.config.autocapture},o.autocapture)),"object"==typeof this.config.autocapture&&(this.config.autocapture=(0,v.pi)((0,v.pi)({},this.config.autocapture),o.autocapture))),this.config.defaultTracking=this.config.autocapture),this.config.loggerProvider.debug("Joined configuration: ",JSON.stringify(this.config,null,2)),null!==(e=(i=this.config).requestMetadata)&&void 0!==e||(i.requestMetadata=new S.Dg),(null===(t=this.remoteConfigFetch)||void 0===t?void 0:t.metrics.fetchTimeIDB)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_IDB",this.remoteConfigFetch.metrics.fetchTimeIDB),(null===(n=this.remoteConfigFetch)||void 0===n?void 0:n.metrics.fetchTimeAPISuccess)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_success",this.remoteConfigFetch.metrics.fetchTimeAPISuccess),(null===(r=this.remoteConfigFetch)||void 0===r?void 0:r.metrics.fetchTimeAPIFail)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_fail",this.remoteConfigFetch.metrics.fetchTimeAPIFail),[3,4];case 3:return a=u.sent(),this.config.loggerProvider.error("Failed to fetch remote configuration because of error: ",a),[3,4];case 4:return[2,this.config]}})})},e}(),to="[Amplitude] Element Clicked",ts="[Amplitude] Element Tag",ta="[Amplitude] Element Text",tu="[Amplitude] Element Selector",tc="[Amplitude] Page URL",tl="https://app.amplitude.com",td={US:tl,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},tf="amp-visual-tagging-selector-highlight",th=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function tp(e){return"function"==typeof e}function tv(e){return tp(null==e?void 0:e.then)}function tg(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var tm=tg(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function ty(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var tb=function(){var e;function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e,t,n,r,i,o=this._parentage;if(o){if(this._parentage=null,Array.isArray(o))try{for(var s=(0,m.__values)(o),a=s.next();!a.done;a=s.next())a.value.remove(this)}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this)}var u=this.initialTeardown;if(tp(u))try{u()}catch(e){i=e instanceof tm?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=(0,m.__values)(c),d=l.next();!d.done;d=l.next()){var f=d.value;try{tw(f)}catch(e){i=null!=i?i:[],e instanceof tm?i=(0,m.__spreadArray)((0,m.__spreadArray)([],(0,m.__read)(i)),(0,m.__read)(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(i)throw new tm(i)}},t.prototype.add=function(e){var n;if(e&&e!==this){if(this.closed)tw(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}}},t.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},t.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},t.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&ty(t,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&ty(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}();function t_(e){return e instanceof tb||e&&"closed"in e&&tp(e.remove)&&tp(e.add)&&tp(e.unsubscribe)}function tw(e){tp(e)?e():e.unsubscribe()}tb.EMPTY;var tS={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},tI={setTimeout:function(e,t){for(var n=[],r=2;r=d.seedMinLength&&(r=t7(i,n)))return"break";o=o.parentElement,s++}(););return(r||(r=t7(i,n)),!r&&n)?n():r}function t7(e,t){var n,r,i=na(function e(t,n){var r,i,o,s,a;return void 0===n&&(n=[]),(0,m.__generator)(this,function(u){switch(u.label){case 0:if(!(t.length>0))return[3,9];u.label=1;case 1:u.trys.push([1,6,7,8]),i=(r=(0,m.__values)(t[0])).next(),u.label=2;case 2:if(i.done)return[3,5];return o=i.value,[5,(0,m.__values)(e(t.slice(1,t.length),n.concat(o)))];case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return s={error:u.sent()},[3,8];case 7:try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}return[7];case 8:return[3,11];case 9:return[4,n];case 10:u.sent(),u.label=11;case 11:return[2]}})}(e));if(i.length>d.threshold)return t?t():null;try{for(var o=(0,m.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(nt(a))return a}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null}function t9(e){for(var t=e[0],n=t.name,r=1;r ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function ne(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function nt(e){var t=t9(e);switch(f.querySelectorAll(t).length){case 0:throw Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function nn(){return{name:"*",penalty:3}}function nr(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function ni(e){return"html"!==e.name&&!e.name.startsWith("#")}function no(){for(var e=[],t=0;t0?n:null}function ns(e){return null!=e}function na(e){return(0,m.__spreadArray)([],(0,m.__read)(e),!1).sort(function(e,t){return ne(e)-ne(t)})}var nu=["input","select","textarea"],nc=function(e,t){return function(n,r){var i,o,s,a=e.pageUrlAllowlist,u=e.shouldTrackEventResolver,c=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!c)return!1;if(u)return u(n,r);if(!np(window.location.href,a))return!1;var l=(null==r?void 0:r.type)||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}if(t&&!t.some(function(e){var t;return!!(null===(t=null==r?void 0:r.matches)||void 0===t?void 0:t.call(r,e))}))return!1;switch(c){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:var d=null===(s=null==window?void 0:window.getComputedStyle)||void 0===s?void 0:s.call(window,r);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===n)return!0;return"click"===n}}},nl=function(e){return!(null==e||"string"==typeof e&&(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,""))||/(^\d{3}-?\d{2}-?\d{4}$)/.test(e)))},nd=function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase())==="true";return!nu.includes(i)&&!o},nf=function(e){var t="";return nd(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach(function(e){var n="";e&&3===e.nodeType?e.textContent&&(n=e.textContent):n=nf(e),t+=n.split(/(\s+)/).filter(nl).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}),t},nh=function(e,t){var n,r,i="";try{return i=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var n,r={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};f=(n=(d=(0,m.__assign)((0,m.__assign)({},r),t)).root).nodeType===Node.DOCUMENT_NODE?n:n===r.root?n.ownerDocument:n;var i=t8(e,"all",function(){return t8(e,"two",function(){return t8(e,"one",function(){return t8(e,"none")})})});if(i){var o=na(function e(t,n,r){var i,o,s;return void 0===r&&(r={counter:0,visited:new Map}),(0,m.__generator)(this,function(a){switch(a.label){case 0:if(!(t.length>2&&t.length>d.optimizedMinLength))return[3,5];i=1,a.label=1;case 1:var u;if(!(id.maxNumberOfTries||(r.counter+=1,(o=(0,m.__spreadArray)([],(0,m.__read)(t),!1)).splice(i,1),s=t9(o),r.visited.has(s)))return[2];if(!(nt(o)&&(u=o,f.querySelector(t9(u))===n)))return[3,4];return[4,o];case 2:return a.sent(),r.visited.set(s,!0),[5,(0,m.__values)(e(o,n,r))];case 3:a.sent(),a.label=4;case 4:return i++,[3,1];case 5:return[2]}})}(i,e));return o.length>0&&(i=o[0]),t9(i)}throw Error("Selector was not found.")}(e,{className:function(e){return e!==tf}})}catch(e){t&&t.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(e.toString()))}var o=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(o&&(i=o),e.id)i="#".concat(e.id);else if(e.className){var s=e.className.split(" ").filter(function(e){return e!==tf}).join(".");s&&(i="".concat(i,".").concat(s))}return i},np=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},nv=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return null==r||"object"==typeof r&&0===Object.keys(r).length||"string"==typeof r&&0===r.trim().length||(t[n]=r),t},{})},ng=function(e){var t=e.parentElement;if(!t)return"";var n=t.querySelector(":scope>span,h1,h2,h3,h4,h5,h6");if(n){var r=n.textContent||"";return nl(r)?r:""}return ng(t)},nm=function(e,t){return e?t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)})?e:nm(null==e?void 0:e.parentElement,t):null},ny=function(e,t){if(!e)return{};var n,r,i,o=null===(i=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===i?void 0:i.call(r),s=nh(e,t);return nv(((n={})[ts]=o,n[ta]=nf(e),n[tu]=s,n[tc]=window.location.href.split("?")[0],n))},nb=function(e){return null!==e.event.target&&!!e.closestTrackedAncestor},n_=function(){function e(e){var t=(void 0===e?{}:e).origin,n=this;this.endpoint=tl,this.requestCallbacks={},this.onSelect=function(e){n.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?n.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&n.notify({action:"track-selector-moved",data:t})},this.endpoint=void 0===t?tl:t}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,s){r.requestCallbacks[i]={resolve:t,reject:s},r.notify(o),(null==n?void 0:n.timeout)>0&&setTimeout(function(){s(Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;if(!this.requestCallbacks[e.id]){null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id));return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},e.prototype.setup=function(e){var t=this,n=void 0===e?{}:e,r=n.logger,i=n.endpoint,o=n.isElementSelectable,s=n.cssSelectorAllowlist,a=n.actionClickAllowlist;this.logger=r,i&&this.endpoint===tl&&(this.endpoint=i);var u=null;window.addEventListener("message",function(e){if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var n,r,i,c,l,d=null==e?void 0:e.data,f=null==d?void 0:d.action;if(f){if("id"in d)null===(c=null===(i=t.logger)||void 0===i?void 0:i.debug)||void 0===c||c.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(d);else if("ping"===f)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===f){var h,p=null==d?void 0:d.data;(h="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise(function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=h,r.addEventListener("load",function(){e({status:!0})},{once:!0}),r.addEventListener("error",function(){t({status:!1,message:"Failed to load the script ".concat(h)})}),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}})).then(function(){var e;u=null===(e=null==window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:ny,isElementSelectable:function(e){return!o||o((null==p?void 0:p.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:tf,messenger:t,cssSelectorAllowlist:s,actionClickAllowlist:a}),t.notify({action:"selector-loaded"})}).catch(function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")})}else"close-visual-tagging-selector"===f&&(null===(l=null==u?void 0:u.close)||void 0===l||l.call(u))}}}),this.notify({action:"page-loaded"})},e}(),nw=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],nS=["type"],nI=["svg","path","g"],nE=["password","hidden"];function nC(e,t){return t$(function(n,r){var i=0;n.subscribe(tY(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}var nk=function(e){function t(t,n){return e.call(this)||this}return(0,m.__extends)(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(tb),nT={setInterval:function(e,t){for(var n=[],r=2;r1024)return e.slice(0,r)}return e}((function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t})(n).map(function(e){return function(e){if(null===e)return null;var t,n,r,i,o,s,a=e.tagName.toLowerCase(),u={tag:a},c=Array.from(null!==(i=null===(r=e.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);c.length&&(u.index=c.indexOf(e),u.indexOfType=c.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var l=null===(s=null===(o=e.previousElementSibling)||void 0===o?void 0:o.tagName)||void 0===s?void 0:s.toLowerCase();l&&(u.prevSib=l);var d=e.id;d&&(u.id=d);var f=Array.from(e.classList);f.length&&(u.classes=f);var h={},p=Array.from(e.attributes).filter(function(e){return!nw.includes(e.name)}),v=!nd(e);if(!nE.includes(e.type)&&!nI.includes(a))try{for(var g=(0,m.__values)(p),y=g.next();!y.done;y=g.next()){var b=y.value;(!v||nS.includes(b.name))&&(h[b.name]=String(b.value).substring(0,128))}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=g.return)&&n.call(g)}finally{if(t)throw t.error}}return Object.keys(h).length&&(u.attrs=h),u}(e)}),0):[],r[ts]=a,r[ta]=nf(t),r["[Amplitude] Element Position Left"]=null==u.left?null:Math.round(u.left),r["[Amplitude] Element Position Top"]=null==u.top?null:Math.round(u.top),r["[Amplitude] Element Aria Label"]=c,r["[Amplitude] Element Attributes"]=d,r[tu]=h,r["[Amplitude] Element Parent Label"]=f,r[tc]=window.location.href.split("?")[0],r["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);return"a"===a&&"click"===e&&t instanceof HTMLAnchorElement&&(p["[Amplitude] Element Href"]=t.href),nv(p)},p=function(t,n){var r={event:t,timestamp:Date.now(),type:n};if(("click"===r.type||"change"===r.type)&&null!==r.event.target){var i=nm(r.event.target,e.cssSelectorAllowlist);i&&(r.closestTrackedAncestor=i,r.targetElementProperties=f(r.type,i))}return r};return{name:u,type:"enrichment",setup:function(t,n){return(0,m.__awaiter)(void 0,void 0,void 0,function(){var r,i,o,s,h,p,v,g,y,b,_;return(0,m.__generator)(this,function(w){var S,I,E,C,k,T,M,O,x,R,P,N,D,A,L,j,q,F,U,z,B,W,G,V,K,J,H,$,Y,Z,Q,X,ee,et;return n?(l=t.loggerProvider,"undefined"==typeof document||(r=nc(e,e.cssSelectorAllowlist),i=nc(e,e.actionClickAllowlist),I=(S={allObservables:o=d(),options:e,amplitude:n,shouldTrackEvent:r}).amplitude,E=S.allObservables,C=S.options,k=S.shouldTrackEvent,x=nz((T=E.clickObservable).pipe(t$(function(e,t){var n,r=!1;e.subscribe(tY(t,function(e){var i=n;n=e,r&&t.next([i,e]),r=!0}))}),nC(function(e){var t=(0,m.__read)(e,2),n=t[0],r=t[1],i=n.event.target!==r.event.target,o=20>=Math.abs(r.event.screenX-n.event.screenX)&&20>=Math.abs(r.event.screenY-n.event.screenY);return i&&!o})),T.pipe((M=C.debounceTime,void 0===O&&(O=nR),t$(function(e,t){var n=null,r=null,i=null,o=function(){if(n){n.unsubscribe(),n=null;var e=r;r=null,t.next(e)}};function s(){var e=i+M,r=O.now();if(r0&&d(i)},void 0,void 0,function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),a=null})),c||d(null!=r?"number"==typeof r?r:+r-u.now():i)})}({first:500,with:function(){return nN}}),tQ(function(){return e}))},t$(function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(tY(t,function(e){null==n||n.unsubscribe(),tJ(et(e,r++)).subscribe(n=tY(t,function(e){return t.next(e)},function(){n=null,o()}))},function(){i=!0,o()}))}))).subscribe(function(e){null==W||W.track(to,K("click",e.closestTrackedAncestor),{time:e.timestamp})}),c.push(p),null===(b=null==t?void 0:t.loggerProvider)||void 0===b||b.log("".concat(u," has been successfully added.")),window.opener&&a.enabled&&(v=e.cssSelectorAllowlist,g=e.actionClickAllowlist,null===(_=a.messenger)||void 0===_||_.setup((0,m.__assign)((0,m.__assign)({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:td[t.serverZone]}),{isElementSelectable:nc(e,(0,m.__spreadArray)((0,m.__spreadArray)([],(0,m.__read)(v),!1),(0,m.__read)(g),!1)),cssSelectorAllowlist:v,actionClickAllowlist:g}))))):null===(y=null==t?void 0:t.loggerProvider)||void 0===y||y.warn("".concat(u," plugin requires a later version of @amplitude/analytics-browser. Events are not tracked.")),[2]})})},execute:function(e){return(0,m.__awaiter)(void 0,void 0,void 0,function(){return(0,m.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,m.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,r;return(0,m.__generator)(this,function(i){try{for(t=(e=(0,m.__values)(c)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]})})}}},n$=(a=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,v.ZT)(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),(0,g.S)(this._init((0,v.pi)((0,v.pi)({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i;return(0,v.mG)(this,void 0,void 0,function(){var o,s,a,u,c,l=this;return(0,v.Jh)(this,function(d){var f,h,p,g,y;switch(d.label){case 0:if(this.initializing)return[2];return this.initializing=!0,[4,(f=t.apiKey,h=t,p=this,void 0===h&&(h={}),(0,v.mG)(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s,a,u,c,l,d,g,m,y,_,w,S,E,C,k,T,M,O,x,R,P,N,D,A,L,j,q,F,U,z,B,W,G,V,K,J,H;return(0,v.Jh)(this,function($){var Y,Z,Q;switch($.label){case 0:if(e=h.identityStorage||eK,E={},!(e!==eK))return[3,1];return n="",[3,5];case 1:if(!(null!==(k=null===(C=h.cookieOptions)||void 0===C?void 0:C.domain)&&void 0!==k))return[3,2];return r=k,[3,4];case 2:return[4,(0,v.mG)(void 0,void 0,void 0,function(){var e,t,n,r,i,o;return(0,v.Jh)(this,function(s){switch(s.label){case 0:return[4,new e_().isEnabled()];case 1:if(!s.sent()||"undefined"==typeof location||!location.hostname)return[2,""];for(e=(null!=Y?Y:location.hostname).split("."),t=[],n="AMP_TLDTEST",r=e.length-2;r>=0;--r)t.push(e.slice(r).join("."));r=0,s.label=2;case 2:if(!(r0&&(this.queue.forEach(function(t){e(t)}),this.queue=[])},e}(),s=function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=200&&e<300?r.q.Success:429===e?r.q.RateLimit:413===e?r.q.PayloadTooLarge:408===e?r.q.Timeout:e>=400&&e<500?r.q.Invalid:e>=500?r.q.Failed:r.q.Unknown},e}()},212328:function(e,t,n){n.d(t,{w_:function(){return u},yh:function(){return o},zn:function(){return a}});var r=n(492336),i=n(203253),o=function(e){return function(){var t=(0,r.__assign)({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},s=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var o=(0,r.__values)(t.split(".")),s=o.next();!s.done;s=o.next()){var a=s.value;if(!(a in e))return;e=e[a]}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return e},a=function(e,t){return function(){var n,i,o={};try{for(var a=(0,r.__values)(t),u=a.next();!u.done;u=a.next()){var c=u.value;o[c]=s(e,c)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return o}},u=function(e,t,n,r,o){return void 0===o&&(o=null),function(){for(var s=[],a=0;athis.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){let n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){let n=this.getNode(e);if(n){let e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function es({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:o}){let s=i||"",a=r&&ea(r);return(t[n.toLowerCase()]||a&&t[a])&&(s=o?o(s,e):"*".repeat(s.length)),s}function ea(e){return e.toLowerCase()}let eu="__rrweb_original__";function ec(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ea(t):null}let el=1,ed=RegExp("[^a-z0-9-_:]");function ef(){return el++}let eh=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ep=/^(?:[a-z+]+:)?\/\//i,ev=/^www\..*/i,eg=/^(data:)([^,]*),(.*)/i;function em(e,t){return(e||"").replace(eh,(e,n,r,i,o,s)=>{let a=r||o||s,u=n||i||"";if(!a)return e;if(ep.test(a)||ev.test(a)||eg.test(a))return`url(${u}${a}${u})`;if("/"===a[0])return`url(${u}${(t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0]).split("?")[0]+a}${u})`;let c=t.split("/"),l=a.split("/");for(let e of(c.pop(),l))"."!==e&&(".."===e?c.pop():c.push(e));return`url(${u}${c.join("/")}${u})`})}let ey=/^[^ \t\n\r\u000c]+/,eb=/^[, \t\n\r\u000c]+/;function e_(e,t){if(!t||""===t.trim())return t;let n=e.createElement("a");return n.href=t,n.href}function ew(){let e=document.createElement("a");return e.href="",e.href}function eS(e,t,n,r){return r?"src"!==n&&("href"!==n||"use"===t&&"#"===r[0])&&("xlink:href"!==n||"#"===r[0])&&("background"!==n||"table"!==t&&"td"!==t&&"th"!==t)?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;let i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):""}let i=[];for(;r(eb),!(n>=t.length);){let o=r(ey);if(","===o.slice(-1))o=e_(e,o.substring(0,o.length-1)),i.push(o);else{let r="";o=e_(e,o);let s=!1;for(;;){let e=t.charAt(n);if(""===e){i.push((o+r).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){n+=1,i.push((o+r).trim());break}"("===e&&(s=!0)}r+=e,n+=1}}}return i.join(", ")}(e,r):"style"===n?em(r,ew()):"object"===t&&"data"===n?e_(e,r):r:e_(e,r):r}function eI(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function eE(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&eE(e.parentNode,t,n);for(let n=e.classList.length;n--;){let r=e.classList[n];if(t.test(r))return!0}return!!n&&eE(e.parentNode,t,n)}function eC(e,t,n){try{let r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(r.classList.contains(t)||r.closest(`.${t}`))return!0}else if(eE(r,t,!0))return!0;if(n&&(r.matches(n)||r.closest(n)))return!0}catch(e){}return!1}function ek(e){return null==e?"":e.toLowerCase()}function eT(e,t){let n;let{doc:o,mirror:s,blockClass:a,blockSelector:u,maskTextClass:c,maskTextSelector:l,skipChild:d=!1,inlineStylesheet:f=!0,maskInputOptions:h={},maskTextFn:p,maskInputFn:v,slimDOMOptions:g,dataURLOptions:m={},inlineImages:y=!1,recordCanvas:b=!1,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:S=5e3,onStylesheetLoad:I,stylesheetLoadTimeout:E=5e3,keepIframeSrcFn:C=()=>!1,newlyAddedElement:k=!1}=t,{preserveWhiteSpace:T=!0}=t,M=function(e,t){let{doc:n,mirror:o,blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:d={},maskTextFn:f,maskInputFn:h,dataURLOptions:p={},inlineImages:v,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:y=!1}=t,b=function(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return 1===n?void 0:n}(n,o);switch(e.nodeType){case e.DOCUMENT_NODE:if("CSS1Compat"!==e.compatMode)return{type:x.Document,childNodes:[],compatMode:e.compatMode};return{type:x.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:x.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return function(e,t){let{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:a,maskInputOptions:u={},maskInputFn:c,dataURLOptions:l={},inlineImages:d,recordCanvas:f,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:v}=t,g=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,o,s),m=function(e){if(e instanceof HTMLFormElement)return"form";let t=ea(e.tagName);return ed.test(t)?"div":t}(e),y={},b=e.attributes.length;for(let t=0;tt.href===e.href),r=null;t&&(r=er(t)),r&&(delete y.rel,delete y.href,y._cssText=em(r,t.href))}if("style"===m&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){let t=er(e.sheet);t&&(y._cssText=em(t,ew()))}if("input"===m||"textarea"===m||"select"===m){let t=e.value,n=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=es({element:e,type:ec(e),tagName:m,value:t,maskInputOptions:u,maskInputFn:c}):n&&(y.checked=n)}if("option"===m&&(e.selected&&!u.select?y.selected=!0:delete y.selected),"canvas"===m&&f){if("2d"===e.__context)!function(e){let t=e.getContext("2d");if(!t)return!0;for(let n=0;n0!==e))return!1}return!0}(e)&&(y.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let t=e.toDataURL(l.type,l.quality),n=document.createElement("canvas");n.width=e.width,n.height=e.height,t!==n.toDataURL(l.type,l.quality)&&(y.rr_dataURL=t)}}if("img"===m&&d){r||(i=(r=n.createElement("canvas")).getContext("2d"));let t=e.crossOrigin;e.crossOrigin="anonymous";let o=()=>{e.removeEventListener("load",o);try{r.width=e.naturalWidth,r.height=e.naturalHeight,i.drawImage(e,0,0),y.rr_dataURL=r.toDataURL(l.type,l.quality)}catch(t){console.warn(`Cannot inline img src=${e.currentSrc}! Error: ${t}`)}t?y.crossOrigin=t:e.removeAttribute("crossorigin")};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if(("audio"===m||"video"===m)&&(y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime),!p&&(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop)),g){let{width:t,height:n}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${n}px`}}return"iframe"!==m||h(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src),{type:x.Element,tagName:m,attributes:y,childNodes:[],isSVG:!!("svg"===e.tagName||e.ownerSVGElement)||void 0,needBlock:g,rootId:v}}(e,{doc:n,blockClass:s,blockSelector:a,inlineStylesheet:l,maskInputOptions:d,maskInputFn:h,dataURLOptions:p,inlineImages:v,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:y,rootId:b});case e.TEXT_NODE:return function(e,t){var n;let{maskTextClass:r,maskTextSelector:i,maskTextFn:o,rootId:s}=t,a=e.parentNode&&e.parentNode.tagName,u=e.textContent,c="STYLE"===a||void 0,l="SCRIPT"===a||void 0;if(c&&u){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(u=er(e.parentNode.sheet))}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}u=em(u,ew())}return l&&(u="SCRIPT_PLACEHOLDER"),!c&&!l&&u&&eC(e,r,i)&&(u=o?o(u,e.parentElement):u.replace(/[\S]/g,"*")),{type:x.Text,textContent:u||"",isStyle:c,rootId:s}}(e,{maskTextClass:u,maskTextSelector:c,maskTextFn:f,rootId:b});case e.CDATA_SECTION_NODE:return{type:x.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:x.Comment,textContent:e.textContent||"",rootId:b};default:return!1}}(e,{doc:o,mirror:s,blockClass:a,blockSelector:u,maskTextClass:c,maskTextSelector:l,inlineStylesheet:f,maskInputOptions:h,maskTextFn:p,maskInputFn:v,dataURLOptions:m,inlineImages:y,recordCanvas:b,keepIframeSrcFn:C,newlyAddedElement:k});if(!M)return console.warn(e,"not serialized"),null;n=s.hasNode(e)?s.getId(e):!function(e,t){if(t.comment&&e.type===x.Comment)return!0;if(e.type===x.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js"))||t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(ek(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===ek(e.attributes.name)||"icon"===ek(e.attributes.rel)||"apple-touch-icon"===ek(e.attributes.rel)||"shortcut icon"===ek(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&ek(e.attributes.name).match(/^description|keywords$/)||t.headMetaSocial&&(ek(e.attributes.property).match(/^(og|twitter|fb):/)||ek(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===ek(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===ek(e.attributes.name)||"googlebot"===ek(e.attributes.name)||"bingbot"===ek(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;else if(t.headMetaAuthorship&&("author"===ek(e.attributes.name)||"generator"===ek(e.attributes.name)||"framework"===ek(e.attributes.name)||"publisher"===ek(e.attributes.name)||"progid"===ek(e.attributes.name)||ek(e.attributes.property).match(/^article:/)||ek(e.attributes.property).match(/^product:/)))return!0;else if(t.headMetaVerification&&("google-site-verification"===ek(e.attributes.name)||"yandex-verification"===ek(e.attributes.name)||"csrf-token"===ek(e.attributes.name)||"p:domain_verify"===ek(e.attributes.name)||"verify-v1"===ek(e.attributes.name)||"verification"===ek(e.attributes.name)||"shopify-checkout-api-token"===ek(e.attributes.name)))return!0}}return!1}(M,g)&&(T||M.type!==x.Text||M.isStyle||M.textContent.replace(/^\s+|\s+$/gm,"").length)?ef():-2;let O=Object.assign(M,{id:n});if(s.add(e,O),-2===n)return null;_&&_(e);let R=!d;if(O.type===x.Element){R=R&&!O.needBlock,delete O.needBlock;let t=e.shadowRoot;t&&en(t)&&(O.isShadowHost=!0)}if((O.type===x.Document||O.type===x.Element)&&R){g.headWhitespace&&O.type===x.Element&&"head"===O.tagName&&(T=!1);let t={doc:o,mirror:s,blockClass:a,blockSelector:u,maskTextClass:c,maskTextSelector:l,skipChild:d,inlineStylesheet:f,maskInputOptions:h,maskTextFn:p,maskInputFn:v,slimDOMOptions:g,dataURLOptions:m,inlineImages:y,recordCanvas:b,preserveWhiteSpace:T,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:I,stylesheetLoadTimeout:E,keepIframeSrcFn:C};if(O.type===x.Element&&"textarea"===O.tagName&&void 0!==O.attributes.value);else for(let n of Array.from(e.childNodes)){let e=eT(n,t);e&&O.childNodes.push(e)}if(e.nodeType===e.ELEMENT_NODE&&e.shadowRoot)for(let n of Array.from(e.shadowRoot.childNodes)){let r=eT(n,t);r&&(en(e.shadowRoot)&&(r.isShadow=!0),O.childNodes.push(r))}}return e.parentNode&&et(e.parentNode)&&en(e.parentNode)&&(O.isShadow=!0),O.type===x.Element&&"iframe"===O.tagName&&function(e,t,n){let r;let i=e.contentWindow;if(!i)return;let o=!1;try{r=i.document.readyState}catch(e){return}if("complete"!==r){let r=setTimeout(()=>{o||(t(),o=!0)},n);e.addEventListener("load",()=>{clearTimeout(r),o=!0,t()});return}let s="about:blank";if(i.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,()=>{let t=e.contentDocument;if(t&&w){let n=eT(t,{doc:t,mirror:s,blockClass:a,blockSelector:u,maskTextClass:c,maskTextSelector:l,skipChild:!1,inlineStylesheet:f,maskInputOptions:h,maskTextFn:p,maskInputFn:v,slimDOMOptions:g,dataURLOptions:m,inlineImages:y,recordCanvas:b,preserveWhiteSpace:T,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:I,stylesheetLoadTimeout:E,keepIframeSrcFn:C});n&&w(e,n)}},S),O.type===x.Element&&"link"===O.tagName&&"stylesheet"===O.attributes.rel&&function(e,t,n){let r,i=!1;try{r=e.sheet}catch(e){return}if(r)return;let o=setTimeout(()=>{i||(t(),i=!0)},n);e.addEventListener("load",()=>{clearTimeout(o),i=!0,t()})}(e,()=>{if(I){let t=eT(e,{doc:o,mirror:s,blockClass:a,blockSelector:u,maskTextClass:c,maskTextSelector:l,skipChild:!1,inlineStylesheet:f,maskInputOptions:h,maskTextFn:p,maskInputFn:v,slimDOMOptions:g,dataURLOptions:m,inlineImages:y,recordCanvas:b,preserveWhiteSpace:T,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:I,stylesheetLoadTimeout:E,keepIframeSrcFn:C});t&&I(e,t)}},E),O}RegExp(/(max|min)-device-(width|height)/.source,"g"),RegExp(/([^\\]):hover/.source,"g");var eM=((d=eM||{})[d.DomContentLoaded=0]="DomContentLoaded",d[d.Load=1]="Load",d[d.FullSnapshot=2]="FullSnapshot",d[d.IncrementalSnapshot=3]="IncrementalSnapshot",d[d.Meta=4]="Meta",d[d.Custom=5]="Custom",d[d.Plugin=6]="Plugin",d),eO=((f=eO||{})[f.Mutation=0]="Mutation",f[f.MouseMove=1]="MouseMove",f[f.MouseInteraction=2]="MouseInteraction",f[f.Scroll=3]="Scroll",f[f.ViewportResize=4]="ViewportResize",f[f.Input=5]="Input",f[f.TouchMove=6]="TouchMove",f[f.MediaInteraction=7]="MediaInteraction",f[f.StyleSheetRule=8]="StyleSheetRule",f[f.CanvasMutation=9]="CanvasMutation",f[f.Font=10]="Font",f[f.Log=11]="Log",f[f.Drag=12]="Drag",f[f.StyleDeclaration=13]="StyleDeclaration",f[f.Selection=14]="Selection",f[f.AdoptedStyleSheet=15]="AdoptedStyleSheet",f),ex=((h=ex||{})[h.MouseUp=0]="MouseUp",h[h.MouseDown=1]="MouseDown",h[h.Click=2]="Click",h[h.ContextMenu=3]="ContextMenu",h[h.DblClick=4]="DblClick",h[h.Focus=5]="Focus",h[h.Blur=6]="Blur",h[h.TouchStart=7]="TouchStart",h[h.TouchMove_Departed=8]="TouchMove_Departed",h[h.TouchEnd=9]="TouchEnd",h[h.TouchCancel=10]="TouchCancel",h),eR=((p=eR||{})[p.Mouse=0]="Mouse",p[p.Pen=1]="Pen",p[p.Touch=2]="Touch",p),eP=((v=eP||{})[v["2D"]=0]="2D",v[v.WebGL=1]="WebGL",v[v.WebGL2=2]="WebGL2",v),eN=((g=eN||{}).Start="start",g.Pause="pause",g.Resume="resume",g.Resize="resize",g.Finish="finish",g.FullsnapshotRebuilded="fullsnapshot-rebuilded",g.LoadStylesheetStart="load-stylesheet-start",g.LoadStylesheetEnd="load-stylesheet-end",g.SkipStart="skip-start",g.SkipEnd="skip-end",g.MouseInteraction="mouse-interaction",g.EventCast="event-cast",g.CustomEvent="custom-event",g.Flush="flush",g.StateChange="state-change",g.PlayBack="play-back",g.Destroy="destroy",g);function eD(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}let eA="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",eL={map:{},getId:()=>(console.error(eA),-1),getNode:()=>(console.error(eA),null),removeNodeFromMap(){console.error(eA)},has:()=>(console.error(eA),!1),reset(){console.error(eA)}};function ej(e,t,n={}){let r=null,i=0;return function(...o){let s=Date.now();i||!1!==n.leading||(i=s);let a=t-(s-i),u=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=s,e.apply(u,o)):r||!1===n.trailing||(r=setTimeout(()=>{i=!1===n.leading?0:Date.now(),r=null,e.apply(u,o)},a))}}function eq(e,t,n,r,i=window){let o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),o&&o.set&&o.set.call(this,e)}}),()=>eq(e,t,o||{},!0)}function eF(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch(e){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(eL=new Proxy(eL,{get:(e,t,n)=>("map"===t&&console.error(eA),Reflect.get(e,t,n))}));let eU=Date.now;function ez(e){var t,n,r,i,o,s;let a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==a?void 0:a.documentElement.scrollLeft)||(null===(n=null===(t=null==a?void 0:a.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null==a?void 0:a.body)||void 0===r?void 0:r.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==a?void 0:a.documentElement.scrollTop)||(null===(o=null===(i=null==a?void 0:a.body)||void 0===i?void 0:i.parentElement)||void 0===o?void 0:o.scrollTop)||(null===(s=null==a?void 0:a.body)||void 0===s?void 0:s.scrollTop)||0}}function eB(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function eW(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function eG(e){return e?e.nodeType===e.ELEMENT_NODE?e:e.parentElement:null}function eV(e,t,n,r){if(!e)return!1;let i=eG(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t)||r&&null!==i.closest("."+t))return!0}else if(eE(i,t,r))return!0}catch(e){}return!!(n&&(i.matches(n)||r&&null!==i.closest(n)))}function eK(e,t){return -2===t.getId(e)}function eJ(e){return!!e.changedTouches}function eH(e,t){return!!("IFRAME"===e.nodeName&&t.getMeta(e))}function e$(e,t){return!!("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function eY(e){return!!(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(eU=()=>new Date().getTime());class eZ{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){let n;return this.has(e)?this.getId(e):(n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n)}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function eQ(e){var t,n;let r=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function eX(e){let t=e.ownerDocument;return!!t&&(t.contains(e)||function(e){let t=e.ownerDocument;if(!t)return!1;let n=function(e){let t,n=e;for(;t=eQ(n);)n=t;return n}(e);return t.contains(n)}(e))}let e0=e=>o?(...t)=>{try{return e(...t)}catch(e){if(o&&!0===o(e))return;throw e}}:e;function e1(e){return(...t)=>{try{return e(...t)}catch(e){try{e._external_=!0}catch(e){}throw e}}}class e2{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,r){let i=n||this.getIdToRemoteIdMap(e),o=r||this.getRemoteIdToIdMap(e),s=i.get(t);return s||(s=this.generateIdFn(),i.set(t,s),o.set(s,t)),s}getIds(e,t){let n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,r))}getRemoteId(e,t,n){let r=n||this.getRemoteIdToIdMap(e);return"number"!=typeof t?t:r.get(t)||-1}getRemoteIds(e,t){let n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class e3{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new e2(ef),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new e2(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){if("rrweb"!==e.data.type||e.origin!==e.data.origin||!e.source)return;let t=this.crossOriginIframeMap.get(e.source);if(!t)return;let n=this.transformCrossOriginEvent(t,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case eM.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:eM.IncrementalSnapshot,data:{source:eO.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case eM.Meta:case eM.Load:case eM.DomContentLoaded:return!1;case eM.Plugin:return t;case eM.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case eM.IncrementalSnapshot:switch(t.data.source){case eO.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case eO.Drag:case eO.TouchMove:case eO.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case eO.ViewportResize:return!1;case eO.MediaInteraction:case eO.MouseInteraction:case eO.Scroll:case eO.CanvasMutation:case eO.Input:return this.replaceIds(t.data,e,["id"]),t;case eO.StyleSheetRule:case eO.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case eO.Font:return t;case eO.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case eO.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}}replace(e,t,n,r){for(let i of r)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===x.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}}class e4{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw Error("Position outside of list range");let t=this.head;for(let n=0;n`${e}@${t}`;class e6{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,n=new e4,r=e=>{let t=e,n=-2;for(;-2===n;)n=(t=t&&t.nextSibling)&&this.mirror.getId(t);return n},i=i=>{if(!i.parentNode||!eX(i)||"TEXTAREA"===i.parentNode.tagName)return;let o=et(i.parentNode)?this.mirror.getId(eQ(i)):this.mirror.getId(i.parentNode),s=r(i);if(-1===o||-1===s)return n.addNode(i);let a=eT(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{eH(e,this.mirror)&&this.iframeManager.addIframe(e),e$(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),eY(i)&&this.shadowDomManager.addShadowRoot(i.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});a&&(e.push({parentId:o,nextId:s,node:a}),t.add(a.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let e of this.movedSet)(!e7(this.removes,e,this.mirror)||this.movedSet.has(e.parentNode))&&i(e);for(let e of this.addedSet)e9(this.droppedSet,e)||e7(this.removes,e,this.mirror)?e9(this.movedSet,e)?i(e):this.droppedSet.add(e):i(e);let o=null;for(;n.length;){let e=null;if(o){let t=this.mirror.getId(o.value.parentNode),n=r(o.value);-1!==t&&-1!==n&&(e=o)}if(!e){let t=n.tail;for(;t;){let n=t;if(t=t.previous,n){let t=this.mirror.getId(n.value.parentNode);if(-1===r(n.value))continue;if(-1!==t){e=n;break}{let t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let r=t.parentNode.host;if(-1!==this.mirror.getId(r)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}o=e.previous,n.removeNode(e.value),i(e.value)}let s={texts:this.texts.map(e=>{let t=e.node;return"TEXTAREA"===t.parentNode.tagName&&this.genTextAreaValueMutation(t.parentNode),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>{let{attributes:t}=e;if("string"==typeof t.style){let n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(s.texts.length||s.attributes.length||s.removes.length||s.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.genTextAreaValueMutation=e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(e.childNodes,e=>e.textContent||"").join("")},this.processMutation=e=>{if(!eK(e.target,this.mirror))switch(e.type){case"characterData":{let t=e.target.textContent;eV(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:eC(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t,eG(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,n=e.attributeName,r=e.target.getAttribute(n);if("value"===n){let e=ec(t);r=es({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(eV(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;n="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!eI(t.tagName,n)&&(i.attributes[n]=eS(this.doc,ea(t.tagName),ea(n),r),"style"===n)){let n;try{n=document.implementation.createHTMLDocument()}catch(e){n=this.doc}let r=n.createElement("span");for(let n of(e.oldValue&&r.setAttribute("style",e.oldValue),Array.from(t.style))){let e=t.style.getPropertyValue(n),o=t.style.getPropertyPriority(n);e!==r.style.getPropertyValue(n)||o!==r.style.getPropertyPriority(n)?""===o?i.styleDiff[n]=e:i.styleDiff[n]=[e,o]:i._unchangedStyles[n]=[e,o]}for(let e of Array.from(r.style))""===t.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}break}case"childList":if(eV(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let n=this.mirror.getId(t),r=et(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);eV(e.target,this.blockClass,this.blockSelector,!1)||eK(t,this.mirror)||-1===this.mirror.getId(t)||(this.addedSet.has(t)?(e8(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||function e(t,n){if(et(t))return!1;let r=n.getId(t);return!n.has(r)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||e(t.parentNode,n))}(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[e5(n,r)]?e8(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!!(et(e.target)&&en(e.target))||void 0})),this.mapRemoves.push(t))})}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(eK(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[e5(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);!eV(e,this.blockClass,this.blockSelector,!1)&&(e.childNodes.forEach(e=>this.genAdds(e)),eY(e)&&e.shadowRoot.childNodes.forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function e8(e,t){e.delete(t),t.childNodes.forEach(t=>e8(e,t))}function e7(e,t,n){return 0!==e.length&&function e(t,n,r){let{parentNode:i}=n;if(!i)return!1;let o=r.getId(i);return!!t.some(e=>e.id===o)||e(t,i,r)}(e,t,n)}function e9(e,t){return 0!==e.size&&function e(t,n){let{parentNode:r}=n;return!!r&&(!!t.has(r)||e(t,r))}(e,t)}let te=[];function tt(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function tn(e,t){var n,r;let i=new e6;te.push(i),i.init(e);let o=window.MutationObserver||window.__rrMutationObserver,s=null===(r=null===(n=null==window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");s&&window[s]&&(o=window[s]);let a=new o(e0(i.processMutations.bind(i)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function tr({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){return eD("scroll",e0(ej(e0(o=>{let s=tt(o);if(!s||eV(s,r,i,!0))return;let a=n.getId(s);if(s===t&&t.defaultView){let n=ez(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})}),o.scroll||100)),t)}function ti(e,t){let n=Object.assign({},e);return t||delete n.userTriggered,n}let to=["INPUT","TEXTAREA","SELECT"],ts=new WeakMap;function ta(e){var t;return t=[],td("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||td("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||td("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||td("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule?t.unshift(Array.from(e.parentRule.cssRules).indexOf(e)):e.parentStyleSheet&&t.unshift(Array.from(e.parentStyleSheet.cssRules).indexOf(e)),t}function tu(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function tc({mirror:e,stylesheetManager:t},n){var r,i,o;let s=null;s="#document"===n.nodeName?e.getId(n):e.getId(n.host);let a="#document"===n.nodeName?null===(r=n.defaultView)||void 0===r?void 0:r.Document:null===(o=null===(i=n.ownerDocument)||void 0===i?void 0:i.defaultView)||void 0===o?void 0:o.ShadowRoot,u=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&u?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var e;return null===(e=u.get)||void 0===e?void 0:e.call(this)},set(e){var n;let r=null===(n=u.set)||void 0===n?void 0:n.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(e){}return r}}),e0(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})})):()=>{}}function tl(e,t={}){let n;let r=e.doc.defaultView;if(!r)return()=>{};!function(e,t){let{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:u,styleSheetRuleCb:c,styleDeclarationCb:l,canvasMutationCb:d,fontCb:f,selectionCb:h}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),o(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),s(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),u(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),l(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),f(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),h(...e)}}(e,t),e.recordDOM&&(n=tn(e,e.doc));let i=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){let i;if(!1===t.mousemove)return()=>{};let o="number"==typeof t.mousemove?t.mousemove:50,s="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500,a=[],u=ej(e0(t=>{let n=Date.now()-i;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],i=null}),s),c=e0(ej(e0(e=>{let t=tt(e),{clientX:n,clientY:o}=eJ(e)?e.changedTouches[0]:e;i||(i=eU()),a.push({x:n,y:o,id:r.getId(t),timeOffset:eU()-i}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?eO.Drag:e instanceof MouseEvent?eO.MouseMove:eO.TouchMove)}),o,{trailing:!1})),l=[eD("mousemove",c,n),eD("touchmove",c,n),eD("drag",c,n)];return e0(()=>{l.forEach(e=>e())})}(e),o=function({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(!1===o.mouseInteraction)return()=>{};let s=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,a=[],u=null,c=t=>o=>{let s=tt(o);if(eV(s,r,i,!0))return;let a=null,c=t;if("pointerType"in o){switch(o.pointerType){case"mouse":a=eR.Mouse;break;case"touch":a=eR.Touch;break;case"pen":a=eR.Pen}a===eR.Touch?ex[t]===ex.MouseDown?c="TouchStart":ex[t]===ex.MouseUp&&(c="TouchEnd"):eR.Pen}else eJ(o)&&(a=eR.Touch);null!==a?(u=a,(c.startsWith("Touch")&&a===eR.Touch||c.startsWith("Mouse")&&a===eR.Mouse)&&(a=null)):ex[t]===ex.Click&&(a=u,u=null);let l=eJ(o)?o.changedTouches[0]:o;if(!l)return;let d=n.getId(s),{clientX:f,clientY:h}=l;e0(e)(Object.assign({type:ex[c],id:d,x:f,y:h},null!==a&&{pointerType:a}))};return Object.keys(ex).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(e=>{let n=ea(e),r=c(e);if(window.PointerEvent)switch(ex[e]){case ex.MouseDown:case ex.MouseUp:n=n.replace("mouse","pointer");break;case ex.TouchStart:case ex.TouchEnd:return}a.push(eD(n,r,t))}),e0(()=>{a.forEach(e=>e())})}(e),s=tr(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return eD("resize",e0(ej(e0(()=>{let t=eB(),i=eW();(n!==t||r!==i)&&(e({width:Number(i),height:Number(t)}),n=t,r=i)}),200)),t)}(e,{win:r}),u=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:u,sampling:c,userTriggeredOnInput:l}){function d(e){let n=tt(e),c=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=n.parentElement),!n||!d||0>to.indexOf(d)||eV(n,r,i,!0)||n.classList.contains(o)||s&&n.matches(s))return;let h=n.value,p=!1,v=ec(n)||"";"radio"===v||"checkbox"===v?p=n.checked:(a[d.toLowerCase()]||a[v])&&(h=es({element:n,maskInputOptions:a,tagName:d,type:v,value:h,maskInputFn:u})),f(n,e0(ti)({text:h,isChecked:p,userTriggered:c},l));let g=n.name;"radio"===v&&g&&p&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(e=>{e!==n&&f(e,e0(ti)({text:e.value,isChecked:!p,userTriggered:!1},l))})}function f(t,r){let i=ts.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){ts.set(t,r);let i=n.getId(t);e0(e)(Object.assign(Object.assign({},r),{id:i}))}}let h=("last"===c.input?["change"]:["input","change"]).map(e=>eD(e,e0(d),t)),p=t.defaultView;if(!p)return()=>{h.forEach(e=>e())};let v=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),g=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return v&&v.set&&h.push(...g.map(e=>eq(e[0],e[1],{set(){e0(d)({target:this,isTrusted:!1})}},!1,p))),e0(()=>{h.forEach(e=>e())})}(e),c=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){let s=e0(o=>ej(e0(i=>{let s=tt(i);if(!s||eV(s,t,n,!0))return;let{currentTime:a,volume:u,muted:c,playbackRate:l}=s;e({type:o,id:r.getId(s),currentTime:a,volume:u,muted:c,playbackRate:l})}),i.media||500)),a=[eD("play",s(0),o),eD("pause",s(1),o),eD("seeked",s(2),o),eD("volumechange",s(3),o),eD("ratechange",s(4),o)];return e0(()=>{a.forEach(e=>e())})}(e),l=()=>{},d=()=>{},f=()=>{},h=()=>{};e.recordDOM&&(l=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){let i,o;if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let s=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:e0((r,i,o)=>{let[s,a]=o,{id:u,styleId:c}=tu(i,t,n.styleMirror);return(u&&-1!==u||c&&-1!==c)&&e({id:u,styleId:c,adds:[{rule:s,index:a}]}),e1(()=>r.apply(i,o))()})});let a=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:e0((r,i,o)=>{let[s]=o,{id:a,styleId:u}=tu(i,t,n.styleMirror);return(a&&-1!==a||u&&-1!==u)&&e({id:a,styleId:u,removes:[{index:s}]}),e1(()=>r.apply(i,o))()})}),r.CSSStyleSheet.prototype.replace&&(i=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(i,{apply:e0((r,i,o)=>{let[s]=o,{id:a,styleId:u}=tu(i,t,n.styleMirror);return(a&&-1!==a||u&&-1!==u)&&e({id:a,styleId:u,replace:s}),r.apply(i,o)})})),r.CSSStyleSheet.prototype.replaceSync&&(o=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(o,{apply:e0((r,i,o)=>{let[s]=o,{id:a,styleId:u}=tu(i,t,n.styleMirror);return(a&&-1!==a||u&&-1!==u)&&e({id:a,styleId:u,replaceSync:s}),r.apply(i,o)})}));let u={};tf("CSSGroupingRule")?u.CSSGroupingRule=r.CSSGroupingRule:(tf("CSSMediaRule")&&(u.CSSMediaRule=r.CSSMediaRule),tf("CSSConditionRule")&&(u.CSSConditionRule=r.CSSConditionRule),tf("CSSSupportsRule")&&(u.CSSSupportsRule=r.CSSSupportsRule));let c={};return Object.entries(u).forEach(([r,i])=>{c[r]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(c[r].insertRule,{apply:e0((r,i,o)=>{let[s,a]=o,{id:u,styleId:c}=tu(i.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||c&&-1!==c)&&e({id:u,styleId:c,adds:[{rule:s,index:[...ta(i),a||0]}]}),r.apply(i,o)})}),i.prototype.deleteRule=new Proxy(c[r].deleteRule,{apply:e0((r,i,o)=>{let[s]=o,{id:a,styleId:u}=tu(i.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||u&&-1!==u)&&e({id:a,styleId:u,removes:[{index:[...ta(i),s]}]}),r.apply(i,o)})})}),e0(()=>{r.CSSStyleSheet.prototype.insertRule=s,r.CSSStyleSheet.prototype.deleteRule=a,i&&(r.CSSStyleSheet.prototype.replace=i),o&&(r.CSSStyleSheet.prototype.replaceSync=o),Object.entries(u).forEach(([e,t])=>{t.prototype.insertRule=c[e].insertRule,t.prototype.deleteRule=c[e].deleteRule})})}(e,{win:r}),d=tc(e,e.doc),f=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:e0((i,s,a)=>{var u;let[c,l,d]=a;if(n.has(c))return o.apply(s,[c,l,d]);let{id:f,styleId:h}=tu(null===(u=s.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,r.styleMirror);return(f&&-1!==f||h&&-1!==h)&&e({id:f,styleId:h,set:{property:c,value:l,priority:d},index:ta(s.parentRule)}),i.apply(s,a)})});let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:e0((i,o,a)=>{var u;let[c]=a;if(n.has(c))return s.apply(o,[c]);let{id:l,styleId:d}=tu(null===(u=o.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,r.styleMirror);return(l&&-1!==l||d&&-1!==d)&&e({id:l,styleId:d,remove:{property:c},index:ta(o.parentRule)}),i.apply(o,a)})}),e0(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}(e,{win:r}),e.collectFonts&&(h=function({fontCb:e,doc:t}){let n=t.defaultView;if(!n)return()=>{};let r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(e,t,n){let r=new o(e,t,n);return i.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};let s=eF(t.fonts,"add",function(t){return function(n){return setTimeout(e0(()=>{let t=i.get(n);t&&(e(t),i.delete(n))}),0),t.apply(this,[n])}});return r.push(()=>{n.FontFace=o}),r.push(s),e0(()=>{r.forEach(e=>e())})}(e)));let p=function(e){let{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e,s=!0,a=e0(()=>{let e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;let a=[],u=e.rangeCount||0;for(let t=0;t{te.forEach(e=>e.reset()),null==n||n.disconnect(),i(),o(),s(),a(),u(),c(),l(),d(),f(),h(),p(),v.forEach(e=>e())})}function td(e){return void 0!==window[e]}function tf(e){return!!(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}for(var th=(m=function(){!function(){function e(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"==typeof Uint8Array?[]:new Uint8Array(256),r=0;r>2]+t[(3&r[n])<<4|r[n+1]>>4]+t[(15&r[n+1])<<2|r[n+2]>>6]+t[63&r[n+2]];return i%3==2?o=o.substring(0,o.length-1)+"=":i%3==1&&(o=o.substring(0,o.length-2)+"=="),o};let o=new Map,s=new Map,a=self;a.onmessage=function(t){return e(this,void 0,void 0,function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:t.data.id});{let{id:n,bitmap:r,width:u,height:c,dataURLOptions:l}=t.data,d=function(t,n,r){return e(this,void 0,void 0,function*(){let e=`${t}-${n}`;if(!("OffscreenCanvas"in globalThis))return"";{if(s.has(e))return s.get(e);let o=new OffscreenCanvas(t,n);o.getContext("2d");let a=yield o.convertToBlob(r),u=i((yield a.arrayBuffer()));return s.set(e,u),u}})}(u,c,l),f=new OffscreenCanvas(u,c);f.getContext("2d").drawImage(r,0,0),r.close();let h=yield f.convertToBlob(l),p=h.type,v=i((yield h.arrayBuffer()));if(!o.has(n)&&(yield d)===v)return o.set(n,v),a.postMessage({id:n});if(o.get(n)===v)return a.postMessage({id:n});a.postMessage({id:n,type:p,base64:v,width:u,height:c}),o.set(n,v)}})}}()},function(e){var t;return new Worker(y=y||(t=new Blob(function(e,t){var n=e.toString().split("\n");n.pop(),n.shift();for(var r=n[0].search(/\S/),i=/(['"])__worker_loader_strict__(['"])/g,o=0,s=n.length;o>2]+tp[(3&n[t])<<4|n[t+1]>>4]+tp[(15&n[t+1])<<2|n[t+2]>>6]+tp[63&n[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i};let ty=new Map,tb=(e,t,n)=>{let r;if(!e||!(tw(e,t)||"object"==typeof e))return;let i=e.constructor.name,o=((r=ty.get(n))||(r=new Map,ty.set(n,r)),r.has(i)||r.set(i,[]),r.get(i)),s=o.indexOf(e);return -1===s&&(s=o.length,o.push(e)),s},t_=(e,t,n)=>[...e].map(e=>(function e(t,n,r){if(t instanceof Array)return t.map(t=>e(t,n,r));if(null===t);else if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};else if(t instanceof ArrayBuffer)return{rr_type:t.constructor.name,base64:tm(t)};else if(t instanceof DataView)return{rr_type:t.constructor.name,args:[e(t.buffer,n,r),t.byteOffset,t.byteLength]};else if(t instanceof HTMLImageElement){let e=t.constructor.name,{src:n}=t;return{rr_type:e,src:n}}else if(t instanceof HTMLCanvasElement)return{rr_type:"HTMLImageElement",src:t.toDataURL()};else if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[e(t.data,n,r),t.width,t.height]};else if(tw(t,n)||"object"==typeof t)return{rr_type:t.constructor.name,index:tb(t,n,r)};return t})(e,t,n)),tw=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]).find(n=>e instanceof t[n]);function tS(e,t,n,r){let i=[];try{let o=eF(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(i,...o){if(!eV(this,t,n,!0)){let e="experimental-webgl"===i?"webgl":i;if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e)){if(o[0]&&"object"==typeof o[0]){let e=o[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0})}}return e.apply(this,[i,...o])}});i.push(o)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(e=>e())}}function tI(e,t,n,r,i,o,s){let a=[];for(let o of Object.getOwnPropertyNames(e))if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(o))try{if("function"!=typeof e[o])continue;let u=eF(e,o,function(e){return function(...a){let u=e.apply(this,a);if(tb(u,s,this),"tagName"in this.canvas&&!eV(this.canvas,r,i,!0)){let e=t_([...a],s,this),r={type:t,property:o,args:e};n(this.canvas,r)}return u}});a.push(u)}catch(i){let r=eq(e,o,{set(e){n(this.canvas,{type:t,property:o,args:[e],setter:!0})}});a.push(r)}return a}class tE{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};let{sampling:t="all",win:n,blockClass:r,blockSelector:i,recordCanvas:o,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(n,r,i),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,i,{dataURLOptions:s})}initCanvasFPSObserver(e,t,n,r,i){let o;let s=tS(t,n,r,!0),a=new Map,u=new th;u.onmessage=e=>{let{id:t}=e.data;if(a.set(t,!1),!("base64"in e.data))return;let{base64:n,type:r,width:i,height:o}=e.data;this.mutationCb({id:t,type:eP["2D"],commands:[{property:"clearRect",args:[0,0,i,o]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};let c=1e3/e,l=0,d=()=>{let e=[];return t.document.querySelectorAll("canvas").forEach(t=>{eV(t,n,r,!0)||e.push(t)}),e},f=e=>{if(l&&e-l{var t,n,r,o;return t=this,n=void 0,r=void 0,o=function*(){var t;let n=this.mirror.getId(e);if(a.get(n))return;if(a.set(n,!0),["webgl","webgl2"].includes(e.__context)){let n=e.getContext(e.__context);(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)===!1&&n.clear(n.COLOR_BUFFER_BIT)}let r=yield createImageBitmap(e);u.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[r])},new(r||(r=Promise))(function(e,i){function s(e){try{u(o.next(e))}catch(e){i(e)}}function a(e){try{u(o.throw(e))}catch(e){i(e)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(s,a)}u((o=o.apply(t,n||[])).next())})}),o=requestAnimationFrame(f)};o=requestAnimationFrame(f),this.resetObservers=()=>{s(),cancelAnimationFrame(o)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let r=tS(e,t,n,!1),i=function(e,t,n,r){let i=[];for(let o of Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype))try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])continue;let s=eF(t.CanvasRenderingContext2D.prototype,o,function(i){return function(...s){return eV(this.canvas,n,r,!0)||setTimeout(()=>{let n=t_([...s],t,this);e(this.canvas,{type:eP["2D"],property:o,args:n})},0),i.apply(this,s)}});i.push(s)}catch(r){let n=eq(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:eP["2D"],property:o,args:[t],setter:!0})}});i.push(n)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n),o=function(e,t,n,r,i){let o=[];return o.push(...tI(t.WebGLRenderingContext.prototype,eP.WebGL,e,n,r,i,t)),void 0!==t.WebGL2RenderingContext&&o.push(...tI(t.WebGL2RenderingContext.prototype,eP.WebGL2,e,n,r,i,t)),()=>{o.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{r(),i(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;let r=n.map(e=>(function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);it.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n})(e,["type"])),{type:i}=n[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}}class tC{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(e,t){let n=this.nodeMap.get(e);return n&&Array.from(n).some(e=>e!==t)}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}class tk{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!en(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let n=tn(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(tr(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(tc({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let n=this;this.restoreHandlers.push(eF(e.prototype,"attachShadow",function(e){return function(r){let i=e.call(this,r);return this.shadowRoot&&eX(this)&&n.addShadowRoot(this.shadowRoot,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}class tT{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new eZ,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;let n={id:t,styleIds:[]},r=[];for(let t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,(e,t)=>({rule:ei(e),index:t}))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function tM(e){return Object.assign(Object.assign({},e),{timestamp:eU()})}let tO=!1,tx=new eo;function tR(e={}){let t;let{emit:n,checkoutEveryNms:r,checkoutEveryNth:i,blockClass:c="rr-block",blockSelector:l=null,ignoreClass:d="rr-ignore",ignoreSelector:f=null,maskTextClass:h="rr-mask",maskTextSelector:p=null,inlineStylesheet:v=!0,maskAllInputs:g,maskInputOptions:m,slimDOMOptions:y,maskInputFn:b,maskTextFn:_,hooks:w,packFn:S,sampling:I={},dataURLOptions:E={},mousemoveWait:C,recordDOM:k=!0,recordCanvas:T=!1,recordCrossOriginIframes:M=!1,recordAfter:O="DOMContentLoaded"===e.recordAfter?e.recordAfter:"load",userTriggeredOnInput:x=!1,collectFonts:R=!1,inlineImages:P=!1,plugins:N,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:A=new Set([]),errorHandler:L}=e;o=L;let j=!M||window.parent===window,q=!1;if(!j)try{window.parent.document&&(q=!1)}catch(e){q=!0}if(j&&!n)throw Error("emit function is required");void 0!==C&&void 0===I.mousemove&&(I.mousemove=C),tx.reset();let F=!0===g?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==m?m:{password:!0},U=!0===y||"all"===y?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===y,headMetaDescKeywords:"all"===y}:y||{};!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw TypeError("1 argument is required");do if(this===t)return!0;while(t=t&&t.parentNode);return!1})}();let z=0,B=e=>{for(let t of N||[])t.eventProcessor&&(e=t.eventProcessor(e));return S&&!q&&(e=S(e)),e};s=(e,o)=>{var s;if((null===(s=te[0])||void 0===s?void 0:s.isFrozen())&&e.type!==eM.FullSnapshot&&!(e.type===eM.IncrementalSnapshot&&e.data.source===eO.Mutation)&&te.forEach(e=>e.unfreeze()),j)null==n||n(B(e),o);else if(q){let t={type:"rrweb",event:B(e),origin:window.location.origin,isCheckout:o};window.parent.postMessage(t,"*")}if(e.type===eM.FullSnapshot)t=e,z=0;else if(e.type===eM.IncrementalSnapshot){if(e.data.source===eO.Mutation&&e.data.isAttachIframe)return;z++;let n=i&&z>=i,o=r&&e.timestamp-t.timestamp>r;(n||o)&&a(!0)}};let W=e=>{s(tM({type:eM.IncrementalSnapshot,data:Object.assign({source:eO.Mutation},e)}))},G=e=>s(tM({type:eM.IncrementalSnapshot,data:Object.assign({source:eO.Scroll},e)})),V=e=>s(tM({type:eM.IncrementalSnapshot,data:Object.assign({source:eO.CanvasMutation},e)})),K=new tT({mutationCb:W,adoptedStyleSheetCb:e=>s(tM({type:eM.IncrementalSnapshot,data:Object.assign({source:eO.AdoptedStyleSheet},e)}))}),J=new e3({mirror:tx,mutationCb:W,stylesheetManager:K,recordCrossOriginIframes:M,wrappedEmit:s});for(let e of N||[])e.getMirror&&e.getMirror({nodeMirror:tx,crossOriginIframeMirror:J.crossOriginIframeMirror,crossOriginIframeStyleMirror:J.crossOriginIframeStyleMirror});let H=new tC;u=new tE({recordCanvas:T,mutationCb:V,win:window,blockClass:c,blockSelector:l,mirror:tx,sampling:I.canvas,dataURLOptions:E});let $=new tk({mutationCb:W,scrollCb:G,bypassOptions:{blockClass:c,blockSelector:l,maskTextClass:h,maskTextSelector:p,inlineStylesheet:v,maskInputOptions:F,dataURLOptions:E,maskTextFn:_,maskInputFn:b,recordCanvas:T,inlineImages:P,sampling:I,slimDOMOptions:U,iframeManager:J,stylesheetManager:K,canvasManager:u,keepIframeSrcFn:D,processedNodeManager:H},mirror:tx});a=(e=!1)=>{if(!k)return;s(tM({type:eM.Meta,data:{href:window.location.href,width:eW(),height:eB()}}),e),K.reset(),$.init(),te.forEach(e=>e.lock());let t=function(e,t){let{mirror:n=new eo,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:u=!1,recordCanvas:c=!1,maskAllInputs:l=!1,maskTextFn:d,maskInputFn:f,slimDOM:h=!1,dataURLOptions:p,preserveWhiteSpace:v,onSerialize:g,onIframeLoad:m,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:_,keepIframeSrcFn:w=()=>!1}=t||{};return eT(e,{doc:e,mirror:n,blockClass:r,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:!0===l?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===l?{password:!0}:l,maskTextFn:d,maskInputFn:f,slimDOMOptions:!0===h||"all"===h?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===h,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===h?{}:h,dataURLOptions:p,inlineImages:u,recordCanvas:c,preserveWhiteSpace:v,onSerialize:g,onIframeLoad:m,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:_,keepIframeSrcFn:w,newlyAddedElement:!1})}(document,{mirror:tx,blockClass:c,blockSelector:l,maskTextClass:h,maskTextSelector:p,inlineStylesheet:v,maskAllInputs:F,maskTextFn:_,maskInputFn:b,slimDOM:U,dataURLOptions:E,recordCanvas:T,inlineImages:P,onSerialize:e=>{eH(e,tx)&&J.addIframe(e),e$(e,tx)&&K.trackLinkElement(e),eY(e)&&$.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{J.attachIframe(e,t),$.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{K.attachLinkElement(e,t)},keepIframeSrcFn:D});if(!t)return console.warn("Failed to snapshot the document");s(tM({type:eM.FullSnapshot,data:{node:t,initialOffset:ez(window)}}),e),te.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&K.adoptStyleSheets(document.adoptedStyleSheets,tx.getId(document))};try{let e=[],t=e=>{var t;return e0(tl)({mutationCb:W,mousemoveCb:(e,t)=>s(tM({type:eM.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>s(tM({type:eM.IncrementalSnapshot,data:Object.assign({source:eO.MouseInteraction},e)})),scrollCb:G,viewportResizeCb:e=>s(tM({type:eM.IncrementalSnapshot,data:Object.assign({source:eO.ViewportResize},e)})),inputCb:e=>s(tM({type:eM.IncrementalSnapshot,data:Object.assign({source:eO.Input},e)})),mediaInteractionCb:e=>s(tM({type:eM.IncrementalSnapshot,data:Object.assign({source:eO.MediaInteraction},e)})),styleSheetRuleCb:e=>s(tM({type:eM.IncrementalSnapshot,data:Object.assign({source:eO.StyleSheetRule},e)})),styleDeclarationCb:e=>s(tM({type:eM.IncrementalSnapshot,data:Object.assign({source:eO.StyleDeclaration},e)})),canvasMutationCb:V,fontCb:e=>s(tM({type:eM.IncrementalSnapshot,data:Object.assign({source:eO.Font},e)})),selectionCb:e=>{s(tM({type:eM.IncrementalSnapshot,data:Object.assign({source:eO.Selection},e)}))},blockClass:c,ignoreClass:d,ignoreSelector:f,maskTextClass:h,maskTextSelector:p,maskInputOptions:F,inlineStylesheet:v,sampling:I,recordDOM:k,recordCanvas:T,inlineImages:P,userTriggeredOnInput:x,collectFonts:R,doc:e,maskInputFn:b,maskTextFn:_,keepIframeSrcFn:D,blockSelector:l,slimDOMOptions:U,dataURLOptions:E,mirror:tx,iframeManager:J,stylesheetManager:K,shadowDomManager:$,processedNodeManager:H,canvasManager:u,ignoreCSSAttributes:A,plugins:(null===(t=null==N?void 0:N.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>s(tM({type:eM.Plugin,data:{plugin:e.name,payload:t}}))})))||[]},w)};J.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}});let n=()=>{a(),e.push(t(document)),tO=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(eD("DOMContentLoaded",()=>{s(tM({type:eM.DomContentLoaded,data:{}})),"DOMContentLoaded"===O&&n()})),e.push(eD("load",()=>{s(tM({type:eM.Load,data:{}})),"load"===O&&n()},window))),()=>{e.forEach(e=>e()),H.destroy(),tO=!1,o=void 0}}catch(e){console.warn(e)}}tR.addCustomEvent=(e,t)=>{if(!tO)throw Error("please add custom event after start recording");s(tM({type:eM.Custom,data:{tag:e,payload:t}}))},tR.freezePage=()=>{te.forEach(e=>e.freeze())},tR.takeFullSnapshot=e=>{if(!tO)throw Error("please take full snapshot after start recording");a(e)},tR.mirror=tx;var tP=Uint8Array,tN=Uint16Array,tD=Uint32Array,tA=new tP([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),tL=new tP([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),tj=new tP([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tq=function(e,t){for(var n=new tN(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&tV)<<1;tK=(61680&(tK=(52428&tK)>>>2|(13107&tK)<<2))>>>4|(3855&tK)<<4,tG[tV]=((65280&tK)>>>8|(255&tK)<<8)>>>1}for(var tJ=function(e,t,n){for(var r,i=e.length,o=0,s=new tN(t);o>>u]=c}else for(o=0,r=new tN(i);o>>15-e[o];return r},tH=new tP(288),tV=0;tV<144;++tV)tH[tV]=8;for(var tV=144;tV<256;++tV)tH[tV]=9;for(var tV=256;tV<280;++tV)tH[tV]=7;for(var tV=280;tV<288;++tV)tH[tV]=8;for(var t$=new tP(32),tV=0;tV<32;++tV)t$[tV]=5;var tY=tJ(tH,9,0),tZ=tJ(t$,5,0),tQ=function(e){return(e/8>>0)+(7&e&&1)},tX=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof tN?tN:e instanceof tD?tD:tP)(n-t);return r.set(e.subarray(t,n)),r},t0=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},t1=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},t2=function(e,t){for(var n=[],r=0;rf&&(f=o[r].s);var h=new tN(f+1),p=t3(n[l-1],h,0);if(p>t){var r=0,v=0,g=p-t,m=1<t)v+=m-(1<>>=g;v>0;){var b=o[r].s;h[b]=0&&v;--r){var _=o[r].s;h[_]==t&&(--h[_],++v)}p=t}return[new tP(h),p]},t3=function(e,t,n){return -1==e.s?Math.max(t3(e.l,t,n+1),t3(e.r,t,n+1)):t[e.s]=n},t4=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new tN(++t),r=0,i=e[0],o=1,s=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[a]}return[n.subarray(0,r),t]},t5=function(e,t){for(var n=0,r=0;r>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o4&&!x[tj[P-1]];--P);var N=c+5<<3,D=t5(i,tH)+t5(o,t$)+s,A=t5(i,g)+t5(o,b)+s+14+3*P+t5(T,x)+(2*T[16]+3*T[17]+7*T[18]);if(N<=D&&N<=A)return t6(t,l,e.subarray(u,u+c));if(t0(t,l,1+(A15&&(t0(t,l,F[M]>>>5&127),l+=F[M]>>>12)}}else d=tY,f=tH,h=tZ,p=t$;for(var M=0;M255){var U=r[M]>>>18&31;t1(t,l,d[U+257]),l+=f[U+257],U>7&&(t0(t,l,r[M]>>>23&31),l+=tA[U]);var z=31&r[M];t1(t,l,h[z]),l+=p[z],z>3&&(t1(t,l,r[M]>>>5&8191),l+=tL[z])}else t1(t,l,d[r[M]]),l+=f[r[M]];return t1(t,l,d[256]),l+f[256]},t7=new tD([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),t9=new tP(0),ne=function(e,t,n,r,i,o){var s=e.length,a=new tP(r+s+5*(1+Math.floor(s/7e3))+i),u=a.subarray(r,a.length-i),c=0;if(!t||s<8)for(var l=0;l<=s;l+=65535){var d=l+65535;d>>13,p=8191&f,v=(1<7e3||k>24576)&&P>423){c=t8(e,u,0,w,S,I,C,k,M,l-M,c),k=E=C=0,M=l;for(var N=0;N<286;++N)S[N]=0;for(var N=0;N<30;++N)I[N]=0}var D=2,A=0,L=p,j=x-R&32767;if(P>2&&O==_(l-j))for(var q=Math.min(h,P)-1,F=Math.min(32767,l),U=Math.min(258,P);j<=F&&--L&&x!=R;){if(e[l+D]==e[l+D-j]){for(var z=0;zD){if(D=z,A=j,z>q)break;for(var B=Math.min(j,z-2),W=0,N=0;NW&&(W=K,R=G)}}}R=g[x=R],j+=x-R+32768&32767}if(A){w[k++]=268435456|tz[D]<<18|tW[A];var J=31&tz[D],H=31&tW[A];C+=tA[J]+tL[H],++S[257+J],++I[H],T=l+D,++E}else w[k++]=e[l],++S[e[l]]}}c=t8(e,u,o,w,S,I,C,k,M,l-M,c),o||(c=t6(u,c,t9))}return tX(a,0,r+tQ(c)+i)},nt=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,o=n.length,s=0;s!=o;){for(var a=Math.min(s+5552,o);s>>8<<16|(255&t)<<8|t>>>8)+((255&e)<<23)*2}}},nn=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},nr=function(e,t){var n=t.level,r=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=r<<6|(r?32-2*r:1)};let ni=e=>{var t,n,r,i,o;return function(e,t){var n="";if(!t&&"undefined"!=typeof TextDecoder)return new TextDecoder().decode(e);for(var r=0;r>10,56320|1023&i)}return n}((t=function(e,t){var n=e.length;if("undefined"!=typeof TextEncoder)return new TextEncoder().encode(e);for(var r=new tP(e.length+(e.length>>>1)),i=0,o=function(e){r[i++]=e},s=0;sr.length){var a=new tP(i+8+(n-s<<1));a.set(r),r=a}var u=e.charCodeAt(s);u<128?o(u):(u<2048?o(192|u>>>6):(u>55295&&u<57344?(o(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++s))>>>18),o(128|u>>>12&63)):o(224|u>>>12),o(128|u>>>6&63)),o(128|63&u))}return tX(r,0,i)}(JSON.stringify(Object.assign(Object.assign({},e),{v:"v1"}))),void 0===n&&(n={}),(r=nt()).p(t),nr(o=ne(t,null==(i=n).level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,2,4,!0),n),nn(o,o.length-4,r.d()),o),!0)};var no=n(327704),ns=n(594789),na="Remote config fetch rejected due to timeout after 5 seconds",nu=function(){function e(e){var t=e.localConfig,n=e.configKeys,r=this;this.retryTimeout=1e3,this.attempts=0,this.sessionTargetingMatch=!1,this.metrics={},this.getRemoteConfig=function(e,t,n){return(0,q.__awaiter)(r,void 0,void 0,function(){var r,i,o;return(0,q.__generator)(this,function(s){switch(s.label){case 0:return r=Date.now(),[4,this.fetchWithTimeout(n)];case 1:if((i=s.sent())&&(o=i.configs&&i.configs[e]))return this.metrics.fetchTimeAPISuccess=Date.now()-r,[2,o[t]];return this.metrics.fetchTimeAPIFail=Date.now()-r,[2,void 0]}})})},this.fetchWithTimeout=function(e){return(0,q.__awaiter)(r,void 0,void 0,function(){var t,n,r;return(0,q.__generator)(this,function(i){switch(i.label){case 0:return t=new AbortController,n=setTimeout(function(){return t.abort()},5e3),[4,this.fetchRemoteConfig(t.signal,e)];case 1:return r=i.sent(),clearTimeout(n),[2,r]}})})},this.fetchRemoteConfig=function(e,t){return(0,q.__awaiter)(r,void 0,void 0,function(){var n,r,i,o,s,a,u,c,l,d;return(0,q.__generator)(this,function(f){switch(f.label){case 0:if(t===this.lastFetchedSessionId&&this.attempts>=this.localConfig.flushMaxRetries)return[2,this.completeRequest({err:"Remote config fetch rejected due to exceeded retry count"})];if(e.aborted)return[2,this.completeRequest({err:na})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0),f.label=1;case 1:f.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(i=(r=(0,q.__values)(this.configKeys)).next();!i.done;i=r.next())o=i.value,n.append("config_keys",o)}catch(e){l={error:e}}finally{try{i&&!i.done&&(d=r.return)&&d.call(r)}finally{if(l)throw l.error}}return t&&n.set("session_id",String(t)),s={headers:{Accept:"*/*"},method:"GET"},a="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(a,(0,q.__assign)((0,q.__assign)({},s),{signal:e}))];case 2:if(null===(u=f.sent()))return[2,this.completeRequest({err:"Unexpected error occurred"})];switch(new no.d().buildStatus(u.status)){case ns.q.Success:return this.attempts=0,[2,this.parseAndStoreConfig(u)];case ns.q.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}return[3,4];case 3:if(c=f.sent(),e.aborted)return[2,this.completeRequest({err:na})];return[2,this.completeRequest({err:c.message})];case 4:return[2]}})})},this.retryFetch=function(e,t){return(0,q.__awaiter)(r,void 0,void 0,function(){var n=this;return(0,q.__generator)(this,function(r){switch(r.label){case 0:return[4,new Promise(function(e){return setTimeout(e,n.attempts*n.retryTimeout)})];case 1:return r.sent(),[2,this.fetchRemoteConfig(e,t)]}})})},this.parseAndStoreConfig=function(e){return(0,q.__awaiter)(r,void 0,void 0,function(){var t;return(0,q.__generator)(this,function(n){switch(n.label){case 0:return[4,e.json()];case 1:return t=n.sent(),this.completeRequest({success:"Remote config successfully fetched"}),[2,t]}})})},this.localConfig=t,this.configKeys=n}return e.prototype.getServerUrl=function(){return this.localConfig.serverZone===G.J.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===G.J.EU?"https://sr-client-cfg.eu.amplitude.com/config":"https://sr-client-cfg.amplitude.com/config"},e.prototype.completeRequest=function(e){var t=e.err,n=e.success;if(t)throw Error(t);n&&this.localConfig.loggerProvider.log(n)},e}(),nc=function(e){var t=e.localConfig,n=e.configKeys;return(0,q.__awaiter)(void 0,void 0,void 0,function(){return(0,q.__generator)(this,function(e){return[2,new nu({localConfig:t,configKeys:n})]})})},nl="medium";(b=R||(R={}))[b.Document=0]="Document",b[b.DocumentType=1]="DocumentType",b[b.Element=2]="Element",b[b.Text=3]="Text",b[b.CDATA=4]="CDATA",b[b.Comment=5]="Comment",RegExp(/(max|min)-device-(width|height)/.source,"g"),RegExp(/([^\\]):hover/.source,"g");var nd=function(e,t,n){switch(t){case"light":if("input"!==e)return!0;var r=n?function(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?t.toLowerCase():null}(n):"";if(!r)return!1;if(["password","hidden","email","tel"].includes(r)||n.autocomplete.startsWith("cc-"))return!0;return!1;case"medium":case"conservative":return!0;default:return nd(e,nl,n)}},nf=function(e,t,n){var r,i,o;if(void 0===t&&(t={defaultMaskLevel:nl}),n){if(n.closest("."+$)||(null!==(r=t.maskSelector)&&void 0!==r?r:[]).some(function(e){return n.closest(e)}))return!0;if(n.closest(".amp-unmask")||(null!==(i=t.unmaskSelector)&&void 0!==i?i:[]).some(function(e){return n.closest(e)}))return!1}return nd(e,null!==(o=t.defaultMaskLevel)&&void 0!==o?o:nl,n)},nh=function(e,t){return function(n,r){return nf(e,t,r)?n.replace(/[^\s]/g,"*"):n}},np=function(e){var t=0;if(0===e.length)return t;for(var n=0;n0?(Object.prototype.hasOwnProperty.call(l,"capture_enabled")?i.captureEnabled=l.capture_enabled:i.captureEnabled=!1,Object.prototype.hasOwnProperty.call(l,"sample_rate")&&(i.sampleRate=l.sample_rate)):(i.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),d){f=null!==(t=i.privacyConfig)&&void 0!==t?t:{},h={defaultMaskLevel:null!==(r=null!==(n=d.defaultMaskLevel)&&void 0!==n?n:f.defaultMaskLevel)&&void 0!==r?r:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[]},p=function(e){var t,n,r,i,o,s,a,u,c,l={};"string"==typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var d=(0,q.__values)(null!==(a=e.blockSelector)&&void 0!==a?a:[]),f=d.next();!f.done;f=d.next()){var h=f.value;l[h]="block"}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}try{for(var p=(0,q.__values)(null!==(u=e.maskSelector)&&void 0!==u?u:[]),v=p.next();!v.done;v=p.next()){var h=v.value;l[h]="mask"}}catch(e){r={error:e}}finally{try{v&&!v.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}try{for(var g=(0,q.__values)(null!==(c=e.unmaskSelector)&&void 0!==c?c:[]),m=g.next();!m.done;m=g.next()){var h=m.value;l[h]="unmask"}}catch(e){o={error:e}}finally{try{m&&!m.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}return l},v=(0,q.__assign)((0,q.__assign)({},p(f)),p(d));try{for(m=(g=(0,q.__values)(Object.entries(v))).next();!m.done;m=g.next())b=(y=(0,q.__read)(m.value,2))[0],_=y[1],"mask"===_?h.maskSelector.push(b):"block"===_?h.blockSelector.push(b):"unmask"===_&&h.unmaskSelector.push(b)}catch(e){w={error:e}}finally{try{m&&!m.done&&(S=g.return)&&S.call(g)}finally{if(w)throw w.error}}i.privacyConfig=nb(h,this.localConfig.loggerProvider)}return this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:ny(i)},null,2)),[2,i]}})})},e}(),nw=n(997172),nS="Failed to store session replay events in IndexedDB";(_=P||(P={})).RECORDING="recording",_.SENT="sent";var nI="sessionCurrentSequence",nE="sequencesToSend",nC=function(){var e=(0,Q.l)();return new Promise(function(t,n){if(!e)return n(Error("Global scope not found"));if(!e.indexedDB)return n(Error("Session Replay: cannot find indexedDB"));try{var r=e.indexedDB.open("keyval-store");r.onupgradeneeded=function(){1===r.result.version&&(r.result.close(),r.transaction&&r.transaction.abort(),e.indexedDB.deleteDatabase("keyval-store"),t())},r.onsuccess=function(){t(r.result)}}catch(e){n(e)}})},nk=function(e){return(0,q.__awaiter)(void 0,void 0,void 0,function(){return(0,q.__generator)(this,function(t){switch(t.label){case 0:if(!(e.length>0))return[3,2];return[4,Promise.all(e.splice(0,10))];case 1:return t.sent(),[3,0];case 2:return[2]}})})},nT=function(e){var t,n;return e.objectStoreNames.contains(nI)||(n=e.createObjectStore(nI,{keyPath:"sessionId"})),e.objectStoreNames.contains(nE)||(t=e.createObjectStore(nE,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:n}},nM=function(){function e(e){var t=e.loggerProvider,n=e.apiKey,r=e.minInterval,i=e.maxInterval,o=this;this.storageKey="",this.maxPersistedEventsSize=1e6,this.timeAtLastSplit=null,this.shouldSplitEventsList=function(e,t){var n=new Blob([t]).size;return new Blob(e).size+n>=o.maxPersistedEventsSize||!!(null!==o.timeAtLastSplit&&o.interval&&Date.now()-o.timeAtLastSplit>o.interval)&&!!e.length&&(o.interval=Math.min(o.maxInterval,o.interval+o.minInterval),o.timeAtLastSplit=Date.now(),!0)},this.getSequencesToSend=function(){return(0,q.__awaiter)(o,void 0,void 0,function(){var e,t;return(0,q.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,null===(t=this.db)||void 0===t?void 0:t.getAll(nE)];case 1:return[2,n.sent()];case 2:return e=n.sent(),this.loggerProvider.warn("".concat(nS,": ").concat(e)),[3,3];case 3:return[2,void 0]}})})},this.storeCurrentSequence=function(e){return(0,q.__awaiter)(o,void 0,void 0,function(){var t,n,r;return(0,q.__generator)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,4,,5]),!this.db)return[2,void 0];return[4,this.db.get(nI,e)];case 1:if(!(t=i.sent()))return[2,void 0];return[4,this.db.put(nE,{sessionId:e,events:t.events})];case 2:return n=i.sent(),[4,this.db.put(nI,{sessionId:e,events:[]})];case 3:return i.sent(),[2,(0,q.__assign)((0,q.__assign)({},t),{sessionId:e,sequenceId:n})];case 4:return r=i.sent(),this.loggerProvider.warn("".concat(nS,": ").concat(r)),[3,5];case 5:return[2,void 0]}})})},this.addEventToCurrentSequence=function(e,t){return(0,q.__awaiter)(o,void 0,void 0,function(){var n,r,i,o,s,a,u;return(0,q.__generator)(this,function(c){switch(c.label){case 0:0===this.interval&&(this.interval=this.minInterval),c.label=1;case 1:if(c.trys.push([1,11,,12]),!(n=null===(u=this.db)||void 0===u?void 0:u.transaction(nI,"readwrite")))return[2];return[4,n.store.get(e)];case 2:if(r=c.sent())return[3,4];return[4,n.store.put({sessionId:e,events:[t]})];case 3:return c.sent(),[2];case 4:if(i=void 0,!this.shouldSplitEventsList(r.events,t))return[3,6];return i=r.events,[4,n.store.put({sessionId:e,events:[t]})];case 5:return c.sent(),[3,8];case 6:return o=r.events.concat(t),[4,n.store.put({sessionId:e,events:o})];case 7:c.sent(),c.label=8;case 8:return[4,n.done];case 9:if(c.sent(),!i)return[2,void 0];return[4,this.storeSendingEvents(e,i)];case 10:if(!(s=c.sent()))return[2,void 0];return[2,{events:i,sessionId:e,sequenceId:s}];case 11:return a=c.sent(),this.loggerProvider.warn("".concat(nS,": ").concat(a)),[3,12];case 12:return[2,void 0]}})})},this.storeSendingEvents=function(e,t){return(0,q.__awaiter)(o,void 0,void 0,function(){var n,r;return(0,q.__generator)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,null===(r=this.db)||void 0===r?void 0:r.put(nE,{sessionId:e,events:t})];case 1:return[2,i.sent()];case 2:return n=i.sent(),this.loggerProvider.warn("".concat(nS,": ").concat(n)),[3,3];case 3:return[2,void 0]}})})},this.cleanUpSessionEventsStore=function(e){return(0,q.__awaiter)(o,void 0,void 0,function(){var t,n;return(0,q.__generator)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,null===(n=this.db)||void 0===n?void 0:n.delete(nE,e)];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),this.loggerProvider.warn("".concat(nS,": ").concat(t)),[3,3];case 3:return[2]}})})},this.transitionFromKeyValStore=function(e){return(0,q.__awaiter)(o,void 0,void 0,function(){var t,n,r,i,o,s,a,u=this;return(0,q.__generator)(this,function(c){switch(c.label){case 0:return c.trys.push([0,6,,7]),[4,nC()];case 1:if(!(t=c.sent()))return[2];n=function(e,t){return(0,q.__awaiter)(u,void 0,void 0,function(){var n,r,i=this;return(0,q.__generator)(this,function(o){switch(o.label){case 0:return n=t.sessionSequences,r=[],Object.keys(n).forEach(function(o){var s=parseInt(o,10),a=n[s];if(s===t.currentSequenceId){var u=a.events.map(function(t){return(0,q.__awaiter)(i,void 0,void 0,function(){return(0,q.__generator)(this,function(n){return[2,this.addEventToCurrentSequence(e,t)]})})});r.concat(u)}else a.status!==P.SENT&&r.push(i.storeSendingEvents(e,a.events))}),[4,nk(r)];case 1:return o.sent(),[2]}})})},r="".concat(W.f1,"_").concat(this.apiKey.substring(0,10)),c.label=2;case 2:return c.trys.push([2,4,,5]),i=t.transaction("keyval").objectStore("keyval").getAll(r),[4,new Promise(function(t){i.onsuccess=function(r){return(0,q.__awaiter)(u,void 0,void 0,function(){var i,o,s,a=this;return(0,q.__generator)(this,function(u){switch(u.label){case 0:if(!(o=(i=r&&r.target.result)&&i[0]))return[3,2];return s=[],Object.keys(o).forEach(function(t){var r=parseInt(t,10),i=o[r];if(e===r)s.push(n(r,i));else{var u=i.sessionSequences;Object.keys(u).forEach(function(e){var t=parseInt(e,10);u[t].status!==P.SENT&&s.push(a.storeSendingEvents(r,u[t].events))})}}),[4,nk(s)];case 1:u.sent(),u.label=2;case 2:return t(),[2]}})})}})];case 3:return c.sent(),(o=(0,Q.l)())&&o.indexedDB.deleteDatabase("keyval-store"),[3,5];case 4:return s=c.sent(),this.loggerProvider.warn("Failed to transition session replay events from keyval to new store: ".concat(s)),[3,5];case 5:return[3,7];case 6:return a=c.sent(),this.loggerProvider.warn("Failed to access keyval store: ".concat(a,". For more information, visit: https://www.docs.developers.amplitude.com/session-replay/sdks/standalone/#indexeddb-best-practices")),[3,7];case 7:return[2]}})})},this.loggerProvider=t,this.apiKey=n,this.maxInterval=null!=i?i:1e4,this.minInterval=null!=r?r:500,this.interval=0}return e.prototype.initialize=function(e,t){return(0,q.__awaiter)(this,void 0,void 0,function(){var n,r,i;return(0,q.__generator)(this,function(o){switch(o.label){case 0:return n="replay"===e?"":"_".concat(e),r="".concat(this.apiKey.substring(0,10),"_amp_session_replay_events").concat(n),i=this,[4,(0,q.__awaiter)(void 0,void 0,void 0,function(){return(0,q.__generator)(this,function(e){switch(e.label){case 0:return[4,(0,nw.X3)(r,1,{upgrade:nT})];case 1:return[2,e.sent()]}})})];case 1:return i.db=o.sent(),this.timeAtLastSplit=Date.now(),[4,this.transitionFromKeyValStore(t)];case 2:return o.sent(),[2]}})})},e}(),nO=function(e){var t=e.loggerProvider,n=e.apiKey,r=e.sessionId,i=e.type,o=e.minInterval,s=e.maxInterval;return(0,q.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,q.__generator)(this,function(a){switch(a.label){case 0:return[4,(e=new nM({loggerProvider:t,apiKey:n,minInterval:o,maxInterval:s})).initialize(i,r)];case 1:return a.sent(),[2,e]}})})},nx="1.13.7",nR=function(){function e(e){var t=e.loggerProvider,n=e.payloadBatcher;this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.loggerProvider=t,this.payloadBatcher=n||function(e){return e}}return e.prototype.sendEventsList=function(e){this.addToQueue((0,q.__assign)((0,q.__assign)({},e),{attempts:0,timeout:0}))},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n0&&t.schedule(e)})},e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,q.__awaiter)(this,void 0,void 0,function(){var t,n,r=this;return(0,q.__generator)(this,function(i){switch(i.label){case 0:return t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),this.queue=n,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),[4,Promise.all(t.map(function(t){return r.send(t,e)}))];case 1:return i.sent(),[2]}})})},e.prototype.send=function(e,t){var n,r;return void 0===t&&(t=!0),(0,q.__awaiter)(this,void 0,void 0,function(){var i,o,s,a,u,c,l,d,f,h,p,v;return(0,q.__generator)(this,function(g){switch(g.label){case 0:if(!(i=e.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(o=e.deviceId))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];if(s=nv(),a=nx,u=e.sampleRate,c=new URLSearchParams({device_id:o,session_id:"".concat(e.sessionId),seq_number:"".concat(e.sequenceId),type:"".concat(e.type)}),l="".concat((null===(n=e.version)||void 0===n?void 0:n.type)||"standalone","/").concat((null===(r=e.version)||void 0===r?void 0:r.version)||a),0===(d=this.payloadBatcher({version:1,events:e.events})).events.length)return this.completeRequest({context:e}),[2];g.label=1;case 1:return g.trys.push([1,3,,4]),f={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(i),"X-Client-Version":a,"X-Client-Library":l,"X-Client-Url":s,"X-Client-Sample-Rate":"".concat(u)},body:JSON.stringify(d),method:"POST"},[4,fetch("".concat(ng(e.serverZone),"?").concat(c.toString()),f)];case 2:if(null===(h=g.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)this.handleReponse(h.status,e);else{p="";try{p=JSON.stringify(h.body,null,2)}catch(e){}this.completeRequest({context:e,success:"".concat(h.status,": ").concat(p)})}return[3,4];case 3:return v=g.sent(),this.completeRequest({context:e,err:v}),[3,4];case 4:return[2]}})})},e.prototype.handleReponse=function(e,t){switch(new no.d().buildStatus(e)){case ns.q.Success:this.handleSuccessResponse(t);break;case ns.q.Failed:this.handleOtherResponse(t);break;default:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"})}},e.prototype.handleSuccessResponse=function(e){var t=Math.round(new Blob(e.events).size/1024);this.completeRequest({context:e,success:"Session replay event batch with seq id ".concat(e.sequenceId," tracked successfully for session id ").concat(e.sessionId,", size of events: ").concat(t," KB")})},e.prototype.handleOtherResponse=function(e){this.addToQueue((0,q.__assign)((0,q.__assign)({},e),{timeout:e.attempts*this.retryTimeout}))},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.onComplete(t.sequenceId),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e}(),nP=function(e){var t=e.config,n=e.sessionId,r=e.minInterval,i=e.maxInterval,o=e.type,s=e.payloadBatcher;return(0,q.__awaiter)(void 0,void 0,void 0,function(){var e,a,u;function c(t){return void 0===t&&(t=!1),(0,q.__awaiter)(this,void 0,void 0,function(){return(0,q.__generator)(this,function(n){return[2,e.flush(t)]})})}return(0,q.__generator)(this,function(l){switch(l.label){case 0:return e=new nR({loggerProvider:t.loggerProvider,payloadBatcher:s}),[4,nO({loggerProvider:t.loggerProvider,apiKey:t.apiKey,sessionId:n,minInterval:r,maxInterval:i,type:o})];case 1:return a=l.sent(),u=function(n){var r=n.events,i=n.sessionId,s=n.deviceId,u=n.sequenceId;t.debugMode&&nm().then(function(e){var n=e.totalStorageSize,r=e.percentOfQuota,i=e.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(n," KB, percentage of quota: ").concat(r,"%, usage details: ").concat(i))}).catch(function(){}),e.sendEventsList({events:r,sequenceId:u,sessionId:i,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:s,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:o,onComplete:a.cleanUpSessionEventsStore.bind(a)})},[2,{sendCurrentSequenceEvents:function(e){var n=e.sessionId,r=e.deviceId;a.storeCurrentSequence(n).then(function(e){e&&u({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r})}).catch(function(e){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",e)})},addEvent:function(e){var n=e.event,r=e.sessionId,i=e.deviceId;a.addEventToCurrentSequence(r,n.data).then(function(e){return e&&u({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:i})}).catch(function(e){t.loggerProvider.warn("Failed to add event to session replay capture:",e)})},sendStoredEvents:function(e){var t=e.deviceId;return(0,q.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,q.__generator)(this,function(n){switch(n.label){case 0:return[4,a.getSequencesToSend()];case 1:return(e=n.sent())&&e.forEach(function(e){u({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:t})}),[2]}})})},flush:c}]}})})},nN=function(){function e(){for(var e=[],t=0;tN.timeoutMs)throw Error("Timeout: Can't find a unique selector after ".concat(l,"ms"));var d=n$((e=o.getAttribute("id"))&&N.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null)||n$.apply(void 0,(0,q.__spreadArray)([],(0,q.__read)(Array.from(o.attributes).filter(function(e){return N.attr(e.name,e.value)}).map(function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}})),!1))||n$.apply(void 0,(0,q.__spreadArray)([],(0,q.__read)(Array.from(o.classList).filter(N.className).map(function(e){return{name:"."+CSS.escape(e),penalty:1}})),!1))||n$((a=o.tagName.toLowerCase(),N.tagName(a)?{name:a,penalty:2}:null))||[nK()],f=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;for(var r=0;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(o);if("all"==t)f&&(d=d.concat(d.filter(nH).map(function(e){return nJ(e,f)})));else if("two"==t)d=d.slice(0,1),f&&(d=d.concat(d.filter(nH).map(function(e){return nJ(e,f)})));else if("one"==t){var h=(0,q.__read)(d=d.slice(0,1),1)[0];f&&nH(h)&&(d=[nJ(h,f)])}else"none"==t&&(d=[nK()],f&&(d=[nJ(d[0],f)]));try{for(var p=(u=void 0,(0,q.__values)(d)),v=p.next();!v.done;v=p.next()){var h=v.value;h.level=s}}catch(e){u={error:e}}finally{try{v&&!v.done&&(c=p.return)&&c.call(p)}finally{if(u)throw u.error}}if(i.push(d),i.length>=N.seedMinLength&&(r=nB(i,n)))return"break";o=o.parentElement,s++}(););return(r||(r=nB(i,n)),!r&&n)?n():r}function nB(e,t){var n,r,i=nZ(function e(t,n){var r,i,o,s,a;return void 0===n&&(n=[]),(0,q.__generator)(this,function(u){switch(u.label){case 0:if(!(t.length>0))return[3,9];u.label=1;case 1:u.trys.push([1,6,7,8]),i=(r=(0,q.__values)(t[0])).next(),u.label=2;case 2:if(i.done)return[3,5];return o=i.value,[5,(0,q.__values)(e(t.slice(1,t.length),n.concat(o)))];case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return s={error:u.sent()},[3,8];case 7:try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}return[7];case 8:return[3,11];case 9:return[4,n];case 10:u.sent(),u.label=11;case 11:return[2]}})}(e));if(i.length>N.threshold)return t?t():null;try{for(var o=(0,q.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(nV(a))return a}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null}function nW(e){for(var t=e[0],n=t.name,r=1;r ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function nG(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function nV(e){var t=nW(e);switch(D.querySelectorAll(t).length){case 0:throw Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function nK(){return{name:"*",penalty:3}}function nJ(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function nH(e){return"html"!==e.name&&!e.name.startsWith("#")}function n$(){for(var e=[],t=0;t0?n:null}function nY(e){return null!=e}function nZ(e){return(0,q.__spreadArray)([],(0,q.__read)(e),!1).sort(function(e,t){return nG(e)-nG(t)})}var nQ=function(e){var t=e.version,n=e.events,r=[];return n.forEach(function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&r.push(t)}),{version:t,events:r}},nX=function(e){var t=e.version,n=e.events,r=[];return n.forEach(function(e){var t=JSON.parse(e);"click"===t.type&&r.push(t)}),{version:t,events:Object.values(r.reduce(function(e,t){var n=t.x,r=t.y,i=t.selector,o=t.timestamp,s=o-o%36e5,a="".concat(n,":").concat(r,":").concat(null!=i?i:"",":").concat(s);return e[a]?e[a].count+=1:e[a]=(0,q.__assign)((0,q.__assign)({},t),{timestamp:s,count:1}),e},{}))}},n0=function(e){var t=e.eventsManager,n=e.sessionId,r=e.deviceIdFn;return function(e){if(e.type===nL.Click){var i,o=(0,Q.l)();if(o){var s=o.location,a=o.innerHeight,u=o.innerWidth;if(s){var c=e.x,l=e.y,d=tR.mirror.getNode(e.id);d&&(i=function(e,t){if(A=new Date,e.nodeType!==Node.ELEMENT_NODE)throw Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var n,r={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};D=(n=(N=(0,q.__assign)((0,q.__assign)({},r),void 0)).root).nodeType===Node.DOCUMENT_NODE?n:n===r.root?n.ownerDocument:n;var i=nz(e,"all",function(){return nz(e,"two",function(){return nz(e,"one",function(){return nz(e,"none")})})});if(i){var o=nZ(function e(t,n,r){var i,o,s;return void 0===r&&(r={counter:0,visited:new Map}),(0,q.__generator)(this,function(a){switch(a.label){case 0:if(!(t.length>2&&t.length>N.optimizedMinLength))return[3,5];i=1,a.label=1;case 1:var u;if(!(iN.maxNumberOfTries||(r.counter+=1,(o=(0,q.__spreadArray)([],(0,q.__read)(t),!1)).splice(i,1),s=nW(o),r.visited.has(s)))return[2];if(!(nV(o)&&(u=o,D.querySelector(nW(u))===n)))return[3,4];return[4,o];case 2:return a.sent(),r.visited.set(s,!0),[5,(0,q.__values)(e(o,n,r))];case 3:a.sent(),a.label=4;case 4:return i++,[3,1];case 5:return[2]}})}(i,e));return o.length>0&&(i=o[0]),nW(i)}throw Error("Selector was not found.")}(d));var f=ez(o),h={x:c+f.left,y:l+f.top,selector:i,viewportHeight:a,viewportWidth:u,pageUrl:s.href,timestamp:Date.now(),type:"click"},p=r();p&&t.addEvent({sessionId:n,event:{type:"interaction",data:JSON.stringify(h)},deviceId:p})}}}}},n1=function(){function e(e,t){var n=(0,Q.l)();n&&n.navigator&&"function"==typeof n.navigator.sendBeacon?this.sendBeacon=function(e,t){try{if(n.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch(e){}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(e,t){var n=new XMLHttpRequest;return n.open("POST",e,!0),n.setRequestHeader("Accept","*/*"),n.send(JSON.stringify(t)),!0},this.basePageUrl=ng(t.serverZone),this.context=e}return e.prototype.send=function(e,t){var n=this.context,r=n.sessionId,i=n.type,o=new URLSearchParams({device_id:e,session_id:String(r),type:String(i)}),s="".concat(this.basePageUrl,"?").concat(o.toString());this.sendBeacon(s,t)||this.sendXhr(s,t)},e}(),n2=function(){function e(e){var t=this;this.timestamp=Date.now(),this.hook=function(e){t.update(e)},this.send=function(e){return function(n){var r=e(),i=(0,Q.l)();i&&r&&t.transport.send(r,{maxScrollX:t._maxScrollX,maxScrollY:t._maxScrollY,maxScrollWidth:t._maxScrollWidth,maxScrollHeight:t._maxScrollHeight,viewportHeight:eB(),viewportWidth:eW(),pageUrl:i.location.href,timestamp:t.timestamp,type:"scroll"})}},this._maxScrollX=0,this._maxScrollY=0,this._maxScrollWidth=eW(),this._maxScrollHeight=eB(),this.transport=e}return e.default=function(t,n){return new e(new n1(t,n))},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),e.prototype.update=function(e){var t=Date.now();if(e.x>this._maxScrollX){var n=eW();this._maxScrollX=e.x;var r=e.x+n;r>this._maxScrollWidth&&(this._maxScrollWidth=r),this.timestamp=t}if(e.y>this._maxScrollY){var i=eB();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),n3=function(e){var t=e.sessionId,n=e.deviceId;this.deviceId=n,this.sessionId=t,t&&n&&(this.sessionReplayId="".concat(n,"/").concat(t))},n4=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.pageLeaveFns=[],this.teardownEventListeners=function(t){var n=(0,Q.l)();n&&(n.removeEventListener("blur",e.blurListener),n.removeEventListener("focus",e.focusListener),t||n.addEventListener("blur",e.blurListener),t||n.addEventListener("focus",e.focusListener),n.self&&"onpagehide"in n.self?(n.removeEventListener("pagehide",e.pageLeaveListener),t||n.addEventListener("pagehide",e.pageLeaveListener)):(n.removeEventListener("beforeunload",e.pageLeaveListener),t||n.addEventListener("beforeunload",e.pageLeaveListener)))},this.blurListener=function(){e.sendEvents()},this.focusListener=function(){e.recordEvents()},this.pageLeaveListener=function(t){e.pageLeaveFns.forEach(function(e){e(t)})},this.addCustomRRWebEvent=function(t,n,r){return void 0===n&&(n={}),void 0===r&&(r=!0),(0,q.__awaiter)(e,void 0,void 0,function(){var e,i,o;return(0,q.__generator)(this,function(s){switch(s.label){case 0:if(s.trys.push([0,3,,4]),e=void 0,!this.config||(e={config:ny(this.config),version:nx},!r))return[3,2];return[4,nm()];case 1:i=s.sent(),e=(0,q.__assign)((0,q.__assign)({},i),e),s.label=2;case 2:return this.recordCancelCallback?tR.addCustomEvent(t,(0,q.__assign)((0,q.__assign)({},n),e)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(t," due to no ongoing recording.")),[3,4];case 3:return o=s.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",o),[3,4];case 4:return[2]}})})},this.stopRecordingEvents=function(){try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null}catch(t){e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(t.toString()))}},this.loggerProvider=new U.Y}return e.prototype.init=function(e,t){return(0,ee.S)(this._init(e,t))},e.prototype._init=function(e,t){var n,r,i;return(0,q.__awaiter)(this,void 0,void 0,function(){var o,s,a,u,c,l,d;return(0,q.__generator)(this,function(f){switch(f.label){case 0:return this.loggerProvider=t.loggerProvider||new U.Y,Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.identifiers=new n3({sessionId:t.sessionId,deviceId:t.deviceId}),o=this,[4,(0,q.__awaiter)(void 0,void 0,void 0,function(){var n;return(0,q.__generator)(this,function(r){switch(r.label){case 0:return[4,(n=new n_(e,t)).initialize()];case 1:return r.sent(),[2,n]}})})];case 1:return o.joinedConfigGenerator=f.sent(),s=this,[4,this.joinedConfigGenerator.generateJoinedConfig(this.identifiers.sessionId)];case 2:return s.config=f.sent(),t.sessionId&&(null===(n=this.config.interactionConfig)||void 0===n?void 0:n.enabled)&&(a=n2.default({sessionId:t.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[a.send(this.getDeviceId.bind(this))],this.scrollHook=a.hook.bind(a)),u=[],[4,nP({config:this.config,sessionId:this.identifiers.sessionId,type:"replay"})];case 3:if(c=f.sent(),u.push({name:"replay",manager:c}),!(null===(r=this.config.interactionConfig)||void 0===r?void 0:r.enabled))return[3,5];return l=this.config.interactionConfig.batch?nX:nQ,[4,nP({config:this.config,sessionId:this.identifiers.sessionId,type:"interaction",minInterval:null!==(i=this.config.interactionConfig.trackEveryNms)&&void 0!==i?i:3e4,maxInterval:6e4,payloadBatcher:l})];case 4:d=f.sent(),u.push({name:"interaction",manager:d}),f.label=5;case 5:return this.eventsManager=new(nN.bind.apply(nN,(0,q.__spreadArray)([void 0],(0,q.__read)(u),!1))),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.teardownEventListeners(!1),this.initialize(!0),[2]}})})},e.prototype.setSessionId=function(e,t){return(0,ee.S)(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t){return(0,q.__awaiter)(this,void 0,void 0,function(){var n,r,i;return(0,q.__generator)(this,function(o){switch(o.label){case 0:if((n=this.identifiers&&this.identifiers.sessionId)&&this.sendEvents(n),r=t||this.getDeviceId(),this.identifiers=new n3({sessionId:e,deviceId:r}),!(this.joinedConfigGenerator&&n))return[3,2];return i=this,[4,this.joinedConfigGenerator.generateJoinedConfig(this.identifiers.sessionId)];case 1:i.config=o.sent(),o.label=2;case 2:return this.recordEvents(),[2]}})})},e.prototype.getSessionReplayDebugPropertyValue=function(){var e="";return this.config&&(e=np(this.config.apiKey).toString()),JSON.stringify({appHash:e})},e.prototype.getSessionReplayProperties=function(){if(!this.config||!this.identifiers)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var e,t=this.getShouldRecord(),n={};return t&&((e={})[K]=this.identifiers.sessionReplayId?this.identifiers.sessionReplayId:null,n=e,this.config.debugMode&&(n[H]=this.getSessionReplayDebugPropertyValue())),this.addCustomRRWebEvent(O.GET_SR_PROPS,{shouldRecord:t,eventProperties:n},10===this.eventCount),10===this.eventCount&&(this.eventCount=0),this.eventCount++,n},e.prototype.sendEvents=function(e){var t,n=e||(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId),r=this.getDeviceId();this.eventsManager&&n&&r&&this.eventsManager.sendCurrentSequenceEvents({sessionId:n,deviceId:r})},e.prototype.initialize=function(e){if(void 0===e&&(e=!1),!(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId)){this.loggerProvider.log("Session is not being recorded due to lack of session id.");return}var t,n=this.getDeviceId();if(!n){this.loggerProvider.log("Session is not being recorded due to lack of device id.");return}this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:n}),this.recordEvents()},e.prototype.shouldOptOut=function(){if(null===(e=this.config)||void 0===e?void 0:e.instanceName){var e,t,n;n=(0,X.bM)(this.config.instanceName).identityStore.getIdentity().optOut}return void 0!==n?n:null===(t=this.config)||void 0===t?void 0:t.optOut},e.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.config.captureEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured due to capture being disabled for project or because the remote config could not be fetched.")),!1;if(this.shouldOptOut())return this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;var e,t,n=(e=this.identifiers.sessionId,t=this.config.sampleRate,31*Math.abs(np(e.toString()))%1e6/1e6t.some(t=>e instanceof t),u=new WeakMap,c=new WeakMap,l=new WeakMap,d={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return u.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return f(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function f(e){var t;if(e instanceof IDBRequest)return function(e){let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(f(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return l.set(t,e),t}(e);if(c.has(e))return c.get(e);let n="function"==typeof(t=e)?(i||(i=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(h(this),e),f(this.request)}:function(...e){return f(t.apply(h(this),e))}:(t instanceof IDBTransaction&&function(e){if(u.has(e))return;let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});u.set(e,t)}(t),a(t,r||(r=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])))?new Proxy(t,d):t;return n!==e&&(c.set(e,n),l.set(n,e)),n}let h=e=>l.get(e);function p(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){let s=indexedDB.open(e,t),a=f(s);return r&&s.addEventListener("upgradeneeded",e=>{r(f(s.result),e.oldVersion,e.newVersion,f(s.transaction),e)}),n&&s.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}function v(e,{blocked:t}={}){let n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",e=>t(e.oldVersion,e)),f(n).then(()=>void 0)}let g=["get","getKey","getAll","getAllKeys","count"],m=["put","add","delete","clear"],y=new Map;function b(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(y.get(t))return y.get(t);let n=t.replace(/FromIndex$/,""),r=t!==n,i=m.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||g.includes(n)))return;let o=async function(e,...t){let o=this.transaction(e,i?"readwrite":"readonly"),s=o.store;return r&&(s=s.index(t.shift())),(await Promise.all([s[n](...t),i&&o.done]))[0]};return y.set(t,o),o}d={...o=d,get:(e,t,n)=>b(e,t)||o.get(e,t,n),has:(e,t)=>!!b(e,t)||o.has(e,t)};let _=["continue","continuePrimaryKey","advance"],w={},S=new WeakMap,I=new WeakMap,E={get(e,t){if(!_.includes(t))return e[t];let n=w[t];return n||(n=w[t]=function(...e){S.set(this,I.get(this)[t](...e))}),n}};async function*C(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;let n=new Proxy(t,E);for(I.set(n,t),l.set(n,h(t));t;)yield n,t=await (S.get(n)||t.continue()),S.delete(n)}function k(e,t){return t===Symbol.asyncIterator&&a(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&a(e,[IDBIndex,IDBObjectStore])}d={...s=d,get:(e,t,n)=>k(e,t)?C:s.get(e,t,n),has:(e,t)=>k(e,t)||s.has(e,t)}},300491:function(e,t,n){n.d(t,{CR:function(){return u},Jh:function(){return a},ZT:function(){return i},ev:function(){return c},mG:function(){return s},pi:function(){return o}});var r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])&&(6===a[0]||2===a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function c(e,t,n){if(n||2==arguments.length)for(var r,i=0,o=t.length;it.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);it.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function a(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t,n,r,i,o){function s(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var a,u=r.kind,c="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?r.static?e:e.prototype:null,d=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),f=!1,h=n.length-1;h>=0;h--){var p={};for(var v in r)p[v]="access"===v?{}:r[v];for(var v in r.access)p.access[v]=r.access[v];p.addInitializer=function(e){if(f)throw TypeError("Cannot add initializers after decoration has completed");o.push(s(e||null))};var g=(0,n[h])("accessor"===u?{get:d.get,set:d.set}:d[c],p);if("accessor"===u){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw TypeError("Object expected");(a=s(g.get))&&(d.get=a),(a=s(g.set))&&(d.set=a),(a=s(g.init))&&i.unshift(a)}else(a=s(g))&&("field"===u?i.unshift(a):d[c]=a)}l&&Object.defineProperty(l,r.name,d),f=!0}function l(e,t,n){for(var r=arguments.length>2,i=0;i0&&i[i.length-1])&&(6===a[0]||2===a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function b(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function _(){for(var e=[],t=0;t1||a(e,t)})},t&&(r[e]=t(r[e])))}function a(e,t){try{var n;(n=i[e](t)).value instanceof I?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function C(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:I(e[r](t)),done:!1}:i?i(t):t}:i}}function k(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=y(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){!function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}(r,i,(t=e[n](t)).done,t.value)})}}}function T(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var M=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},O=function(e){return(O=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t})(e)};function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=O(e),r=0;r