@amplitude/unified 1.1.35 → 1.1.36-video-analytics-5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,function(e){"use strict";function t(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new 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 i,o,s=function(){return s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)};function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function l(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})}function u(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function c(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function h(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(i||(i={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(o||(o={}));var p,f="AMP",g="".concat(f,"_unsent"),v="$default_instance",m="https://api2.amplitude.com/2/httpapi",y="https://api.eu.amplitude.com/2/httpapi",b="https://api2.amplitude.com/batch",w="https://api.eu.amplitude.com/batch",S="dclid",x="fbclid",k="gbraid",C="gclid",E="ko_click_id",I="li_fat_id",O="msclkid",P="rdt_cid",T="ttclid",R="twclid",M="wbraid",A={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},_=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],N=["authorization","cookie","set-cookie"],D=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var r=e[t];if(!L(t,r))return!1}return!0},L=function(e,t){var r,n;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=c(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&&D(a);else if(!["number","string"].includes(typeof a))return!1;if(!i)return!1}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}else{if(null==t)return!1;if("object"==typeof t)return D(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},F=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return s({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(p.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(p.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(p.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(p.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(p.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(p.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(p.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(p.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(p.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[p.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,r){if(this._validate(e,t,r)){var n=this._properties[e];return void 0===n&&(n={},this._properties[e]=n),n[t]=r,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,r){return void 0===this._properties[p.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===p.ADD?"number"==typeof r:e===p.UNSET||e===p.REMOVE||L(t,r)))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(p||(p={}));var U,j=[p.CLEAR_ALL,p.UNSET,p.SET,p.SET_ONCE,p.ADD,p.APPEND,p.PREPEND,p.PREINSERT,p.POSTINSERT,p.REMOVE],B="Event skipped due to empty event type";!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(U||(U={}));var q=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=U.Unknown),{event:e,code:t,message:r}},z=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},W=h([],d(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),V=function(e){var t,r=z();if(!(null===(t=null==r?void 0:r.crypto)||void 0===t?void 0:t.getRandomValues))return 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,V)}(e);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,h([],d(n.entries()),!1).map(function(e){var t=d(e,2),r=t[0],n=t[1];return[4,6,8,10].includes(r)?"-".concat(W[n]):W[n]}).join("")},$="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},H={},K={get exports(){return H},set exports(e){H=e}},G=Object.prototype.hasOwnProperty;function J(e){return"[Throws: "+(e?e.message:"?")+"]"}function X(e){var t=[];return function e(r){if(null===r||"object"!=typeof r)return r;if(-1!==t.indexOf(r))return"[Circular]";if(t.push(r),"function"==typeof r.toJSON)try{var n=e(r.toJSON());return t.pop(),n}catch(e){return J(e)}if(Array.isArray(r)){var i=r.map(e);return t.pop(),i}var o=Object.keys(r).reduce(function(t,n){return t[n]=e(function(e,t){if(G.call(e,t))try{return e[t]}catch(e){return J(e)}return e[t]}(r,n)),t},{});return t.pop(),o}(e)}K.exports=function(e,t,r){return JSON.stringify(X(e),t,r)};var Y,Q=H.ensureProperties=X,Z=H||t({__proto__:null,ensureProperties:Q,get default(){return H}},[H]),ee=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){var r,n;return l(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return void 0===e.name&&(e.name=V(),this.loggerProvider.warn("Plugin name is undefined.\n Generating a random UUID for plugin name: ".concat(e.name,".\n Set a name for the plugin to prevent it from being added multiple times."))),i=e.name,this.pluginStatus.has(i)?(this.loggerProvider.warn("Plugin with name ".concat(i," already exists, skipping registration")),[2]):(e.type=null!==(r=e.type)&&void 0!==r?r:"enrichment",this.pluginStatus.set(i,"locked"),[4,null===(n=e.setup)||void 0===n?void 0:n.call(e,t,this.client)]);case 1:return o.sent(),"locked"!==this.pluginStatus.get(i)?[2]:(this.plugins.push(e),this.pluginStatus.set(i,"installed"),[2])}})})},e.prototype.deregister=function(e,t){var r;return l(this,void 0,void 0,function(){var n,i;return u(this,function(o){switch(o.label){case 0:return this.pluginStatus.delete(e),n=this.plugins.findIndex(function(t){return t.name===e}),-1===n?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(i=this.plugins[n],this.plugins.splice(n,1),[4,null===(r=i.teardown)||void 0===r?void 0:r.call(i)]);case 1:return o.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)}),this.plugins=[],this.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(r){t.queue.push([e,r]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o,a,l,h,p,f,g,v,m,y,b,w,S,x,k,C;return u(this,function(u){switch(u.label){case 0:if(!e)return[2];t=d(e,1),r=t[0],n=d(e,2),i=n[1],this.loggerProvider.log("Timeline.apply: Initial event",r),o=this.plugins.filter(function(e){return"before"===e.type}),u.label=1;case 1:u.trys.push([1,6,7,8]),a=c(o),l=a.next(),u.label=2;case 2:return l.done?[3,5]:(v=l.value).execute?[4,v.execute(s({},r))]:[3,4];case 3:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(v.name),"', event: ").concat(Z(r))),i({event:r,code:0,message:""}),[2];r=m,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(v.name),"', event: ").concat(Z(r))),u.label=4;case 4:return l=a.next(),[3,2];case 5:return[3,8];case 6:return h=u.sent(),S={error:h},[3,8];case 7:try{l&&!l.done&&(x=a.return)&&x.call(a)}finally{if(S)throw S.error}return[7];case 8:p=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),u.label=9;case 9:u.trys.push([9,14,15,16]),f=c(p),g=f.next(),u.label=10;case 10:return g.done?[3,13]:(v=g.value).execute?[4,v.execute(s({},r))]:[3,12];case 11:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(v.name),"', event: ").concat(Z(r))),i({event:r,code:0,message:""}),[2];r=m,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(v.name),"', event: ").concat(Z(r))),u.label=12;case 12:return g=f.next(),[3,10];case 13:return[3,16];case 14:return y=u.sent(),k={error:y},[3,16];case 15:try{g&&!g.done&&(C=f.return)&&C.call(f)}finally{if(k)throw k.error}return[7];case 16:return b=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(Z(r))),w=b.map(function(e){var t=s({},r);return e.execute(t).catch(function(e){return q(t,0,String(e))})}),Promise.all(w).then(function(e){var t=d(e,1)[0]||q(r,100,"Event not tracked, no destination plugins on the instance");i(t)}),[2]}})})},e.prototype.flush=function(){return l(this,void 0,void 0,function(){var e,t,r,n=this;return u(this,function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return n.apply(e)}))];case 1:return i.sent(),t=this.plugins.filter(function(e){return"destination"===e.type}),r=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(r)];case 2:return i.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var r;null===(r=t.onIdentityChanged)||void 0===r||r.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var r;null===(r=t.onSessionIdChanged)||void 0===r||r.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var r;null===(r=t.onOptOutChanged)||void 0===r||r.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o,s,a;return u(this,function(l){switch(l.label){case 0:l.trys.push([0,7,8,9]),t=c(this._optOutListeners),r=t.next(),l.label=1;case 1:if(r.done)return[3,6];n=r.value,l.label=2;case 2:return l.trys.push([2,4,,5]),[4,n(e)];case 3:return l.sent(),[3,5];case 4:return i=l.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return r=t.next(),[3,1];case 6:return[3,9];case 7:return o=l.sent(),s={error:o},[3,9];case 8:try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(s)throw s.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null===(t=e.onReset)||void 0===t||t.call(e)})},e}(),te=function(e,t){return s(s({},t),{event_type:o.IDENTIFY,user_properties:e.getUserProperties()})},re=function(e){return{promise:e||Promise.resolve()}},ne=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 ee(this),this.name=e}return e.prototype._init=function(e){return l(this,void 0,void 0,function(){var t=this;return u(this,function(r){switch(r.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return t.isReady=!0})];case 1:return r.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return l(this,void 0,void 0,function(){var r,n,i,o,s,a,l,d;return u(this,function(u){switch(u.label){case 0:r=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),n=c(r),i=n.next(),u.label=2;case 2:return i.done?[3,7]:(o=i.value,(s=o())&&"promise"in s?[4,s.promise]:[3,4]);case 3:return u.sent(),[3,6];case 4:return[4,s];case 5:u.sent(),u.label=6;case 6:return i=n.next(),[3,2];case 7:return[3,10];case 8:return a=u.sent(),l={error:a},[3,10];case 9:try{i&&!i.done&&(d=n.return)&&d.call(n)}finally{if(l)throw l.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e,t)]:[3,12];case 11:return u.sent(),[3,13];case 12:null==t||t(),u.label=13;case 13:return[2]}})})},e.prototype.track=function(e,t,r){var n=function(e,t,r){return s(s(s({},"string"==typeof e?{event_type:e}:e),r),t&&{event_properties:t})}(e,t,r);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),re(this.dispatch(n))},e.prototype.identify=function(e,t){var r=te(e,t);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),re(this.dispatch(r))},e.prototype.groupIdentify=function(e,t,r,n){var i=function(e,t,r,n){var i;return s(s({},n),{event_type:o.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,r,n);return re(this.dispatch(i))},e.prototype.setGroup=function(e,t,r){var n=function(e,t,r){var n,i=new F;return i.set(e,t),s(s({},r),{event_type:o.IDENTIFY,user_properties:i.getUserProperties(),groups:(n={},n[e]=t,n)})}(e,t,r);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),re(this.dispatch(n))},e.prototype.revenue=function(e,t){var r=function(e,t){return s(s({},t),{event_type:o.REVENUE,event_properties:e.getEventProperties()})}(e,t);return re(this.dispatch(r))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),re())},e.prototype._addPlugin=function(e){return re(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)),re())},e.prototype._removePlugin=function(e){return re(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(q(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return l(this,void 0,void 0,function(){var t=this;return u(this,function(r){return this.isReady?[2,this.process(e)]:[2,new Promise(function(r){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,r))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,r=null!==(t=this.userProperties)&&void 0!==t?t:{},n=s({},r);if(void 0===e)return n;var o={};return Object.keys(e).forEach(function(t){Object.values(i).includes(t)||(o[t]=e[t])}),j.forEach(function(t){if(Object.keys(e).includes(t)){var r=e[t];switch(t){case i.CLEAR_ALL:Object.keys(n).forEach(function(e){delete n[e]});break;case i.UNSET:Object.keys(r).forEach(function(e){delete n[e]});break;case i.SET:Object.assign(n,r)}}}),Object.assign(n,o),n},e.prototype.process=function(e){return l(this,void 0,void 0,function(){var t,r,n,i;return u(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),this.config.optOut?[2,q(e,0,"Event skipped due to optOut config")]:"string"!=typeof(t=e.event_type)||0===t.trim().length?(this.config.loggerProvider.error(B),[2,q(e,0,B)]):(e.event_type===o.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)]);case 1:return 200===(i=s.sent()).code?this.config.loggerProvider.log(i.message):100===i.code?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return r=s.sent(),n=String(r),this.config.loggerProvider.error(n),[2,i=q(e,0,n)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=Boolean(e),this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return re(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});if(void 0!==t)return t;this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e))},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),ie=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){try{var t=JSON.parse(JSON.stringify(e));D(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?s({},this.properties):{};return e[Y.REVENUE_PRODUCT_ID]=this.productId,e[Y.REVENUE_QUANTITY]=this.quantity,e[Y.REVENUE_PRICE]=this.price,e[Y.REVENUE_TYPE]=this.revenueType,e[Y.REVENUE_CURRENCY]=this.currency,e[Y.REVENUE]=this.revenue,e[Y.RECEIPT]=this.receipt,e[Y.RECEIPT_SIG]=this.receiptSig,e},e}();!function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"}(Y||(Y={}));var oe;!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(oe||(oe={}));var se="Amplitude Logger ",ae=function(){function e(){this.logLevel=oe.None}return e.prototype.disable=function(){this.logLevel=oe.None},e.prototype.enable=function(e){void 0===e&&(e=oe.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<oe.Verbose||console.log("".concat(se,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<oe.Warn||console.warn("".concat(se,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<oe.Error||console.error("".concat(se,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<oe.Debug||console.log("".concat(se,"[Debug]: ").concat(e.join(" ")))},e}(),le=function(e){return void 0===e||""===e?v:e},ue=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:v,logLevel:oe.Warn,loggerProvider:new ae,offline:!1,optOut:!1,serverUrl:m,serverZone:"US",useBatch:!1}},ce=function(){function e(e){var t,r,n,i;this._optOut=!1;var o=ue();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=le(e.instanceName),this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(r=e.logLevel)&&void 0!==r?r:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(n=e.optOut)&&void 0!==n?n:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=he(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),de=function(e,t){return"EU"===e?t?w:y:t?b:m},he=function(e,t,r){if(void 0===e&&(e=""),void 0===t&&(t=ue().serverZone),void 0===r&&(r=ue().useBatch),e)return{serverUrl:e,serverZone:void 0};var n=["US","EU"].includes(t)?t:ue().serverZone;return{serverZone:n,serverUrl:de(n,r)}},pe=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function fe(e){return e>=200&&e<300}var ge=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},ve=function(e){return function(){var t=s({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},me=function(e,t){var r,n;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=c(t.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e},ye=function(e,t){return function(){var r,n,i={};try{for(var o=c(t),s=o.next();!s.done;s=o.next()){var a=s.value;i[a]=me(e,a)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}},be=function(e,t,r,n,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=r(),l=a.logger,u=a.logLevel;if(u&&u<oe.Debug||!u||!l)return e.apply(i,o);var c={type:"invoke public method",name:t,args:o,stacktrace:ge(1),time:{start:(new Date).toISOString()},states:{}};n&&c.states&&(c.states.before=n());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=(new Date).toISOString()),l.debug(JSON.stringify(c,null,2))}):(n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=(new Date).toISOString()),l.debug(JSON.stringify(c,null,2))),d}},we=new Set([m,y,b,w]);function Se(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var xe=function(){function e(e){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return l(this,void 0,void 0,function(){var r,n=this;return u(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(g,"_").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(r=i.sent())&&r.length>0&&Promise.all(r.map(function(e){return n.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=V()),new Promise(function(r){var n={event:e,attempts:0,callback:function(e){return r(e)},timeout:0};t.queue.push(n),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),l(this,void 0,void 0,function(){var t,r,n,i=this;return u(this,function(o){switch(o.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),t=[],r=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):r.push(e)}),s=t,a=this.config.flushQueueSize,c=Math.max(a,1),n=s.reduce(function(e,t,r){var n=Math.floor(r/c);return e[n]||(e[n]=[]),e[n].push(t),e},[]),[4,n.reduce(function(t,r){return l(i,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return[4,t];case 1:return n.sent(),[4,this.send(r,e)];case 2:return[2,n.sent()]}})})},Promise.resolve())]);case 1:return o.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var s,a,c})})},e.prototype.send=function(e,t){var r;return void 0===t&&(t=!0),l(this,void 0,void 0,function(){var n,i,o,s,l,c;return u(this,function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,a(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new pe,u.label=1;case 1:return u.trys.push([1,3,,4]),i=he(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,o=function(e,t){return void 0===t&&(t=!1),!!we.has(e)||t}(i,this.config.enableRequestBodyCompression),[4,this.config.transportProvider.send(i,n,o)];case 2:return null===(s=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(s,e),[3,4]):("body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(Se(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return l=u.sent(),c=(d=l)instanceof Error?d.message:String(d),this.config.loggerProvider.error(c),null===(r=this.diagnosticsClient)||void 0===r||r.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:c,stack_trace:ge()}),this.handleResponse({status:U.Failed,statusCode:0},e),[3,4];case 4:return[2]}var d})})},e.prototype.handleResponse=function(e,t){var r;fe(e.statusCode)||null===(r=this.diagnosticsClient)||void 0===r||r.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:Se(e),stack_trace:ge()});var n=e.status;switch(n){case U.Success:this.handleSuccessResponse(e,t);break;case U.Invalid:this.handleInvalidResponse(e,t);break;case U.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case U.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var r=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var n=h(h(h(h([],d(Object.values(e.body.eventsWithInvalidFields)),!1),d(Object.values(e.body.eventsWithMissingFields)),!1),d(Object.values(e.body.eventsWithInvalidIdLengths)),!1),d(e.body.silencedEvents),!1).flat(),i=new Set(n),o=t.filter(function(t,n){if(!i.has(n))return!0;r.fulfillRequest([t],e.statusCode,e.body.error)});o.length>0&&this.config.loggerProvider.warn(Se(e));var s=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(Se(e)),this.config.flushQueueSize/=2;var r=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(r)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var r=this,n=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(n),a=new Set(i),l=new Set(o),u=t.filter(function(t,n){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)))return l.has(n)&&(t.timeout=r.throttleTimeout),!0;r.fulfillRequest([t],e.statusCode,e.body.error)});u.length>0&&this.config.loggerProvider.warn(Se(e));var c=this.removeEventsExceedFlushMaxRetries(u);this.scheduleEvents(c)},e.prototype.handleOtherResponse=function(e){var t=this,r=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),n=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(n)},e.prototype.fulfillRequest=function(e,t,r){var n,i,o;fe(t)?null===(o=this.diagnosticsClient)||void 0===o||o.increment("analytics.events.sent",e.length):(null===(n=this.diagnosticsClient)||void 0===n||n.increment("analytics.events.dropped",e.length),null===(i=this.diagnosticsClient)||void 0===i||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:r,stack_trace:ge()})),this.removeEvents(e),e.forEach(function(e){return e.callback(q(e.event,t,r))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(e){return e.event});this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter(function(t){return!e.some(function(e){return e.event.insert_id===t.event.insert_id})}),this.saveEvents()},e}(),ke=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Ce(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),Ce=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},Ee=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(t){e(t)}),this.queue=[])},e}(),Ie=function(){return Ie=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ie.apply(this,arguments)};function Oe(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Pe(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var Te=function(e,t){var r,n,i=typeof e;if(i!==typeof t)return!1;try{for(var o=Oe(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next()){if(s.value===i)return e===t}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var a=Array.isArray(e),l=Array.isArray(t);if(a!==l)return!1;if(!a||!l){var u=Object.keys(e).sort(),c=Object.keys(t).sort();if(!Te(u,c))return!1;var d=!0;return Object.keys(e).forEach(function(r){Te(e[r],t[r])||(d=!1)}),d}for(var h=0;h<e.length;h++)if(!Te(e[h],t[h]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=new Array(r);r--;)n[r]=[t[r],e[t[r]]];return n});var Re=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=Ie({},this.identity.userProperties),r=Ie(Ie({},this.identity),{userProperties:t});return{setUserId:function(e){return r.userId=e,this},setDeviceId:function(e){return r.deviceId=e,this},setUserProperties:function(e){return r.userProperties=e,this},setOptOut:function(e){return r.optOut=e,this},updateUserProperties:function(e){var t,n,i,o,s,a,l=r.userProperties||{};try{for(var u=Oe(Object.entries(e)),c=u.next();!c.done;c=u.next()){var d=Pe(c.value,2),h=d[0],p=d[1];switch(h){case"$set":try{for(var f=(i=void 0,Oe(Object.entries(p))),g=f.next();!g.done;g=f.next()){var v=Pe(g.value,2),m=v[0],y=v[1];l[m]=y}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,Oe(Object.keys(p))),w=b.next();!w.done;w=b.next()){delete l[m=w.value]}}catch(e){s={error:e}}finally{try{w&&!w.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":l={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return r.userProperties=l,this},commit:function(){return e.setIdentity(r),this}}},e.prototype.getIdentity=function(){return Ie({},this.identity)},e.prototype.setIdentity=function(e){var t=Ie({},this.identity);this.identity=Ie({},e),Te(t,this.identity)||this.listeners.forEach(function(t){t(e)})},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),Me="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,Ae=function(){function e(){this.identityStore=new Re,this.eventBridge=new Ee,this.applicationContextProvider=new ke}return e.getInstance=function(t){return Me.analyticsConnectorInstances||(Me.analyticsConnectorInstances={}),Me.analyticsConnectorInstances[t]||(Me.analyticsConnectorInstances[t]=new e),Me.analyticsConnectorInstances[t]},e}(),_e=function(e){return Ae.getInstance(le(e))},Ne=function(){function e(){this.name="identity",this.type="before",this.identityStore=_e().identityStore}return e.prototype.execute=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return l(this,void 0,void 0,function(){return u(this,function(t){return e.instanceName&&(this.identityStore=_e(e.instanceName).identityStore),[2]})})},e}(),De=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},Le=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),[f,t,e.substring(0,r)].filter(Boolean).join("_")},Fe=function(){var e,t,r,n;if("undefined"==typeof navigator)return"";var i=navigator.userLanguage;return null!==(n=null!==(r=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==r?r:i)&&void 0!==n?n:""},Ue=function(){var e,t=z();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 r=t.split("=",2),n=je(r[0]),i=je(r[1]);return i?(e[n]=i,e):e},{}):{}},je=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Be=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},qe=function(e,t){var r=e;try{r=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return r},ze=function(e){var t=0;if(0===e.length)return t;for(var r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r),t|=0}return t},We=function(e,t){var r=ze(e.toString());return 31*Math.abs(r)%1e5/1e5<t},Ve=function(e){var t={};for(var r in e){var n=e[r];n&&(t[r]=n)}return t},$e=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,function(){return u(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return l(this,void 0,void 0,function(){return u(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return[4,this.get(e)];case 1:return[2,(t=r.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return l(this,void 0,void 0,function(){return u(this,function(r){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return l(this,void 0,void 0,function(){return u(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return l(this,void 0,void 0,function(){return u(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),He=function(){function e(e,t){void 0===t&&(t={}),this.options=s({},e),this.config=t}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,function(){var t,r,n,i,o=this;return u(this,function(a){switch(a.label){case 0:return t="AMP_TEST",r=s({},this.options),n=new e(r),i=String(Date.now()),[4,n.transaction(t,function(e){var r,n;try{e.set(i);var s=e.get()===i;return!s&&o.config.diagnosticsClient&&(null===(r=o.config.diagnosticsClient)||void 0===r||r.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:i,sync:!0})),s}catch(e){if(o.config.diagnosticsClient){var a=e instanceof Error?e.message:String(e);null===(n=o.config.diagnosticsClient)||void 0===n||n.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:i,error:a,sync:!0})}return!1}finally{e.set(null)}})];case 1:return[2,a.sent()]}})})},e.prototype.get=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return[4,this.getRaw(e)];case 1:return t=r.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var r=Ke(t);return void 0===r?void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t)):JSON.parse(r)}catch(r){return void console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t))}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,r;return l(this,void 0,void 0,function(){var n,i,o,s,a,l,d,h,p;return u(this,function(u){switch(u.label){case 0:n=z(),i=n,u.label=1;case 1:return u.trys.push([1,4,,5]),(o=null==i?void 0:i.cookieStore)?[4,o.getAll(e)]:[3,3];case 2:if(s=u.sent()){s.length>1&&(null===(t=this.config.diagnosticsClient)||void 0===t||t.recordEvent("cookies.duplicate",{cookies:s.map(function(e){return e.domain})}),null===(r=this.config.diagnosticsClient)||void 0===r||r.increment("cookies.duplicate.occurrence.cookieStore"));try{for(a=c(s),l=a.next();!l.done;l=a.next())if(d=l.value,Ge(d.domain,this.options.domain))return[2,d.value]}catch(e){h={error:e}}finally{try{l&&!l.done&&(p=a.return)&&p.call(a)}finally{if(h)throw h.error}}}u.label=3;case 3:return[3,5];case 4:return u.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,r,n=this,i=z(),o=(null!==(r=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==r?r:[]).filter(function(t){return 0===t.indexOf(e+"=")}),s=void 0,a=this.config.duplicateResolverFn;if("function"==typeof a&&o.length>1&&(s=o.find(function(t){var r;try{var i=a(t.substring(e.length+1));return i||null===(r=n.config.diagnosticsClient)||void 0===r||r.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),s||(s=o[0]),s)return s.substring(e.length+1)},e.prototype.set=function(e,t){return l(this,void 0,void 0,function(){return u(this,function(r){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var r;try{var n=z();if(!n||!n.document||"function"!=typeof n.btoa||"function"!=typeof n.encodeURIComponent)return;var i=null!==(r=this.options.expirationDays)&&void 0!==r?r:0,o=null!==t?i:-1,s=void 0;if(o){var a=new Date;a.setTime(a.getTime()+24*o*60*60*1e3),s=a}var l="".concat(e,"=").concat(n.btoa(n.encodeURIComponent(JSON.stringify(t))));s&&(l+="; expires=".concat(s.toUTCString())),l+="; path=/",this.options.domain&&(l+="; domain=".concat(this.options.domain)),this.options.secure&&(l+="; Secure"),this.options.sameSite&&(l+="; SameSite=".concat(this.options.sameSite)),n.document.cookie=l}catch(t){var u=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(u))}},e.prototype.remove=function(e){return l(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}})})},e.prototype.reset=function(){return l(this,void 0,void 0,function(){return u(this,function(e){return[2]})})},e.isDomainWritable=function(t){return l(this,void 0,void 0,function(){var r,n;return u(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];r="AMP_TLDTEST",n=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n.transaction(r,function(r){if(e.cachedTlds[t])return!0;try{r.set(1);var n=!!r.get();return n&&(e.cachedTlds[t]=!0),n}finally{r.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return l(this,void 0,void 0,function(){var r,n,i=this;return u(this,function(o){switch(o.label){case 0:if(r=function(){var e,t=z();return null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.locks}(),n=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!r)return[2,n()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.request("com.amplitude:cookie-lock:".concat(e),n)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,n()];case 4:return[2]}})})},e.cachedTlds={},e}(),Ke=function(e){var t;return null!==(t=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}}(e))&&void 0!==t?t:function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}}(e)},Ge=function(e,t){if(""===e&&""===t)return!0;if(!e||!t)return!1;var r=e.startsWith(".")?e.substring(1):e,n=t.startsWith(".")?t.substring(1):t;return r.toLowerCase()===n.toLowerCase()},Je=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),[f,t,e.substring(0,r)].filter(Boolean).join("_")},Xe=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,function(){var t,r,n;return u(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),r=new e(this.storage),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,r.set(n,t)];case 2:return i.sent(),[4,r.get(n)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,r.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=r.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return r.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(r){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var r;return l(this,void 0,void 0,function(){return u(this,function(n){try{null===(r=this.storage)||void 0===r||r.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(r){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return l(this,void 0,void 0,function(){return u(this,function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]})})},e}(),Ye="tags",Qe="counters",Ze="histograms",et="events",tt="internal",rt="last_flush_timestamp",nt=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return void 0!==(null===(e=z())||void 0===e?void 0:e.indexedDB)},e.prototype.getDB=function(){return l(this,void 0,void 0,function(){return u(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,r){var n=indexedDB.open(e.dbName,1);n.onerror=function(){e.dbPromise=null,r(new Error("Failed to open IndexedDB"))},n.onsuccess=function(){var r=n.result;r.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},r.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),r.close()},t(r)},n.onupgradeneeded=function(){var t=n.result;t?e.createTables(t):e.logger.debug("DiagnosticsStorage: Missing DB during upgrade.")}})},e.prototype.createTables=function(e){(e.objectStoreNames.contains(Ye)||e.createObjectStore(Ye,{keyPath:"key"}),e.objectStoreNames.contains(Qe)||e.createObjectStore(Qe,{keyPath:"key"}),e.objectStoreNames.contains(Ze)||e.createObjectStore(Ze,{keyPath:"key"}),e.objectStoreNames.contains(et))||e.createObjectStore(et,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(tt)||e.createObjectStore(tt,{keyPath:"key"})},e.prototype.setTags=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o=this;return u(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=s.sent(),r=t.transaction([Ye],"readwrite"),n=r.objectStore(Ye),[2,new Promise(function(t){var i=Object.entries(e);r.oncomplete=function(){t()},r.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tags",e),t()},i.forEach(function(e){var t=d(e,2),r=t[0],i=t[1];n.put({key:r,value:i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tag",r,i,e)}})})];case 2:return i=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",i),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o=this;return u(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=s.sent(),r=t.transaction([Qe],"readwrite"),n=r.objectStore(Qe),[2,new Promise(function(t){var i=Object.entries(e);r.oncomplete=function(){t()},r.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to increment counters",e),t()},i.forEach(function(e){var t=d(e,2),r=t[0],i=t[1],s=n.get(r);s.onsuccess=function(){var e=s.result,t=e?e.value:0;n.put({key:r,value:t+i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to update counter",r,e)}},s.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing counter",r,e)}})})];case 2:return i=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",i),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o=this;return u(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=s.sent(),r=t.transaction([Ze],"readwrite"),n=r.objectStore(Ze),[2,new Promise(function(t){var i=Object.entries(e);r.oncomplete=function(){t()},r.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),t()},i.forEach(function(e){var t=d(e,2),r=t[0],i=t[1],s=n.get(r);s.onsuccess=function(){var e,t=s.result;e=t?{key:r,count:t.count+i.count,min:Math.min(t.min,i.min),max:Math.max(t.max,i.max),sum:t.sum+i.sum}:{key:r,count:i.count,min:i.min,max:i.max,sum:i.sum},n.put(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",r,e)}},s.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",r,e)}})})];case 2:return i=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",i),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o=this;return u(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),0===e.length?[2]:[4,this.getDB()];case 1:return t=s.sent(),r=t.transaction([et],"readwrite"),n=r.objectStore(et),[2,new Promise(function(t){r.oncomplete=function(){t()},r.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event records",e),t()};var i=n.count();i.onsuccess=function(){var t=i.result,r=Math.max(0,10-t);r<e.length&&o.logger.debug("DiagnosticsStorage: Only added ".concat(r," of ").concat(e.length," events due to storage limit")),e.slice(0,r).forEach(function(e){n.add(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},i.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return i=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",i),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return l(this,void 0,void 0,function(){var r,n,i,o;return u(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([tt],"readwrite"),i=n.objectStore(tt),[2,new Promise(function(r,o){n.onabort=function(){return o(new Error("Failed to set internal value"))};var s=i.put({key:e,value:t});s.onsuccess=function(){return r()},s.onerror=function(){return o(new Error("Failed to set internal value"))}})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",o),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return l(this,void 0,void 0,function(){var t,r,n,i;return u(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return t=o.sent(),r=t.transaction([tt],"readonly"),n=r.objectStore(tt),[2,new Promise(function(t,i){r.onabort=function(){return i(new Error("Failed to get internal value"))};var o=n.get(e);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(new Error("Failed to get internal value"))}})];case 2:return i=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",i),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return l(this,void 0,void 0,function(){var e,t;return u(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getInternal(rt)];case 1:return[2,(e=r.sent())?parseInt(e.value,10):void 0];case 2:return t=r.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.setInternal(rt,e.toString())];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(r,n){var i=e.objectStore(t).clear();i.onsuccess=function(){return r()},i.onerror=function(){return n(new Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return l(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a;return u(this,function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=l.sent(),t=e.transaction([Ye,Qe,Ze,et],"readwrite"),[4,Promise.all([this.getAllFromStore(t,Ye),this.getAllFromStore(t,Qe),this.getAllFromStore(t,Ze),this.getAllFromStore(t,et)])];case 2:return r=d.apply(void 0,[l.sent(),4]),n=r[0],i=r[1],o=r[2],s=r[3],[4,Promise.all([this.clearTable(t,Qe),this.clearTable(t,Ze),this.clearTable(t,et)])];case 3:return l.sent(),[2,{tags:n,counters:i,histogramStats:o,events:s}];case 4:return a=l.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",a),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(r,n){var i=e.objectStore(t).getAll();i.onsuccess=function(){return r(i.result)},i.onerror=function(){return n(new Error("Failed to get all from ".concat(t)))}})},e}(),it=function(e){var t,r,n=function(){var e=z();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]}();if(0!==n.length)try{for(var i=c(n),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.filename&&e.filename.includes(s))return"filename";if(e.stack&&e.stack.includes(s))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},ot=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},st=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},at=3e5,lt=1e4,ut=function(){function e(e,t,r,n,i){void 0===r&&(r="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===r?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(n,null,2)),this.config=s({enabled:!0,sampleRate:0},n),this.startTimestamp=Date.now(),this.shouldTrack=We(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:nt.isSupported()?this.storage=new nt(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),function(e){var t=z();if(t&&"function"==typeof t.addEventListener){var r=function(t){e.recordEvent("sdk.error.uncaught",s({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,n=null==t?void 0:t.stack,i=it({filename:e.filename,stack:n});i&&r({type:"error",message:e.message,stack:n,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,n=e.reason instanceof Error?e.reason:void 0,i=null==n?void 0:n.stack,o=ot(i),s=it({filename:o,stack:i});s&&r({type:"unhandledrejection",message:null!==(t=null==n?void 0:n.message)&&void 0!==t?t:st(e.reason),stack:i,filename:o,errorName:null==n?void 0:n.name,metadata:{isTrusted:e.isTrusted,matchReason:s}})},!0)}}(this))}return e.prototype.isStorageAndTrackEnabled=function(){return Boolean(this.storage)&&Boolean(this.shouldTrack)},e.prototype.setTag=function(e,t){this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryTags).length>=lt?this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit"):(this.inMemoryTags[e]=t,this.startTimersIfNeeded()))},e.prototype.increment=function(e,t){void 0===t&&(t=1),this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryCounters).length>=lt?this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit"):(this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()))},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled())if(Object.keys(this.inMemoryHistograms).length>=lt)this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");else{var r=this.inMemoryHistograms[e];r?(r.count+=1,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){this.isStorageAndTrackEnabled()&&(this.inMemoryEvents.length>=10?this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit"):(this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()))},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},at))},e.prototype.saveAllDataToStorage=function(){return l(this,void 0,void 0,function(){var e,t,r,n;return u(this,function(i){switch(i.label){case 0:return this.storage?(e=s({},this.inMemoryTags),t=s({},this.inMemoryCounters),r=s({},this.inMemoryHistograms),n=h([],d(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(r),this.storage.addEventRecords(n)])]):[2];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return l(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a,l,c;return u(this,function(u){switch(u.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return u.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=u.sent(),t=e.tags,r=e.counters,n=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),s={},r.forEach(function(e){s[e.key]=e.value}),a={},n.forEach(function(e){a[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),l=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(s).length&&0===Object.keys(a).length&&0===l.length?[2]:(c={tags:o,histogram:a,counters:s,events:l},this.fetch(c),[2])}})})},e.prototype.fetch=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!z())throw new Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return r.sent().ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return t=r.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return l(this,void 0,void 0,function(){var e,t,r;return u(this,function(n){switch(n.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return-1===(t=n.sent()||-1)?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(at),[2]):(r=e-t)>=at?(this._flush(),[2]):(this._setFlushTimer(at-r),[2])}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=We(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),ct=function(){function e(){}return e.prototype.send=function(e,t,r){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,r,n,i,o,s,a,l,u,c,d,h,p,f,g,v,m,y,b,w,S,x;if("object"!=typeof e)return null;var k=e.code||0,C=this.buildStatus(k);switch(C){case U.Success:return{status:C,statusCode:k,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(r=e.payload_size_bytes)&&void 0!==r?r:0,serverUploadTime:null!==(n=e.server_upload_time)&&void 0!==n?n:0}};case U.Invalid:return{status:C,statusCode:k,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(a=e.events_with_missing_fields)&&void 0!==a?a:{},eventsWithInvalidIdLengths:null!==(l=e.events_with_invalid_id_lengths)&&void 0!==l?l:{},epsThreshold:null!==(u=e.eps_threshold)&&void 0!==u?u:0,exceededDailyQuotaDevices:null!==(c=e.exceeded_daily_quota_devices)&&void 0!==c?c:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(h=e.silenced_events)&&void 0!==h?h:[],throttledDevices:null!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(f=e.throttled_events)&&void 0!==f?f:[]}};case U.PayloadTooLarge:return{status:C,statusCode:k,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case U.RateLimit:return{status:C,statusCode:k,body:{error:null!==(v=e.error)&&void 0!==v?v:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(S=e.exceeded_daily_quota_users)&&void 0!==S?S:{},throttledEvents:null!==(x=e.throttled_events)&&void 0!==x?x:[]}};case U.Timeout:default:return{status:C,statusCode:k}}},e.prototype.buildStatus=function(e){return fe(e)?U.Success:429===e?U.RateLimit:413===e?U.PayloadTooLarge:408===e?U.Timeout:e>=400&&e<500?U.Invalid:e>=500?U.Failed:U.Unknown},e}(),dt=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.customHeaders=t,r}return n(t,e),t.prototype.send=function(e,t){return l(this,void 0,void 0,function(){var r,n,i;return u(this,function(o){switch(o.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return r={headers:s({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(t),method:"POST"},[4,fetch(e,r)];case 1:return[4,(n=o.sent()).text()];case 2:i=o.sent();try{return[2,this.buildResponse(JSON.parse(i))]}catch(e){return[2,this.buildResponse({code:n.status})]}return[2]}})})},t}(ct);function ht(){return"undefined"!=typeof CompressionStream}function pt(e){return l(this,void 0,void 0,function(){var t,r;return u(this,function(n){switch(n.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];n.label=1;case 1:return n.trys.push([1,3,,4]),r=new Blob([e]).stream().pipeThrough(new t("gzip")),[4,new Response(r).arrayBuffer()];case 2:return[2,n.sent()];case 3:return n.sent(),[2,void 0];case 4:return[2]}})})}var ft=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t;try{this.isSupported="undefined"!=typeof localStorage}catch(e){this.logger.debug("Remote config localstorage failed to access: ",e),this.isSupported=!1}}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};if(!this.isSupported)return Promise.resolve(t);try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var r=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(Z(r))),Promise.resolve({remoteConfig:r.remoteConfig,lastFetch:new Date(r.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){if(!this.isSupported)return Promise.resolve(!1);try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}();var gt=401,vt=403,mt=429,yt=function(){function e(t,r,n,i,o,s,a){void 0===n&&(n="US"),void 0===s&&(s=e.DEFAULT_CONFIG_GROUP),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=t,this.configGroup=s,this.serverUrl=i||("US"===n?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=r,this.storage=a||new ft(t,r),this.customFetch=o}return e.prototype.subscribe=function(e,t,r){var n=V(),i={id:n,key:e,deliveryMode:t,callback:r};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),n},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return-1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return l(this,void 0,void 0,function(){var e,t=this;return u(this,function(r){switch(r.label){case 0:return this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return e=r.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(r){t.sendCallback(r,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(e){return l(this,void 0,void 0,function(){var t,r,n,i=this;return u(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),r=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,r])];case 1:return void 0!==(n=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(n))),null!==n.remoteConfig?this.sendCallback(e,n,"cache"):this.logger.debug("Remote config client skips sending callback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return l(this,void 0,void 0,function(){var r,n;return u(this,function(i){switch(i.label){case 0:r=new Promise(function(e,r){setTimeout(function(){r("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),r])];case 2:return n=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,n,"remote"),this.storage.setConfig(n),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(n=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,n,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,n,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,r){var n;e.lastCallback=new Date,n=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(n,r,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),l(this,void 0,void 0,function(){var r,n,i,o,s,a,l=this;return u(this,function(c){switch(c.label){case 0:r=t/e,n={remoteConfig:null,lastFetch:new Date},i=function(n){var i,s,a,c,d,h,p,f,g;return u(this,function(u){switch(u.label){case 0:i=!0,s=new AbortController,a=setTimeout(function(){return s.abort()},t),u.label=1;case 1:return u.trys.push([1,10,11,12]),c=o.getUrlParams(),d={Accept:"*/*"},o.customFetch?[4,(v=o.customFetch({url:c,method:"GET",headers:d,signal:s.signal}),m=s.signal,new Promise(function(e,t){var r=function(){var e=new Error("Remote config custom fetch aborted by timeout");e.name="AbortError",t(e)};m.addEventListener("abort",r,{once:!0}),v.then(function(t){m.removeEventListener("abort",r),e(t)},function(e){m.removeEventListener("abort",r),t(e)})}))]:[3,3];case 2:return p=u.sent(),[3,5];case 3:return[4,fetch(c,{method:"GET",headers:d,signal:s.signal})];case 4:p=u.sent(),u.label=5;case 5:return(h=p).ok||h.status>=200&&h.status<300?[3,7]:[4,h.text()];case 6:return f=u.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(h.status,": ").concat(f)),h.status===gt||h.status===vt?(o.logger.error("Remote config client fetch failed with ".concat(h.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):h.status>=400&&h.status<500&&h.status!==mt&&(i=!1),[3,9];case 7:return[4,h.json()];case 8:return[2,{value:{remoteConfig:u.sent(),lastFetch:new Date}}];case 9:return[3,12];case 10:return(g=u.sent())instanceof Error&&"AbortError"===g.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),g),[3,12];case 11:return clearTimeout(a),[7];case 12:return i?n<e-1?[4,new Promise(function(e){return setTimeout(e,l.getJitterDelay(r))})]:[3,14]:[2,"break"];case 13:u.sent(),u.label=14;case 14:return[2]}var v,m})},o=this,s=0,c.label=1;case 1:return s<e?[5,i(s)]:[3,4];case 2:if("object"==typeof(a=c.sent()))return[2,a.value];if("break"===a)return[3,4];c.label=3;case 3:return s++,[3,1];case 4:return[2,n]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var e=encodeURIComponent(this.apiKey),t=new URLSearchParams;return t.append("config_group",this.configGroup),"".concat(this.serverUrl,"/").concat(e,"?").concat(t.toString())},e.DEFAULT_CONFIG_GROUP="browser",e}(),bt=z(),wt=null==bt?void 0:bt.console,St={},xt={},kt=!1;var Ct,Et={addListener:function(e,t){var r,n=(r=e,!!wt&&"function"==typeof wt[r]&&(xt[r]||(xt[r]=wt[r],wt[r]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(St[r]&&!kt){kt=!0;var n=St[r];n&&n.forEach(function(t){try{t(r,e)}catch(e){}})}}catch(e){}return kt=!1,xt[r].apply(wt,e)}),!0));if(!n)return new Error("Console override failed");St[e]?St[e].push(t):St[e]=[t]},removeListener:function(e){var t,r;try{for(var n=c(Object.values(St)),i=n.next();!i.done;i=n.next())for(var o=i.value,s=o.length-1;s>=0;s--)if(o[s]===e){o.splice(s,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var r=c(Object.entries(xt)),n=r.next();!n.done;n=r.next()){var i=d(n.value,2),o=i[0],s=i[1];s&&(wt[o]=s)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}xt={},St={}}};!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(Ct||(Ct={}));var It=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Ot="data-amp-track-",Pt=["div","span","h1","h2","h3","h4","h5","h6"],Tt=h(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],d(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),Rt=Tt,Mt=Tt,At=["*"];function _t(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function Nt(e,t,r){e&&Dt({json:e,allowlist:t.map(Lt),excludelist:r.map(Lt),ancestors:[]})}function Dt(e){var t,r,n=e.json,i=e.targetObject,o=e.allowlist,s=e.excludelist,a=e.ancestors,l=e.parentObject,u=e.targetKey;i||(i=n);var p=Object.keys(i);try{for(var f=c(p),g=f.next();!g.done;g=f.next()){var v=g.value,m=h(h([],d(a),!1),[v],!1);_t(i[v])?Ut(m,o)&&!Ut(m,s)||delete i[v]:Dt({json:n,targetObject:i[v],allowlist:o,excludelist:s,ancestors:m,parentObject:i,targetKey:v})}}catch(e){t={error:e}}finally{try{g&&!g.done&&(r=f.return)&&r.call(f)}finally{if(t)throw t.error}}0===Object.keys(i).length&&l&&u&&delete l[u]}function Lt(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function Ft(e,t,r,n){if(void 0===r&&(r=0),void 0===n&&(n=0),n===t.length)return r===e.length;if(r===e.length){for(;n<t.length&&"**"===t[n];)n++;return n===t.length}var i=t[n];if("**"===i){if(n+1===t.length)return!0;for(var o=r;o<=e.length;o++)if(Ft(e,t,o,n+1))return!0;return!1}return("*"===i||i===e[r])&&Ft(e,t,r+1,n+1)}function Ut(e,t){return t.some(function(t){return Ft(e,t)})}var jt=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,r;void 0===e&&(e=[]);var n=this.request.headers,i={};if(Array.isArray(n))n.forEach(function(e){var t=d(e,2),r=t[0],n=t[1];i[r]=n});else if(n instanceof Headers)n.forEach(function(e,t){i[t]=e});else if("object"==typeof n&&null!==n)try{for(var o=c(Object.entries(n)),s=o.next();!s.done;s=o.next()){var a=d(s.value,2),l=a[0],u=a[1];i[l]=u}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return Kt(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=z();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=qt(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),l(this,void 0,void 0,function(){return u(this,function(r){return 0===e.length?[2,null]:[2,$t(this.body,e,t)]})})},e}(),Bt=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),Kt(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return qt(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),l(this,void 0,void 0,function(){return u(this,function(r){return 0===e.length?[2,null]:[2,$t(this.body,e,t)]})})},e}();function qt(e,t){var r,n,i,o=z(),s=null==o?void 0:o.TextEncoder;if(s&&null!=e){var a;if("string"==typeof e)a=e,i=(new s).encode(a).length;else if("undefined"!=typeof Blob&&e instanceof Blob)i=(a=e).size;else if("undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams)a=e,i=(new s).encode(a.toString()).length;else if(ArrayBuffer.isView(e))i=(a=e).byteLength;else if(e instanceof ArrayBuffer)i=(a=e).byteLength;else if("undefined"!=typeof FormData&&e instanceof FormData){var l=e,u=0,h=0;try{for(var p=c(l.entries()),f=p.next();!f.done;f=p.next()){var g=d(f.value,2),v=g[0],m=g[1];if(u+=v.length,"string"==typeof m)u+=(new s).encode(m).length;else{if(!("undefined"!=typeof Blob&&m instanceof Blob))return;u+=m.size}if(++h>=t)return}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}i=u}else if("undefined"!=typeof ReadableStream&&e instanceof ReadableStream)return void(a=e);return i}}var zt,Wt=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var r=this.response.headers,n={};return null===(t=null==r?void 0:r.forEach)||void 0===t||t.call(r,function(e,t){n[t]=e}),Kt(n,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var r=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),n=r?parseInt(r,10):void 0;return this._bodySize=n,n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return l(this,void 0,void 0,function(){var e,t;return u(this,function(r){switch(r.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),r.label=1;case 1:return r.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise(function(e){return setTimeout(function(){return e(null)},500)}),[4,Promise.race([e,t])];case 2:return[2,r.sent()];case 3:return r.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),l(this,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,$t(r.sent(),e,t)]}})})},e}(),Vt=function(){function e(e,t,r,n){this.statusCode=e,this.headersString=t,this.size=r,this.getJson=n}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,r;if(void 0===e&&(e=[]),!this.headersString)return{};var n={},i=this.headersString.split("\r\n");try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var a=d(s.value.split(": "),2),l=a[0],u=a[1];l&&u&&(n[l]=u)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return Kt(n,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),l(this,void 0,void 0,function(){var r;return u(this,function(n){return 0===e.length?[2,null]:(r=this.getJson())?(Nt(r,e,t),[2,r]):[2,null]})})},e}();function $t(e,t,r){if(!e)return null;try{var n=JSON.parse(e);return Nt(n,t,r),n}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(zt||(zt={}));var Ht="[REDACTED]",Kt=function(e,t){var r,n,i=t.allow,o=void 0===i?[]:i,s=t.strategy,a=void 0===s?zt.REMOVE:s,l=h([],d(N),!1),u={},p=function(t){var r=t.toLowerCase();l.find(function(e){return e.toLowerCase()===r})?a===zt.REDACT&&(u[t]=Ht):o.find(function(e){return e.toLowerCase()===r})?u[t]=e[t]:a===zt.REDACT&&(u[t]=Ht)};try{for(var f=c(Object.keys(e)),g=f.next();!g.done;g=f.next()){p(g.value)}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}return u},Gt=function(){function e(e,t,r,n,i,o,s,a,l,u,c){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=r,this.startTime=n,this.url=i,this.requestWrapper=o,this.status=s,this.duration=a,this.responseWrapper=l,this.error=u,this.endTime=c}return e.prototype.toSerializable=function(){var e,t,r,n,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(h([],d(_),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(r=this.responseWrapper)||void 0===r?void 0:r.headers(h([],d(_),!1)),responseBodySize:null===(n=this.responseWrapper)||void 0===n?void 0:n.bodySize};return Object.fromEntries(Object.entries(i).filter(function(e){var t=d(e,2);return t[0],void 0!==t[1]}))},e}();var Jt=function(e,t){void 0===t&&(t=V()),this.callback=e,this.id=t};function Xt(e){try{e()}catch(e){}}var Yt=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=z();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var e=z();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var r,n,i,o,s,a,l,u,c,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var h=null===(i=null===(n=null===(r=this.globalScope)||void 0===r?void 0:r.XMLHttpRequest)||void 0===n?void 0:n.prototype)||void 0===i?void 0:i.open,p=null===(a=null===(s=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===s?void 0:s.prototype)||void 0===a?void 0:a.send,f=null===(c=null===(u=null===(l=this.globalScope)||void 0===l?void 0:l.XMLHttpRequest)||void 0===u?void 0:u.prototype)||void 0===c?void 0:c.setRequestHeader;h&&p&&f&&this.observeXhr(h,p,f);var g=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;g&&this.observeFetch(g),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach(function(r){try{r.callback(e)}catch(e){Xt(function(){var r;null===(r=t.logger)||void 0===r||r.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,r,n,i,o,s){var a;if(void 0!==o&&void 0!==s){var l,u,c,d="GET";if(!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?l=null===(a=null==t?void 0:t.toString)||void 0===a?void 0:a.call(t):(l=t.url,d=t.method),l)try{var h=new URL(l);l="".concat(h.protocol,"//").concat(h.host).concat(h.pathname).concat(h.search).concat(h.hash)}catch(e){}d=(null==r?void 0:r.method)||d,n&&(u=n.status),i&&(c={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},u=0);var p=Math.floor(performance.now()-s),f=Math.floor(o+p),g=new Gt(e,d,o,o,l,r,u,p,n,c,f);this.triggerEventCallbacks(g)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(r,n){return l(t,void 0,void 0,function(){var t,i,o,s,a=this;return u(this,function(l){switch(l.label){case 0:try{t=this.getTimestamps()}catch(e){Xt(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}l.label=1;case 1:return l.trys.push([1,3,,4]),[4,e(r,n)];case 2:return i=l.sent(),[3,4];case 3:return s=l.sent(),o=s,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",r,n?new jt(n):void 0,i?new Wt(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){Xt(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){var r;try{if("json"===e.responseType){if(null===(r=t.globalScope)||void 0===r?void 0:r.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(r){return r instanceof Error&&"InvalidStateError"===r.name&&Xt(function(){var r;return null===(r=t.logger)||void 0===r?void 0:r.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))}),null}return null}},e.prototype.observeXhr=function(t,r,n){if(this.globalScope&&t&&r){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=d(r,2),a=i[0],l=i[1];try{this.$$AmplitudeAnalyticsEvent=s({method:a,url:null===(e=null==l?void 0:l.toString)||void 0===e?void 0:e.call(l),headers:{}},o.getTimestamps())}catch(e){Xt(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,r)},i.send=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this,s=e.createXhrJsonParser(this,o),a=t[0],l=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),r=new Vt(i.status,e,t?parseInt(t,10):void 0,s),n=i.$$AmplitudeAnalyticsEvent.headers,u=new Bt(a,n);l.status=i.status,o.handleNetworkRequestEvent("xhr",{url:l.url,method:l.method},u,r,void 0,l.startTime,l.durationStart)}catch(e){Xt(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),r.apply(i,t)},i.setRequestHeader=function(e,t){try{var r=this.$$AmplitudeAnalyticsEvent;r&&(r.headers[e]=t)}catch(e){Xt(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}n.apply(this,[e,t])}}},e}(),Qt=new Yt,Zt=function(){function e(){}return e.prototype.parse=function(){return l(this,void 0,void 0,function(){return u(this,function(e){return[2,s(s(s(s({},A),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=Ue();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,r={referrer:void 0,referring_domain:void 0};try{r.referrer=document.referrer||void 0,r.referring_domain=null!==(t=null===(e=r.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return r},e.prototype.getClickIds=function(){var e,t=Ue();return(e={})[S]=t[S],e[x]=t[x],e[k]=t[k],e[C]=t[C],e[E]=t[E],e[I]=t[I],e[O]=t[O],e[P]=t[P],e[T]=t[T],e[R]=t[R],e[M]=t[M],e},e}(),er="data-amp-mask",tr="*****",rr=/\b(?:\d[ -]*?){13,16}\b/,nr=/(\d{3}-?\d{2}-?\d{4})/g,ir=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,or=function(e,t){var r,n;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var i=e;i=(i=(i=i.replace(rr,tr)).replace(nr,tr)).replace(ir,tr);try{for(var o=c(t),s=o.next();!s.done;s=o.next()){var a=s.value;try{i=i.replace(a,tr)}catch(e){}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},sr=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(er)?tr:e?e(document.title):document.title},ar={};Object.defineProperty(ar,"__esModule",{value:!0}),ar.Observable=void 0;const lr=e=>Boolean(Symbol[e]),ur=e=>lr(e)?Symbol[e]:"@@"+e,cr=ur("iterator"),dr=ur("observable"),hr=ur("species");function pr(e,t){let r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function fr(e){let t=e.constructor;return void 0!==t&&(t=t[hr],null===t&&(t=void 0)),void 0!==t?t:xr}function gr(e){gr.log?gr.log(e):setTimeout(()=>{throw e})}function vr(e){Promise.resolve().then(()=>{try{e()}catch(e){gr(e)}})}function mr(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=pr(t,"unsubscribe");e&&e.call(t)}}catch(e){gr(e)}}function yr(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function br(e,t,r){e._state="running";let n=e._observer;try{let i=pr(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(yr(e),!i)throw r;i.call(n,r);break;case"complete":yr(e),i&&i.call(n)}}catch(e){gr(e)}"closed"===e._state?mr(e):"running"===e._state&&(e._state="ready")}function wr(e,t,r){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void vr(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let r=0;r<t.length&&(br(e,t[r].type,t[r].value),"closed"!==e._state);++r);}}(e))):void br(e,t,r);e._queue.push({type:t,value:r})}}class Sr{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let r=this,n={get closed(){return"closed"===r._state},next(e){wr(r,"next",e)},error(e){wr(r,"error",e)},complete(){wr(r,"complete")}};try{this._cleanup=t.call(void 0,n)}catch(e){n.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(yr(this),mr(this))}}class xr{constructor(e){if(!(this instanceof xr))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new Sr(e,this._subscriber)}forEach(e){return new Promise((t,r)=>{if("function"!=typeof e)return void r(new TypeError(e+" is not a function"));function n(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,n)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(fr(this))(t=>this.subscribe({next(r){try{r=e(r)}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(fr(this))(t=>this.subscribe({next(r){try{if(!e(r))return}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=fr(this),r=arguments.length>1,n=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let s=!n;if(n=!0,!s||r)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!n&&!r)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=fr(this);return new t(r=>{let n,i=0;return function o(s){n=s.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){i===e.length?(n=void 0,r.complete()):o(t.from(e[i++]))}})}(this),()=>{n&&(n.unsubscribe(),n=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=fr(this);return new t(r=>{let n=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return r.error(e)}let s=t.from(i).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){let e=n.indexOf(s);e>=0&&n.splice(e,1),o()}});n.push(s)},error(e){r.error(e)},complete(){o()}});function o(){i.closed&&0===n.length&&r.complete()}return()=>{n.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[dr](){return this}static from(e){let t="function"==typeof this?this:xr;if(null==e)throw new TypeError(e+" is not an object");let r=pr(e,dr);if(r){let n=r.call(e);if(Object(n)!==n)throw new TypeError(n+" is not an object");return function(e){return e instanceof xr}(n)&&n.constructor===t?n:new t(e=>n.subscribe(e))}if(lr("iterator")&&(r=pr(e,cr),r))return new t(t=>{vr(()=>{if(!t.closed){for(let n of r.call(e))if(t.next(n),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{vr(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:xr)(t=>{vr(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})})}static get[hr](){return this}}ar.Observable=xr,Object.defineProperty(xr,Symbol("extensions"),{value:{symbol:dr,hostReportError:gr},configurable:!0});var kr=ar.Observable;function Cr(e,t){return new kr(function(r){e.subscribe({next:function(e){t(e).then(function(e){return r.next(e)}).catch(function(e){return r.error(e)})},error:function(e){r.error(e)},complete:function(){r.complete()}})})}function Er(e,t){return new kr(function(r){var n=!1,i=new Set,o=function(){var e,t;n=!0;try{for(var r=c(i),o=r.next();!o.done;o=r.next()){var s=o.value;try{s.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}i.clear()},s=function(e){var t=e.subscribe({next:function(e){n||r.next(e)},error:function(e){n||(n=!0,r.error(e),o())},complete:function(){i.delete(t),n||0!==i.size||(r.complete(),o(),n=!0)}});i.add(t)};return s(e),s(t),o})}function Ir(e){var t=new Set,r=null;function n(){null==r||r.unsubscribe(),r=null,t.clear()}return new kr(function(i){return t.add(i),null===r&&(r=e.subscribe({next:function(e){var r,n,i;try{for(var o=c(t),s=o.next();!s.done;s=o.next()){var a=s.value;null===(i=a.next)||void 0===i||i.call(a,e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},error:function(e){var r,i,o;try{for(var s=c(t),a=s.next();!a.done;a=s.next()){var l=a.value;null===(o=l.error)||void 0===o||o.call(l,e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}n()},complete:function(){var e,r,i;try{for(var o=c(t),s=o.next();!s.done;s=o.next()){var a=s.value;null===(i=a.complete)||void 0===i||i.call(a)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}n()}})),function(){t.delete(i),0===t.size&&r&&(r.unsubscribe(),r=null)}})}var Or,Pr="https://app.amplitude.com",Tr={US:Pr,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var Rr="__AMPLITUDE_MESSENGER_INSTANCE__",Mr="__AMPLITUDE_MESSENGER__",Ar=function(){function e(e){var t=(void 0===e?{}:e).origin,r=void 0===t?Pr:t;this[Or]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=r}return e.prototype.notify=function(e){var t,r,n,i;null===(r=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===r||r.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(n=window.opener)||void 0===n?void 0:n.postMessage)||void 0===i||i.call(n,e,this.endpoint)},e.prototype.sendRequest=function(e,t,r){var n=this;void 0===r&&(r={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,s){n.requestCallbacks[i]={resolve:t,reject:s},n.notify(o),r.timeout>0&&setTimeout(function(){s(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete n.requestCallbacks[i]},r.timeout)})},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.registerActionHandler=function(e,t){var r,n,i,o;this.actionHandlers.has(e)&&(null===(o=null===(i=this.logger)||void 0===i?void 0:i.warn)||void 0===o||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var s=this.pendingMessages.get(e);if(s){this.pendingMessages.delete(e);try{for(var a=c(s),l=a.next();!l.done;l=a.next()){t(l.value)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}},e.prototype.loadScriptOnce=function(e){return l(this,void 0,void 0,function(){var t,r,n;return u(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];r=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,r){var n;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){r({status:!1,message:"Failed to load the script ".concat(e)})}),null===(n=document.head)||void 0===n||n.appendChild(i)}catch(e){r(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,r),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r];case 2:return i.sent(),[3,4];case 3:throw n=i.sent(),this.scriptLoadPromises.delete(e),n;case 4:return[2]}})})},e.prototype.setup=function(e){var t,r,n=this,i=void 0===e?{}:e,o=i.logger,s=i.endpoint;o&&(this.logger=o),s&&this.endpoint===Pr&&(this.endpoint=s),this.isSetup||(this.isSetup=!0,null===(r=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===r||r.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,r,i,o,s;if(null===(r=null===(t=n.logger)||void 0===t?void 0:t.debug)||void 0===r||r.call(t,"Message received: ",JSON.stringify(e)),n.endpoint===e.origin){var a=e.data,l=null==a?void 0:a.action;if(l)if("id"in a&&a.id)null===(o=null===(i=n.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),n.handleResponse(a);else{if("ping"===l)return void n.notify({action:"pong"});var u=n.actionHandlers.get(l);if(u)u(a.data);else{var c=null!==(s=n.pendingMessages.get(l))&&void 0!==s?s:[];c.push(a.data),n.pendingMessages.set(l,c)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=z();(null==e?void 0:e[Mr])===this&&delete e[Mr]},e}();function _r(e){var t,r=z(),n=null==r?void 0:r[Mr];if("object"==typeof(t=n)&&null!==t&&Rr in t&&!0===t[Rr])return n;var i=new Ar(e);return r&&(r[Mr]=i),i}Or=Rr;var Nr="__AMPLITUDE_BACKGROUND_CAPTURE__";function Dr(e,t){var r,n=e;if(!0!==n[Nr]){n[Nr]=!0;var i=null!==(r=null==t?void 0:t.scriptUrl)&&void 0!==r?r:"https://cdn.amplitude.com/libs/background-capture-1.0.3.js.gz",o=null,s=function(t,r){var n,i;"background-capture-complete"===t&&(null===(i=null===(n=e.logger)||void 0===n?void 0:n.debug)||void 0===i||i.call(n,"Background capture complete"),e.notify({action:"background-capture-complete",data:r}))};e.registerActionHandler("initialize-background-capture",function(){var t,r;null===(r=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===r||r.call(t,"Initializing background capture (external script)");var n=new URL(i,e.endpoint).toString();e.loadScriptOnce(n).then(function(){var t,r,n;null===(r=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===r||r.call(t,"Background capture script loaded (external)"),o=null===(n=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===n?void 0:n.call(window,{messenger:e,onBackgroundCapture:s}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==o?void 0:o.close)||void 0===e||e.call(o),o=null})}}var Lr={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function Fr(e,t,r){var n,i,o=[];try{for(var s=c(null!=t?t:[]),a=s.next();!a.done;a=s.next()){var l=a.value;try{o.push(new RegExp(l))}catch(e){r.warn("Invalid regex pattern: ".concat(l),e)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return e.concat(o)}function Ur(e){var t,r,n,i,o,s,a,l,u,p,f,g,v;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var m=Object.keys(e);try{for(var y=c(m),b=y.next();!b.done;b=y.next()){var w=b.value;try{var S=e[w];"boolean"==typeof(null==S?void 0:S.enabled)&&(S.enabled?(delete S.enabled,0===Object.keys(S).length&&(e[w]=!0)):e[w]=!1),Ur(S)}catch(e){}}}catch(e){t={error:e}}finally{try{b&&!b.done&&(r=y.return)&&r.call(y)}finally{if(t)throw t.error}}try{if(null===(u=null===(l=null===(a=e.autocapture)||void 0===a?void 0:a.networkTracking)||void 0===l?void 0:l.captureRules)||void 0===u?void 0:u.length)try{for(var x=c(e.autocapture.networkTracking.captureRules),k=x.next();!k.done;k=x.next()){var C=k.value;try{for(var E=(o=void 0,c(["responseHeaders","requestHeaders"])),I=E.next();!I.done;I=E.next()){var O=I.value,P=null!==(p=C[O])&&void 0!==p?p:{},T=P.captureSafeHeaders,R=P.allowlist;(T||R)&&(void 0===R||Array.isArray(R)?C[O]=h(h([],d(T?_:[]),!1),d(null!=R?R:[]),!1):delete C[O])}}catch(e){o={error:e}}finally{try{I&&!I.done&&(s=E.return)&&s.call(E)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{k&&!k.done&&(i=x.return)&&i.call(x)}finally{if(n)throw n.error}}}catch(e){}void 0!==(null===(f=e.autocapture)||void 0===f?void 0:f.pageViews)&&(e.autocapture.screenViews=e.autocapture.pageViews);var M=null===(g=e.autocapture)||void 0===g?void 0:g.frustrationInteractions;M&&(M.rageClick&&(M.rageClicks=M.rageClick,delete M.rageClick),M.deadClick&&(M.deadClicks=M.deadClick,delete M.deadClick));try{var A=null===(v=e.autocapture)||void 0===v?void 0:v.elementInteractions;if(A&&"object"==typeof A&&(!0===A.viewportContentUpdated&&(A.viewportContentUpdated={}),!1===A.viewportContentUpdated&&(A.viewportContentUpdated={enabled:!1}),void 0!==A.exposureDuration)){var N=A.viewportContentUpdated;void 0===N?A.viewportContentUpdated={exposureDuration:A.exposureDuration}:"object"==typeof N&&void 0===N.exposureDuration&&!1!==N.enabled&&(N.exposureDuration=A.exposureDuration),delete A.exposureDuration}}catch(e){}}}var jr=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])&&(!function(){var e,t,r=z();return"string"==typeof(null===(t=null===(e=null==r?void 0:r.chrome)||void 0===e?void 0:e.runtime)||void 0===t?void 0:t.id)}()||!!(null==e?void 0:e[t]))},Br=function(e){return jr(e,"attribution")},qr=function(e){return jr(e,"formInteractions")},zr=function(e){return jr(e,"pageViews")},Wr=function(e){return jr(e,"sessions")},Vr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},$r=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},Hr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},Kr=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.performanceTracking;return!0===t?{mainThreadBlock:!0}:"object"==typeof t&&null!==t?t:void 0}},Gr=function(e){if($r(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},Jr=function(e){if(Hr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},Xr=function(e){if(Vr(e.autocapture)){var t=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?t=e.autocapture.networkTracking:e.networkTrackingOptions&&(t=e.networkTrackingOptions),s(s({},t),{captureRules:(r=null==t?void 0:t.captureRules,n=e.loggerProvider,null==r?void 0:r.map(function(e){var t,r;if((null===(t=e.urls)||void 0===t?void 0:t.length)&&(null===(r=e.hosts)||void 0===r?void 0:r.length)){var i=JSON.stringify(e.hosts),o=JSON.stringify(e.urls);return null==n||n.warn("Found network capture rule with both urls='".concat(o,"' and hosts='").concat(i,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),s(s({},e),{hosts:void 0})}return e}))})}var r,n},Yr=function(e){var t,r=function(){return!1},n=void 0,i=e.pageCounter;return zr(e.defaultTracking)&&(r=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:r,trackHistoryChanges:n,eventType:t,pageCounter:i}},Qr=function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.name,o=n.args,s=n.resolve,a=e&&e[i];if("function"==typeof a){var l=a.apply(e,o);"function"==typeof s&&s(null==l?void 0:l.promise)}}return e},Zr=function(e){return e&&void 0!==e._q};var en="2.46.0",tn="amplitude-ts",rn=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(tn,"/").concat(en),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,r;return l(this,void 0,void 0,function(){var n,i,o;return u(this,function(a){return n=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,o=null!==(r=e.event_id)&&void 0!==r?r:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=n),[2,s(s(s(s(s(s(s(s({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:n},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Fe()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:V(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:o,library:this.library,user_agent:this.userAgent})]})})},e}(),nn=1e3,on=function(e){function t(t){var r,n,i,o=this;try{i=null===(r=z())||void 0===r?void 0:r.localStorage}catch(e){null===(n=null==t?void 0:t.loggerProvider)||void 0===n||n.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return n(t,e),t.prototype.set=function(t,r){var n;return l(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return Array.isArray(r)&&r.length>nn?(i=r.length-nn,[4,e.prototype.set.call(this,t,r.slice(0,nn))]):[3,2];case 1:return o.sent(),null===(n=this.loggerProvider)||void 0===n||n.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(nn,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,r)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(Xe),sn=function(e){function t(){var t;return e.call(this,null===(t=z())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(Xe),an=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.state={done:4},r.customHeaders=t,r}return n(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),l(this,void 0,void 0,function(){var n=this;return u(this,function(i){return[2,new Promise(function(i,o){"undefined"==typeof XMLHttpRequest&&o(new Error("XHRTransport is not supported."));var a=new XMLHttpRequest;a.open("POST",e,!0),a.onreadystatechange=function(){if(a.readyState===n.state.done){var e=a.responseText;try{i(n.buildResponse(JSON.parse(e)))}catch(e){i(n.buildResponse({code:a.status}))}}};var h={"Content-Type":"application/json",Accept:"*/*"},p=JSON.stringify(t),f=r&&p.length>=2048&&ht(),g=function(e){var t,r;h=s(s({},n.customHeaders),h);try{for(var i=c(Object.entries(h)),o=i.next();!o.done;o=i.next()){var l=d(o.value,2),u=l[0],p=l[1];a.setRequestHeader(u,p)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}a.send(e)};l(n,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return f?[4,pt(p)]:[3,2];case 1:return(e=t.sent())?(h["Content-Encoding"]="gzip",g(e)):g(p),[3,3];case 2:g(p),t.label=3;case 3:return[2]}})}).catch(o)})]})})},t}(ct),ln=function(e){function t(t,r,n){void 0===t&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=!1!==r,i.referrerPolicy=n,i}return n(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),l(this,void 0,void 0,function(){var n,i,o,a,l,c,d,h,p;return u(this,function(u){switch(u.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n=JSON.stringify(t),i=r&&n.length>=2048&&ht(),o=n,a={"Content-Type":"application/json",Accept:"*/*"},i?[4,pt(n)]:[3,2];case 1:(l=u.sent())&&(a["Content-Encoding"]="gzip",o=l),u.label=2;case 2:return a=s(s({},this.customHeaders),a),c="string"==typeof o?o.length:o.byteLength,d={headers:a,body:o,method:"POST",keepalive:this.enableKeepalive&&c<=16384},this.referrerPolicy&&(d.referrerPolicy=this.referrerPolicy),[4,fetch(e,d)];case 3:return[4,(h=u.sent()).text()];case 4:p=u.sent();try{return[2,this.buildResponse(JSON.parse(p))]}catch(e){return[2,this.buildResponse({code:h.status})]}return[2]}})})},t}(ct),un=function(e){function t(){return e.call(this)||this}return n(t,e),t.prototype.send=function(e,t,r){return l(this,void 0,void 0,function(){var r=this;return u(this,function(n){return[2,new Promise(function(n,i){var o=z();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return n(o.navigator.sendBeacon(e,s)?r.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):r.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(ct),cn=function(e,t,r){return void 0===r&&(r=!0),l(void 0,void 0,void 0,function(){var n,i,o,s,a,l,c,h,p;return u(this,function(u){switch(u.label){case 0:return n=function(e){return"".concat(f.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(n)];case 1:return(i=u.sent())?r?[4,t.remove(n)]:[3,3]:[2,{optOut:!1}];case 2:u.sent(),u.label=3;case 3:return o=d(i.split("."),6),s=o[0],a=o[1],l=o[2],c=o[3],h=o[4],p=o[5],[2,{deviceId:s,userId:hn(a),sessionId:dn(c),lastEventId:dn(p),lastEventTime:dn(h),optOut:Boolean(l)}]}})})},dn=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},hn=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},pn="[Amplitude]",fn="".concat(pn," Form Started"),gn="".concat(pn," Form Submitted"),vn="".concat(pn," File Downloaded"),mn="session_start",yn="session_end",bn="".concat(pn," File Extension"),wn="".concat(pn," File Name"),Sn="".concat(pn," Link ID"),xn="".concat(pn," Link Text"),kn="".concat(pn," Link URL"),Cn="".concat(pn," Form ID"),En="".concat(pn," Form Name"),In="".concat(pn," Form Destination"),On="cookie",Pn=Object.freeze({__proto__:null,get IdentifyOperation(){return i},get SpecialEventType(){return o},get RevenueProperty(){return Y},get LogLevel(){return oe},get ServerZone(){return Ct},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:It,DEFAULT_DATA_ATTRIBUTE_PREFIX:Ot,DEFAULT_ACTION_CLICK_ALLOWLIST:Pt,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Lr}),Tn=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Rn=function(e,t,r,n,i,o){void 0===i&&(i=!0),e.referrer;var l=e.referring_domain,u=a(e,["referrer","referring_domain"]),c=t||{};c.referrer;var d,h=c.referring_domain,p=a(c,["referrer","referring_domain"]),f=r.excludeInternalReferrers;if(f){var g=An(f,n);if(!(g instanceof TypeError)&&e.referring_domain&&Ln(e.referring_domain,o)){if("always"===g)return _n(g,e.referring_domain,n),!1;if("ifEmptyCampaign"===g&&(d=s(s({},e),{referring_domain:void 0,referrer:void 0}),Object.values(d).every(function(e){return!e})))return _n(g,e.referring_domain,n),!1}}if(Mn(r.excludeReferrers,e.referring_domain))return n.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&function(e){return Object.values(e).every(function(e){return!e})}(e)&&t)return n.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var v=JSON.stringify(u)!==JSON.stringify(p),m=Tn(l||"")!==Tn(h||""),y=!t||v||m;return y?n.debug("This is a new campaign. An $identify event will be sent."):n.debug("This is not a new campaign because it's the same as the previous one."),y},Mn=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})},An=function(e,t){if(!0===e)return Lr.always;if("object"==typeof e){var r=e.condition;if("string"==typeof r&&Object.keys(Lr).includes(r))return r;if(void 0===r)return Lr.always}var n="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(n),new TypeError(n)};function _n(e,t,r){var n="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?r.debug(n):"ifEmptyCampaign"===e&&r.debug("".concat(n," with empty campaign parameters"))}var Nn=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","cloudfront.net","myshopify.com","blogspot.com","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","netlify.app","workers.dev"],Dn=function(e){var t,r,n=e||(null===(r=null===(t=z())||void 0===t?void 0:t.location)||void 0===r?void 0:r.hostname);if(!n)return"";var i=n.split("."),o=i[i.length-1],s=i[i.length-2];return Nn.find(function(e){return n.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],s=i[i.length-3]),s?"".concat(s,".").concat(o):o},Ln=function(e,t){var r=z();if(!r)return!1;var n,i,o,s=(t||"").trim()||Dn(r.location.hostname);return n=e,o=(i=s).startsWith(".")?i:".".concat(i),!!(n.startsWith(".")?n:".".concat(n)).endsWith(o)},Fn=function(e){function t(t,r,n,i,o,s,a,l,u,c,d,h,p,f,g,v,m,y,b,w,S,x,k,C,E,I,O,P,T,R,M,A,_,N,D,L,F,U,j,B,q,z,W,V){void 0===n&&(n=new $e),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===l&&(l=1e3),void 0===u&&(u=5),void 0===c&&(c=30),void 0===d&&(d=On),void 0===v&&(v=new ae),void 0===m&&(m=oe.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===k&&(k=""),void 0===C&&(C="US"),void 0===O&&(O=18e5),void 0===P&&(P=new on({loggerProvider:v})),void 0===T&&(T={ipAddress:!0,language:!0,platform:!0}),void 0===R&&(R="fetch"),void 0===M&&(M=!1),void 0===A&&(A=!0),void 0===U&&(U=!0),void 0===j&&(j=0),void 0===W&&(W=!1);var $,H=this;(H=e.call(this,{apiKey:t,instanceName:p,storageProvider:P,transportProvider:Bn(R)})||this).apiKey=t,H.appVersion=r,H.cookieOptions=i,H.defaultTracking=o,H.autocapture=s,H.flushIntervalMillis=l,H.flushMaxRetries=u,H.flushQueueSize=c,H.identityStorage=d,H.ingestionMetadata=h,H.loggerProvider=v,H.logLevel=m,H.minIdLength=y,H.offline=b,H.partnerId=S,H.plan=x,H.serverUrl=k,H.serverZone=C,H.sessionTimeout=O,H.storageProvider=P,H.trackingOptions=T,H.transport=R,H.useBatch=M,H.fetchRemoteConfig=A,H.networkTrackingOptions=L,H.identify=F,H.enableDiagnostics=U,H.diagnosticsSampleRate=j,H.diagnosticsClient=B,H.remoteConfig=q,H.topLevelDomain=z,H.enableRequestBodyCompression=W,H.customEnrichment=V,H.version=en,H._optOut=!1,H._cookieStorage=n,H.deviceId=a,H.lastEventId=f,H.lastEventTime=g,H.optOut=w,H.deferredSessionId=I,H.sessionId=E,H.pageCounter=N,H.userId=_,H.debugLogsEnabled=D,H.loggerProvider.enable(D?oe.Debug:H.logLevel),H.networkTrackingOptions=L,H.identify=F,H.enableDiagnostics=U,H.diagnosticsSampleRate=j,H.diagnosticsClient=B;var K=null!==($=null==q?void 0:q.fetchRemoteConfig)&&void 0!==$?$:A;return H.remoteConfig=H.remoteConfig||{},H.remoteConfig.fetchRemoteConfig=K,H.fetchRemoteConfig=K,H.topLevelDomain=z||Dn(),H}return n(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,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof He&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Le(this.apiKey),e)},t}(ce),Un=function(e,t,r,n,i){return void 0===t&&(t={}),l(void 0,void 0,void 0,function(){var o,a,l,c,d,h,p,f,g,v,m,y,b,w,S,x,k,C,E,I,O,P,T,R,M,A,_,N,D,L,F,U,j,B,q,z,W,$,H,K,G,J,X,Y,Q,Z,ee,te,re,ne,ie;return u(this,function(u){switch(u.label){case 0:return o=t.identityStorage||On,a="",o!==On||(null===(P=t.cookieOptions)||void 0===P?void 0:P.domain)||""===(null===(T=t.cookieOptions)||void 0===T?void 0:T.domain)?[3,2]:[4,qn(void 0,n)];case 1:a=u.sent(),u.label=2;case 2:return l=s({domain:null!==(M=null===(R=t.cookieOptions)||void 0===R?void 0:R.domain)&&void 0!==M?M:a,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},t.cookieOptions),c={duplicateResolverFn:function(e){var t=Ke(e);if(!t)return!1;var r=JSON.parse(t);return Ge(r.cookieDomain,l.domain)},diagnosticsClient:n},d=jn(t.identityStorage,l,c),[4,cn(e,d,null===(_=null===(A=t.cookieOptions)||void 0===A?void 0:A.upgrade)||void 0===_||_)];case 3:return h=u.sent(),[4,d.get(Le(e))];case 4:return p=u.sent(),f=Ue(),g=f.ampTimestamp?Number(f.ampTimestamp):void 0,v=!g||Date.now()<g,m=null!==(U=null!==(F=null!==(L=null!==(N=t.deviceId)&&void 0!==N?N:v?null!==(D=f.ampDeviceId)&&void 0!==D?D:f.deviceId:void 0)&&void 0!==L?L:null==p?void 0:p.deviceId)&&void 0!==F?F:h.deviceId)&&void 0!==U?U:V(),y=null!==(j=null==p?void 0:p.lastEventId)&&void 0!==j?j:h.lastEventId,b=null!==(B=null==p?void 0:p.lastEventTime)&&void 0!==B?B:h.lastEventTime,w=null!==(z=null!==(q=t.optOut)&&void 0!==q?q:null==p?void 0:p.optOut)&&void 0!==z?z:h.optOut,S=null!==(W=null==p?void 0:p.sessionId)&&void 0!==W?W:h.sessionId,x=null==p?void 0:p.deferredSessionId,k=null!==(H=null!==($=t.userId)&&void 0!==$?$:null==p?void 0:p.userId)&&void 0!==H?H:h.userId,r.previousSessionDeviceId=null!==(K=null==p?void 0:p.deviceId)&&void 0!==K?K:h.deviceId,r.previousSessionUserId=null!==(G=null==p?void 0:p.userId)&&void 0!==G?G:h.userId,C={ipAddress:null===(X=null===(J=t.trackingOptions)||void 0===J?void 0:J.ipAddress)||void 0===X||X,language:null===(Q=null===(Y=t.trackingOptions)||void 0===Y?void 0:Y.language)||void 0===Q||Q,platform:null===(ee=null===(Z=t.trackingOptions)||void 0===Z?void 0:Z.platform)||void 0===ee||ee},E=null==p?void 0:p.pageCounter,I=null==p?void 0:p.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(O=new Fn(e,t.appVersion,d,l,t.defaultTracking,t.autocapture,m,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,o,t.ingestionMetadata,t.instanceName,y,b,null!==(te=null==i?void 0:i.loggerProvider)&&void 0!==te?te:t.loggerProvider,t.logLevel,t.minIdLength,t.offline,w,t.partnerId,t.plan,t.serverUrl,null!==(re=null==i?void 0:i.serverZone)&&void 0!==re?re:t.serverZone,S,x,t.sessionTimeout,t.storageProvider,C,t.transport,t.useBatch,t.fetchRemoteConfig,k,E,I,t.networkTrackingOptions,t.identify,null!==(ne=null==i?void 0:i.enableDiagnostics)&&void 0!==ne?ne:t.enableDiagnostics,null!==(ie=null==i?void 0:i.diagnosticsSampleRate)&&void 0!==ie?ie:r._diagnosticsSampleRate,n,t.remoteConfig,a,t.enableRequestBodyCompression,t.customEnrichment)).storageProvider.isEnabled()];case 5:return u.sent()||(O.loggerProvider.warn("Storage provider ".concat(O.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),O.storageProvider=new $e),[2,O]}})})},jn=function(e,t,r){switch(void 0===e&&(e=On),void 0===t&&(t={}),e){case"localStorage":return new on;case"sessionStorage":return new sn;case"none":return new $e;default:return new He(s(s({},t),{expirationDays:t.expiration}),r)}},Bn=function(e){var t="object"==typeof e?e.type:e,r="object"==typeof e?e.headers:void 0,n="object"==typeof e?e.enableKeepalive:void 0,i="object"==typeof e?e.referrerPolicy:void 0;return"xhr"===t?new an(r):"beacon"===t?new un:new ln(r,n,i)},qn=function(e,t){return l(void 0,void 0,void 0,function(){var r,n,i,o,s,a,l;return u(this,function(u){switch(u.label){case 0:return[4,new He(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!u.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];if(r=null!=e?e:location.hostname,1===(n=r.split(".")).length)return[2,""];for(i=[],o=1,Nn.find(function(e){return r.endsWith(".".concat(e))})&&(o=2),s=n.length-o-1;s>=0;--s)i.push(n.slice(s).join("."));s=0,u.label=2;case 2:if(!(s<i.length))return[3,7];a=i[s],u.label=3;case 3:return u.trys.push([3,5,,6]),[4,He.isDomainWritable(a)];case 4:return u.sent()?[2,"."+a]:[3,6];case 5:return l=u.sent(),t&&t.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(a),error:l instanceof Error?l.message:String(l)}),[3,6];case 6:return s++,[3,2];case 7:return t&&t.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(r)}),[2,""]}})})},zn="AMP_PAGE_VIEW",Wn=function(e){var t;void 0===e&&(e={});var r,n,i=z(),o=void 0,a=!1,c=e.trackOn,h=e.trackHistoryChanges,p=e.eventType,f=void 0===p?"[Amplitude] Page Viewed":p,g=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==o||o.error("Malformed URI sequence: ",e)}return t},v=function(e){return l(void 0,void 0,void 0,function(){var t,r,n;return u(this,function(i){switch(i.label){case 0:return t=g("undefined"!=typeof location&&location.href||""),n={event_type:f},r=[{}],[4,Vn()];case 1:return[2,(n.event_properties=s.apply(void 0,[s.apply(void 0,r.concat([i.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":t,"[Amplitude] Page Path":"undefined"!=typeof location&&g(location.pathname)||"","[Amplitude] Page Title":sr(or),"[Amplitude] Page URL":t.split("?")[0],"[Amplitude] Page View ID":e}]),n)]}})})},m=function(){return void 0===c||"function"==typeof c&&c()},y="undefined"!=typeof location?location.href:null,b=function(){l(void 0,void 0,void 0,function(){var e,r,i,s,a;return u(this,function(l){switch(l.label){case 0:return e=location.href,r=Hn(h,e,y||"")&&m(),y=e,r?(i=void 0,n&&(i=V(),n.set(zn,{pageViewId:i})),null==o||o.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return a=(s=t).track,[4,v(i)];case 2:a.apply(s,[l.sent()]),l.label=3;case 3:l.label=4;case 4:return[2]}})})},w={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return l(void 0,void 0,void 0,function(){var l,c,h;return u(this,function(u){switch(u.label){case 0:if(t=s,r=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),a=!0,i){try{n=new Xe(i.sessionStorage)}catch(e){null==o||o.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",b),i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,r){var n=d(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),a&&b()}})}return m()?(o.log("Tracking page view event"),l=void 0,n&&(l=V(),n.set(zn,{pageViewId:l})),h=(c=t).track,[4,v(l)]):[3,2];case 1:h.apply(c,[u.sent()]),u.label=2;case 2:return[2]}})})},execute:function(e){return l(void 0,void 0,void 0,function(){var t,i,a;return u(this,function(l){switch(l.label){case 0:return"attribution"===c&&$n(e)?(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,n?[4,n.get(zn)]:[3,2]):[3,4];case 1:i=l.sent(),t=null==i?void 0:i.pageViewId,l.label=2;case 2:return[4,v(t)];case 3:a=l.sent(),e.event_type=a.event_type,e.event_properties=s(s({},e.event_properties),a.event_properties),l.label=4;case 4:return r&&e.event_type===f&&(r.pageCounter=r.pageCounter?r.pageCounter+1:1,e.event_properties=s(s({},e.event_properties),{"[Amplitude] Page Counter":r.pageCounter})),[2,e]}})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(e){return i&&(i.removeEventListener("popstate",b),a=!1),[2]})})}};return w},Vn=function(){return l(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return e=Ve,[4,(new Zt).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},$n=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,r=t[i.SET]||{},n=t[i.UNSET]||{},o=h(h([],d(Object.keys(r)),!1),d(Object.keys(n)),!1);return Object.keys(A).every(function(e){return o.includes(e)})}return!1},Hn=function(e,t,r){if("pathOnly"===e){if(""==r)return!0;var n=new URL(t),i=new URL(r);return n.origin+n.pathname!==i.origin+i.pathname}return t!==r},Kn=function(){var e,t,r=[],n=function(e,t,n){e.addEventListener(t,n),r.push({element:e,type:t,handler:n})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(r,i){return l(void 0,void 0,void 0,function(){var o,s;return u(this,function(a){return t=function(e){if(qr(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions}(r),o=function(){if(i){if("undefined"!=typeof document){var o=new WeakSet,s=function(e){if(!o.has(e)){o.add(e);var s=!1;n(e,"change",function(){var t,r=Jn(e);s||i.track(fn,((t={})[Cn]=Gn(e.id),t[En]=Gn(e.name),t[In]=r,t)),s=!0}),n(e,"submit",function(n){var o,a,l=Jn(e);if(s||i.track(fn,((o={})[Cn]=Gn(e.id),o[En]=Gn(e.name),o[In]=l,o)),s=!0,void 0!==(null==t?void 0:t.shouldTrackSubmit))if("function"==typeof t.shouldTrackSubmit&&"undefined"!=typeof SubmitEvent&&n instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(n))return}catch(e){r.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else r.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(gn,((a={})[Cn]=Gn(e.id),a[En]=Gn(e.name),a[In]=l,a)),s=!1})}};Array.from(document.getElementsByTagName("form")).forEach(s),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("FORM"===e.nodeName&&s(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("form");null==t||t.forEach(s)}}catch(e){r.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(e)))}})})}),e.observe(document.body,{subtree:!0,childList:!0}))}}else r.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")},"complete"===document.readyState?o():(s=z())?s.addEventListener("load",o):r.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(t){return null==e||e.disconnect(),r.forEach(function(e){var t=e.element,r=e.type,n=e.handler;null==t||t.removeEventListener(r,n)}),r=[],[2]})})}}},Gn=function(e){if("string"==typeof e)return e},Jn=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},Xn=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(r,n){return l(void 0,void 0,void 0,function(){var i,o;return u(this,function(s){return i=function(){if(n){if("undefined"!=typeof document){var i=function(e){var r;try{r=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(r.href),s=null==i?void 0:i[1];s&&function(e,r,n){e.addEventListener(r,n),t.push({element:e,type:r,handler:n})}(e,"click",function(){var t;s&&n.track(vn,((t={})[bn]=s,t[wn]=r.pathname,t[Sn]=e.id,t[xn]=e.text,t[kn]=e.href,t))})},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){try{if("A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("a");null==t||t.forEach(i)}}catch(e){r.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(e)))}})})}),e.observe(document.body,{subtree:!0,childList:!0}))}}else r.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")},"complete"===document.readyState?i():(o=z())?o.addEventListener("load",i):r.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(r){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,r=e.type,n=e.handler;null==t||t.removeEventListener(r,n)}),t=[],[2]})})}}},Yn=!1,Qn=function(){var e=z(),t=[],r=function(r,n){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(r,n),t.push({type:r,handler:n}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return l(void 0,void 0,void 0,function(){return u(this,function(n){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,r("online",function(){!1!==e.offline&&(e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),r("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2])})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(r){return t.forEach(function(t){var r=t.type,n=t.handler;null==e||e.removeEventListener(r,n)}),t=[],[2]})})}}};function Zn(e,t){var r,n;if(e){Ur(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",Z(e));var i=e;if(i&&"autocapture"in i){if("boolean"==typeof i.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture&&null!==i.autocapture){var o=s({},i.autocapture);if(void 0===t.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture.elementInteractions&&null!==i.autocapture.elementInteractions&&(null===(r=i.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===r?void 0:r.length)){o.elementInteractions=s({},i.autocapture.elementInteractions);var a=o.elementInteractions,l=null!==(n=a.pageUrlAllowlist)&&void 0!==n?n:[],u=i.autocapture.elementInteractions.pageUrlAllowlistRegex;a.pageUrlAllowlist=Fr(l,u,t.loggerProvider),delete a.pageUrlAllowlistRegex}var d=function(e,t){var r,n,i,o,a;if("object"==typeof e&&null!==e&&(null===(i=e.captureRules)||void 0===i?void 0:i.length)){var l=s({},e),u=null!==(o=l.captureRules)&&void 0!==o?o:[];try{for(var d=c(u),h=d.next();!h.done;h=d.next()){var p=h.value;p.urls=Fr(null!==(a=p.urls)&&void 0!==a?a:[],p.urlsRegex,t),delete p.urlsRegex}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return l}}(i.autocapture.networkTracking,t.loggerProvider);d&&(o.networkTracking=d),"boolean"==typeof t.autocapture&&(t.autocapture=s({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},o)),"object"==typeof t.autocapture&&(t.autocapture=s(s({},t.autocapture),o))}t.defaultTracking=t.autocapture}"customEnrichment"in i&&null!==i.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=i.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",Z(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}var ei="1.29.2",ti="[Amplitude] Element Clicked",ri="[Amplitude] Element Tag",ni="[Amplitude] Element Text",ii="[Amplitude] Page URL",oi="[Amplitude] Viewport Height",si="[Amplitude] Viewport Width",ai="[Amplitude] Page View ID",li="data-amp-mask-attributes",ui="data-amp-internal-shadow";function ci(e,t){var r=e.getAttribute(t.explicitTrackingAttribute);if(null!==r&&""===r)return null;var n=e.getAttribute("id");return null===n||""===n?null:function(e,t){var r,n;if(null==e||""===e)return!1;try{for(var i=c(t),o=i.next();!o.done;o=i.next())if(o.value.test(e))return!1}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0}(n,t.autogeneratedIdPatterns)?n:null}function di(e,t){return t.map(hi).join(" > ")}function hi(e){var t=e.tagName.toLowerCase(),r=e.parentElement;if(null===r)return t;var n=function(e,t){for(var r=0,n=0;n<t.children.length;n++){var i=t.children[n];if(i.tagName===e.tagName&&(r+=1,i===e))return r}return 1}(e,r);return"".concat(t,":nth-of-type(").concat(n,")")}var pi=":scope > ";function fi(e){return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot}function gi(e){var t,r=e.getRootNode();return fi(r)?r:null!==(t=e.ownerDocument)&&void 0!==t?t:document}function vi(e,t){var r,n,i,o;return u(this,function(s){switch(s.label){case 0:r=e,n=0,i=0,s.label=1;case 1:return null!==r&&i<1024?(i+=1,[4,r]):[3,3];case 2:return s.sent(),r.parentElement?(r=r.parentElement,[3,1]):n<t&&"function"==typeof r.getRootNode&&(o=function(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return fi(t)?t.host:null}(r),o&&o!==r)?(n+=1,r=o,[3,1]):[3,3];case 3:return[2]}})}function mi(e,t){var r=[];if(t<=0)return r;for(var n=[[e,0]],i=0;n.length&&i<5e4;){i+=1;var o=d(n.pop(),2),s=o[0],a=o[1],l=s.shadowRoot;if(l&&a+1<=t){r.push({root:l,depth:a+1});for(var u=l.children,c=0;c<u.length;c++)n.push([u[c],a+1])}var h=s.children;for(c=0;c<h.length;c++)n.push([h[c],a])}return r}function yi(e,t){for(var r=[],n=e,i=0;null!==n&&i<1024;){i+=1;var o=gi(n);r.push({root:o,target:n});var s=n.getRootNode();if(!fi(s))break;n=s.host}var a=r.length-1,l=!1,u=r;return a>t&&(u=r.slice(a-t),l=!0),{segments:u.reverse(),truncated:l}}function bi(e,t){var r=e.tagName.toLowerCase(),n=e.parentElement;if(null===n){var i=e.getRootNode();return t&&fi(i)?"".concat(r,":nth-of-type(").concat(wi(e,i.children),")"):r}return"".concat(r,":nth-of-type(").concat(wi(e,n.children),")")}function wi(e,t){for(var r=0,n=0;n<t.length;n++){var i=t[n];if(i.tagName===e.tagName&&(r+=1,i===e))return r}return 1}var Si={name:"explicitTrackingAttribute",try:function(e,t){var r=t.config.explicitTrackingAttribute,n=e.getAttribute(r);return null===n||""===n?null:"[".concat(r,"=").concat(JSON.stringify(n),"]")}};function xi(e){var t=globalThis.CSS;if(t&&"function"==typeof t.escape)return t.escape(e);for(var r=String(e),n=r.length,i="",o=0;o<n;o++){var s=r.charCodeAt(o);0!==s?s>=1&&s<=31||127===s||0===o&&s>=48&&s<=57||1===o&&s>=48&&s<=57&&45===r.charCodeAt(0)?i+="\\".concat(s.toString(16)," "):i+=0!==o||1!==n||45!==s?s>=128||45===s||95===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?r.charAt(o):"\\".concat(r.charAt(o)):"\\-":i+="�"}return i}function ki(e){return xi(e)}var Ci={name:"stableId",try:function(e,t){var r=ci(e,t.config);return null===r?null:"".concat(e.tagName.toLowerCase(),"#").concat(ki(r))}},Ei=!1,Ii=Object.freeze({enabled:!1,explicitTrackingAttribute:"data-amp-track-id",autogeneratedIdPatterns:h([],d([/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/]),!1),unstableClassPatterns:h([],d([/^(p|m|px|py|mx|my|pt|pb|pl|pr|mt|mb|ml|mr)-\d+$/,/^(w|h|min-w|max-w|min-h|max-h)-/,/^(text|bg|border|ring|fill|stroke)-/,/^(hover|focus|active|disabled|group-hover):/,/^(sm|md|lg|xl|2xl):/,/^z-\d+$/,/^data-\[/,/^\[/,/^css-[a-z0-9]{6,}$/,/^[a-zA-Z]+_[a-zA-Z0-9]{3,}__[a-zA-Z0-9]{5,}$/,/^sc-[a-zA-Z0-9]{6,}$/,/^jsx-\d+$/,/^swiper-slide-(visible|fully-visible|active|prev|next|duplicate)$/,/^is-(active|open|selected|hovered|focused|expanded)$/,/^Mui[A-Z][a-zA-Z]+-(focused|selected|disabled|expanded|focusVisible|active|checked)$/,/^Mui-(selected|focused|disabled|expanded|focusVisible|active|checked)$/,/^data-state-/]),!1),maxAncestorWalkDepth:void 0,shadowDomEnabled:Ei,maxShadowDomDepth:1});function Oi(e){var t;return s(s({},e),{shadowDomEnabled:null!==(t=e.shadowDomEnabled)&&void 0!==t?t:Ei,maxShadowDomDepth:Ti(e.maxShadowDomDepth)})}function Pi(e,t){if(!e)return Ri();var r,n=Ri();return"boolean"==typeof e.enabled&&(n.enabled=e.enabled),"string"==typeof e.explicitTrackingAttribute&&""!==e.explicitTrackingAttribute&&(n.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(n.autogeneratedIdPatterns=function(e,t){var r,n,i=[];try{for(var o=c(e),s=o.next();!s.done;s=o.next()){var a=s.value;try{i.push(new RegExp(a))}catch(e){var l=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid autogenerated-id pattern "'.concat(a,'" (').concat(l,")"))}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(n.unstableClassPatterns=function(e,t){var r,n,i=[];try{for(var o=c(e),s=o.next();!s.done;s=o.next()){var a=s.value;try{i.push(new RegExp(a))}catch(e){var l=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid unstable-class pattern "'.concat(a,'" (').concat(l,")"))}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}(e.unstableClassPatterns,t)),n.maxAncestorWalkDepth="number"!=typeof(r=e.maxAncestorWalkDepth)?void 0:Number.isFinite(r)?r<=0?void 0:Math.floor(r):void 0,"boolean"==typeof e.shadowDomEnabled&&(n.shadowDomEnabled=e.shadowDomEnabled),n.maxShadowDomDepth=Ti(e.maxShadowDomDepth),Oi(n)}function Ti(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}function Ri(){return{enabled:Ii.enabled,explicitTrackingAttribute:Ii.explicitTrackingAttribute,autogeneratedIdPatterns:h([],d(Ii.autogeneratedIdPatterns),!1),unstableClassPatterns:h([],d(Ii.unstableClassPatterns),!1),maxAncestorWalkDepth:Ii.maxAncestorWalkDepth,shadowDomEnabled:Ii.shadowDomEnabled,maxShadowDomDepth:Ii.maxShadowDomDepth}}var Mi=[Si,Ci];function Ai(e,t,r){var n,i,o,s,a;void 0===r&&(r={});var l=Oi(t),u=null!==(o=r.strategies)&&void 0!==o?o:Mi,d=null!==(a=null!==(s=r.scope)&&void 0!==s?s:e.ownerDocument)&&void 0!==a?a:document,h={scope:d,config:l},p=function(e,t){var r=[],n=e;for(;null!==n&&(r.push(n),!(void 0!==t&&r.length>t));)n=n.parentElement;return r}(e,l.maxAncestorWalkDepth);try{for(var f=c(u),g=f.next();!g.done;g=f.next())for(var v=g.value,m=0;m<p.length;m++){var y=p[m],b=v.try(y,h);if(null!==b)if(0!==m){var w=di(0,p.slice(0,m).reverse()),S="".concat(b," > ").concat(w);if(_i(d,S,e,v.name,r.logger))return S}else if(_i(d,b,e,v.name,r.logger))return b}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}return null}function _i(e,t,r,n,i){var o;try{o=e.querySelectorAll(t)}catch(e){var s=e instanceof Error?e.message:String(e);return null==i||i.debug('@amplitude/element-selector: strategy "'.concat(n,'" emitted a malformed selector "').concat(t,'" (').concat(s,")")),!1}return 1===o.length&&o[0]===r}function Ni(e,t,r){var n;try{n=e.querySelectorAll(t)}catch(e){return!1}return 1===n.length&&n[0]===r}var Di=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),Li=function(e,t,r){var n,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute("id");if(t){if(o)return new Di(Ui(o),!0);var s=e.tagName.toLowerCase();if("body"===s||"head"===s||"html"===s)return new Di(s,!0)}var a=e.tagName.toLowerCase();if(o)return new Di(a+Ui(o),!0);var l=e.parentNode;if(!l||l.nodeType===Node.DOCUMENT_NODE)return new Di(a,!0);for(var u=Fi(e),d=!1,h=!1,p=-1,f=-1,g=l.children,v=0;g&&(-1===p||!h)&&v<g.length;++v){var m=g[v];if(m.nodeType===Node.ELEMENT_NODE)if(f+=1,m!==e){if(!h&&m.tagName.toLowerCase()===a){d=!0;var y=new Set(u);if(y.size)for(var b=Fi(m),w=0;w<b.length;++w){var S=b[w];if(y.has(S)&&(y.delete(S),!y.size)){h=!0;break}}else h=!0}}else p=f}var x=a;if(r&&"input"===a.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(x+="[type="+xi(e.getAttribute("type")||"")+"]"),h)x+=":nth-child("+String(p+1)+")";else if(d)try{for(var k=c(u),C=k.next();!C.done;C=k.next()){x+="."+xi(C.value.slice(1))}}catch(e){n={error:e}}finally{try{C&&!C.done&&(i=k.return)&&i.call(k)}finally{if(n)throw n.error}}return new Di(x,!1)},Fi=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},Ui=function(e){return"#"+xi(e)};function ji(e,t){try{return function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var r=[],n=e;n;){var i=Li(n,Boolean(t),n===e);if(!i)break;if(r.push(i),i.optimized)break;n=n.parentElement}return r.reverse(),r.join(" > ")}(e)}catch(e){var r=e instanceof Error?e.message:String(e);return null==t||t.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(r)),""}}function Bi(e,t){void 0===t&&(t={});var r=Oi(e),n=new Set,i=t.logger,o=function(e){return ji(e,i)},s=function(e,n){var o;return null!==(o=Ai(e,r,{strategies:t.strategies,scope:n,logger:i}))&&void 0!==o?o:function(e,t,r){var n,i;void 0===r&&(r={});for(var o=Oi(t),s=null!==(i=null!==(n=r.scope)&&void 0!==n?n:e.ownerDocument)&&void 0!==i?i:document,a=fi(s),l=[],u=e,c=0,p=!(o.shadowDomEnabled&&a);null!==u&&!(p&&void 0!==o.maxAncestorWalkDepth&&c>o.maxAncestorWalkDepth);){var f=ci(u,o);if(null!==f){var g=h(["".concat(u.tagName.toLowerCase(),"#").concat(ki(f))],d(l),!1).join(" > ");if(Ni(s,g,e))return g}l.unshift(bi(u,o.shadowDomEnabled)),u=u.parentElement,c+=1}var v=l.join(" > ");return o.shadowDomEnabled&&a&&null===u?"".concat(pi).concat(v):v}(e,r,{scope:n})},a=function(e,t){return function(e,t,r){return e&&r&&fi(t)?"".concat(pi).concat(e):e}(o(e),t,function(e){for(var t=e;null!==t;t=t.parentElement)if(t.getAttribute("id"))return!1;return!0}(e))};return{generate:function(e){var n,l;try{return r.shadowDomEnabled?function(e,t){var n=yi(e,r.maxShadowDomDepth),o=n.segments;return n.truncated&&(null==i||i.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(r.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host"))),o.map(function(e){var r=e.target,n=e.root;return t(r,n)}).join(" >>> ")}(e,r.enabled?s:a):(r.enabled?s:o)(e,null!==(l=null!==(n=t.scope)&&void 0!==n?n:e.ownerDocument)&&void 0!==l?l:document)}catch(t){var u=t instanceof Error?t.message:String(t);return null==i||i.warn("@amplitude/element-selector: selector generation threw — falling back to legacy cssPath: ".concat(u)),ji(e,i)}},getConfig:function(){return r},updateConfig:function(e){var t,o;r=Oi(e);try{for(var s=c(n),a=s.next();!a.done;a=s.next()){var l=a.value;try{l(r)}catch(e){var u=e instanceof Error?e.message:String(e);null==i||i.warn("@amplitude/element-selector: onConfigChange subscriber threw — ".concat(u))}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(t)throw t.error}}},onConfigChange:function(e){return n.add(e),function(){n.delete(e)}}}}var qi,zi,Wi=Object.freeze({enabled:!1,maxDepth:0}),Vi=function(){var e=Wi,t=new Set;return{get:function(){return e},arm:function(r){return e.enabled||!r.enabled||(e=r,function(e){var r,n;try{for(var i=c(h([],d(t),!1)),o=i.next();!o.done;o=i.next()){var s=o.value;try{s(e)}catch(e){}}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.clear()}(r)),e},onArm:function(r){if(e.enabled){var n=e;try{r(n)}catch(e){}return function(){}}return t.add(r),function(){t.delete(r)}}}},$i=["input","select","textarea"],Hi=function(e){var t=e.pageUrlAllowlist,r=e.pageUrlExcludelist;return!(r&&r.length>0&&Be(window.location.href,r))&&!!Be(window.location.href,t)},Ki=function(e,t){return function(r,n){var i,o,s=e.shouldTrackEventResolver,a=null===(o=null===(i=null==n?void 0:n.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!a)return!1;if(s)return s(r,n);if(!Hi(e))return!1;var l=String(null==n?void 0:n.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}if(t){var u=t.some(function(e){var t;return!!(null===(t=null==n?void 0:n.matches)||void 0===t?void 0:t.call(n,e))});if(!u)return!1}switch(a){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return"click"===r}}},Gi=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},Ji=function(e){return Object.keys(e).reduce(function(t,r){var n=e[r];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(n)||(t[r]=n),t},{})},Xi=function(){var e;try{var t=z(),r=null===(e=null==t?void 0:t.sessionStorage)||void 0===e?void 0:e.getItem("AMP_PAGE_VIEW");if(!r)return;var n=JSON.parse(r);if("string"==typeof n.pageViewId)return n.pageViewId}catch(e){}},Yi=function(e,t,r){return void 0===r&&(r=Wi),r.enabled?Zi(e,t,r.maxDepth):Qi(e,t)},Qi=function(e,t){return e?t.some(function(t){var r;return null===(r=null==e?void 0:e.matches)||void 0===r?void 0:r.call(e,t)})?e:Qi(null==e?void 0:e.parentElement,t):null},Zi=function(e,t,r){var n,i;if(!e)return null;var o=function(e){if(t.some(function(t){var r;return null===(r=null==e?void 0:e.matches)||void 0===r?void 0:r.call(e,t)}))return{value:e}};try{for(var s=c(vi(e,r)),a=s.next();!a.done;a=s.next()){var l=o(a.value);if("object"==typeof l)return l.value}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return null},eo=function(e,t,r){return void 0===r&&(r=Wi),r.enabled?ro(e,t,r.maxDepth):to(e,t)},to=function(e,t){var r=[];return t?(e.querySelectorAll(t).forEach(function(e){return r.push(e)}),r):r},ro=function(e,t,r){var n=to(e,t),i=e instanceof Document?e.documentElement:e;return i?(mi(i,r).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return n.push(e)})}),n):n},no=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};function io(e){if(!e)return"";try{var t=new URL(e);return t.search="",qe(t.href)}catch(t){return qe(e)}}function oo(e){var t,r;return void 0===e&&(e=z()),io(null!==(r=null===(t=null==e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==r?r:"")}!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(zi||(zi={}));var so="__AMPLITUDE_VISUAL_TAGGING__";var ao=z(),lo=function(e){return e.get()},uo={childList:!0,attributes:!0,characterData:!0,subtree:!0},co=function(e){return new kr(e?function(t){var r,n=new WeakSet,i=new WeakMap,o=function(e,t){n.has(e)||(n.add(e),fi(e)&&i.set(e,t),a.observe(e,uo))},s=function(e,t,r){var n=r-t;n<=0||mi(e,n).forEach(function(e){var r=e.root,n=e.depth;return o(r,t+n)})},a=new MutationObserver(function(r){var n,o;t.next(r);try{var a=lo(e);if(!a.enabled)return;var l=function(e){var t=function(e){var t=e.getRootNode();if(!fi(t))return 0;var r=i.get(t);return null!=r?r:0}(e.target);e.addedNodes.forEach(function(e){e instanceof Element&&s(e,t,a.maxDepth)})};try{for(var u=c(r),d=u.next();!d.done;d=u.next()){l(d.value)}}catch(e){n={error:e}}finally{try{d&&!d.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}}catch(e){}});if(document.body){var l=document.body;o(l,0),r=e.onArm(function(e){s(l,0,e.maxDepth)})}return function(){null==r||r(),a.disconnect()}}:function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},ho=function(e){return void 0===e&&(e="click"),new kr(function(t){var r,n=function(e){t.next(e)};return null===(r=z())||void 0===r||r.document.addEventListener(e,n,{capture:!0}),function(){var t;null===(t=z())||void 0===t||t.document.removeEventListener(e,n,{capture:!0})}})},po=function(){var e=Er(new kr(function(e){var t=function(t){if(t instanceof ErrorEvent){var r={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?r=s(s({},r),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(r.message=t.error),e.next(r)}};return ao.addEventListener("error",t),function(){ao.removeEventListener("error",t)}}),new kr(function(e){var t=function(t){var r={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(r.message=t.reason.message,r.stack=t.reason.stack):"string"==typeof t.reason&&(r.message=t.reason),e.next(r)};return ao.addEventListener("unhandledrejection",t),function(){ao.removeEventListener("unhandledrejection",t)}}));return Er(e,new kr(function(e){var t=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=void 0;Array.isArray(r[0])&&"string"==typeof r[0][0]&&(i=r[0][0]),e.next({kind:"console",message:i})};return Et.addListener("error",t),function(){Et.removeListener(t)}}))},fo=function(e,t,r){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var n=r.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=n}})},go={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},vo=function(e){var t,r,n,i,o=Object.values(go).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var s=c(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{try{for(var u=(n=void 0,c(l.definition)),d=u.next();!d.done;d=u.next()){var h=d.value,p=go[h.event_type];p&&o[p].add(l.id)}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==l?void 0:l.id,e)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o},mo=function(e){var t,r,n,i,o=new Map;try{for(var s=c(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{for(var u=(n=void 0,c(l.conditions)),d=u.next();!d.done;d=u.next()){var h=d.value;if("LABELED_EVENT"===h.type){var p=h.match.eventId,f=o.get(p);f||(f=[],o.set(p,f)),f.push(l)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o},yo=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return go[t.event_type]===e.type&&t.filters.every(function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)})})})},bo=function(){function e(e,t,r,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=r,this.options=n}return e.prototype.evaluate=function(e){var t,r,n=this.options.pageActions;if(!n)return e;var i=yo(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return n.labeledEvents[e]})),o=function(e,t){var r,n,i,o,s=new Set;try{for(var a=c(e),l=a.next();!l.done;l=a.next()){var u=l.value,d=t.get(u.id);if(d)try{for(var h=(i=void 0,c(d)),p=h.next();!p.done;p=h.next()){var f=p.value;s.add(f)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return Array.from(s)}(i,this.labeledEventToTriggerMap);try{for(var s=c(o),a=s.next();!a.done;a=s.next()){var l=a.value;fo(l.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=r},e}(),wo=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",li,er,ui]),So=["type"],xo=["svg","path","g"],ko=["password","hidden"];function Co(e,t,r){var n,i,o,a,l;if(void 0===r&&(r=Wi),null===e)return null;var u=String(e.tagName).toLowerCase(),d={tag:u},h=Array.from(function(e,t){if(e.parentElement)return e.parentElement.children;var r=e.getRootNode();return t&&fi(r)?r.children:[]}(e,r.enabled));h.length&&(d.index=h.indexOf(e),d.indexOfType=h.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var p=null===(l=null===(a=e.previousElementSibling)||void 0===a?void 0:a.tagName)||void 0===l?void 0:l.toLowerCase();p&&(d.prevSib=String(p));var f=e.getAttribute("id");f&&(d.id=String(f));var g=Array.from(e.classList);g.length&&(d.classes=g);var v={},m=Array.from(e.attributes).filter(function(e){return!wo.has(e.name)}),y=!function(e){var t,r,n,i=null===(r=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===r?void 0:r.call(t),o=e instanceof HTMLElement&&"true"===(null===(n=e.getAttribute("contenteditable"))||void 0===n?void 0:n.toLowerCase());return!$i.includes(i)&&!o}(e);if(!ko.includes(String(e.getAttribute("type")))&&!xo.includes(u))try{for(var b=c(m),w=b.next();!w.done;w=b.next()){var S=w.value;y&&!So.includes(S.name)||(t.has(S.name)?v[S.name]=tr:v[S.name]=String(S.value).substring(0,128))}}catch(e){n={error:e}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(n)throw n.error}}return Object.keys(v).length&&(d.attrs=v),e.shadowRoot&&(d.attrs=s(s({},d.attrs||{}),((o={})[ui]="true",o)),d.shadow=!0),d}function Eo(e,t){return void 0===t&&(t=Wi),e?t.enabled?function(e,t){var r,n,i=[];try{for(var o=c(vi(e,t)),s=o.next();!s.done;s=o.next()){var a=s.value;if("HTML"===a.tagName)break;i.push(a)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}(e,t.maxDepth):function(e){var t=[];t.push(e);var r=e.parentElement;for(;r&&"HTML"!==r.tagName;)t.push(r),r=r.parentElement;return t}(e):[]}var Io;var Oo=function(e,t){var r,n,i,o=this;this.replaceSensitiveString=function(e){return or(e,o.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,r,n,i,s,a=performance.now();if(!e)return[];for(var l=o.getShadowMode(),u=Eo(e,l),p=new Map,f=u.length-1;f>=0;f--){var g=u[f];if(g){var v=Gi(g.getAttribute(li)),m=f===u.length-1?[]:null!==(n=p.get(u[f+1]))&&void 0!==n?n:new Set,y=new Set(h(h([],d(m),!1),d(v),!1));p.set(g,y)}}s=u.map(function(e){var t;return Co(e,null!==(t=p.get(e))&&void 0!==t?t:new Set,l)});var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var r=d(t,2),n=r[0],i=r[1];e.attrs&&(e.attrs[n]=o.replaceSensitiveString(i))})};try{for(var w=c(s),S=w.next();!S.done;S=w.next())b(S.value)}catch(e){t={error:e}}finally{try{S&&!S.done&&(r=w.return)&&r.call(w)}finally{if(t)throw t.error}}var x=performance.now();return null===(i=o.diagnosticsClient)||void 0===i||i.recordHistogram("autocapturePlugin.getHierarchy",x-a),s},this.getNearestLabel=function(e){var t,r=e.parentElement;if(!r)return"";try{t=r.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?o.getText(t):o.getNearestLabel(r)},this.getElementPath=function(e){var t;if(!e)return"";var r=performance.now(),n=o.selectorEngine.generate(e),i=performance.now();return null===(t=o.diagnosticsClient)||void 0===t||t.recordHistogram("autocapturePlugin.getElementPath",i-r),n},this.updateSelectorConfig=function(e,t){var r;if(null!=e){var n="boolean"==typeof e.enabled,i="boolean"==typeof e.shadowDomEnabled;if(n||i){var a=Pi(e,t),l=o.selectorEngine.getConfig().enabled,u=o.shadowGate.get().enabled,c=o.shadowGate.arm(function(e){var t,r=null!==(t=e.maxShadowDomDepth)&&void 0!==t?t:1;return!e.shadowDomEnabled||r<=0?Wi:Object.freeze({enabled:!0,maxDepth:r})}(a));o.selectorEngine.updateConfig(s(s(s({},n?a:o.selectorEngine.getConfig()),{shadowDomEnabled:c.enabled}),c.enabled&&{maxShadowDomDepth:c.maxDepth})),n&&l!==a.enabled&&(null==t||t.debug(a.enabled?"@amplitude/element-selector: engine enabled — now emitting new element-selector element paths for autocapture events.":"@amplitude/element-selector: engine disabled — reverting to legacy cssPath for element paths.")),!u&&c.enabled&&(null===(r=o.diagnosticsClient)||void 0===r||r.setTag("plugin.autocapture.shadowDom","enabled:".concat(c.maxDepth)))}else null==t||t.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` or `shadowDomEnabled` flag — keeping current engine state.")}},this.getShadowMode=function(){return o.shadowGate.get()},this.getEventProperties=function(e,t,r){var n,i,s,a,l,u,c=null===(s=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===s?void 0:s.call(i),h="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},p=o.getHierarchy(t),f=null===(a=p[0])||void 0===a?void 0:a.attrs,g=o.getNearestLabel(t),v=(l=null!=f?f:{},u=r,Object.entries(l).reduce(function(e,t){var r=d(t,2),n=r[0],i=r[1];if(n.startsWith(u)){var o=n.replace(u,"");o&&(e[o]=i||"")}return e},{})),m=((n={})["[Amplitude] Element Hierarchy"]=p,n[ri]=c,n[ni]=o.getText(t),n["[Amplitude] Element Position Left"]=null==h.left?null:Math.round(h.left),n["[Amplitude] Element Position Top"]=null==h.top?null:Math.round(h.top),n["[Amplitude] Element Attributes"]=v,n["[Amplitude] Element Path"]=o.getElementPath(t),n["[Amplitude] Element Parent Label"]=g,n[ii]=qe(window.location.href.split("?")[0]),n["[Amplitude] Page Title"]=sr(o.replaceSensitiveString),n[oi]=window.innerHeight,n[si]=window.innerWidth,n),y=Xi();if(y&&(m[ai]=y),m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null==f?void 0:f["aria-label"],"a"===c&&"click"===e&&t instanceof HTMLAnchorElement){var b=t.href.substring(0,128);m["[Amplitude] Element Href"]=o.replaceSensitiveString(b)}return Ji(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,r,n,i){void 0===i&&(i=!1);var s=o.addTypeAndTimestamp(e,t);try{if(function(e){return"click"===e.type||"change"===e.type}(s)&&null!==s.event.target){var a=o.getShadowMode(),l=function(e,t){var r,n;if(void 0===t&&(t=Wi),!t.enabled)return e.target;var i=null===(r=e.composedPath)||void 0===r?void 0:r.call(e),o=null!==(n=e.target)&&void 0!==n?n:null;if(!i||0===i.length)return o;var s=i[0];if(!(s instanceof Element))return null!=s?s:o;var a=yi(s,t.maxDepth),l=a.segments;return a.truncated&&l.length>0?l[l.length-1].target:s}(s.event,a);if(i){var u=function(e,t){var r,n=null===(r=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===r?void 0:r.call(window,e);return"pointer"===(null==n?void 0:n.getPropertyValue("cursor"))&&"click"===t}(l,s.type);if(u)return s.closestTrackedAncestor=l,s.targetElementProperties=o.getEventProperties(s.type,s.closestTrackedAncestor,n),s}var c=Yi(l,r,a);c&&(s.closestTrackedAncestor=c,s.targetElementProperties=o.getEventProperties(s.type,c,n))}}catch(e){}return s},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var r=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var r=document.documentElement;return e.scope&&t&&(r=t.closest(e.scope)),r&&e.selector?r.querySelector(e.selector):r}}catch(e){return}}(e,t);if(!r)return;return"TEXT"===e.elementExtractType?o.getText(r):"ATTRIBUTE"===e.elementExtractType&&e.attribute?r.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,r,n="[".concat(er,"], [contenteditable]");if(!e.querySelector(n))return e.innerText;var i="",s=Array.from(e.childNodes);try{for(var a=c(s),l=a.next();!l.done;l=a.next()){var u=l.value;u.nodeType!==Node.TEXT_NODE?u instanceof Element&&(u.hasAttribute(er)||u.hasAttribute("contenteditable")?i+=tr:i+=o.getTextWithMaskedDescendants(u)):i+=u.textContent||""}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return i},this.hasMaskedAncestor=function(e){var t=o.getShadowMode();return t.enabled?function(e,t){var r,n;return!!Eo(e,t).some(function(e){return e.hasAttribute(er)})||null!==(n=null===(r=document.documentElement)||void 0===r?void 0:r.hasAttribute(er))&&void 0!==n&&n}(e,t):function(e){return null!==e.closest("[".concat(er,"]"))}(e)},this.getText=function(e){if(o.hasMaskedAncestor(e))return tr;var t="";return t=e.querySelector("[".concat(er,"], [contenteditable]"))?o.getTextWithMaskedDescendants(e):e.innerText||"",o.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,r,n;if(!e)return{};var i=null===(n=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===n?void 0:n.call(r),s=((t={})[ri]=i,t[ni]=o.getText(e),t[ii]=window.location.href.split("?")[0],t);return Ji(s)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(Io||(Io=Bi(Pi())),Io),this.shadowGate=(qi||(qi=Vi()),qi);var a=null!==(i=e.maskTextRegex)&&void 0!==i?i:[],l=[];try{for(var u=c(a),p=u.next();!p.done;p=u.next()){var f=p.value;if(l.length>=25)break;if(f instanceof RegExp)l.push(f);else if("pattern"in f&&"string"==typeof f.pattern)try{l.push(new RegExp(f.pattern,"i"))}catch(e){}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}this.additionalMaskTextPatterns=l};function Po(e,t){var r=e.remoteConfigClient;if(e.fetchRemoteConfig&&r){var n=r.subscribe("configs.analyticsSDK.browserSDK.autocapture.elementSelector","all",function(r,n){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(n),") ").concat(JSON.stringify(r))),t.updateSelectorConfig(r,e.loggerProvider)});return function(){r.unsubscribe(n)}}}var To,Ro=function(e,t){return("fixed"===t||"absolute"===t)&&e instanceof HTMLElement?e.offsetParent:function(e){var t;return e.assignedSlot||e.parentElement||(null===(t=e.parentNode)||void 0===t?void 0:t.host)||null}(e)};function Mo(e){var t=e.allObservables,r=e.onExposure,n=e.dataExtractor,i=e.exposureDuration,o=void 0===i?150:i,s=new Map,a=new Map,l=new Set,u=function(e){var t=a.get(e);t&&(clearTimeout(t),a.set(e,null))},c=function(e){if(function(e){var t=z(),r=t.document.documentElement.clientHeight||t.innerHeight,n=t.document.documentElement.clientWidth||t.innerWidth,i=e.getBoundingClientRect(),o=i.top+.5*i.height,s=Math.max(i.left,0),a=Math.min(i.right,n);if(o<-1||o>r+1||s>=a||i.width<=0)return!1;for(var l=Ro(e,t.getComputedStyle(e).position);l;){var u=t.getComputedStyle(l),c=u.overflowY&&"visible"!==u.overflowY,d=u.overflowX&&"visible"!==u.overflowX;if(c||d){var h=l.getBoundingClientRect();if(c&&(o<h.top-1||o>h.bottom+1))return!1;if(d&&(s=Math.max(s,h.left))>=(a=Math.min(a,h.right)))return!1}l=Ro(l,u.position)}return!0}(e)){if(!s.get(e)&&!a.get(e)){var t=setTimeout(function(){s.set(e,!0);var t=n.getElementPath(e);r(t),a.set(e,null)},o);a.set(e,t)}}else u(e)},d=t.exposureObservable,h=t.scrollObservable,p=d.subscribe(function(e){var t=e,r=t.target;t.isIntersecting?(l.add(r),c(r)):(l.delete(r),u(r))}),f=h.subscribe(function(){l.forEach(c)}),g=function(){a.forEach(function(e){e&&clearTimeout(e)}),a.clear(),s.clear()};return{unsubscribe:function(){p.unsubscribe(),f.unsubscribe(),g(),l.clear()},reset:function(){g(),l.forEach(c)}}}function Ao(e){var t,r,n,i,o,s=e.mutationObservable,a=e.onRescan,l=e.onFlush,u=e.exposureDuration,c=e.quietMs,d=void 0===c?150:c,h=e.maxWaitMs,p=void 0===h?4e3:h,f=!1,g=function(){t&&(clearTimeout(t),t=void 0),r&&(clearTimeout(r),r=void 0),n&&(clearTimeout(n),n=void 0)},v=function(){o&&(document.removeEventListener("DOMContentLoaded",o),o=void 0)},m=function(){f||("undefined"!=typeof document&&"loading"!==document.readyState?(f=!0,g(),v(),a(),n=setTimeout(function(){n=void 0,l()},u+50)):o||(o=function(){o=void 0,y()},document.addEventListener("DOMContentLoaded",o)))},y=function(){f||(t&&clearTimeout(t),t=setTimeout(m,d))},b=function(){g(),v(),f=!1,y(),r=setTimeout(m,p)};return{start:function(){i||(i=s.subscribe(function(){y()}),b())},reset:function(){b()},stop:function(){null==i||i.unsubscribe(),i=void 0,g(),v()}}}!function(e){e.ClickObservable="clickObservable",e.PointerDownObservable="pointerDownObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}(To||(To={}));var _o=function(e,t){var r,n,i,o,a,p,f,g,v,m,y,b;void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",ei);var w=e.dataAttributePrefix,S=void 0===w?Ot:w,x=e.visualTaggingOptions,k=void 0===x?{enabled:!0}:x;e.cssSelectorAllowlist=null!==(r=e.cssSelectorAllowlist)&&void 0!==r?r:It,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:Pt,e.debounceTime=null!==(i=e.debounceTime)&&void 0!==i?i:0;var C=!1!==(null===(o=e.viewportContentUpdated)||void 0===o?void 0:o.enabled),E=null!==(f=null!==(p=null===(a=e.viewportContentUpdated)||void 0===a?void 0:a.exposureDuration)&&void 0!==p?p:e.exposureDuration)&&void 0!==f?f:150;e.viewportContentUpdated=s(s({},e.viewportContentUpdated),{exposureDuration:E}),e.pageUrlExcludelist=null===(g=e.pageUrlExcludelist)||void 0===g?void 0:g.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(r){return console.warn("Invalid regex pattern: ".concat(t.pattern),r),e}return e},[]);var I,O,P="@amplitude/plugin-autocapture-browser",T=[],R=new Oo(e,t),M=new Set,A=new Set,_=new Set,N=function(){var t,r,n=Ir(ho().map(function(t){return R.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,S)})),i=Ir(new kr(function(t){var r,n=function(r){var n=R.addAdditionalEventProperties(r,"change",e.cssSelectorAllowlist,S);t.next(n)};return null===(r=z())||void 0===r||r.document.addEventListener("change",n,{capture:!0}),function(){var e;return null===(e=z())||void 0===e?void 0:e.document.removeEventListener("change",n)}}));window.navigation&&(r=Ir(new kr(function(t){var r=function(r){var n=R.addAdditionalEventProperties(r,"navigate",e.cssSelectorAllowlist,S);t.next(n)};return window.navigation.addEventListener("navigate",r),function(){window.navigation.removeEventListener("navigate",r)}})));var o=R.shadowGate,s=Ir(co(o).map(function(t){return R.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,S)})),a=new kr(function(e){var t,r,n=function(t){e.next(t)};return null===(t=z())||void 0===t||t.addEventListener("scroll",n,{capture:!0,passive:!0}),null===(r=z())||void 0===r||r.addEventListener("resize",n,{passive:!0}),function(){var e,t;null===(e=z())||void 0===e||e.removeEventListener("scroll",n,{capture:!0}),null===(t=z())||void 0===t||t.removeEventListener("resize",n)}}),l=function(e,t,r,n){var i="function"==typeof r?r:void 0,o="function"==typeof r?n:r;return new kr(function(r){var n=z();if(!(null==n?void 0:n.IntersectionObserver))return function(){};var s=new IntersectionObserver(function(e){e.forEach(function(e){r.next(e)})},{root:null,rootMargin:"0px",threshold:0}),a=t.join(","),l=function(e){e instanceof Element&&e.matches(a)&&s.observe(e),e.querySelectorAll(a).forEach(function(e){s.observe(e)})},u=function(e){if(o)try{eo(e,a,lo(o)).forEach(function(e){s.observe(e)})}catch(e){}},c=function(){var e=null==n?void 0:n.document;if(e){var t=[];try{t=o&&lo(o).enabled?eo(e,a,lo(o)):e.querySelectorAll(a)}catch(e){return}Array.from(t).forEach(function(e){s.unobserve(e),s.observe(e)})}};null==i||i(c),c();var d=null==o?void 0:o.onArm(function(){(null==n?void 0:n.document)&&u(n.document)}),h=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){if(e instanceof DocumentFragment)l(e);else if(e instanceof Element)if(o&&lo(o).enabled){try{e.matches(a)&&s.observe(e)}catch(e){}u(e)}else l(e)})})});return function(){null==i||i(void 0),null==d||d(),h.unsubscribe(),s.disconnect()}})}(s,e.cssSelectorAllowlist,function(e){O=e},o);return(t={})[To.ChangeObservable]=i,t[To.ClickObservable]=n,t[To.MutationObservable]=s,t[To.NavigateObservable]=r,t[To.ScrollObservable]=a,t[To.ExposureObservable]=l,t},D=vo(Object.values(null!==(m=null===(v=e.pageActions)||void 0===v?void 0:v.labeledEvents)&&void 0!==m?m:{})),L=mo(null!==(b=null===(y=e.pageActions)||void 0===y?void 0:y.triggers)&&void 0!==b?b:[]),F=function(e,t,r,n){return new bo(e,t,r,n)}(D,L,R,e);return{name:P,type:"enrichment",setup:function(t,r){return l(void 0,void 0,void 0,function(){var n,i,o,a,l,c,p,f,g,v,m,y,b,w,x,U,j,B,q,W,V,$,H,K,G,J,X;return u(this,function(u){return"undefined"==typeof document||(n=!1,t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(t){!function(t){var r,n;t&&(e.pageActions=s(s({},e.pageActions),t),D=vo(Object.values(null!==(r=e.pageActions.labeledEvents)&&void 0!==r?r:{})),L=mo(null!==(n=e.pageActions.triggers)&&void 0!==n?n:[]),F.update(D,L,e))}(t)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),(i=Po(t,R))&&T.push({unsubscribe:i}),o=Ki(e,e.cssSelectorAllowlist),a=Ki(e,e.actionClickAllowlist),l=N(),c=function(e){var t=e.amplitude,r=e.allObservables,n=e.shouldTrackEvent,i=e.evaluateTriggers;return r.clickObservable.filter(no).filter(function(e){return n("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(ti,e.targetElementProperties)})}({allObservables:l,amplitude:r,shouldTrackEvent:o,evaluateTriggers:F.evaluate.bind(F)}),T.push(c),p=function(e){var t=e.amplitude,r=e.allObservables,n=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return r.changeObservable.filter(no).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",n("change",e.closestTrackedAncestor))})}({allObservables:l,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return R.getEventProperties.apply(R,h(h([],d(e),!1),[S],!1))},amplitude:r,shouldTrackEvent:o,evaluateTriggers:F.evaluate.bind(F)}),T.push(p),f=function(e){var t=e.amplitude,r=e.allObservables,n=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,s=e.shouldTrackActionClick,a=r.clickObservable,l=r.mutationObservable,u=r.navigateObservable,c=a.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=Yi(e.event.target,n.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(no).filter(function(e){return s("click",e.closestTrackedAncestor)}),d=u?Er(l,u):l,h=Er(c,d),p=null,f=null;return Cr(h,function(e){if(p&&(clearTimeout(p),p=null),"click"===e.type)return f=e,p=setTimeout(function(){p=null,f=null},500),Promise.resolve(null);if(f){var t=f;return f=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==t||t.track(ti,i("click",e.closestTrackedAncestor)))})}({allObservables:l,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return R.getEventProperties.apply(R,h(h([],d(e),!1),[S],!1))},amplitude:r,shouldTrackEvent:o,shouldTrackActionClick:a}),f&&T.push(f),g=function(e){e.amplitude;var t=e.allObservables.scrollObservable,r={maxX:0,maxY:0},n=t.subscribe(function(){var e,t,n,i,o=z(),s=Math.floor(null!==(t=null!==(e=null==o?void 0:o.scrollX)&&void 0!==e?e:null==o?void 0:o.pageXOffset)&&void 0!==t?t:0),a=Math.floor(null!==(i=null!==(n=null==o?void 0:o.scrollY)&&void 0!==n?n:null==o?void 0:o.pageYOffset)&&void 0!==i?i:0);r.maxX=Math.max(r.maxX,s),r.maxY=Math.max(r.maxY,a)});return{unsubscribe:function(){n.unsubscribe()},getState:function(){return r},reset:function(){r.maxX=0,r.maxY=0}}}({allObservables:l,amplitude:r}),T.push(g),v=s({},g.getState()),m={},y=z(),w=function(e){e&&(null==b||b.reset()),e&&n||(e&&(n=!0,setTimeout(function(){n=!1},100)),function(e){var t,r,n,i=e.amplitude,o=e.scrollTracker,s=e.currentElementExposed,a=e.elementExposedForPage,l=e.elementExposedInSentEvents,u=e.exposureTracker,c=e.isPageEnd,d=e.lastScroll,h=o.getState(),p=z(),f=null!==(r=null==p?void 0:p.innerWidth)&&void 0!==r?r:0,g=null!==(n=null==p?void 0:p.innerHeight)&&void 0!==n?n:0,v=Array.from(s).filter(function(e){return!l.has(e)}),m=((t={})[ii]=oo(p),t["[Amplitude] Max Page X"]=h.maxX+f,t["[Amplitude] Max Page Y"]=h.maxY+g,t[oi]=g,t[si]=f,t["[Amplitude] Element Exposed"]=v,t),y=Xi();y&&(m[ai]=y);var b=function(){o.reset();var e=o.getState();d.maxX=e.maxX,d.maxY=e.maxY,a.clear(),l.clear(),null==u||u.reset()};0!==v.length||h.maxX!==d.maxX||h.maxY!==d.maxY?(null==i||i.track("[Amplitude] Viewport Content Updated",m),d.maxX=h.maxX,d.maxY=h.maxY,v.forEach(function(e){l.add(e)}),s.clear(),c&&b()):c&&b()}({amplitude:r,scrollTracker:g,currentElementExposed:_,elementExposedForPage:M,elementExposedInSentEvents:A,exposureTracker:m.exposure,isPageEnd:e,lastScroll:v}))},x=oo(y),U=function(){var e=oo(y);e!==x&&(x=e,w(!0))},j=function(e,t){var r=oo(y),n=function(e,t){var r;if(void 0===t&&(t=z()),null==e||""===e)return oo(t);var n=(null===(r=null==t?void 0:t.location)||void 0===r?void 0:r.href)||"http://localhost/";try{return io(new URL(e,n).href)}catch(e){return oo(t)}}(t,y);r!==n?(x=n,w(!0),e()):e()},B=function(e){!function(e,t,r,n,i){if(!t.has(e)&&!r.has(e)){t.add(e),n.add(e);var o=Array.from(n);JSON.stringify(o).length>=18e3&&i(!1)}}(e,M,A,_,w)},C&&(m.exposure=Mo({allObservables:l,onExposure:B,dataExtractor:R,exposureDuration:E}),m.exposure&&T.push(m.exposure),b=Ao({mutationObservable:l[To.MutationObservable],onRescan:function(){var e,r;null===(r=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===r||r.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),null==O||O()},onFlush:function(){var e,r;null===(r=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===r||r.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),w(!1)},exposureDuration:E}),b.start(),T.push({unsubscribe:function(){null==b||b.stop()}}),q=function(){w(!0)},null==y||y.addEventListener("beforeunload",q),I=function(){null==y||y.removeEventListener("beforeunload",q)},T.push({unsubscribe:function(){return I()}}),(W=l[To.NavigateObservable])?T.push(W.subscribe(function(e){var t,r,n=null===(r=null===(t=e.event)||void 0===t?void 0:t.destination)||void 0===r?void 0:r.url;if(n){var i=io(n);if(i===x)return;return x=i,void w(!0)}U()})):y&&(V=function(){U()},y.addEventListener("popstate",V),$=y.history.pushState,H=y.history.replaceState,y.history&&$&&(y.history.pushState=new Proxy($,{apply:function(e,t,r){j(function(){e.apply(t,r)},r[2])}})),y.history&&H&&(y.history.replaceState=new Proxy(H,{apply:function(e,t,r){j(function(){e.apply(t,r)},r[2])}})),T.push({unsubscribe:function(){y.removeEventListener("popstate",V),y.history&&$&&(y.history.pushState=$),y.history&&H&&(y.history.replaceState=H)}}))),null===(X=null==t?void 0:t.loggerProvider)||void 0===X||X.log("".concat(P," has been successfully added.")),window.opener&&k.enabled&&(K=e.cssSelectorAllowlist,G=e.actionClickAllowlist,function(e,t){var r=e;if(!0!==r[so]){r[so]=!0;var n=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,s=t.actionClickAllowlist,a=null,l=function(t){e.notify({action:"element-selected",data:t})},u=function(t,r){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:r}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:r})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var r;a=null===(r=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===r?void 0:r.call(window,{getEventTagProps:n.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:u,onSelect:l,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:s,extractDataFromDataSource:n.extractDataFromDataSource,dataExtractor:n,diagnostics:{autocapture:{version:ei}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==a?void 0:a.close)||void 0===e||e.call(a)})}}(J=_r(),{dataExtractor:R,isElementSelectable:Ki(e,h(h([],d(K),!1),d(G),!1)),cssSelectorAllowlist:K,actionClickAllowlist:G}),Dr(J),J.setup(s({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:Tr[t.serverZone]})))),[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){var e,t,r,n;return u(this,function(i){try{for(e=c(T),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(n=e.return)&&n.call(e)}finally{if(r)throw r.error}}return[2]})})}}},No=["mutation","navigate"];function Do(e,t){var r,n,i,o,s=t.event,a=s.pageX,l=s.pageY;e.yMin=Math.min(null!==(r=e.yMin)&&void 0!==r?r:l,l),e.yMax=Math.max(null!==(n=e.yMax)&&void 0!==n?n:l,l),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:a,a),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:a,a),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function Lo(e){if(0===e.length)return null;var t=e[0],r=e[e.length-1];return{rageClickEvent:s({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(r.timestamp).toISOString(),"[Amplitude] Duration":r.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function Fo(e){var t=this,r=e.amplitude,n=e.allObservables,i=e.shouldTrackRageClick,o=n.pointerDownObservable,s=n.selectionObservable,a=[],c={},d=null;function h(e){a=[],c={},e&&(Do(c,e),a.push(e))}var p=Cr(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return l(t,void 0,void 0,function(){var t;return u(this,function(r){return Do(c,e),t=null,0===a.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(a,e)||function(e,t){var r=e[Math.max(0,e.length-4+1)];return t.timestamp-r.timestamp>=1e3}(a,e)||c.isOutOfBounds?(d&&(t=Lo(a)),h(e)):a.push(e),d&&(clearTimeout(d.timerId),d.resolve(t),d=null),a.length>=4?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(Lo(a))},1e3)}})]:[2,null]})})}),f=null==s?void 0:s.subscribe(function(){h()}),g=p.subscribe(function(e){null!==e&&r.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){g.unsubscribe(),null==f||f.unsubscribe()}}}var Uo,jo;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(Uo||(Uo={})),function(e){e.X="x",e.Y="y"}(jo||(jo={}));function Bo(e){var t=e.changes,r=e.changesThreshold,n=e.thresholdMs;return!(t.length<r)&&t[t.length-1]-t[0]<n}function qo(e){e.changes=[],e.startTime=void 0}function zo(e){for(var t=e.changes,r=e.thresholdMs,n=0,i=t[t.length-1];n<t.length;n++){if(i-t[n]<r)break}0!==n&&(e.startTime=t[n],e.changes.splice(0,n))}var Wo=function(e){var t=e.mouseDirectionChangeObservable,r=e.directionChanges,n=void 0===r?20:r,i=e.thresholdMs,o=void 0===i?2e3:i;return new kr(function(e){var r={changes:[],changesThreshold:n,thresholdMs:o},i={changes:[],changesThreshold:n,thresholdMs:o},s=void 0,a=null;function l(){void 0!==s&&(e.next(s),s=void 0,null!==a&&clearTimeout(a),qo(r),qo(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),function(e){var t=+Date.now();e.startTime=e.startTime||t;var r=e.changes,n=e.changesThreshold;r.push(t),r.length>n&&r.shift()}(e===jo.X?r:i);var t=function(e,t){var r=void 0;if(Bo(e)&&(r=e.startTime),Bo(t)){var n=t.startTime;n&&(!r||n<r)&&(r=n)}return r}(r,i);return t?(s=s||t,a=setTimeout(function(){l(),a=null},o)):l(),zo(r),zo(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},Vo=function(e){var t=e.amplitude,r=e.options,n=e.allObservables,i=e.directionChanges,o=void 0===i?20:i,s=e.thresholdMs,a=void 0===s?2e3:s,l=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new kr(function(e){var r=null,n=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==r?(o.x>r.x?(n===Uo.DECREASING&&e.next(jo.X),n=Uo.INCREASING):o.x<r.x&&(n===Uo.INCREASING&&e.next(jo.X),n=Uo.DECREASING),o.y>r.y?(i===Uo.DECREASING&&e.next(jo.Y),i=Uo.INCREASING):o.y<r.y&&(i===Uo.INCREASING&&e.next(jo.Y),i=Uo.DECREASING),r=o):r=o})})}({allWindowObservables:n});return Wo({mouseDirectionChangeObservable:l,directionChanges:o,thresholdMs:a}).subscribe(function(e){Hi(r)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function $o(e,t,r,n){if(!n)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:r}var Ho=4e3,Ko=function(e){var t;void 0===e&&(e={});var r="@amplitude/plugin-frustration-browser",n=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var o=!1!==e.deadClicks&&null!==e.deadClicks,a=!1!==e.rageClicks&&null!==e.rageClicks,p=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(p=!1);var f=$o(e,"rageClicks",At,a),g=$o(e,"deadClicks",Rt,o),v=$o(e,"errorClicks",Mt,i),m=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:Ot,y=new Oo(e),b=h([],d(new Set(h(h(h([],d(f),!1),d(g),!1),d(v),!1))),!1),w=function(){var e,t,r=function(e){return Ir(ho(e).map(function(e){return y.addAdditionalEventProperties(e,"click",b,m,!0)}))},n=r("click"),i=r("pointerdown"),o=Ir(po().map(function(e){return y.addTypeAndTimestamp(e,"error")})),a=Ir(co(y.shadowGate).map(function(e){return y.addAdditionalEventProperties(e,"mutation",b,m)}));window.navigation&&(t=Ir(new kr(function(e){var t=function(t){e.next(s(s({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return y.addAdditionalEventProperties(e,"navigate",b,m)})));var l=Ir(new kr(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){try{if(t.selectionStart===t.selectionEnd)return}catch(e){return}return e.next()}var r=window.getSelection();if(r&&!r.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),u=Ir(new kr(function(e){var t=function(t){e.next(t)},r={capture:!0};return ao.document.addEventListener("mousemove",t,r),function(){ao.document.removeEventListener("mousemove",t,r)}}));return(e={})[To.ClickObservable]=n,e[To.PointerDownObservable]=i,e[To.MutationObservable]=a,e[To.NavigateObservable]=t,e[To.BrowserErrorObservable]=o,e[To.SelectionObservable]=l,e[To.MouseMoveObservable]=u,e};return{name:r,type:"enrichment",setup:function(t,c){return l(void 0,void 0,void 0,function(){var l,d,h,b,S,x,k,C,E,I,O,P;return u(this,function(u){return"undefined"==typeof document||(l=w(),(d=Po(t,y))&&n.push({unsubscribe:d}),a&&(h=Ki(e,f),b=Fo({allObservables:l,amplitude:c,shouldTrackRageClick:h}),n.push(b)),o&&(S=Ki(e,g),x=function(e){var t=e.amplitude,r=e.allObservables,n=e.getEventProperties,i=e.shouldTrackDeadClick,o=r.clickObservable,a=r.mutationObservable,l=r.navigateObservable,u=o.filter(function(e){return no(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===zi.LEFT_OR_TOUCH_CONTACT}),c=l?Er(a,l):a,d=Er(u,c),h=null;return Cr(d,function(e){return h&&No.includes(e.type)?(clearTimeout(h),h=null,Promise.resolve(null)):"click"===e.type?h?Promise.resolve(null):new Promise(function(t){h=setTimeout(function(){t(e),h=null},3e3)}):Promise.resolve(null)}).subscribe(function(e){if(e){var r={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",s(s({},n("click",e.closestTrackedAncestor)),r),{time:e.timestamp})}})}({amplitude:c,allObservables:l,getEventProperties:function(e,t){return y.getEventProperties(e,t,m)},shouldTrackDeadClick:S}),n.push(x)),i&&(k=Ki(e,v),C=function(e){var t=e.amplitude,r=e.allObservables,n=e.shouldTrackErrorClick,i=r.pointerDownObservable,o=r.browserErrorObservable,a=i.filter(function(e){return no(e)&&n("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===zi.LEFT_OR_TOUCH_CONTACT}),l=null,u=null,c=function(){null!==l&&(clearTimeout(l),l=null),u=null};return Er(a,o).subscribe(function(e){var r;if("click"===e.type)return c(),u=e,void(l=setTimeout(c,2e3));"error"===e.type&&u&&(t.track("[Amplitude] Error Click",s(((r={})["[Amplitude] Kind"]=e.event.kind,r["[Amplitude] Message"]=e.event.message,r["[Amplitude] Stack"]=e.event.stack,r["[Amplitude] Filename"]=e.event.filename,r["[Amplitude] Line Number"]=e.event.lineNumber,r["[Amplitude] Column Number"]=e.event.columnNumber,r),u.targetElementProperties)),c())})}({amplitude:c,allObservables:l,shouldTrackErrorClick:k}),n.push(C)),p&&(E=void 0,I=void 0,"object"==typeof e.thrashedCursor&&(E=e.thrashedCursor.directionChanges,I=e.thrashedCursor.threshold,E&&E<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(E," is below the minimum of ").concat(5,", setting to ").concat(5)),E=5),I&&I>Ho&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(I," is above the maximum of ").concat(Ho,", setting to ").concat(Ho)),I=Ho)),O=Vo({amplitude:c,options:e,allObservables:l,directionChanges:E,thresholdMs:I}),n.push(O)),null===(P=null==t?void 0:t.loggerProvider)||void 0===P||P.log("".concat(r," has been successfully added."))),[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){var e,t,r,i;return u(this,function(o){try{for(e=c(n),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}};function Go(e,t){var r=e.startTime+e.duration;return t.filter(function(t){return t.startTime<r&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}function Jo(e,t){var r,n=Go(e,t),i=null!==(r=e.scripts)&&void 0!==r?r:[],o=i.map(function(e){return e.sourceURL}).filter(Boolean),a=i.map(function(e){return e.sourceFunctionName}).filter(Boolean),l=i.map(function(e){return e.sourceCharPosition}).filter(function(e){return"number"==typeof e&&e>=0}),u=i.map(function(e){return e.invokerType}).filter(Boolean),c=i.map(function(e){return e.invoker}).filter(Boolean);return s(s(s(s(s(s(s({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},n.length>0&&{"[Amplitude] Main Thread Block Measures":n}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),o.length>0&&{"[Amplitude] Main Thread Block Script URLs":o}),a.length>0&&{"[Amplitude] Main Thread Block Script Functions":a}),l.length>0&&{"[Amplitude] Main Thread Block Script Positions":l}),u.length>0&&{"[Amplitude] Main Thread Block Invoker Types":u}),c.length>0&&{"[Amplitude] Main Thread Block Invokers":c})}function Xo(e,t){var r,n=Go(e,t),i=null!==(r=e.attribution)&&void 0!==r?r:[];return s(s({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},n.length>0&&{"[Amplitude] Main Thread Block Measures":n}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}function Yo(e){var t=e.amplitude,r=e.options,n=e.durationThreshold,i=void 0===n?100:n,o=function(){if("undefined"==typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!o)return{unsubscribe:function(){}};var s=[],a=new PerformanceObserver(function(e){var t,r,n=performance.now();try{for(var i=c(e.getEntries()),o=i.next();!o.done;o=i.next()){var a=o.value;s.push(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}for(var l=n-1e4;s.length>0&&s[0].startTime<l;)s.shift()});try{a.observe({entryTypes:["measure"]})}catch(e){}var l=new PerformanceObserver(function(e){var n,a;try{for(var l=c(e.getEntries()),u=l.next();!u.done;u=l.next()){var d=u.value;if(!Hi(r))return;if(!(d.duration<i)){var h="long-animation-frame"===o?Jo(d,s):Xo(d,s);t.track("[Amplitude] Main Thread Block",h)}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(n)throw n.error}}});try{l.observe({entryTypes:[o]})}catch(e){return a.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){l.disconnect(),a.disconnect()}}}var Qo,Zo,es=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",r=[],n=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(i,o){return l(void 0,void 0,void 0,function(){var s,a,l;return u(this,function(u){return"undefined"==typeof document||(n&&(s=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(s=e.mainThreadBlock.durationThreshold),a=Yo({amplitude:o,options:e,durationThreshold:s}),r.push(a)),null===(l=null==i?void 0:i.loggerProvider)||void 0===l||l.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){var e,t,n,i;return u(this,function(o){try{for(e=c(r),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]})})}}},ts="[Amplitude] Network Request",rs="500-599";function ns(e,t){var r="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(r).test(e)}function is(e,t){var r,n,i=t.split(",");try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var a=d(s.value.split("-").map(Number),2),l=a[0],u=a[1];if(e===l&&void 0===u)return!0;if(e>=l&&e<=u)return!0}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return!1}function os(e){var t;if(e)try{var r=null===(t=z())||void 0===t?void 0:t.location.href,n=new URL(e,r),i=n.searchParams.toString(),o=n.hash.replace("#",""),s=n.href,a=n.host;return n.hash="",n.search="",{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:n.href,host:a}}catch(t){try{return function(e){var t,r=e.indexOf("#"),n=r>=0?e.slice(r+1):"",i=r>=0?e.slice(0,r):e,o=i.indexOf("?"),s=o>=0?i.slice(o+1):"",a=o>=0?i.slice(0,o):i,l=a.match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i);return{query:s,fragment:n,href:e,hrefWithoutQueryOrHash:a,host:null!==(t=null==l?void 0:l[1])&&void 0!==t?t:""}}(e)}catch(e){return}}}function ss(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return h([],d(_),!1);if(void 0===e){return}}}function as(e){var t,r,n;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(r=null==e?void 0:e.blocklist)||void 0===r?void 0:r.length)&&!(null===(n=null==e?void 0:e.excludelist)||void 0===n?void 0:n.length)}function ls(e,t){var r;void 0===t&&(t={});var n=os(e.url);if(!n)return!1;var i,o=n.host;if(!1!==t.ignoreAmplitudeRequests&&(ns(o,"*.amplitude.com")||ns(o,"amplitude.com")))return!1;if(null===(r=t.ignoreHosts)||void 0===r?void 0:r.find(function(e){return ns(o,e)}))return!1;if(!t.captureRules&&void 0!==e.status&&!is(e.status,rs))return!1;if(t.captureRules&&(h([],d(t.captureRules),!1).reverse().find(function(t){if(i=function(e,t,r,n,i){if((!e.hosts||e.hosts.find(function(e){return ns(t,e)}))&&(!n||!e.urls||Be(n,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return!((r||0===r)&&!is(r,e.statusCodeRange||rs))}(t,o,e.status,e.url,e.method),i){var r=ss(t.responseHeaders);if(e.responseWrapper&&r){var n=e.responseWrapper.headers(r);n&&(e.responseHeaders=n)}var s=ss(t.requestHeaders);if(e.requestWrapper&&s){var a=e.requestWrapper.headers(s);a&&(e.requestHeaders=a)}if(e.responseWrapper&&t.responseBody&&!as(t.responseBody)){var l=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,l)}if(e.requestWrapper&&t.requestBody&&!as(t.requestBody)){l=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,l)}}return void 0!==i}),!i))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var r=t.body;if("string"!=typeof r)return!1;if(JSON.parse(r).events.find(function(e){return e.event_type===ts}))return!0}catch(e){}return!1}(o,e.requestWrapper)}function us(e){var t=e.allObservables,r=e.networkTrackingOptions,n=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return ls(e.event,r)}).subscribe(function(e){var t,r,o,s=e.event,a=os(s.url);if(a){var c=null===(r=s.responseWrapper)||void 0===r?void 0:r.bodySize,h=null===(o=s.requestWrapper)||void 0===o?void 0:o.bodySize;!function(e,t,r,n){l(this,void 0,void 0,function(){var i,o,s;return u(this,function(a){switch(a.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(i=d.apply(void 0,[a.sent(),2]),o=i[0],s=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==n||n.debug("Failed to stringify request body",e)}if(s)try{e["[Amplitude] Response Body"]=JSON.stringify(s)}catch(e){null==n||n.debug("Failed to stringify response body")}a.label=2;case 2:return null==r||r.track(ts,e),[2]}})})}(((t={})["[Amplitude] URL"]=a.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=a.query,t["[Amplitude] URL Fragment"]=a.fragment,t["[Amplitude] Request Method"]=s.method,t["[Amplitude] Status Code"]=s.status,t["[Amplitude] Start Time"]=s.startTime,t["[Amplitude] Completion Time"]=s.endTime,t["[Amplitude] Duration"]=s.duration,t["[Amplitude] Request Body Size"]=h,t["[Amplitude] Response Body Size"]=c,t["[Amplitude] Request Type"]=s.type,t["[Amplitude] Request Headers"]=s.requestHeaders,t["[Amplitude] Response Headers"]=s.responseHeaders,t),s,n,i)}})}!function(e){e.NetworkObservable="networkObservable"}(Qo||(Qo={}));var cs=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-network-capture-browser",n=function(){var e,r=new kr(function(e){var r=new Jt(function(t){var r=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(r)});return Qt.subscribe(r,t),function(){Qt.unsubscribe(r)}});return(e={})[Qo.NetworkObservable]=r,e};return{name:r,type:"enrichment",setup:function(i,o){return l(void 0,void 0,void 0,function(){var s;return u(this,function(a){return"undefined"!=typeof document||function(){var e,t=z();return"ReactNative"===(null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.product)}()?(s=n(),t=null==i?void 0:i.loggerProvider,Zo=us({allObservables:s,networkTrackingOptions:e,amplitude:o,loggerProvider:t}),null==t||t.log("".concat(r," has been successfully added.")),[2]):[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(e){return Zo.unsubscribe(),[2]})})}}};let ds=-1;const hs=e=>{addEventListener("pageshow",t=>{t.persisted&&(ds=t.timeStamp,e(t))},!0)},ps=(e,t,r,n)=>{let i,o;return s=>{t.value>=0&&(s||n)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t)))}},fs=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},gs=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},vs=()=>{const e=gs();return e?.activationStart??0},ms=(e,t=-1)=>{const r=gs();let n="navigate";return ds>=0?n="back-forward-cache":r&&(document.prerendering||vs()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},ys=new WeakMap;function bs(e,t){return ys.get(e)||ys.set(e,new t),ys.get(e)}class ws{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const Ss=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const n=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},xs=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let ks=-1;const Cs=new Set,Es=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Is=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of Cs)e();isFinite(ks)||(ks="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Is,!0))}},Os=()=>{if(ks<0){const e=vs(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime;ks=t??Es(),addEventListener("visibilitychange",Is,!0),addEventListener("prerenderingchange",Is,!0),hs(()=>{setTimeout(()=>{ks=Es()})})}return{get firstHiddenTime(){return ks},onHidden(e){Cs.add(e)}}},Ps=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},Ts=[1800,3e3],Rs=(e,t={})=>{Ps(()=>{const r=Os();let n,i=ms("FCP");const o=Ss("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-vs(),0),i.entries.push(t),n(!0)))});o&&(n=ps(e,i,Ts,t.reportAllChanges),hs(r=>{i=ms("FCP"),n=ps(e,i,Ts,t.reportAllChanges),fs(()=>{i.value=performance.now()-r.timeStamp,n(!0)})}))})},Ms=[.1,.25];let As=0,_s=1/0,Ns=0;const Ds=e=>{for(const t of e)t.interactionId&&(_s=Math.min(_s,t.interactionId),Ns=Math.max(Ns,t.interactionId),As=Ns?(Ns-_s)/7+1:0)};let Ls;const Fs=()=>Ls?As:performance.interactionCount??0;let Us=0;class js{u=[];l=new Map;m;p;v(){Us=Fs(),this.u.length=0,this.l.clear()}L(){const e=Math.min(this.u.length-1,Math.floor((Fs()-Us)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let r=this.l.get(e.interactionId);if(r||this.u.length<10||e.duration>t.P){if(r?e.duration>r.P?(r.entries=[e],r.P=e.duration):e.duration===r.P&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],P:e.duration},this.l.set(r.id,r),this.u.push(r)),this.u.sort((e,t)=>t.P-e.P),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.p?.(r)}}}const Bs=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=xs(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},qs=[200,500],zs=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const r=Os();Ps(()=>{"interactionCount"in performance||Ls||(Ls=Ss("event",Ds,{type:"event",buffered:!0,durationThreshold:0}));let n,i=ms("INP");const o=bs(t,js),s=e=>{Bs(()=>{for(const t of e)o.h(t);const t=o.L();t&&t.P!==i.value&&(i.value=t.P,i.entries=t.entries,n())})},a=Ss("event",s,{durationThreshold:t.durationThreshold??40});n=ps(e,i,qs,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),r.onHidden(()=>{s(a.takeRecords()),n(!0)}),hs(()=>{o.v(),i=ms("INP"),n=ps(e,i,qs,t.reportAllChanges)}))})};class Ws{m;h(e){this.m?.(e)}}const Vs=[2500,4e3],$s=[800,1800],Hs=e=>{document.prerendering?Ps(()=>Hs(e)):"complete"!==document.readyState?addEventListener("load",()=>Hs(e),!0):setTimeout(e)};function Ks(e){var t,r=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+r}function Gs(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(Ks(e)),navigationStart:Math.floor(performance.timeOrigin)}}var Js,Xs=function(){var e=null,t=z(),r=null==t?void 0:t.document,n=null==t?void 0:t.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(t,i){return l(void 0,void 0,void 0,function(){var o,s;return u(this,function(a){return void 0===r||(o=qe((null==n?void 0:n.href)||"",t.loggerProvider),s={"[Amplitude] Page Domain":(null==n?void 0:n.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":qe((null==n?void 0:n.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":qe(o.split("?")[0],t.loggerProvider)},((e,t={})=>{Ps(()=>{const r=Os();let n,i=ms("LCP");const o=bs(t,Ws),s=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)o.h(t),t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-vs(),0),i.entries=[t],n())},a=Ss("largest-contentful-paint",s);if(a){n=ps(e,i,Vs,t.reportAllChanges);const r=xs(()=>{s(a.takeRecords()),a.disconnect(),n(!0)}),o=e=>{e.isTrusted&&(Bs(r),removeEventListener(e.type,o,{capture:!0}))};for(const e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});hs(r=>{i=ms("LCP"),n=ps(e,i,Vs,t.reportAllChanges),fs(()=>{i.value=performance.now()-r.timeStamp,n(!0)})})}})})(function(e){s["[Amplitude] LCP"]=Gs(e)}),Rs(function(e){s["[Amplitude] FCP"]=Gs(e)}),zs(function(e){s["[Amplitude] INP"]=Gs(e)}),((e,t={})=>{const r=Os();Rs(xs(()=>{let n,i=ms("CLS",0);const o=bs(t,ws),s=e=>{for(const t of e)o.h(t);o.i>i.value&&(i.value=o.i,i.entries=o.o,n())},a=Ss("layout-shift",s);a&&(n=ps(e,i,Ms,t.reportAllChanges),r.onHidden(()=>{s(a.takeRecords()),n(!0)}),hs(()=>{o.i=0,i=ms("CLS",0),n=ps(e,i,Ms,t.reportAllChanges),fs(()=>n())}),setTimeout(n))}))})(function(e){s["[Amplitude] CLS"]=Gs(e)}),((e,t={})=>{let r=ms("TTFB"),n=ps(e,r,$s,t.reportAllChanges);Hs(()=>{const i=gs();i&&(r.value=Math.max(i.responseStart-vs(),0),r.entries=[i],n(!0),hs(()=>{r=ms("TTFB",0),n=ps(e,r,$s,t.reportAllChanges),n(!0)}))})})(function(e){s["[Amplitude] TTFB"]=Gs(e)}),e=function(){"hidden"===r.visibilityState&&e&&(i.track("[Amplitude] Web Vitals",s),r.removeEventListener("visibilitychange",e),e=null)},r.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(t){return e&&(null==r||r.removeEventListener("visibilitychange",e)),[2]})})}}},Ys=function(){function e(e,t){var r,n,i;this.shouldTrackNewCampaign=!1,this.options=s({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(n=(null===(r=t.cookieOptions)||void 0===r?void 0:r.domain)||t.topLevelDomain,i=n,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[]),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=Je(t.apiKey,"MKTG"),this.webExpStorageKey=Je(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=A,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return l(this,void 0,void 0,function(){var e,t;return u(this,function(r){switch(r.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return t=d.apply(void 0,[r.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||De(this.sessionTimeout,this.lastEventTime),Rn(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return l(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return(e=t.sent())?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||(new Zt).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,r,n,i,o=(t=this.currentCampaign,r=this.options,n=s(s({},A),t),i=Object.entries(n).reduce(function(e,t){var n,i=d(t,2),o=i[0],s=i[1];return e.setOnce("initial_".concat(o),null!==(n=null!=s?s:r.initialEmptyValue)&&void 0!==n?n:"EMPTY"),s?e.set(o,s):e.unset(o)},new F),te(i));return e&&(o.event_id=e),o},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),Qs=new Set([o.IDENTIFY,o.GROUP_IDENTIFY]),Zs=function(e){var t;void 0===e&&(e={});var r,n,i,o,a,c,d=null!==(t=e.fallbackAttributionEvent)&&void 0!==t&&t,h=z(),p={},f=!1,g=!1,v=function(){return l(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,(new Zt).parse()];case 1:return e=t.sent(),p=Ve(e),d&&(null==n||n.log("Tracking attribution fallback event."),null==r||r.track("[Amplitude] Attribution",p)),[2]}})})},m=function(){v()},y=function(e){return new Proxy(e,{apply:function(e,t,r){Reflect.apply(e,t,r),f&&m()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return l(void 0,void 0,void 0,function(){return u(this,function(s){switch(s.label){case 0:return r=t,n=e.loggerProvider,f=!0,n.log("Installing event property attribution tracking."),[4,v()];case 1:if(s.sent(),!h)return[2];if(h.addEventListener("popstate",m),!g){if(i=Reflect.get(h.history,"pushState"),o=Reflect.get(h.history,"replaceState"),!i||!o)return[2];a=y(i),h.history.pushState=a,c=y(o),h.history.replaceState=c,g=!0}return[2]}})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return Qs.has(e.event_type)||(e.event_properties=s(s({},p),e.event_properties)),[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){var e,t;return u(this,function(r){return h&&(h.removeEventListener("popstate",m),e=Reflect.get(h.history,"pushState"),t=Reflect.get(h.history,"replaceState"),g&&e===a&&i&&(h.history.pushState=i),g&&t===c&&o&&(h.history.replaceState=o)),f=!1,g=!1,i=void 0,o=void 0,a=void 0,c=void 0,p={},[2]})})}}},ea="AMP_CURRENT_PAGE",ta="AMP_PREVIOUS_PAGE",ra="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(Js||(Js={}));var na=new Set([o.IDENTIFY,o.GROUP_IDENTIFY,o.REVENUE]),ia=function(e){var t=(void 0===e?{}:e).internalDomains,r=void 0===t?[]:t,n=z(),i=void 0,o=!1,a=void 0,c=!1,h=!1,p=function(e){var t;try{var r=qe(e,a);t=new URL(r).hostname}catch(e){null==a||a.error("Could not parse URL: ",e)}return t},f=function(e){var t="undefined"!=typeof location&&location.hostname||"",n=e?p(e):void 0;if(!n)return Js.Direct;var i=r.some(function(e){return-1!==t.indexOf(e)}),o=r.some(function(e){return-1!==n.indexOf(e)});return t===n||o&&i?Js.Internal:Js.External},g=function(){return l(void 0,void 0,void 0,function(){var e,t,r,n,s;return u(this,function(a){switch(a.label){case 0:return i&&o?[4,i.get(ra)]:[3,3];case 1:return e=a.sent(),t=qe("undefined"!=typeof location&&location.href||""),r=(null==e?void 0:e[ea])||"",n=void 0,n=t===r?(null==e?void 0:e[ta])||"":r||(document.referrer||""),[4,i.set(ra,(s={},s[ea]=t,s[ta]=n,s))];case 2:a.sent(),a.label=3;case 3:return[2]}})})},v=function(){g()},m={name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return l(void 0,void 0,void 0,function(){var t,r,s,l,f,m,y,b;return u(this,function(u){switch(u.label){case 0:if((a=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),h=!0,!n)return[3,7];try{i=new Xe(n.sessionStorage)}catch(e){null==a||a.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:return o=null!==(b=u.sent())&&void 0!==b&&b,i&&o?(t="undefined"!=typeof document&&document.referrer||"",r=t?p(t):void 0,s="undefined"!=typeof location&&location.hostname||"",l=qe("undefined"!=typeof location&&location.href||""),[4,i.get(ra)]):[3,6];case 2:return f=u.sent(),m=(null==f?void 0:f[ea])||"",!!r&&r!==s&&m!==l?[4,i.set(ra,(y={},y[ea]=l,y[ta]=t,y))]:[3,4];case 3:return u.sent(),[3,6];case 4:return[4,g()];case 5:u.sent(),u.label=6;case 6:n.addEventListener("popstate",v),c||(n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,r){var n=d(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),h&&v()}}),n.history.replaceState=new Proxy(n.history.replaceState,{apply:function(e,t,r){var n=d(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),h&&v()}}),c=!0),u.label=7;case 7:return[2]}})})},execute:function(e){return l(void 0,void 0,void 0,function(){var t,r,n;return u(this,function(a){switch(a.label){case 0:return t=qe("undefined"!=typeof location&&location.href||""),i&&o?[4,i.get(ra)]:[3,2];case 1:if(r=a.sent(),n=(null==r?void 0:r[ta])||"",na.has(e.event_type))return[2,e];e.event_properties=s(s({},e.event_properties||{}),{"[Amplitude] Page Domain":oa(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":oa(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":oa(e,"[Amplitude] Page Path","undefined"!=typeof location&&qe(location.pathname)||""),"[Amplitude] Page Title":oa(e,"[Amplitude] Page Title",sr(or)),"[Amplitude] Page URL":oa(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":n,"[Amplitude] Previous Page Type":f(n)}),a.label=2;case 2:return[2,e]}})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return n&&(n.removeEventListener("popstate",v),h=!1),i&&o?[4,i.set(ra,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}};return m};function oa(e,t,r){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?r:e.event_properties[t]}var sa,aa=function(){var e,t,r;function n(t){if(t)try{var r=new Function("return "+t)();if("function"==typeof r)return r;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}var i={name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(i,o){return l(void 0,void 0,void 0,function(){var o,s;return u(this,function(a){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null===(s=i.remoteConfig)||void 0===s?void 0:s.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){r=e&&function(e){return"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body}(e)?n(e.body||""):n("")}),t=function(){var e;return null===(e=i.remoteConfigClient)||void 0===e?void 0:e.unsubscribe(o)}):null==e||e.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(t){return l(void 0,void 0,void 0,function(){var n;return u(this,function(i){if(r)try{return[2,null!==(n=r(t))&&void 0!==n?n:null]}catch(r){return null==e||e.error("Could not execute custom enrichment function",r),[2,t]}return[2,t]})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(e){return t&&t(),[2]})})}};return i},la="userProperty",ua="eventProperty",ca=function(e){return e===la||e===ua},da=[la,ua],ha=function(e,t){return function(e){var t=h([],d(new Set((Array.isArray(e)?e:[e]).filter(ca))),!1);return t.length>0?t:h([],d(da),!1)}(e.trackingMethod).includes(t)},pa=function(e){return ha(e,la)},fa=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return n(t,e),t.prototype.init=function(e,t,r){var n,i;return void 0===e&&(e=""),arguments.length>2?(n=t,i=r):"string"==typeof t?(n=t,i=void 0):(n=null==t?void 0:t.userId,i=t),re(this._init(s(s({},i),{userId:n,apiKey:e})))},t.prototype._init=function(t){var r,n,i,o,c,d,h,p;return l(this,void 0,void 0,function(){var f,g,v,m,y,b,w,S,x,k,C,E,I,O,P,T=this;return u(this,function(R){switch(R.label){case 0:return this.initializing?[2]:(this.initializing=!0,f=function(e){var t,r;return void 0===e&&(e={}),!0===(null===(t=e.remoteConfig)||void 0===t?void 0:t.fetchRemoteConfig)||!1!==(null===(r=e.remoteConfig)||void 0===r?void 0:r.fetchRemoteConfig)&&!1!==e.fetchRemoteConfig}(t),g=null!==(r=t.loggerProvider)&&void 0!==r?r:new ae,t.loggerProvider||g.enable(null!==(n=t.logLevel)&&void 0!==n?n:oe.Warn),v=null!==(i=t.serverZone)&&void 0!==i?i:"US",y=this._diagnosticsSampleRate,b=null===(o=t.enableDiagnostics)||void 0===o||o,f?(m=new yt(t.apiKey,g,v,null===(c=t.remoteConfig)||void 0===c?void 0:c.serverUrl),[4,new Promise(function(e){null==m||m.subscribe("configs.diagnostics.browserSDK","all",function(t,r,n){if(g.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:r,lastFetch:n},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(y=i);var o=t.enabled;"boolean"==typeof o&&(b=o)}e()})})]):[3,2]);case 1:R.sent(),R.label=2;case 2:return(w=new ut(t.apiKey,g,v,{enabled:b,sampleRate:y})).setTag("library","".concat(tn,"/").concat(en)),w.setTag("platform","Web"),w.setTag("web_environment",function(){var e=z();if(!e)return"unknown";var t=function(e){var t,r;return"string"==typeof(null===(r=null===(t=e.chrome)||void 0===t?void 0:t.runtime)||void 0===r?void 0:r.id)}(e);return function(e){var t=e.ServiceWorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?t?"chrome_extension_service_worker":"service_worker":function(e){var t=e.WorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?"web_worker":function(e){return void 0!==e.document}(e)?t?"chrome_extension":"browser":function(e){var t,r;return"string"==typeof(null===(r=null===(t=e.process)||void 0===t?void 0:t.versions)||void 0===r?void 0:r.node)}(e)?"node":"unknown"}()),"undefined"!=typeof navigator&&w.setTag("user_agent",navigator.userAgent),[4,Un(t.apiKey,t,this,w,{loggerProvider:g,serverZone:v,enableDiagnostics:b,diagnosticsSampleRate:y})];case 3:return S=R.sent(),f&&m?[4,new Promise(function(e){null==m||m.subscribe("configs.analyticsSDK.browserSDK","all",function(t,r,n){S.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:r,lastFetch:n},null,2)),t&&Zn(t,S),e()})})]:[3,5];case 4:R.sent(),R.label=5;case 5:return[4,e.prototype._init.call(this,S)];case 6:return R.sent(),this.logBrowserOptions(S),this.config.remoteConfigClient=m,x=function(e){return Br(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?s({},e.defaultTracking.attribution):{}}(this.config),Br(this.config.defaultTracking)&&pa(x)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return l(T,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[3,2]:(this.webAttribution=new Ys(x,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new Ys(x,this.config),[4,this.webAttribution.init()]):[3,8];case 7:R.sent(),R.label=8;case 8:return k=Ue(),C=k.ampTimestamp?Number(k.ampTimestamp):void 0,E=!C||Date.now()<C,I=E&&!Number.isNaN(Number(k.ampSessionId))?Number(k.ampSessionId):void 0,-1!==(O=this.config.deferredSessionId)||this.config.optOut||(O=Date.now()),this.setSessionId(null!==(p=null!==(h=null!==(d=t.sessionId)&&void 0!==d?d:I)&&void 0!==h?h:O)&&void 0!==p?p:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return l(T,void 0,void 0,function(){return u(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(P=_e(this.config.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,10]:[4,this.add(Qn()).promise];case 9:R.sent(),R.label=10;case 10:return[4,this.add(new xe({diagnosticsClient:w})).promise];case 11:return R.sent(),[4,this.add(new rn).promise];case 12:return R.sent(),[4,this.add(new Ne).promise];case 13:return R.sent(),function(e){Yn||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),Yn=!0)}(this.config),A=this.config.defaultTracking,jr(A,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(Xn()).promise]):[3,15];case 14:R.sent(),R.label=15;case 15:return qr(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Kn()).promise]):[3,17];case 16:R.sent(),R.label=17;case 17:return zr(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Wn(Yr(this.config))).promise]):[3,20];case 18:return R.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return l(T,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[2]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Wn(Yr(this.config))).promise]);case 1:return t.sent(),[2]}})})}),R.label=20;case 20:return Br(this.config.defaultTracking)&&function(e){return ha(e,ua)}(x)?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(Zs(x)).promise]):[3,22];case 21:R.sent(),R.label=22;case 22:return $r(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(_o(Gr(this.config),{diagnosticsClient:w})).promise]):[3,24];case 23:R.sent(),R.label=24;case 24:return Hr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Ko(Jr(this.config))).promise]):[3,26];case 25:R.sent(),R.label=26;case 26:return Vr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(cs(Xr(this.config))).promise]):[3,28];case 27:R.sent(),R.label=28;case 28:return function(e){return"boolean"==typeof e?e:"object"==typeof e&&!0===e.webVitals}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(Xs()).promise]):[3,30];case 29:R.sent(),R.label=30;case 30:return function(e){return"object"==typeof e&&(!0===e.performanceTracking||"object"==typeof e.performanceTracking)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(es(Kr(this.config))).promise]):[3,32];case 31:R.sent(),R.label=32;case 32:return function(e){return jr(e,"pageUrlEnrichment")}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(ia()).promise]):[3,34];case 33:R.sent(),R.label=34;case 34:return("boolean"==typeof(M=this.config.customEnrichment)?M:"object"==typeof M&&null!==M&&!1!==M.enabled)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(aa()).promise]):[3,36];case 35:R.sent(),R.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return R.sent(),P.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},r=t.time,n=a(t,["time"]),i="number"==typeof r?{time:r}:void 0;T.track(e.eventType,n,i)}),[2]}var M,A})})},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){_e(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){_e(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(V()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){var t,r,n;if("userId"in e&&this.setUserId(e.userId),"deviceId"in e&&e.deviceId&&this.setDeviceId(e.deviceId),"userProperties"in e){this.userProperties=e.userProperties;var i=new F,o=null!==(n=e.userProperties)&&void 0!==n?n:{};try{for(var s=c(Object.entries(o)),a=s.next();!a.done;a=s.next()){var l=d(a.value,2),u=l[0],h=l[1];i.set(u,h)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}this.identify(i)}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,r=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),re(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,re(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return re(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var n=this.getSessionId();n!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,Wr(this.config.defaultTracking)&&(n&&i&&r.push(this.track(yn,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:n,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,r);return this.config.identify&&r.push(this.track(te(this.config.identify)).promise),Wr(this.config.defaultTracking)&&r.push(this.track(mn,void 0,{event_id:s?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,re(Promise.all(r))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=Bn(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,r){if(Zr(t)){var n=t._q;t._q=[],t=Qr(new F,n)}return(null==r?void 0:r.user_id)&&this.setUserId(r.user_id),(null==r?void 0:r.device_id)&&this.setDeviceId(r.device_id),e.prototype.identify.call(this,t,r)},t.prototype.groupIdentify=function(t,r,n,i){if(Zr(n)){var o=n._q;n._q=[],n=Qr(new F,o)}return e.prototype.groupIdentify.call(this,t,r,n,i)},t.prototype.revenue=function(t,r){if(Zr(t)){var n=t._q;t._q=[],t=Qr(new ie,n)}return e.prototype.revenue.call(this,t,r)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!pa(this.webAttribution.options))return!1;var r=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(r).promise):this.track(r),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return l(this,void 0,void 0,function(){var r,n,i;return u(this,function(o){return r=Date.now(),n=De(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===mn||t.event_type===yn||t.session_id&&t.session_id!==this.getSessionId()||(n||i?(this.setSessionId(r),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):n||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=s(s({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",Z(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){e>1||e<0||this.config||(this._diagnosticsSampleRate=e)},t}(ne),ga="[Amplitude]",va="".concat(ga," Session Replay ID"),ma=Ct.US,ya={enabled:!0},ba=1e3,wa="".concat(ga," Session Replay Debug"),Sa="amp-mask",xa="amp-unmask",ka="https://api-sr.amplitude.com/sessions/v2/track",Ca="https://api-sr.eu.amplitude.com/sessions/v2/track",Ea="https://api-sr.stag2.amplitude.com/sessions/v2/track",Ia=9e6,Oa=/payload.*exceed/i,Pa=500,Ta=1e4,Ra=1024,Ma="X-Session-Replay-Event-Skipped",Aa="amplitude-sr-iframe";!function(e){e.GET_SR_PROPS="get-sr-props",e.DEBUG_INFO="debug-info",e.FETCH_REQUEST="fetch-request",e.METADATA="metadata",e.TARGETING_DECISION="targeting-decision",e.REPLAY_GATE_DECISION="replay-gate-decision"}(sa||(sa={}));var _a=function(){function e(e){this.logger=e,this.log=this.getSafeMethod("log"),this.warn=this.getSafeMethod("warn"),this.error=this.getSafeMethod("error"),this.debug=this.getSafeMethod("debug")}return e.prototype.getSafeMethod=function(e){var t;if(!this.logger)return function(){};var r=this.logger[e];return"function"==typeof r?(null!==(t=r.__rrweb_original__)&&void 0!==t?t:r).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),Na="medium";function Da(e,t){return t||("STAGING"===e?Ea:"EU"===e?Ca:ka)}var La=function(e,t,r){switch(t){case"light":if("input"!==e)return!1;var n=r?function(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?t.toLowerCase():null}(r):"";return!!n&&(!!["password","hidden","email","tel"].includes(n)||!!r.autocomplete.startsWith("cc-"));case"medium":return"input"===e;case"conservative":return!0;default:return La(e,Na,r)}},Fa=function(e,t){var r,n,i;if(e&&t.urlMaskLevels)try{for(var o=c(t.urlMaskLevels),s=o.next();!s.done;s=o.next()){var a=s.value;if(Wa(a.match).test(e))return a.maskLevel}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null!==(i=t.defaultMaskLevel)&&void 0!==i?i:Na},Ua=function(e,t,r,n){var i,o;if(void 0===t&&(t={defaultMaskLevel:Na}),r){if(r.closest("."+Sa))return!0;var s=(null!==(i=t.maskSelector)&&void 0!==i?i:[]).some(function(e){return r.closest(e)});if(s)return!0;if(r.closest("."+xa))return!1;var a=(null!==(o=t.unmaskSelector)&&void 0!==o?o:[]).some(function(e){return r.closest(e)});if(a)return!1}return La(e,Fa(n,t),r)},ja=function(e,t,r){return function(n,i){return Ua(e,t,i,null==r?void 0:r())?n.replace(/[^\s]/g,"*"):n}},Ba=function(e,t){return function(r,n,i){var o;if("style"===r)return n;if(!(null!==(o=null==e?void 0:e.maskAttributes)&&void 0!==o?o:[]).includes(r))return n;var s=["INPUT","SELECT","TEXTAREA"].includes(i.tagName)?"input":"text";return Ua(s,e,i,null==t?void 0:t())?n.replace(/[^\s]/g,"*"):n}},qa=function(){var e=z();return(null==e?void 0:e.location)?e.location.href:""},za=new Map,Wa=function(e){var t=za.get(e);if(t)return t;var r="\0TRAIL\0",n="\0MID\0",i="\0DS\0",o="\0ST\0",s="\0QU\0",a=e;a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=a.replace(/\/\*\*$/,r)).replace(/\/\*\*\//g,n)).replace(/\*\*/g,i)).replace(/\*/g,o)).replace(/\?/g,s)).replace(/[.+^${}()|[\]\\]/g,"\\$&")).split(r).join("(/.*)?")).split(n).join("/(.*\\/)?")).split(i).join(".*")).split(o).join(".*")).split(s).join(".");var l=new RegExp("^".concat(a,"$"));return za.set(e,l),l},Va=function(e,t){var r,n;try{for(var i=c(t),o=i.next();!o.done;o=i.next()){var s=o.value,a=Wa(s.selector);if(a.test(e))return e.replace(a,s.replacement)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e},$a=function(){return l(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),(e=z())?[4,e.navigator.storage.estimate()]:[3,2];case 1:return t=a.sent(),r=t.usage,n=t.quota,i=t.usageDetails,o=r?Math.round(r/Ra):0,s=r&&n?Math.round(1e3*(r/n+Number.EPSILON))/1e3:0,[2,{totalStorageSize:o,percentOfQuota:s,usageDetails:JSON.stringify(i)}];case 2:return[3,4];case 3:return a.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:""}]}})})},Ha=function(e){var t=s({},e),r=t.apiKey;return t.apiKey="****".concat(r.substring(r.length-4)),t},Ka=function(){return{flushMaxRetries:2,logLevel:oe.Warn,loggerProvider:new ae,transportProvider:new dt}},Ga=function(e){function t(t,r){var n,i,o,a,l,u,c,p,f,g,v,m,y,b,w=this,S=Ka();(w=e.call(this,s(s({transportProvider:S.transportProvider,loggerProvider:new _a(r.loggerProvider||S.loggerProvider)},r),{apiKey:t}))||this).flushMaxRetries=void 0!==r.flushMaxRetries&&r.flushMaxRetries<=S.flushMaxRetries?r.flushMaxRetries:S.flushMaxRetries,w.apiKey=t,w.sampleRate=r.sampleRate||0,w.serverZone=r.serverZone||ma,w.configServerUrl=r.configServerUrl,w.trackServerUrl=r.trackServerUrl,w.shouldInlineStylesheet=r.shouldInlineStylesheet,w.inlineImages=r.inlineImages,w.version=r.version,w.performanceConfig=r.performanceConfig||ya,w.storeType=null!==(n=r.storeType)&&void 0!==n?n:"memory",w.applyBackgroundColorToBlockedElements=null!==(i=r.applyBackgroundColorToBlockedElements)&&void 0!==i&&i,w.enableUrlChangePolling=null!==(o=r.enableUrlChangePolling)&&void 0!==o&&o,w.urlChangePollingInterval=null!==(a=r.urlChangePollingInterval)&&void 0!==a?a:ba,w.captureDocumentTitle=null!==(l=r.captureDocumentTitle)&&void 0!==l&&l,void 0!==r.fullSnapshotIntervalMs&&(w.fullSnapshotIntervalMs=r.fullSnapshotIntervalMs),void 0!==r.eagerFullSnapshotSend&&(w.eagerFullSnapshotSend=r.eagerFullSnapshotSend),w.captureFullSnapshotOnFocus=null!==(u=r.captureFullSnapshotOnFocus)&&void 0!==u&&u,void 0!==r.maxPersistedEventsSizeBytes&&(w.maxPersistedEventsSizeBytes=Za(r.maxPersistedEventsSizeBytes,Xa,Ya,"maxPersistedEventsSizeBytes",w.loggerProvider)),void 0!==r.maxSingleEventSizeBytes&&(w.maxSingleEventSizeBytes=Za(r.maxSingleEventSizeBytes,Xa,Qa,"maxSingleEventSizeBytes",w.loggerProvider)),w.privacyConfig=s(s({},null!==(c=r.privacyConfig)&&void 0!==c?c:{}),{unmaskSelector:Array.from(new Set(h([".".concat(xa)],d(null!==(f=null===(p=r.privacyConfig)||void 0===p?void 0:p.unmaskSelector)&&void 0!==f?f:[]),!1)))}),r.interactionConfig&&(w.interactionConfig=r.interactionConfig,w.interactionConfig.ugcFilterRules&&function(e){if(!e.every(function(e){return"string"==typeof e.selector&&"string"==typeof e.replacement}))throw new Error("ugcFilterRules must be an array of objects with selector and replacement properties");if(!e.every(function(e){return"string"==typeof(t=e.selector)&&""!==t.trim()&&!!/^\/|^https?:\/\/[^\s]+$/.test(t);var t}))throw new Error("ugcFilterRules must be an array of objects with valid globs")}(w.interactionConfig.ugcFilterRules)),r.debugMode&&(w.debugMode=r.debugMode);var x=r;return w.useWebWorker=null===(m=null!==(g=r.useWebWorker)&&void 0!==g?g:null===(v=x.experimental)||void 0===v?void 0:v.useWebWorker)||void 0===m||m,w.enableTransportCompression=null===(y=r.enableTransportCompression)||void 0===y||y,w.sendTimeoutMs=r.sendTimeoutMs,w.captureAdoptedStyleSheets=null===(b=r.captureAdoptedStyleSheets)||void 0===b||b,r.crossOriginIframes&&(w.crossOriginIframes=r.crossOriginIframes),r.flushIntervalConfig?w.flushIntervalConfig=function(e,t){var r,n,i={};void 0!==e.minIntervalMs&&(!Number.isFinite(e.minIntervalMs)||e.minIntervalMs<Ja?(t.warn("flushIntervalConfig.minIntervalMs ".concat(e.minIntervalMs," is below floor ").concat(Ja,"ms; clamping.")),i.minIntervalMs=Ja):i.minIntervalMs=e.minIntervalMs);void 0!==e.maxIntervalMs&&(Number.isNaN(e.maxIntervalMs)||e.maxIntervalMs<Ja?(t.warn("flushIntervalConfig.maxIntervalMs ".concat(e.maxIntervalMs," is below floor ").concat(Ja,"ms; clamping.")),i.maxIntervalMs=Ja):i.maxIntervalMs=e.maxIntervalMs);if(void 0!==i.minIntervalMs||void 0!==i.maxIntervalMs){var o=null!==(r=i.minIntervalMs)&&void 0!==r?r:Pa,s=null!==(n=i.maxIntervalMs)&&void 0!==n?n:Ta;s<o&&(void 0===i.maxIntervalMs?(t.warn("flushIntervalConfig.minIntervalMs (".concat(o,") exceeds the default maxIntervalMs (").concat(Ta,"); raising max to match min.")),i.maxIntervalMs=o):void 0===i.minIntervalMs?(t.warn("flushIntervalConfig.maxIntervalMs (".concat(s,") is below the default minIntervalMs (").concat(Pa,"); lowering min to match max.")),i.minIntervalMs=s):(t.warn("flushIntervalConfig.maxIntervalMs (".concat(i.maxIntervalMs,") is less than minIntervalMs (").concat(i.minIntervalMs,"); raising max to match min.")),i.maxIntervalMs=i.minIntervalMs))}return i}(r.flushIntervalConfig,w.loggerProvider):w.flushIntervalConfig={minIntervalMs:1e3,maxIntervalMs:1e4},w.handleSendEvents=r.handleSendEvents,w.handleFetchConfig=r.handleFetchConfig,w}return n(t,e),t}(ce),Ja=100,Xa=1e3,Ya=8e6,Qa=1e7;function Za(e,t,r,n,i){if(Number.isFinite(e))return e<t?(i.warn("".concat(n," ").concat(e," is below floor ").concat(t,"; clamping.")),t):e>r?(i.warn("".concat(n," ").concat(e," exceeds ceiling ").concat(r,"; clamping.")),r):e;i.warn("".concat(n," value is not a finite number (got ").concat(String(e),"); ignoring."))}var el=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(el||{}),tl=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(tl||{}),rl=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(rl||{}),nl=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){var e,t,r,n,i,o,a;return l(this,void 0,void 0,function(){var l,p,f,g,v,m,y,b,w,S,x,k,C,E,I,O,P,T=this;return u(this,function(u){switch(u.label){case 0:(l=s({},this.localConfig)).optOut=this.localConfig.optOut,l.captureEnabled=!0,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,new Promise(function(e,t){T.remoteConfigClient.subscribe("configs.sessionReplay",{timeout:1500},function(r,n){var i;if(T.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(n,":"),JSON.stringify(r,null,2)),r){var o=r,s=o.sr_sampling_config,a=o.sr_privacy_config,u=o.sr_targeting_config,c=null===(i=l.interactionConfig)||void 0===i?void 0:i.ugcFilterRules;l.interactionConfig=o.sr_interaction_config,l.interactionConfig&&c&&(l.interactionConfig.ugcFilterRules=c),l.loggingConfig=o.sr_logging_config,(s||a||u)&&(p={},s&&(p.sr_sampling_config=s),a&&(p.sr_privacy_config=a),u&&(p.sr_targeting_config=u)),e()}else t(new Error("No remote config received"))})})];case 2:return u.sent(),[3,4];case 3:return f=u.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",f),l.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:l,remoteConfig:void 0}];case 4:if(!p)return[2,{localConfig:this.localConfig,joinedConfig:l,remoteConfig:p}];if(g=p.sr_sampling_config,v=p.sr_privacy_config,m=p.sr_targeting_config,g&&Object.keys(g).length>0?(Object.prototype.hasOwnProperty.call(g,"capture_enabled")?l.captureEnabled=g.capture_enabled:l.captureEnabled=!1,Object.prototype.hasOwnProperty.call(g,"sample_rate")&&(l.sampleRate=g.sample_rate),Object.prototype.hasOwnProperty.call(g,"min_session_duration_ms")&&(l.minSessionDurationMs=this.sanitizeMinSessionDurationMs(g.min_session_duration_ms))):(l.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),v){y=null!==(e=l.privacyConfig)&&void 0!==e?e:{},b={defaultMaskLevel:null!==(r=null!==(t=v.defaultMaskLevel)&&void 0!==t?t:y.defaultMaskLevel)&&void 0!==r?r:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:h([],d(new Set(h(h([],d(null!==(n=y.maskAttributes)&&void 0!==n?n:[]),!1),d(null!==(i=v.maskAttributes)&&void 0!==i?i:[]),!1))),!1),urlMaskLevels:h(h([],d(null!==(o=v.urlMaskLevels)&&void 0!==o?o:[]),!1),d(null!==(a=y.urlMaskLevels)&&void 0!==a?a:[]),!1)},w=function(e){var t,r,n,i,o,s,a,l,u,d={};"string"==typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var h=c(null!==(a=e.blockSelector)&&void 0!==a?a:[]),p=h.next();!p.done;p=h.next()){d[p.value]="block"}}catch(e){t={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}try{for(var f=c(null!==(l=e.maskSelector)&&void 0!==l?l:[]),g=f.next();!g.done;g=f.next()){d[g.value]="mask"}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}try{for(var v=c(null!==(u=e.unmaskSelector)&&void 0!==u?u:[]),m=v.next();!m.done;m=v.next()){d[m.value]="unmask"}}catch(e){o={error:e}}finally{try{m&&!m.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}return d},S=s(s({},w(y)),w(v));try{for(x=c(Object.entries(S)),k=x.next();!k.done;k=x.next())C=d(k.value,2),E=C[0],"mask"===(I=C[1])?b.maskSelector.push(E):"block"===I?b.blockSelector.push(E):"unmask"===I&&b.unmaskSelector.push(E)}catch(e){O={error:e}}finally{try{k&&!k.done&&(P=x.return)&&P.call(x)}finally{if(O)throw O.error}}l.privacyConfig=(R=b,M=this.localConfig.loggerProvider,A=document.createDocumentFragment(),_=function(e){if(void 0===e&&(e=[]),"string"==typeof e&&(e=[e]),e=e.filter(function(e){try{A.querySelector(e)}catch(t){return M.warn('[session-replay-browser] omitting selector "'.concat(e,'" because it is invalid')),!1}return!0}),0!==e.length)return e},R.blockSelector=_(R.blockSelector),R.maskSelector=_(R.maskSelector),R.unmaskSelector=_(R.unmaskSelector),R)}return m&&Object.keys(m).length>0&&(l.targetingConfig=m),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:Ha(l)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:l,remoteConfig:p}]}var R,M,A,_})})},e.prototype.sanitizeMinSessionDurationMs=function(e){if("number"==typeof e&&Number.isFinite(e)){if(!(e<0))return e>il?(this.localConfig.loggerProvider.warn("min_session_duration_ms remote value ".concat(e," exceeds ").concat(il,"ms ceiling; clamping.")),il):e;this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is negative (".concat(e,"); ignoring."))}else this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is not a finite number (got ".concat(String(e),"); ignoring."))},e}(),il=6e4,ol=function(e,t){return l(void 0,void 0,void 0,function(){var r,n;return u(this,function(i){return r=new Ga(e,t),n=new yt(e,r.loggerProvider,r.serverZone,t.configServerUrl,t.handleFetchConfig),[2,new nl(n,r)]})})};function sl(e){if(e.type!==el.IncrementalSnapshot)return!1;var t=e.data;return t.source===tl.Mutation&&!t.isAttachIframe}function al(e){var t,r,n=new Map;if(e.forEach(function(e,t){if(e.attributes&&"style"in e.attributes){var r=n.get(e.id);r?r.push(t):n.set(e.id,[t])}}),0===n.size)return e;var i=function(t){return e[t].attributes.style},o=new Set,a=new Map,l=function(e){if(1===e.length)return"continue";var t=-1;e.forEach(function(e,r){var n;("object"!=typeof(n=i(e))||null===n)&&(t=r)});var r=[];if(e.forEach(function(e,n){n!==t&&(o.add(e),n>t&&r.push(e))}),r.length>0){var n=r[r.length-1],s=function(e){var t,r,n,i,o={};try{for(var s=c(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{for(var u=(n=void 0,c(Object.keys(l))),d=u.next();!d.done;d=u.next()){var h=d.value;o[h]=l[h]}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o}(r.map(function(e){return i(e)}));o.delete(n),a.set(n,s)}};try{for(var u=c(n.values()),d=u.next();!d.done;d=u.next()){l(d.value)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}if(0===o.size&&0===a.size)return e;var h=[];return e.forEach(function(e,t){var r=a.get(t);if(void 0===r)if(o.has(t)){var n=s({},e.attributes);delete n.style,Object.keys(n).length>0&&h.push(s(s({},e),{attributes:n}))}else h.push(e);else h.push(s(s({},e),{attributes:s(s({},e.attributes),{style:r})}))}),h}function ll(e){var t,r,n,i,o=e[0],a=new Map,l=new Map,u=new Map,h=new Map,p=new Map;e.forEach(function(e,t){var r,n,i,o,s=e.data;try{for(var d=c(s.adds),f=d.next();!f.done;f=d.next()){var g=f.value;a.has(g.node.id)||a.set(g.node.id,t),l.set(g.node.id,t),p.set(g.node.id,g.parentId)}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}try{for(var v=c(s.removes),m=v.next();!m.done;m=v.next()){var y=m.value;u.has(y.id)||u.set(y.id,t),h.set(y.id,t)}}catch(e){i={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}});var f=new Set,g=new Set;try{for(var v=c(a),m=v.next();!m.done;m=v.next()){var y=d(m.value,2),b=y[0],w=y[1],S=u.get(b);if(void 0!==S)l.get(b)>=h.get(b)||(w<S?f.add(b):S<w&&g.add(b))}}catch(e){t={error:e}}finally{try{m&&!m.done&&(r=v.return)&&r.call(v)}finally{if(t)throw t.error}}var x=new Set;if(f.size>0||g.size>0)for(var k=!0;k;){k=!1;try{for(var C=(n=void 0,c(p)),E=C.next();!E.done;E=C.next()){var I=d(E.value,2),O=I[0],P=I[1];if(!f.has(O)&&!g.has(O)&&!x.has(O)&&(f.has(P)||g.has(P)||x.has(P))){var T=u.get(O),R=a.get(O);void 0!==T&&void 0!==R&&T<R?g.add(O):void 0!==T&&void 0!==R&&T===R?x.add(O):f.add(O),k=!0}}}catch(e){n={error:e}}finally{try{E&&!E.done&&(i=C.return)&&i.call(C)}finally{if(n)throw n.error}}}var M=f.size>0||g.size>0||x.size>0,A=[];e.forEach(function(e,t){var r,n;try{for(var i=c(e.data.removes),o=i.next();!o.done;o=i.next()){var s=o.value;f.has(s.id)||(g.has(s.id)&&t>=a.get(s.id)||x.has(s.id)&&(f.has(s.parentId)||g.has(s.parentId)||x.has(s.parentId))||A.push(s))}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}});var _=e.flatMap(function(e){return e.data.adds}),N=e.flatMap(function(e){return e.data.texts}),D=e.flatMap(function(e){return e.data.attributes}),L=M?D.filter(function(e){return!f.has(e.id)&&!g.has(e.id)&&!x.has(e.id)}):D,F={source:tl.Mutation,removes:A,adds:M?_.filter(function(e){return!f.has(e.node.id)&&!g.has(e.node.id)&&!x.has(e.node.id)}):_,texts:M?N.filter(function(e){return!f.has(e.id)&&!g.has(e.id)&&!x.has(e.id)}):N,attributes:al(L)};return s(s({},o),{data:F})}function ul(e){if(e.length<=1)return e;for(var t=[],r=0;r<e.length;)if(sl(e[r])){for(var n=r+1;n<e.length&&sl(e[n]);)n++;t.push(n>r+1?ll(e.slice(r,n)):e[r]),r=n}else t.push(e[r]),r++;return t}var cl=function(){function e(e,t,r,n,i){var o,s=this;this.taskQueue=[],this.pendingQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t=e,r=t.type,n=t.timestamp,i=t.delay,o=t.data;return null!=i?JSON.stringify({type:r,timestamp:n,delay:i,data:o}):JSON.stringify({type:r,timestamp:n,data:o})},this.addCompressedEventToManager=function(e,t){var r,n=new Blob([e]).size;n>(null!==(r=s.config.maxSingleEventSizeBytes)&&void 0!==r?r:Ia)?s.config.loggerProvider.warn("Session replay event dropped: serialized size ".concat(Math.round(n/1024)," KB exceeds maximum allowed event size. If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support.")):s.eventsManager&&s.deviceId&&s.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:s.deviceId})},this.addCompressedEvent=function(e,t){if(s.worker)try{s.worker.postMessage({event:e,sessionId:t})}catch(r){"DataCloneError"===r.name?s.worker.postMessage(JSON.stringify({event:e,sessionId:t})):s.config.loggerProvider.warn("Unexpected error while posting message to worker:",r)}else{var r=s.compressEvent(e);s.addCompressedEventToManager(r,t)}},this.flushQueue=function(){var e;for(s.pendingQueue.length>0&&(e=s.taskQueue).push.apply(e,h([],d(s.mergeMutationTasks(s.pendingQueue.splice(0))),!1));s.taskQueue.length>0;){var t=s.taskQueue.shift();if(t){var r=t.event,n=t.sessionId,i=s.compressEvent(r);s.addCompressedEventToManager(i,n)}}s.isProcessing=!1},this.terminate=function(){var e;null===(e=s.worker)||void 0===e||e.terminate()};var a=z();if(this.canUseIdleCallback=a&&"requestIdleCallback"in a,this.eventsManager=e,this.config=t,this.deviceId=r,this.timeout=(null===(o=t.performanceConfig)||void 0===o?void 0:o.timeout)||2e3,this.onFullSnapshotProcessed=i,n){t.loggerProvider.log("Enabling web worker for compression");try{var l=new Blob([n],{type:"application/javascript"}),u=URL.createObjectURL(l),c=new Worker(u);c.onerror=function(e){e.preventDefault(),t.loggerProvider.error("Worker failed, falling back to non-worker compression: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),c.terminate(),s.worker=void 0},c.onmessage=function(e){var t=e.data,r=t.compressedEvent,n=t.sessionId;s.addCompressedEventToManager(r,n)},this.worker=c}catch(e){t.loggerProvider.error("Failed to create worker, falling back to non-worker compression:",e)}}}return e.prototype.scheduleIdleProcessing=function(){var e=this;this.isProcessing||(this.isProcessing=!0,requestIdleCallback(function(t){e.processQueue(t)},{timeout:this.timeout}))},e.prototype.enqueueEvent=function(e,t){var r,n,i,o;if(e.type===el.FullSnapshot){if(this.config.loggerProvider.debug("Processing full snapshot immediately."),this.taskQueue.length>0||this.pendingQueue.length>0){var s=h(h([],d(this.taskQueue.splice(0)),!1),d(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1);try{for(var a=c(s),l=a.next();!l.done;l=a.next()){var u=l.value,p=this.compressEvent(u.event);this.addCompressedEventToManager(p,u.sessionId)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}this.isProcessing=!1}var f=this.compressEvent(e);return this.addCompressedEventToManager(f,t),void(null===(i=this.onFullSnapshotProcessed)||void 0===i||i.call(this))}this.canUseIdleCallback&&(null===(o=this.config.performanceConfig)||void 0===o?void 0:o.enabled)?(this.config.loggerProvider.debug("Enqueuing event for processing during idle time."),this.pendingQueue.push({event:e,sessionId:t}),this.scheduleIdleProcessing()):(this.config.loggerProvider.debug("Processing event without idle callback."),this.addCompressedEvent(e,t))},e.prototype.processQueue=function(e){var t,r=this;for(this.pendingQueue.length>0&&(t=this.taskQueue).push.apply(t,h([],d(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1));this.taskQueue.length>0&&(e.timeRemaining()>0||e.didTimeout);){var n=this.taskQueue.shift();if(n){var i=n.event,o=n.sessionId;this.addCompressedEvent(i,o)}}this.taskQueue.length>0||this.pendingQueue.length>0?requestIdleCallback(function(e){r.processQueue(e)},{timeout:this.timeout}):this.isProcessing=!1},e.prototype.mergeMutationTasks=function(e){var t,r,n;if(!1===(null===(n=this.config.performanceConfig)||void 0===n?void 0:n.mergeMutations))return e;if(e.length<=1)return e;for(var i=[],o=0;o<e.length;){for(var s=e[o].sessionId,a=o+1;a<e.length&&e[a].sessionId===s;)a++;var l=ul(e.slice(o,a).map(function(e){return e.event}));try{for(var u=(t=void 0,c(l)),d=u.next();!d.done;d=u.next()){var h=d.value;i.push({event:h,sessionId:s})}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}o=a}return i},e}(),dl="Session replay event batch rejected due to exceeded retry count",hl="Failed to store session replay events in IndexedDB",pl="Session replay event batch dropped: server signalled capture disabled or session out of valid range for this session",fl="1.50.2";function gl(e,t){return l(this,void 0,void 0,function(){var r,n,i,o,s,a,d,h,p,f,g,v,m,y,b=this;return u(this,function(w){switch(w.label){case 0:return w.trys.push([0,4,,5]),r=t.CompressionStream,n=new r("gzip"),i=n.writable.getWriter(),o=n.readable.getReader(),s=[],a=l(b,void 0,void 0,function(){var e,t,r;return u(this,function(n){switch(n.label){case 0:return[4,o.read()];case 1:if(e=n.sent(),t=e.done,r=e.value,t)return[3,3];s.push(r),n.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,i.write((new TextEncoder).encode(e))];case 1:return w.sent(),[4,i.close()];case 2:return w.sent(),[4,a];case 3:w.sent(),d=s.reduce(function(e,t){return e+t.length},0),h=new Uint8Array(d),p=0;try{for(f=c(s),g=f.next();!g.done;g=f.next())v=g.value,h.set(v,p),p+=v.length}catch(e){m={error:e}}finally{try{g&&!g.done&&(y=f.return)&&y.call(f)}finally{if(m)throw m.error}}return[2,h];case 4:return w.sent(),[2,null];case 5:return[2]}})})}var vl=function(){function e(e){var t=e.trackServerUrl,r=e.loggerProvider,n=e.payloadBatcher,i=e.workerScript,o=e.enableTransportCompression,s=e.sendTimeoutMs,a=e.handleSendEvents,l=this;if(this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.sendIdCounter=0,this.pendingWorkerRequests=new Map,this.timedOutWorkerRequests=new Map,this.flushPauseUntilMs=0,this.mergeOnNextFlush=!1,this.coalesceNextFlush=!1,this.mergeLogFiredThisPause=!1,this.killedSessions=new Set,this.loggerProvider=r,this.payloadBatcher=n||function(e){return e},this.trackServerUrl=t,this.enableTransportCompression=null==o||o,this.sendTimeoutMs=null!=s?s:1e4,this.handleSendEvents=a,i)try{var u=new Blob([i],{type:"application/javascript"}),h=URL.createObjectURL(u),p=new Worker(h);p.onerror=function(e){var t,n;e.preventDefault(),r.error("Track destination worker failed, falling back to main-thread sending: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),p.terminate(),l.worker=void 0;try{for(var i=c(l.pendingWorkerRequests),o=i.next();!o.done;o=i.next()){var s=d(o.value,2)[1];s.timeout&&clearTimeout(s.timeout),r.warn("Session replay event send failed due to worker crash: ".concat(e.message)),s.resolve()}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}l.pendingWorkerRequests.clear(),l.timedOutWorkerRequests.clear()},p.onmessage=function(e){var t=e.data;if("log"===t.type)r.log(t.message);else if("warn"===t.type)r.warn(t.message);else if("payload_too_large"===t.type){var n=l.pendingWorkerRequests.get(t.id);if(n)n.timeout&&clearTimeout(n.timeout),l.handlePayloadTooLargeResponse(n.context,t.isWaf),n.resolve(),l.pendingWorkerRequests.delete(t.id);else(i=l.timedOutWorkerRequests.get(t.id))&&(l.timedOutWorkerRequests.delete(t.id),l.handlePayloadTooLargeResponse(i,t.isWaf))}else if("complete"===t.type){var i,o=l.pendingWorkerRequests.get(t.id);if(o)o.timeout&&clearTimeout(o.timeout),void 0!==t.skipCode&&l.applyServerDirective(o.context.sessionId,t.skipCode),l.completeRequest({context:o.context}),o.resolve(),l.pendingWorkerRequests.delete(t.id);else(i=l.timedOutWorkerRequests.get(t.id))&&(l.timedOutWorkerRequests.delete(t.id),void 0!==t.skipCode&&l.applyServerDirective(i.sessionId,t.skipCode),l.completeRequest({context:i}))}else"fetch-request"===t.type&&l.handleDelegatedFetch(p,t).catch(function(e){r.warn("Failed to handle delegated session replay fetch:",e)})},this.worker=p}catch(e){r.error("Failed to create track destination worker, falling back to main-thread sending:",e)}}return e.prototype.sendEventsList=function(e){this.addToQueue(s(s({},e),{attempts:0,timeout:0}))},e.prototype.markCoalesceNextFlush=function(){this.coalesceNextFlush=!0,this.schedule(0)},e.prototype.sendBeacon=function(e){var t,r,n=this,i=e.events,o=e.sessionId,s=e.deviceId,a=e.apiKey,l=e.serverZone,u=function(e){return new Blob([e]).size},c=i,d=JSON.stringify({version:2,events:c});if(u(d)>65536){for(var h=0,p=c.length;h<p;){var f=Math.floor((h+p+1)/2);u(JSON.stringify({version:2,events:c.slice(0,f)}))<=65536?h=f:p=f-1}c=c.slice(0,h),d=JSON.stringify({version:2,events:c}),this.loggerProvider.warn("sendBeacon payload exceeded 64 KB limit, trimmed from ".concat(i.length," to ").concat(c.length," events"))}if(0!==c.length)if(this.handleSendEvents){var g=new URLSearchParams({device_id:s,session_id:String(o),type:"replay"}),v="".concat(Da(l,this.trackServerUrl),"?").concat(g.toString()),m={"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(a)};this.loggerProvider.debug("Routing session replay exit batch (".concat(c.length," events) through custom transport for session id ").concat(o,"."));try{this.handleSendEvents({url:v,method:"POST",headers:m,body:d,keepalive:!0}).catch(function(e){n.loggerProvider.warn("Custom transport failed to send session replay exit batch:",e)})}catch(e){this.loggerProvider.warn("Custom transport threw while sending session replay exit batch:",e)}}else{var y=new URLSearchParams({device_id:s,session_id:String(o),type:"replay",api_key:a}),b="".concat(Da(l,this.trackServerUrl),"?").concat(y.toString()),w=z();try{var S=new Blob([d],{type:"application/json"});!1===(null===(r=null===(t=null==w?void 0:w.navigator)||void 0===t?void 0:t.sendBeacon)||void 0===r?void 0:r.call(t,b,S))&&this.loggerProvider.warn("sendBeacon failed to queue session replay payload")}catch(e){}}},e.prototype.addToQueue=function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];t.filter(function(t){return e.killedSessions.has(t.sessionId)?(e.completeRequest({context:t,err:pl}),!1):t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:dl}),!1)}).forEach(function(t){e.queue=e.queue.concat(t),e.schedule(0)})},e.prototype.schedule=function(e){var t=this;if(!this.scheduled){var r=this.flushPauseUntilMs-Date.now(),n=r>e?r:e;r>0&&(this.mergeOnNextFlush=!0),this.scheduled=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},n)}},e.prototype.flush=function(e){return void 0===e&&(e=!1),l(this,void 0,void 0,function(){var t,r,n,i,o,s,a;return u(this,function(l){switch(l.label){case 0:t=this.queue,this.queue=[],this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),this.mergeOnNextFlush?(this.mergeOnNextFlush=!1,this.coalesceNextFlush=!1,t=this.mergeQueueAfterThrottle(t)):this.coalesceNextFlush&&(this.coalesceNextFlush=!1,t=this.mergeDrainBacklog(t)),l.label=1;case 1:l.trys.push([1,6,7,8]),r=c(t),n=r.next(),l.label=2;case 2:return n.done?[3,5]:(i=n.value,[4,this.send(i,e)]);case 3:l.sent(),l.label=4;case 4:return n=r.next(),[3,2];case 5:return[3,8];case 6:return o=l.sent(),s={error:o},[3,8];case 7:try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}return[7];case 8:return[2]}})})},e.prototype.mergeQueueAfterThrottle=function(e){var t=this.coalesceByIdentity(e);return t.length<e.length&&!this.mergeLogFiredThisPause&&(this.mergeLogFiredThisPause=!0,this.loggerProvider.log("Session replay throttle pause ended; merged ".concat(e.length," queued batches into ").concat(t.length," request(s)"))),t},e.prototype.mergeDrainBacklog=function(e){var t=this.coalesceByIdentity(e);return t.length<e.length&&this.loggerProvider.log("Session replay coalesced ".concat(e.length," persisted page-load backlog batches into ").concat(t.length," request(s)")),t},e.prototype.coalesceByIdentity=function(e){var t,r,n,i,o,a,p,f,g,v,m,y=this;if(e.length<=1)return e;var b=new Map;try{for(var w=c(e),S=w.next();!S.done;S=w.next()){var x=S.value,k=[x.sessionId,null!==(o=x.deviceId)&&void 0!==o?o:"",null!==(a=x.apiKey)&&void 0!==a?a:"",x.type,null!==(p=x.serverZone)&&void 0!==p?p:"",x.sampleRate,null!==(g=null===(f=x.version)||void 0===f?void 0:f.type)&&void 0!==g?g:"",null!==(m=null===(v=x.version)||void 0===v?void 0:v.version)&&void 0!==m?m:""].join("|"),C=b.get(k);C?C.push(x):b.set(k,[x])}}catch(e){t={error:e}}finally{try{S&&!S.done&&(r=w.return)&&r.call(w)}finally{if(t)throw t.error}}var E=[],I=function(e){var t,r;if(1===e.length)return E.push(e[0]),"continue";var n=null,i=0,o=function(){n&&E.push(n),n=null,i=0},a=function(e){var t=e.events.reduce(function(e,t){return e+new Blob([t]).size},0);if(null===n)return n=s(s({},e),{events:h([],d(e.events),!1),attempts:0}),i=t,"continue";if(i+t>4e6)return o(),n=s(s({},e),{events:h([],d(e.events),!1),attempts:0}),i=t,"continue";var r=n.onComplete,a=e.onComplete;n.events=n.events.concat(e.events),i+=t,n.onComplete=function(){return l(y,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,Promise.allSettled([r(),a()])];case 1:return e.sent(),[2]}})})}};try{for(var p=(t=void 0,c(e)),f=p.next();!f.done;f=p.next()){a(f.value)}}catch(e){t={error:e}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}o()};try{for(var O=c(b.values()),P=O.next();!P.done;P=O.next()){I(P.value)}}catch(e){n={error:e}}finally{try{P&&!P.done&&(i=O.return)&&i.call(O)}finally{if(n)throw n.error}}return E},e.prototype.send=function(e,t){return void 0===t&&(t=!0),l(this,void 0,void 0,function(){var r,n,i,o;return u(this,function(s){return this.killedSessions.has(e.sessionId)?[2,this.completeRequest({context:e,err:pl})]:(r=e.apiKey)?(n=e.deviceId)?0===(i=this.payloadBatcher({version:1,events:e.events})).events.length?(this.completeRequest({context:e}),[2]):(o=this.worker)?[2,this.sendViaWorker(o,e,i,t)]:[2,this.sendOnMainThread(r,n,e,i,t)]:[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})]:[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})]})})},e.prototype.sendViaWorker=function(e,t,r,n){return l(this,void 0,void 0,function(){var i,o=this;return u(this,function(s){return i="".concat(++this.sendIdCounter),[2,new Promise(function(s){var a,l=o.sendTimeoutMs>0?setTimeout(function(){var e=o.pendingWorkerRequests.get(i);e&&(o.pendingWorkerRequests.delete(i),o.rememberTimedOutRequest(i,e.context),o.loggerProvider.warn("Session replay worker send timed out after ".concat(o.sendTimeoutMs,"ms; leaving events for retry")),e.resolve())},o.sendTimeoutMs):void 0;o.pendingWorkerRequests.set(i,{context:t,resolve:s,timeout:l}),e.postMessage({type:"send",id:i,payload:r,useRetry:n,useCustomTransport:!!o.handleSendEvents,context:{apiKey:t.apiKey,deviceId:t.deviceId,sessionId:t.sessionId,events:t.events,eventType:t.type,flushMaxRetries:null!==(a=t.flushMaxRetries)&&void 0!==a?a:0,sampleRate:t.sampleRate,serverZone:t.serverZone,trackServerUrl:o.trackServerUrl,version:t.version,currentUrl:qa(),sdkVersion:fl,enableTransportCompression:o.enableTransportCompression,sendTimeoutMs:o.sendTimeoutMs}})})]})})},e.prototype.rememberTimedOutRequest=function(e,t){var r,n;if(this.timedOutWorkerRequests.set(e,t),this.timedOutWorkerRequests.size>256)try{for(var i=c(this.timedOutWorkerRequests.keys()),o=i.next();!o.done;o=i.next()){var s=o.value;this.timedOutWorkerRequests.delete(s);break}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},e.prototype.handleDelegatedFetch=function(e,t){var r,n,i;return l(this,void 0,void 0,function(){var o,s,a,l,c,d,h,p,f,g,v;return u(this,function(u){switch(u.label){case 0:o=t.requestId,s=t.url,a=t.method,l=t.headers,c=t.body,d=t.keepalive,u.label=1;case 1:return u.trys.push([1,10,,11]),h=void 0,this.handleSendEvents?[4,this.handleSendEvents({url:s,method:a,headers:l,body:c,keepalive:d})]:[3,3];case 2:return h=u.sent(),[3,5];case 3:return this.loggerProvider.warn("Delegated session replay fetch received without a custom transport configured; falling back to built-in fetch."),[4,fetch(s,{method:a,headers:l,body:c,keepalive:d})];case 4:h=u.sent(),u.label=5;case 5:if(p=h.status,f=null,g="",p>=200&&p<300&&(f=null!==(i=null===(n=null===(r=h.headers)||void 0===r?void 0:r.get)||void 0===n?void 0:n.call(r,Ma))&&void 0!==i?i:null),413!==p)return[3,9];u.label=6;case 6:return u.trys.push([6,8,,9]),[4,h.text()];case 7:return g=u.sent(),[3,9];case 8:return u.sent(),[3,9];case 9:return this.loggerProvider.debug("Delegated session replay fetch (request ".concat(o,") returned status ").concat(p,".")),e.postMessage({type:"fetch-response",requestId:o,status:p,skipHeader:f,body:g}),[3,11];case 10:return v=u.sent(),this.loggerProvider.debug("Delegated session replay fetch (request ".concat(o,") failed:"),v),e.postMessage({type:"fetch-response",requestId:o,status:0,skipHeader:null,body:String(v),error:!0}),[3,11];case 11:return[2]}})})},e.prototype.sendOnMainThread=function(e,t,r,n,i){var o,a,c,d,h,p,f;return l(this,void 0,void 0,function(){var l,g,v,m,y,b,w,S,x,k,C,E,I,O,P,T,R,M,A,_,N,D;return u(this,function(u){switch(u.label){case 0:l=qa(),g=fl,v=r.sampleRate,m=new URLSearchParams({device_id:t,session_id:"".concat(r.sessionId),type:"".concat(r.type)}),y="".concat(null!==(a=null===(o=r.version)||void 0===o?void 0:o.type)&&void 0!==a?a:"standalone","/").concat(null!==(d=null===(c=r.version)||void 0===c?void 0:c.version)&&void 0!==d?d:g),u.label=1;case 1:return u.trys.push([1,19,,23]),b=JSON.stringify(n),w=z(),this.enableTransportCompression&&w&&"CompressionStream"in w?[4,gl(b,w)]:[3,3];case 2:return x=u.sent(),[3,4];case 3:x=null,u.label=4;case 4:if(k=(S=x)?S.byteLength:new Blob([b]).size,C=new AbortController,E=s({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(e),"X-Client-Version":g,"X-Client-Library":y,"X-Client-Url":l.substring(0,1e3),"X-Client-Sample-Rate":"".concat(v),"X-Sampling-Hash-Alg":"xxhash32"},S?{"Content-Encoding":"gzip"}:{}),P={headers:E,body:I=null!=S?S:b,method:"POST",keepalive:O=k<=65536,signal:C.signal},T="".concat(Da(r.serverZone,this.trackServerUrl),"?").concat(m.toString()),0===n.events.length)return this.completeRequest({context:r}),[2];R=this.sendTimeoutMs>0?setTimeout(function(){C.abort()},this.sendTimeoutMs):void 0,M=void 0,u.label=5;case 5:return u.trys.push([5,,10,11]),this.handleSendEvents?[4,(L=this.handleSendEvents({url:T,method:"POST",headers:E,body:I,keepalive:O}),F=C.signal,new Promise(function(e,t){var r=function(){var e=new Error("Custom session replay transport aborted by send timeout");e.name="AbortError",t(e)};F.addEventListener("abort",r,{once:!0}),L.then(function(t){F.removeEventListener("abort",r),e(t)},function(e){F.removeEventListener("abort",r),t(e)})}))]:[3,7];case 6:return A=u.sent(),[3,9];case 7:return[4,fetch(T,P)];case 8:A=u.sent(),u.label=9;case 9:return M=A,[3,11];case 10:return R&&clearTimeout(R),[7];case 11:if(null===M)return this.completeRequest({context:r,err:"Unexpected error occurred"}),[2];if(M.status>=200&&M.status<300&&(_=null!==(f=null===(p=null===(h=M.headers)||void 0===h?void 0:h.get)||void 0===p?void 0:p.call(h,Ma))&&void 0!==f?f:null,this.applyServerDirective(r.sessionId,_)),i)return[3,12];N="";try{N=JSON.stringify(M.body,null,2)}catch(e){}return this.completeRequest({context:r,success:"".concat(M.status,": ").concat(N)}),[3,18];case 12:if(N="",413!==M.status)return[3,16];u.label=13;case 13:return u.trys.push([13,15,,16]),[4,M.text()];case 14:return N=u.sent(),[3,16];case 15:return u.sent(),[3,16];case 16:return[4,this.handleReponse(M.status,r,N)];case 17:u.sent(),u.label=18;case 18:return[3,23];case 19:return D=u.sent(),!!D&&"object"==typeof D&&"AbortError"===D.name&&i?[4,this.handleOtherResponse(r)]:[3,21];case 20:return u.sent(),[3,22];case 21:this.completeRequest({context:r,err:D}),u.label=22;case 22:return[3,23];case 23:return[2]}var L,F})})},e.prototype.handleReponse=function(e,t,r){return void 0===r&&(r=""),l(this,void 0,void 0,function(){var n;return u(this,function(i){switch(i.label){case 0:switch(n=(new ct).buildStatus(e),n){case U.Success:return[3,1];case U.Failed:case U.Timeout:case U.RateLimit:return[3,2];case U.PayloadTooLarge:return[3,4]}return[3,5];case 1:return this.handleSuccessResponse(t),[3,8];case 2:return[4,this.handleOtherResponse(t)];case 3:return i.sent(),[3,8];case 4:return this.handlePayloadTooLargeResponse(t,Oa.test(r)),[3,8];case 5:return 499!==e?[3,7]:[4,this.handleOtherResponse(t)];case 6:return i.sent(),[3,8];case 7:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"}),i.label=8;case 8:return[2]}})})},e.prototype.handlePayloadTooLargeResponse=function(e,t){var r=t?"WAF (compressed payload too large)":"server (event too large)",n=Math.round(e.events.reduce(function(e,t){return e+t.length},0)/Ra);if(t)if(1!==e.events.length){this.loggerProvider.warn("Session replay event batch rejected by ".concat(r," (").concat(e.events.length," events, ").concat(n," KB total) — splitting and retrying")),e.onComplete();var i=function(){return Promise.resolve()},o=Math.floor(e.events.length/2);this.sendEventsList(s(s({},e),{events:e.events.slice(0,o),onComplete:i})),this.sendEventsList(s(s({},e),{events:e.events.slice(o),onComplete:i}))}else this.completeRequest({context:e,err:"Session replay event dropped: single event (".concat(n," KB, 1 event) rejected by ").concat(r," — cannot split further")});else this.completeRequest({context:e,err:"Session replay event batch dropped: ".concat(r," rejected payload (").concat(e.events.length," events, ").concat(n," KB) — not retrying non-WAF 413")})},e.prototype.handleSuccessResponse=function(e){var t=Math.round(new Blob(e.events).size/Ra);this.completeRequest({context:e,success:"Session replay event batch tracked successfully for session id ".concat(e.sessionId,", size of events: ").concat(t," KB")})},e.prototype.handleOtherResponse=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return t=Math.random()*e.attempts*this.retryTimeout,e.attempts++,e.attempts>(e.flushMaxRetries||0)?(this.completeRequest({context:e,err:dl}),[2]):[4,new Promise(function(e){return setTimeout(e,t)})];case 1:return r.sent(),[4,this.send(e,!0)];case 2:return r.sent(),[2]}})})},e.prototype.completeRequest=function(e){var t=e.context,r=e.err,n=e.success;t.onComplete(),r?this.loggerProvider.warn(r):n&&this.loggerProvider.log(n)},e.prototype.applyServerDirective=function(e,t){if(null===t)return this.flushPauseUntilMs=0,void(this.mergeLogFiredThisPause=!1);if("429"===t){var r=this.flushPauseUntilMs>Date.now();return this.flushPauseUntilMs=Date.now()+6e4,void(r||this.loggerProvider.log("Session replay throttled by server; pausing flush schedule for ".concat(60,"s")))}"4005"!==t&&"4004"!==t||this.killSession(e,t)},e.prototype.killSession=function(e,t){var r,n,i,o;if(!this.killedSessions.has(e)){if(this.killedSessions.add(e),this.killedSessions.size>256)try{for(var s=c(this.killedSessions),a=s.next();!a.done;a=s.next()){var l=a.value;this.killedSessions.delete(l);break}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}this.loggerProvider.log("Session replay capture stopped for session ".concat(e," by server directive ").concat(t,"; remaining events will be dropped"));var u=[];try{for(var d=c(this.queue),h=d.next();!h.done;h=d.next()){var p=h.value;p.sessionId===e?this.completeRequest({context:p,err:pl}):u.push(p)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}this.queue=u}},e}();const ml=(e,t)=>t.some(t=>e instanceof t);let yl,bl;const wl=new WeakMap,Sl=new WeakMap,xl=new WeakMap;let kl={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return wl.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Ol(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Cl(e){kl=e(kl)}function El(e){return(bl||(bl=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Pl(this),t),Ol(this.request)}:function(...t){return Ol(e.apply(Pl(this),t))}}function Il(e){return"function"==typeof e?El(e):(e instanceof IDBTransaction&&function(e){if(wl.has(e))return;const t=new Promise((t,r)=>{const n=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),n()},o=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});wl.set(e,t)}(e),ml(e,yl||(yl=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,kl):e)}function Ol(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,r)=>{const n=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(Ol(e.result)),n()},o=()=>{r(e.error),n()};e.addEventListener("success",i),e.addEventListener("error",o)});return xl.set(t,e),t}(e);if(Sl.has(e))return Sl.get(e);const t=Il(e);return t!==e&&(Sl.set(e,t),xl.set(t,e)),t}const Pl=e=>xl.get(e);function Tl(e,t,{blocked:r,upgrade:n,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=Ol(s);return n&&s.addEventListener("upgradeneeded",e=>{n(Ol(s.result),e.oldVersion,e.newVersion,Ol(s.transaction),e)}),r&&s.addEventListener("blocked",e=>r(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}const Rl=["get","getKey","getAll","getAllKeys","count"],Ml=["put","add","delete","clear"],Al=new Map;function _l(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Al.get(t))return Al.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,i=Ml.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!i&&!Rl.includes(r))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;return n&&(s=s.index(t.shift())),(await Promise.all([s[r](...t),i&&o.done]))[0]};return Al.set(t,o),o}Cl(e=>({...e,get:(t,r,n)=>_l(t,r)||e.get(t,r,n),has:(t,r)=>!!_l(t,r)||e.has(t,r)}));const Nl=["continue","continuePrimaryKey","advance"],Dl={},Ll=new WeakMap,Fl=new WeakMap,Ul={get(e,t){if(!Nl.includes(t))return e[t];let r=Dl[t];return r||(r=Dl[t]=function(...e){Ll.set(this,Fl.get(this)[t](...e))}),r}};async function*jl(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const r=new Proxy(t,Ul);for(Fl.set(r,t),xl.set(r,Pl(t));t;)yield r,t=await(Ll.get(r)||t.continue()),Ll.delete(r)}function Bl(e,t){return t===Symbol.asyncIterator&&ml(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&ml(e,[IDBIndex,IDBObjectStore])}Cl(e=>({...e,get:(t,r,n)=>Bl(t,r)?jl:e.get(t,r,n),has:(t,r)=>Bl(t,r)||e.has(t,r)}));var ql=function(){function e(e){var t,r,n,i=this;this.minInterval=Pa,this.maxInterval=Ta,this.maxPersistedEventsSize=6e6,this._timeAtLastSplit=Date.now(),this.shouldSplitEventsList=function(e,t){var r=i.getStringSize(t);return i.getEventsArraySize(e)+r>=i.maxPersistedEventsSize||!!(Date.now()-i.timeAtLastSplit>i.interval&&e.length)&&(i.interval=Math.min(i.maxInterval,i.interval+i.minInterval),i._timeAtLastSplit=Date.now(),!0)},this.loggerProvider=e.loggerProvider,this.minInterval=null!==(t=e.minInterval)&&void 0!==t?t:this.minInterval,this.maxInterval=null!==(r=e.maxInterval)&&void 0!==r?r:this.maxInterval,this.maxPersistedEventsSize=null!==(n=e.maxPersistedEventsSize)&&void 0!==n?n:this.maxPersistedEventsSize,this.interval=this.minInterval}return Object.defineProperty(e.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),e.prototype.getStringSize=function(e){for(var t=0,r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n<=127)t++;else if(n<=2047)t+=2;else if(n>=55296&&n<=56319){var i=r+1<e.length?e.charCodeAt(r+1):NaN;i>=56320&&i<=57343?(t+=4,r++):t+=3}else t+=3}return t},e.prototype.getEventsArraySize=function(e){var t,r,n=0;try{for(var i=c(e),o=i.next();!o.done;o=i.next()){var s=o.value;n+=this.getStringSize(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n+(2+Math.max(0,e.length-1)+2*e.length)},e}(),zl=function(e,t,r){!function(e){return"object"==typeof e&&null!==e&&"AbortError"===e.name}(r)?e.warn(t):e.debug(t)};var Wl="sessionCurrentSequence",Vl="sequencesToSend",$l=5e3;function Hl(e,t,r){var n=setTimeout(r,t);return e.then(function(){return clearTimeout(n)},function(){return clearTimeout(n)}),function(){return clearTimeout(n)}}var Kl,Gl,Jl,Xl=function(e){var t,r;return e.objectStoreNames.contains(Wl)||(r=e.createObjectStore(Wl,{keyPath:"sessionId"})),e.objectStoreNames.contains(Vl)||(t=e.createObjectStore(Vl,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:r}},Yl=function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,(r=Tl(e,1,{upgrade:Xl}),n=2e3,i="IDB openDB timed out",void 0===i&&(i="IDB operation timed out"),new Promise(function(e,t){var o=setTimeout(function(){return t(new Error("".concat(i," after ").concat(n,"ms")))},n);r.then(function(t){clearTimeout(o),e(t)},function(e){clearTimeout(o),t(e)})}))];case 1:return[2,t.sent()]}var r,n,i})})},Ql=function(e){function t(t){var r,n=this;return(n=e.call(this,t)||this).consecutiveFailures=0,n.hasTriggeredFallback=!1,n.emptyFilteredCount=0,n.getSequencesToSend=function(){return l(n,void 0,void 0,function(){var e,t,r,n,i,o,s,a,l,c,d=this;return u(this,function(u){switch(u.label){case 0:e=!1,t=!1,u.label=1;case 1:return u.trys.push([1,9,,10]),r=[],(n=this.db.transaction("sequencesToSend","readwrite")).done.catch(function(r){e||t||(zl(d.loggerProvider,"".concat(hl,": ").concat(r),r),d.recordFailure())}),i=Hl(n.done,$l,function(){e||t||(t=!0,zl(d.loggerProvider,"".concat(hl,": transaction timed out")),d.recordFailure())}),[4,n.store.openCursor()];case 2:o=u.sent(),u.label=3;case 3:return o?(s=o.value,a=s.sessionId,0!==(l=s.events).length?[3,5]:(this.maybeLogEmptyFiltered("getSequencesToSend"),[4,o.delete()])):[3,8];case 4:return u.sent(),[3,6];case 5:r.push({events:l,sequenceId:o.key,sessionId:a}),u.label=6;case 6:return[4,o.continue()];case 7:return o=u.sent(),[3,3];case 8:return this.recordSuccess(),i(),[2,r];case 9:return c=u.sent(),t||(e=!0,zl(this.loggerProvider,"".concat(hl,": ").concat(c),c),this.recordFailure()),[3,10];case 10:return[2,void 0]}})})},n.storeCurrentSequence=function(e){return l(n,void 0,void 0,function(){var t,r,n,i,o,l,c,d,h=this;return u(this,function(u){switch(u.label){case 0:t=!1,r=!1,u.label=1;case 1:return u.trys.push([1,5,,6]),(n=this.db.transaction([Wl,Vl],"readwrite")).done.catch(function(e){t||r||(zl(h.loggerProvider,"".concat(hl,": ").concat(e),e),h.recordFailure())}),i=Hl(n.done,$l,function(){t||r||(r=!0,zl(h.loggerProvider,"".concat(hl,": transaction timed out")),h.recordFailure())}),[4,n.objectStore(Wl).get(e)];case 2:return!(o=u.sent())||o.tabId&&o.tabId!==this.tabId?(i(),[2,void 0]):0===o.events.length?(this.maybeLogEmptyFiltered("storeCurrentSequence"),i(),[2,void 0]):[4,n.objectStore(Vl).put({sessionId:e,events:o.events,tabId:this.tabId})];case 3:return l=u.sent(),[4,n.objectStore(Wl).put({sessionId:e,events:[],tabId:this.tabId})];case 4:return u.sent(),this.recordSuccess(),i(),o.tabId,c=a(o,["tabId"]),[2,s(s({},c),{sessionId:e,sequenceId:l})];case 5:return d=u.sent(),r||(t=!0,zl(this.loggerProvider,"".concat(hl,": ").concat(d),d),this.recordFailure()),[3,6];case 6:return[2,void 0]}})})},n.addEventToCurrentSequence=function(e,t){return l(n,void 0,void 0,function(){var r,n,i,o,s,a,l,c,d,h=this;return u(this,function(u){switch(u.label){case 0:r=!1,n=!1,u.label=1;case 1:return u.trys.push([1,15,,16]),(i=this.db.transaction([Wl,Vl],"readwrite")).done.catch(function(e){r||n||(zl(h.loggerProvider,"".concat(hl,": ").concat(e),e),h.recordFailure())}),o=Hl(i.done,$l,function(){r||n||(n=!0,zl(h.loggerProvider,"".concat(hl,": transaction timed out")),h.recordFailure())}),[4,i.objectStore(Wl).get(e)];case 2:return(null==(s=u.sent())?void 0:s.tabId)&&s.tabId!==this.tabId?s.events.length>0?[4,i.objectStore(Vl).put({sessionId:e,events:s.events,tabId:s.tabId})]:[3,4]:[3,6];case 3:u.sent(),u.label=4;case 4:return[4,i.objectStore(Wl).put({sessionId:e,events:[t],tabId:this.tabId})];case 5:return u.sent(),this.recordSuccess(),o(),[2,void 0];case 6:return(a=s)?[3,8]:[4,i.objectStore(Wl).put({sessionId:e,events:[t],tabId:this.tabId})];case 7:return u.sent(),this.recordSuccess(),o(),[2,void 0];case 8:return this.shouldSplitEventsList(a.events,t)?[3,10]:[4,i.objectStore(Wl).put({sessionId:e,events:a.events.concat(t),tabId:this.tabId})];case 9:return u.sent(),this.recordSuccess(),o(),[2,void 0];case 10:return 0!==(l=a.events).length?[3,12]:(this.maybeLogEmptyFiltered("addEventToCurrentSequence"),[4,i.objectStore(Wl).put({sessionId:e,events:[t],tabId:this.tabId})]);case 11:return u.sent(),this.recordSuccess(),o(),[2,void 0];case 12:return[4,i.objectStore(Wl).put({sessionId:e,events:[t],tabId:this.tabId})];case 13:return u.sent(),[4,i.objectStore(Vl).put({sessionId:e,events:l,tabId:this.tabId})];case 14:return c=u.sent(),this.recordSuccess(),o(),[2,{events:l,sessionId:e,sequenceId:c}];case 15:return d=u.sent(),n||(r=!0,zl(this.loggerProvider,"".concat(hl,": ").concat(d),d),this.recordFailure()),[3,16];case 16:return[2,void 0]}})})},n.storeSendingEvents=function(e,t){return l(n,void 0,void 0,function(){var r,n;return u(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.db.put(Vl,{sessionId:e,events:t,tabId:this.tabId})];case 1:return r=i.sent(),this.recordSuccess(),[2,r];case 2:return n=i.sent(),zl(this.loggerProvider,"".concat(hl,": ").concat(n),n),this.recordFailure(),[3,3];case 3:return[2,void 0]}})})},n.cleanUpSessionEventsStore=function(e,t){return l(n,void 0,void 0,function(){var e;return u(this,function(r){switch(r.label){case 0:if(!t)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.db.delete(Vl,t)];case 2:return r.sent(),this.recordSuccess(),[3,4];case 3:return e=r.sent(),zl(this.loggerProvider,"".concat(hl,": ").concat(e),e),this.recordFailure(),[3,4];case 4:return[2]}})})},n.db=t.db,n.tabId=t.tabId,n.onPersistentFailure=t.onPersistentFailure,n.consecutiveFailureThreshold=null!==(r=t.consecutiveFailureThreshold)&&void 0!==r?r:1,n}return n(t,e),t.prototype.maybeLogEmptyFiltered=function(e){this.emptyFilteredCount++%100==0&&this.loggerProvider.debug("Filtered empty session replay sequence at ".concat(e," (idb store)"))},t.prototype.recordFailure=function(){var e;this.consecutiveFailures++,!this.hasTriggeredFallback&&this.consecutiveFailures>=this.consecutiveFailureThreshold&&(this.hasTriggeredFallback=!0,null===(e=this.onPersistentFailure)||void 0===e||e.call(this))},t.prototype.recordSuccess=function(){this.consecutiveFailures=0},t.new=function(e,r){var n;return l(this,void 0,void 0,function(){var i,o,a,l,c;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),i="replay"===e?"":"_".concat(e),o="".concat(r.apiKey.substring(0,10),"_amp_session_replay_events").concat(i),[4,Yl(o)];case 1:return a=u.sent(),l=null!==(n=r.tabId)&&void 0!==n?n:function(){try{return crypto.randomUUID()}catch(e){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}}(),[2,new t(s(s({},r),{db:a,tabId:l}))];case 2:return c=u.sent(),zl(r.loggerProvider,"".concat(hl,": ").concat(c),c),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o,s,l,d;return u(this,function(u){switch(u.label){case 0:return e?[4,this.db.get("sessionCurrentSequence",e)]:[3,2];case 1:return(i=u.sent())?i.tabId&&i.tabId!==this.tabId?[2,void 0]:(i.tabId,[2,[o=a(i,["tabId"])]]):[2,void 0];case 2:t=[],u.label=3;case 3:return u.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:r=c.apply(void 0,[u.sent()]),n=r.next(),u.label=5;case 5:if(n.done)return[3,7];if((i=n.value).tabId&&i.tabId!==this.tabId)return[3,6];i.tabId,o=a(i,["tabId"]),t.push(o),u.label=6;case 6:return n=r.next(),[3,5];case 7:return[3,10];case 8:return s=u.sent(),l={error:s},[3,10];case 9:try{n&&!n.done&&(d=r.return)&&d.call(r)}finally{if(l)throw l.error}return[7];case 10:return[2,t]}})})},t}(ql),Zl=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.finalizedSequences={},t.sequences={},t.sequenceId=0,t.emptyFilteredCount=0,t}return n(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,r=h([],d(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:r},this.resetCurrentSequence(e),{sequenceId:t,events:r,sessionId:e}},t.prototype.maybeLogEmptyFiltered=function(e){this.emptyFilteredCount++%100==0&&this.loggerProvider.debug("Filtered empty session replay sequence at ".concat(e," (in-memory store)"))},t.prototype.getSequencesToSend=function(){return l(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a,l,h;return u(this,function(u){e=[];try{for(t=c(Object.entries(this.finalizedSequences)),r=t.next();!r.done;r=t.next())n=d(r.value,2),i=n[0],o=n[1],s=o.sessionId,0!==(a=o.events).length?e.push({sequenceId:Number(i),sessionId:s,events:a}):(this.maybeLogEmptyFiltered("getSequencesToSend"),delete this.finalizedSequences[Number(i)])}catch(e){l={error:e}}finally{try{r&&!r.done&&(h=t.return)&&h.call(t)}finally{if(l)throw l.error}}return[2,e]})})},t.prototype.storeCurrentSequence=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){return(t=this.sequences[e])?0===t.length?(this.maybeLogEmptyFiltered("storeCurrentSequence"),[2,void 0]):[2,this.addSequence(e)]:[2,void 0]})})},t.prototype.addEventToCurrentSequence=function(e,t){return l(this,void 0,void 0,function(){var r;return u(this,function(n){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(0===this.sequences[e].length?this.maybeLogEmptyFiltered("addEventToCurrentSequence"):r=this.addSequence(e)),this.sequences[e].push(t),[2,r]})})},t.prototype.storeSendingEvents=function(e,t){return l(this,void 0,void 0,function(){return u(this,function(r){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(e,t){return l(this,void 0,void 0,function(){return u(this,function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]})})},t}(ql),eu=function(e){var t=e.config,r=e.minInterval,n=e.maxInterval,i=e.maxPersistedEventsSize,o=e.type,a=e.payloadBatcher,c=e.storeType,p=e.trackDestinationWorkerScript,f=e.shouldSend;return l(void 0,void 0,void 0,function(){function e(e){return void 0===e&&(e=!1),l(this,void 0,void 0,function(){return u(this,function(t){return[2,v.flush(e)]})})}var g,v,m,y,b,w,S,x,k,C,E,I,O,P,T,R,M;return u(this,function(A){switch(A.label){case 0:return g=null!==(M=t.maxSingleEventSizeBytes)&&void 0!==M?M:Ia,v=new vl(s(s({},t),{loggerProvider:t.loggerProvider,payloadBatcher:a,workerScript:p})),m=function(){return new Zl({loggerProvider:t.loggerProvider,maxInterval:n,minInterval:r,maxPersistedEventsSize:i})},b=!1,S=function(){return l(void 0,void 0,void 0,function(){var e,r,n;return u(this,function(i){switch(i.label){case 0:return b?(b=!1,t.loggerProvider.warn("IDB store is experiencing repeated failures; falling back to in-memory event store."),y?[4,w.getSequencesToSend()]:[3,2]):[2];case 1:return r=i.sent(),[3,3];case 2:r=void 0,i.label=3;case 3:return e=r,w=m(),e&&y&&(n=y,e.forEach(function(e){O({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:n})})),[2]}})})},x=function(){return l(void 0,void 0,void 0,function(){var e;return u(this,function(s){switch(s.label){case 0:return[4,Ql.new(o,{loggerProvider:t.loggerProvider,minInterval:r,maxInterval:n,maxPersistedEventsSize:i,apiKey:t.apiKey,onPersistentFailure:function(){S()}})];case 1:return(e=s.sent())?(b=!0,[2,e]):(t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,m()])}})})},"idb"!==c?[3,2]:[4,x()];case 1:return k=A.sent(),[3,3];case 2:k=m(),A.label=3;case 3:return w=k,C=[],E=0,I=function(e){if(!(e<=E)){var t=Math.min(e-E,C.length);t>0&&(C.splice(0,t),E=e)}},O=function(e){var r=e.events,n=e.sessionId,i=e.deviceId,s=e.sequenceId,a=r.map(function(e){return{event:e,bytes:new Blob([e]).size}}),c=a.filter(function(e){return e.bytes>g});c.length>0&&t.loggerProvider.warn("Dropping ".concat(c.length," oversized event(s) from session replay sequence before send. Sizes: ").concat(c.map(function(e){return"".concat(Math.round(e.bytes/1024)," KB")}).join(", "),". If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support."));var d=c.length>0?a.filter(function(e){return e.bytes<=g}).map(function(e){return e.event}):r;0!==d.length?(t.debugMode&&$a().then(function(e){var r=e.totalStorageSize,n=e.percentOfQuota,i=e.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(r," KB, percentage of quota: ").concat(n,"%, usage details: ").concat(i))}).catch(function(){}),v.sendEventsList({events:d,sessionId:n,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:i,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:o,onComplete:function(){return l(void 0,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,w.cleanUpSessionEventsStore(n,s)];case 1:return e.sent(),[2]}})})}})):w.cleanUpSessionEventsStore(n,s).catch(function(e){t.loggerProvider.warn("Failed to clean up session replay events store:",e)})},P=function(e){var r=e.sessionId,n=e.deviceId;if(y=n,!f||f()){var i=E+C.length;w.storeCurrentSequence(r).then(function(e){e&&(I(i),O({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:n}))}).catch(function(e){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",e)})}},T=function(e){var r=e.deviceId;return l(void 0,void 0,void 0,function(){var e;return u(this,function(n){switch(n.label){case 0:return y=r,[4,w.getSequencesToSend()];case 1:return(null==(e=n.sent())?void 0:e.length)?(t.loggerProvider.log("Draining ".concat(e.length," stored sequence(s) from previous session.")),e.length>1&&v.markCoalesceNextFlush(),e.forEach(function(e){O({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r})}),[2]):[2]}})})},R=function(e){var r=e.event,n=e.sessionId,i=e.deviceId;y=i;var o=!f||f(),s=E+C.length;C.push(r.data),w.addEventToCurrentSequence(n,r.data).then(function(e){if(e){if(!o)return w.cleanUpSessionEventsStore(e.sessionId,e.sequenceId).catch(function(e){t.loggerProvider.warn("Failed to clean up dropped session replay sequence:",e)}),void I(s);I(s),O({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)})},[2,{sendCurrentSequenceEvents:P,addEvent:R,sendStoredEvents:T,flush:e,getBeaconEvents:function(){return h([],d(C),!1)},dropPendingBeaconEvents:function(){I(E+C.length)},trackDestination:v}]}})})},tu=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=new Map;e.forEach(function(e){r.set(e.name,e.manager)}),this.managers=r}return e.prototype.sendStoredEvents=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return t=[],this.managers.forEach(function(r){t.push(r.sendStoredEvents(e))}),[4,Promise.all(t)];case 1:return r.sent(),[2]}})})},e.prototype.addEvent=function(e){var t,r=e.sessionId,n=e.event,i=e.deviceId;null===(t=this.managers.get(n.type))||void 0===t||t.addEvent({sessionId:r,event:n,deviceId:i})},e.prototype.sendCurrentSequenceEvents=function(e){var t=e.sessionId,r=e.deviceId;this.managers.forEach(function(e){e.sendCurrentSequenceEvents({sessionId:t,deviceId:r})})},e.prototype.flush=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return t=[],this.managers.forEach(function(r){t.push(r.flush(e))}),[4,Promise.all(t)];case 1:return r.sent(),[2]}})})},e}();function ru(e,t){if(Jl=new Date,e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var 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};Kl=s(s({},r),t),Gl=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(Kl.root,r);var n=nu(e,"all",function(){return nu(e,"two",function(){return nu(e,"one",function(){return nu(e,"none")})})});if(n){var i=pu(fu(n,e));return i.length>0&&(n=i[0]),ou(n)}throw new Error("Selector was not found.")}function nu(e,t,r){for(var n=null,i=[],o=e,s=0,a=function(){var e,a,l=(new Date).getTime()-Jl.getTime();if(void 0!==Kl.timeoutMs&&l>Kl.timeoutMs)throw new Error("Timeout: Can't find a unique selector after ".concat(l,"ms"));var u=cu(function(e){var t=e.getAttribute("id");if(t&&Kl.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(o))||cu.apply(void 0,h([],d(function(e){var t=Array.from(e.attributes).filter(function(e){return Kl.attr(e.name,e.value)});return t.map(function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}})}(o)),!1))||cu.apply(void 0,h([],d(function(e){var t=Array.from(e.classList).filter(Kl.className);return t.map(function(e){return{name:"."+CSS.escape(e),penalty:1}})}(o)),!1))||cu(function(e){var t=e.tagName.toLowerCase();if(Kl.tagName(t))return{name:t,penalty:2};return null}(o))||[{name:"*",penalty:3}],p=function(e){var t=e.parentNode;if(!t)return null;var r=t.firstChild;if(!r)return null;var n=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&n++,r!==e);)r=r.nextSibling;return n}(o);if("all"==t)p&&(u=u.concat(u.filter(uu).map(function(e){return lu(e,p)})));else if("two"==t)u=u.slice(0,1),p&&(u=u.concat(u.filter(uu).map(function(e){return lu(e,p)})));else if("one"==t){var f=d(u=u.slice(0,1),1)[0];p&&uu(f)&&(u=[lu(f,p)])}else"none"==t&&(u=[{name:"*",penalty:3}],p&&(u=[lu(u[0],p)]));try{for(var g=(e=void 0,c(u)),v=g.next();!v.done;v=g.next()){(f=v.value).level=s}}catch(t){e={error:t}}finally{try{v&&!v.done&&(a=g.return)&&a.call(g)}finally{if(e)throw e.error}}if(i.push(u),i.length>=Kl.seedMinLength&&(n=iu(i,r)))return"break";o=o.parentElement,s++};o;){if("break"===a())break}return n||(n=iu(i,r)),!n&&r?r():n}function iu(e,t){var r,n,i=pu(hu(e));if(i.length>Kl.threshold)return t?t():null;try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(au(a))return a}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null}function ou(e){for(var t=e[0],r=t.name,n=1;n<e.length;n++){var i=e[n].level||0;r=t.level===i-1?"".concat(e[n].name," > ").concat(r):"".concat(e[n].name," ").concat(r),t=e[n]}return r}function su(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function au(e){var t=ou(e);switch(Gl.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function lu(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function uu(e){return"html"!==e.name&&!e.name.startsWith("#")}function cu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.filter(du);return r.length>0?r:null}function du(e){return null!=e}function hu(e,t){var r,n,i,o,s,a;return void 0===t&&(t=[]),u(this,function(l){switch(l.label){case 0:if(!(e.length>0))return[3,9];l.label=1;case 1:l.trys.push([1,6,7,8]),r=c(e[0]),n=r.next(),l.label=2;case 2:return n.done?[3,5]:(i=n.value,[5,c(hu(e.slice(1,e.length),t.concat(i)))]);case 3:l.sent(),l.label=4;case 4:return n=r.next(),[3,2];case 5:return[3,8];case 6:return o=l.sent(),s={error:o},[3,8];case 7:try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:l.sent(),l.label=11;case 11:return[2]}})}function pu(e){return h([],d(e),!1).sort(function(e,t){return su(e)-su(t)})}function fu(e,t,r){var n,i,o;return void 0===r&&(r={counter:0,visited:new Map}),u(this,function(s){switch(s.label){case 0:if(!(e.length>2&&e.length>Kl.optimizedMinLength))return[3,5];n=1,s.label=1;case 1:return n<e.length-1?r.counter>Kl.maxNumberOfTries?[2]:(r.counter+=1,(i=h([],d(e),!1)).splice(n,1),o=ou(i),r.visited.has(o)?[2]:au(i)&&function(e,t){return Gl.querySelector(ou(e))===t}(i,t)?[4,i]:[3,4]):[3,5];case 2:return s.sent(),r.visited.set(o,!0),[5,c(fu(i,t,r))];case 3:s.sent(),s.label=4;case 4:return n++,[3,1];case 5:return[2]}})}var gu=function(e){var t=e.version,r=e.events,n=[];return r.forEach(function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&n.push(t)}),{version:t,events:n}},vu=function(e){var t=e.version,r=e.events,n=[];r.forEach(function(e){var t=JSON.parse(e);"click"===t.type&&n.push(t)});var i=n.reduce(function(e,t){var r=t.x,n=t.y,i=t.selector,o=t.timestamp,a=o-o%36e5,l="".concat(r,":").concat(n,":").concat(null!=i?i:"",":").concat(a);return e[l]?e[l].count+=1:e[l]=s(s({},t),{timestamp:a,count:1}),e},{});return{version:t,events:Object.values(i)}},mu=function(e,t){var r=this;this.createHook=function(e){var t=e.eventsManager,n=e.sessionId,i=e.deviceIdFn,o=e.mirror,s=e.ugcFilterRules,a=e.performanceOptions;return function(e){if(e.type===rl.Click){var l=z();if(l){var u=l.location,c=l.innerHeight,d=l.innerWidth;if(u){var h=e.x,p=e.y;if(void 0!==h&&void 0!==p){var f,g=o.getNode(e.id);if(g)try{f=ru(g,a)}catch(e){r.logger.debug("error resolving selector from finder")}var v=Va(u.href,s),m={x:h+r.scrollWatcher.currentScrollX,y:p+r.scrollWatcher.currentScrollY,selector:f,viewportHeight:c,viewportWidth:d,pageUrl:v,timestamp:Date.now(),type:"click"},y=i();y&&t.addEvent({sessionId:n,event:{type:"interaction",data:JSON.stringify(m)},deviceId:y})}}}}}},this.logger=e,this.scrollWatcher=t};function yu(){var e=z();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||0}function bu(){var e=z();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||0}var wu=function(){function e(e,t){var r=z();r&&r.navigator&&"function"==typeof r.navigator.sendBeacon?this.sendBeacon=function(e,t){try{if(r.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch(e){}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(e,t){var r=new XMLHttpRequest;return r.open("POST",e,!0),r.setRequestHeader("Accept","*/*"),r.send(JSON.stringify(t)),!0},this.basePageUrl=Da(t.serverZone,t.trackServerUrl),this.apiKey=t.apiKey,this.context=e,this.handleSendEvents=t.handleSendEvents,this.loggerProvider=t.loggerProvider}return e.prototype.send=function(e,t){var r,n=this,i=this.context,o=i.sessionId,s=i.type;if(this.handleSendEvents){var a=new URLSearchParams({device_id:e,session_id:String(o),type:String(s)}),l="".concat(this.basePageUrl,"?").concat(a.toString()),u={"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(this.apiKey)};try{this.handleSendEvents({url:l,method:"POST",headers:u,body:JSON.stringify(t),keepalive:!0}).catch(function(e){var t;null===(t=n.loggerProvider)||void 0===t||t.warn("Custom transport failed to send session replay interaction beacon:",e)})}catch(e){null===(r=this.loggerProvider)||void 0===r||r.warn("Custom transport threw while sending session replay interaction beacon:",e)}}else{var c=new URLSearchParams({device_id:e,session_id:String(o),type:String(s),api_key:this.apiKey}),d="".concat(this.basePageUrl,"?").concat(c.toString());this.sendBeacon(d,t)||this.sendXhr(d,t)}},e}(),Su=function(){function e(e,t){var r=this;this.timestamp=Date.now(),this.hook=function(e){r.update(e)},this.send=function(e){return function(t){var n,i,o,s,a=e(),l=z();if(l&&a){var u=null!==(n=l.scrollX)&&void 0!==n?n:0,c=null!==(i=l.scrollY)&&void 0!==i?i:0;(u>0||c>0)&&r.update({id:1,x:u,y:c}),r.transport.send(a,{version:1,events:[{maxScrollX:r._maxScrollX,maxScrollY:r._maxScrollY,maxScrollWidth:r._maxScrollWidth,maxScrollHeight:r._maxScrollHeight,viewportHeight:yu(),viewportWidth:bu(),pageUrl:Va(l.location.href,null!==(s=null===(o=r.config.interactionConfig)||void 0===o?void 0:o.ugcFilterRules)&&void 0!==s?s:[]),timestamp:r.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=bu(),this._maxScrollHeight=yu(),this.config=t,this.transport=e}return e.default=function(t,r){return new e(new wu(t,r),r)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollX",{get:function(){return this._currentScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollY",{get:function(){return this._currentScrollY},enumerable:!1,configurable:!0}),e.prototype.update=function(e){var t=Date.now();if(this._currentScrollX=e.x,this._currentScrollY=e.y,e.x>this._maxScrollX){var r=bu();this._maxScrollX=e.x;var n=e.x+r;n>this._maxScrollWidth&&(this._maxScrollWidth=n),this.timestamp=t}if(e.y>this._maxScrollY){var i=yu();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),xu=function(e){var t=e.sessionId,r=e.deviceId;this.deviceId=r,this.sessionId=t,t&&r&&(this.sessionReplayId=function(e,t){return"".concat(t,"/").concat(e)}(t,r))},ku=864e5,Cu=function(e){return"".concat("AMP_SR_START_").concat(e.substring(0,10),"_")},Eu=function(e,t){return"".concat(Cu(e)).concat(t)},Iu=function(){try{var e=z();return null==e?void 0:e.localStorage}catch(e){return}},Ou=function(){var e=this;this.dbs={},this.createStore=function(t){return l(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,Tl(t,1,{upgrade:function(e){e.objectStoreNames.contains("sessionTargetingMatch")||e.createObjectStore("sessionTargetingMatch",{keyPath:"sessionId"})}})];case 1:return[2,e.sent()]}})})},this.openOrCreateDB=function(t){return l(e,void 0,void 0,function(){var e,r;return u(this,function(n){switch(n.label){case 0:return this.dbs&&this.dbs[t]?[2,this.dbs[t]]:(e="".concat(t.substring(0,10),"_amp_session_replay_targeting"),[4,this.createStore(e)]);case 1:return r=n.sent(),this.dbs[t]=r,[2,r]}})})},this.getTargetingMatchForSession=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.sessionId;return l(e,void 0,void 0,function(){var e,t,o,s;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(n)];case 1:return e=a.sent(),t=String(i),[4,e.get("sessionTargetingMatch",t)];case 2:return[2,null==(o=a.sent())?void 0:o.targetingMatch];case 3:return s=a.sent(),zl(r,"Failed to get targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.storeTargetingMatchForSession=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.sessionId,o=t.targetingMatch;return l(e,void 0,void 0,function(){var e,t,s;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(n)];case 1:return e=a.sent(),t=String(i),[4,e.put("sessionTargetingMatch",{targetingMatch:o,sessionId:t,lastUpdated:Date.now()})];case 2:return[2,a.sent()];case 3:return s=a.sent(),zl(r,"Failed to store targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.clearStoreOfOldSessions=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.currentSessionId;return l(e,void 0,void 0,function(){var e,t,o,s,a,l,c,d;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,8,,9]),[4,this.openOrCreateDB(n)];case 1:return e=u.sent(),t=String(i),[4,(o=e.transaction("sessionTargetingMatch","readwrite")).store.getAll()];case 2:s=u.sent(),a=0,u.label=3;case 3:return a<s.length?(l=s[a],c=Date.now()-l.lastUpdated,l.sessionId!==t&&c>1728e5?[4,o.store.delete(l.sessionId)]:[3,5]):[3,6];case 4:u.sent(),u.label=5;case 5:return a++,[3,3];case 6:return[4,o.done];case 7:return u.sent(),[3,9];case 8:return d=u.sent(),zl(r,"Failed to clear old targeting matches for sessions: ".concat(d),d),[3,9];case 9:return[2]}})})}},Pu=new Ou,Tu=function(e){var t=e.sessionId,r=e.targetingConfig,n=e.loggerProvider,i=e.apiKey,o=e.targetingParams,a=e.urlChange,c=void 0!==a&&a;return l(void 0,void 0,void 0,function(){var e,a,l,d,h,p;return u(this,function(u){switch(u.label){case 0:return[4,Pu.clearStoreOfOldSessions({loggerProvider:n,apiKey:i,currentSessionId:t})];case 1:return u.sent(),[4,Pu.getTargetingMatchForSession({loggerProvider:n,apiKey:i,sessionId:t})];case 2:if(!0===u.sent()&&!c)return[2,!0];e=!0,u.label=3;case 3:return u.trys.push([3,6,,7]),[4,Promise.resolve().then(function(){return Wp})];case 4:return a=u.sent().evaluateTargeting,l=s(s({},o),{flag:r,sessionId:"string"==typeof t?parseInt(t,10):t,apiKey:i,loggerProvider:n}),[4,a(l)];case 5:return(d=u.sent())&&d.sr_targeting_config&&(e="on"===d.sr_targeting_config.key),Pu.storeTargetingMatchForSession({loggerProvider:n,apiKey:i,sessionId:t,targetingMatch:e}),[3,7];case 6:return h=u.sent(),p=h,n.warn(p.message),[3,7];case 7:return[2,e]}})})},Ru=2654435761,Mu=2246822519,Au=3266489917,_u=374761393;function Nu(e,t){return(e<<t|e>>>32-t)>>>0}function Du(e,t){return e=Nu(e=e+Math.imul(t,Mu)>>>0,13),e=Math.imul(e,Ru)>>>0}function Lu(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Fu(e,t){void 0===t&&(t=0);var r,n=function(e){for(var t=[],r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<e.length){var i=e.charCodeAt(r+1);i>=56320&&i<=57343&&(n=i-56320+(n-55296<<10)+65536,r++)}n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<65536?t.push(224|n>>12,128|n>>6&63,128|63&n):t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n)}return new Uint8Array(t)}(e),i=n.length,o=0;if(i>=16){for(var s=t+Ru+Mu>>>0,a=t+Mu>>>0,l=t>>>0,u=t-Ru>>>0;o<=i-16;)s=Du(s,Lu(n,o)),a=Du(a,Lu(n,o+=4)),l=Du(l,Lu(n,o+=4)),u=Du(u,Lu(n,o+=4)),o+=4;r=Nu(s,1)+Nu(a,7)+Nu(l,12)+Nu(u,18)>>>0}else r=t+_u>>>0;for(r=r+i>>>0;o<=i-4;)r=r+Math.imul(Lu(n,o),Au)>>>0,r=Math.imul(Nu(r,17),668265263)>>>0,o+=4;for(;o<i;)r=r+Math.imul(n[o],_u)>>>0,r=Math.imul(Nu(r,11),Ru)>>>0,o++;return r^=r>>>15,r=Math.imul(r,Mu)>>>0,r^=r>>>13,r=Math.imul(r,Au)>>>0,(r^=r>>>16)>>>0}var Uu="__amplitude_url_tracking_patched__",ju=new WeakMap;function Bu(e,t,r){if(void 0===r&&(r={}),!(null==e?void 0:e.location))return function(){};var n=r.enablePolling,i=void 0!==n&&n,o=r.pollingInterval,s=void 0===o?ba:o;if(i){var a=function(){var t;return null!==(t=e.location.href)&&void 0!==t?t:""},l=a(),u=e.setInterval(function(){var e=a();e!==l&&(l=e,t(e))},s);return function(){null!=u&&e.clearInterval(u)}}var c=ju.get(e);if(!c){var d=void 0,h=new Set,p=function(){var t=function(){var t;return null!==(t=e.location.href)&&void 0!==t?t:""}();void 0!==d&&t===d||(d=t,h.forEach(function(e){return e(t)}))},f=function(e){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=e.apply(this,t);return p(),n};return t[Uu]=!0,t},g=e.history;if(null==g?void 0:g.pushState){var v=Reflect.get(g,"pushState");v[Uu]||(g.pushState=f(v))}if(null==g?void 0:g.replaceState){var m=Reflect.get(g,"replaceState");m[Uu]||(g.replaceState=f(m))}c={callbacks:h,notify:p,onPopStateOrHashChange:function(){return p()},listenersAttached:!1},ju.set(e,c)}var y=c;return y.listenersAttached||(e.addEventListener("popstate",y.onPopStateOrHashChange),e.addEventListener("hashchange",y.onPopStateOrHashChange),y.listenersAttached=!0),y.callbacks.add(t),function(){y.callbacks.delete(t),0===y.callbacks.size&&y.listenersAttached&&(e.removeEventListener("popstate",y.onPopStateOrHashChange),e.removeEventListener("hashchange",y.onPopStateOrHashChange),y.listenersAttached=!1)}}function qu(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,r,n){var i,o,a,l=s(s({},e),n),u=l.ugcFilterRules||[],c=null!==(i=l.enablePolling)&&void 0!==i&&i,d=null!==(o=l.pollingInterval)&&void 0!==o?o:ba,h=null!==(a=l.captureDocumentTitle)&&void 0!==a&&a;if(!r)return function(){};var p=void 0,f=function(){return r.location&&r.location.href||""},g=function(){var e=f();if(void 0===p||e!==p){p=e;var n=function(){var e=r.innerHeight,t=r.innerWidth,n=r.document,i=f(),o="";return h&&(o=(null==n?void 0:n.title)||""),{href:u.length>0?Va(i,u):i,title:o,viewportHeight:e,viewportWidth:t,type:"url-change-event"}}();t(n)}},v=Bu(r,function(){return g()},c?{enablePolling:!0,pollingInterval:d}:{});return g(),function(){return v()}},options:e}}qu();var zu=function(){function e(){this.pendingLoadListeners=new Map}return e.prototype.start=function(){var e,t=this;null===(e=this.mutationObserver)||void 0===e||e.disconnect(),z()&&(this.sendToAllIframes({type:Aa,action:"start"}),this.mutationObserver=new MutationObserver(function(e){var r,n,i,o,s,a;try{for(var l=c(e),u=l.next();!u.done;u=l.next()){var d=u.value;try{for(var h=(i=void 0,c(Array.from(d.addedNodes))),p=h.next();!p.done;p=h.next()){(v=p.value)instanceof HTMLIFrameElement?t.sendToIframeAfterLoad(v):v instanceof Element&&v.querySelectorAll("iframe").forEach(function(e){t.sendToIframeAfterLoad(e)})}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}try{for(var f=(s=void 0,c(Array.from(d.removedNodes))),g=f.next();!g.done;g=f.next()){var v;if((v=g.value)instanceof HTMLIFrameElement){var m=t.pendingLoadListeners.get(v);m&&(v.removeEventListener("load",m),t.pendingLoadListeners.delete(v))}}}catch(e){s={error:e}}finally{try{g&&!g.done&&(a=f.return)&&a.call(f)}finally{if(s)throw s.error}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}),this.mutationObserver.observe(document.documentElement,{childList:!0,subtree:!0}))},e.prototype.stop=function(){var e;null===(e=this.mutationObserver)||void 0===e||e.disconnect(),this.mutationObserver=void 0,this.pendingLoadListeners.forEach(function(e,t){t.removeEventListener("load",e)}),this.pendingLoadListeners.clear(),this.sendToAllIframes({type:Aa,action:"stop"})},e.prototype.sendToIframeAfterLoad=function(e){var t=this,r=function(){t.pendingLoadListeners.delete(e),t.sendToIframe(e,{type:Aa,action:"start"})};this.pendingLoadListeners.set(e,r),e.addEventListener("load",r,{once:!0})},e.prototype.sendToAllIframes=function(e){var t=this;document.querySelectorAll("iframe").forEach(function(r){return t.sendToIframe(r,e)})},e.prototype.sendToIframe=function(e,t){var r;try{null===(r=e.contentWindow)||void 0===r||r.postMessage(t,"*")}catch(e){}},e}();var Wu,Vu,$u,Hu=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.sessionTargetingMatch=!1,this.pageLeaveFns=[],this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,this.recordFunction=null,this.recordEventsInFlight=!1,this.recordingEnabled=!0,this.recordingGeneration=0,this.startChildRecordingOnSetup=!1,this.pendingEmitEvents=[],this.currentPageUrl="",this.recordEventsPendingShouldLogMetadata=null,this.urlChangeCleanup=null,this.crossOriginIframeCoordinator=null,this.crossOriginParentSignalCleanup=null,this.latestUrlChangeTargetingEvaluationId=0,this.teardownEventListeners=function(t){var r=z();r&&(r.removeEventListener("blur",e.blurListener),r.removeEventListener("focus",e.focusListener),!t&&r.addEventListener("blur",e.blurListener),!t&&r.addEventListener("focus",e.focusListener),r.self&&"onpagehide"in r.self?(r.removeEventListener("pagehide",e.pageLeaveListener),!t&&r.addEventListener("pagehide",e.pageLeaveListener)):(r.removeEventListener("beforeunload",e.pageLeaveListener),!t&&r.addEventListener("beforeunload",e.pageLeaveListener)))},this.blurListener=function(){e.sendEvents()},this.focusListener=function(){var t;if(e.recordingEnabled)if(e.recordCancelCallback&&e.recordFunction){if(!1===(null===(t=e.config)||void 0===t?void 0:t.captureFullSnapshotOnFocus))return;try{e.recordFunction.takeFullSnapshot(!0)}catch(t){e.loggerProvider.warn("Failed to take full snapshot on focus:",t)}}else e.recordEventsInFlight||e.recordEvents(!1)},this.pageLeaveListener=function(t){var r;null===(r=e.eventCompressor)||void 0===r||r.flushQueue(),e.sendEvents(),e.pageLeaveFns.forEach(function(e){e(t)})},this.evaluateTargetingAndCapture=function(t,r,n,i){return void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===i&&(i=!1),l(e,void 0,void 0,function(){var e,s,a,l,c,d,h,p,f,g,v,m;return u(this,function(u){switch(u.label){case 0:if(!this.identifiers||!this.identifiers.sessionId||!this.config)return this.identifiers&&!this.identifiers.sessionId?this.loggerProvider.log("Session ID has not been set yet, cannot evaluate targeting for Session Replay."):this.loggerProvider.warn("Session replay init has not been called, cannot evaluate targeting."),[2];if(!this.config.targetingConfig){if(!r)return this.loggerProvider.log("No targeting config set, skipping initialization/recording for event."),[2];this.loggerProvider.log("Targeting config has not been set yet, cannot evaluate targeting.")}return this.lastTargetingParams=t,e=this.config.targetingConfig,e&&!this.sessionTargetingMatch?(s=i?this.latestUrlChangeTargetingEvaluationId:void 0,(a=t.event)&&Object.values(o).includes(a.event_type)&&(a=void 0),l=null!==(v=null!==(p=null===(h=t.page)||void 0===h?void 0:h.url)&&void 0!==p?p:null===(g=null===(f=z())||void 0===f?void 0:f.location)||void 0===g?void 0:g.href)&&void 0!==v?v:"",c=null!==(m=t.page)&&void 0!==m?m:""!==l?{url:l}:void 0,[4,Tu({sessionId:this.identifiers.sessionId,targetingConfig:e,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:a,page:c},urlChange:i})]):[3,2];case 1:if(d=u.sent(),i&&void 0!==s&&s!==this.latestUrlChangeTargetingEvaluationId)return this.loggerProvider.debug("Ignoring stale URL-change targeting result #".concat(s,"; latest is #").concat(this.latestUrlChangeTargetingEvaluationId,".")),[2];this.sessionTargetingMatch=this.sessionTargetingMatch||d,this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:a,targetingParams:t},null,2)),u.label=2;case 2:return r?(this.initialize(!0),[3,5]):[3,3];case 3:return!n&&this.recordCancelCallback?[3,5]:(this.loggerProvider.log("Recording events for session due to forceRestart or no ongoing recording."),[4,this.recordEvents()]);case 4:u.sent(),u.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n=!0),l(e,void 0,void 0,function(){var e,i,o,a;return u(this,function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),e=void 0,(i=this.config)&&t!==sa.METADATA?(e={config:Ha(i),version:fl},n?[4,$a()]:[3,2]):[3,2];case 1:o=l.sent(),e=s(s({},o),e),l.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,s(s({},r),e)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(t," due to no ongoing recording.")),[3,4];case 3:return a=l.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",a),[3,4];case 4:return[2]}})})},this.stopRecordingEvents=function(){var t,r,n;try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,null===(t=e.networkObservers)||void 0===t||t.stop(),null===(r=e.crossOriginIframeCoordinator)||void 0===r||r.stop(),e.crossOriginIframeCoordinator=null,null===(n=e.crossOriginParentSignalCleanup)||void 0===n||n.call(e),e.crossOriginParentSignalCleanup=null}catch(t){var i=t;e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(i.toString()))}},this.loggerProvider=new _a(new ae)}return e.prototype.init=function(e,t){return re(this._init(e,t))},e.prototype.setupUrlChangeListener=function(){var e,t,r=this;null===(e=this.urlChangeCleanup)||void 0===e||e.call(this);var n=z();if(null==n?void 0:n.location){var i=!!(null===(t=this.config)||void 0===t?void 0:t.targetingConfig),o=Bu(n,function(e){if(r.currentPageUrl=e,i){var t=++r.latestUrlChangeTargetingEvaluationId;r.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:e}},!1,!1,!0),r.loggerProvider.debug("Queued URL-change targeting re-evaluation #".concat(t," for ").concat(e,"."))}});this.urlChangeCleanup=function(){o(),r.urlChangeCleanup=null}}},e.prototype.isBelowMinSessionDuration=function(){var e,t=null===(e=this.config)||void 0===e?void 0:e.minSessionDurationMs;return void 0!==t&&void 0!==this.sessionStartTime&&Date.now()-this.sessionStartTime<t},e.prototype.getCurrentPageForTargeting=function(){var e,t,r=null===(t=null===(e=z())||void 0===e?void 0:e.location)||void 0===t?void 0:t.href;return null!=r?{url:r}:void 0},e.prototype._init=function(e,t){var r,n,i,o,a,p,f,g,v,m,y,b,w,S;return l(this,void 0,void 0,function(){var l,x,k,C,E,I,O,P,T,R,M,A,_,N,D,L,F,U,j,B,q,W,V,$,H,K,G,J,X,Y,Q,Z=this;return u(this,function(u){switch(u.label){case 0:return null===(r=this.urlChangeCleanup)||void 0===r||r.call(this),this.recordingEnabled=!0,this.startChildRecordingOnSetup=!1,this.loggerProvider=new _a(t.loggerProvider||new ae),Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.currentPageUrl=qa(),this.identifiers=new xu({sessionId:t.sessionId,deviceId:t.deviceId}),l=Date.now(),function(e,t,r){var n,i,o=Iu();if(o){var s=Cu(e);try{for(var a=[],l=0;l<o.length;l++)if((f=o.key(l))&&f.startsWith(s)){var u=o.getItem(f);if(null!==u){var d=Number(u);(!Number.isFinite(d)||d<=0||t-d>=ku)&&a.push(f)}}try{for(var h=c(a),p=h.next();!p.done;p=h.next()){var f=p.value;o.removeItem(f)}}catch(e){n={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}}catch(e){null==r||r.debug("Failed to prune stale replay start times: ".concat(String(e)))}}}(e,l,this.loggerProvider),this.sessionStartTime=void 0!==t.sessionId&&null!==(n=function(e,t,r,n){var i=Iu();if(i){var o=Eu(e,t);try{var s=i.getItem(o);if(null!==s){var a=Number(s);if(Number.isFinite(a)&&a>0&&a<=r&&r-a<ku)return a}return i.setItem(o,String(r)),r}catch(e){return void(null==n||n.debug("Failed to read/write replay start time from storage: ".concat(String(e))))}}}(e,t.sessionId,l,this.loggerProvider))&&void 0!==n?n:l,x=this,[4,ol(e,t)];case 1:return x.joinedConfigGenerator=u.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:return k=u.sent(),C=k.joinedConfig,E=k.localConfig,I=k.remoteConfig,this.config=C,this.setMetadata(t.sessionId,C,E,I,null===(i=t.version)||void 0===i?void 0:i.version,fl,null===(o=t.version)||void 0===o?void 0:o.type),this.pageLeaveFns=[],t.sessionId&&(null===(a=this.config.interactionConfig)||void 0===a?void 0:a.enabled)&&(O=Su.default({sessionId:t.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[O.send(this.getDeviceId.bind(this)).bind(O)],this.scrollHook=O.hook.bind(O),this.clickHandler=new mu(this.loggerProvider,O)),P=[],"idb"!==(T=this.config.storeType)||(null===(p=z())||void 0===p?void 0:p.indexedDB)||(T="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(T," for event storage.")),A=z(),this.config.useWebWorker&&A&&A.Worker?[4,Promise.resolve().then(function(){return Vp})]:[3,4];case 3:_=u.sent(),N=_.compressionScript,D=_.trackDestinationScript,R=N,M=D,u.label=4;case 4:return u.trys.push([4,6,,7]),[4,eu({config:this.config,type:"replay",minInterval:null===(f=this.config.flushIntervalConfig)||void 0===f?void 0:f.minIntervalMs,maxInterval:null===(g=this.config.flushIntervalConfig)||void 0===g?void 0:g.maxIntervalMs,maxPersistedEventsSize:this.config.maxPersistedEventsSizeBytes,storeType:T,trackDestinationWorkerScript:M,shouldSend:function(){return!Z.isBelowMinSessionDuration()}})];case 5:return L=u.sent(),this.rrwebEventManager=L,P.push({name:"replay",manager:L}),[3,7];case 6:return F=u.sent(),q=F,this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(q.toString())),[3,7];case 7:if(!(null===(v=this.config.interactionConfig)||void 0===v?void 0:v.enabled))return[3,11];U=this.config.interactionConfig.batch?vu:gu,u.label=8;case 8:return u.trys.push([8,10,,11]),[4,eu({config:this.config,type:"interaction",minInterval:null!==(m=this.config.interactionConfig.trackEveryNms)&&void 0!==m?m:3e4,maxInterval:6e4,maxPersistedEventsSize:this.config.maxPersistedEventsSizeBytes,payloadBatcher:U,storeType:T,trackDestinationWorkerScript:M})];case 9:return j=u.sent(),P.push({name:"interaction",manager:j}),[3,11];case 10:return B=u.sent(),q=B,this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(q.toString())),[3,11];case 11:if(this.eventsManager=new(tu.bind.apply(tu,h([void 0],d(P),!1))),this.eventCompressor&&this.eventCompressor.terminate(),W=!0===this.config.eagerFullSnapshotSend?function(){return Z.sendEvents()}:void 0,this.eventCompressor=new cl(this.eventsManager,this.config,this.getDeviceId(),R,W),this.pendingEmitEvents.length>0){V=this.pendingEmitEvents.splice(0);try{for($=c(V),H=$.next();!H.done;H=$.next())K=H.value,G=K.event,J=K.sessionId,this.eventCompressor.enqueueEvent(G,J)}catch(e){Y={error:e}}finally{try{H&&!H.done&&(Q=$.return)&&Q.call($)}finally{if(Y)throw Y.error}}}return this.pageLeaveFns=h(h([],d(this.pageLeaveFns),!1),[function(){var e;if(Z.config&&(null===(e=Z.identifiers)||void 0===e?void 0:e.sessionId)&&L){var t=L.getBeaconEvents();if(t.length){var r=Z.getDeviceId();r&&(Z.isBelowMinSessionDuration()||L.trackDestination.sendBeacon({events:t,sessionId:Z.identifiers.sessionId,deviceId:r,apiKey:Z.config.apiKey,serverZone:Z.config.serverZone}))}}}],!1),[4,this.initializeNetworkObservers()];case 12:return u.sent(),(null===(y=z())||void 0===y?void 0:y.opener)&&(Dr(X=_r()),X.setup(s({logger:this.loggerProvider},this.config.serverZone&&{endpoint:Tr[this.config.serverZone]}))),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.teardownEventListeners(!1),[4,this.evaluateTargetingAndCapture({userProperties:t.userProperties,page:this.getCurrentPageForTargeting()},!0)];case 13:return u.sent(),(this.config.targetingConfig||(null!==(S=null===(w=null===(b=this.config.privacyConfig)||void 0===b?void 0:b.urlMaskLevels)||void 0===w?void 0:w.length)&&void 0!==S?S:0)>0)&&this.setupUrlChangeListener(),[2]}})})},e.prototype.setSessionId=function(e,t){return re(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t,r){var n,i,o,s;return l(this,void 0,void 0,function(){var a,l,c,d,h;return u(this,function(u){switch(u.label){case 0:return a=null===(n=this.identifiers)||void 0===n?void 0:n.sessionId,l=this.getDeviceId(),void 0===a||a!==e||void 0!==t&&t!==l||void 0!==(null==r?void 0:r.userProperties)&&0!==Object.keys(r.userProperties).length?(this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,a&&this.sendEvents(a),(c=a!==e)&&(null===(i=this.rrwebEventManager)||void 0===i||i.dropPendingBeaconEvents()),d=t||this.getDeviceId(),this.identifiers=new xu({sessionId:e,deviceId:d}),c&&(this.sessionStartTime=Date.now(),this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,(null===(o=this.config)||void 0===o?void 0:o.apiKey)&&(function(e,t,r,n){var i=Iu();if(i)try{i.setItem(Eu(e,t),String(r))}catch(e){null==n||n.debug("Failed to write replay start time to storage: ".concat(String(e)))}}(this.config.apiKey,e,this.sessionStartTime,this.loggerProvider),void 0!==a&&function(e,t,r){var n=Iu();if(n)try{n.removeItem(Eu(e,t))}catch(e){null==r||r.debug("Failed to remove replay start time from storage: ".concat(String(e)))}}(this.config.apiKey,a,this.loggerProvider))),this.joinedConfigGenerator&&a?[4,this.joinedConfigGenerator.generateJoinedConfig()]:[3,2]):[2];case 1:h=u.sent().joinedConfig,this.config=h,u.label=2;case 2:return(null===(s=this.config)||void 0===s?void 0:s.targetingConfig)?[4,this.evaluateTargetingAndCapture({userProperties:null==r?void 0:r.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)]:[3,4];case 3:return u.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:u.sent(),u.label=6;case 6:return[2]}})})},e.prototype.getSessionReplayProperties=function(){var e,t=this.config,r=this.identifiers;if(!t||!r)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var n=this.getShouldRecord(),i={};return n&&((e={})[va]=r.sessionReplayId?r.sessionReplayId:null,i=e,t.debugMode&&(i[wa]=JSON.stringify({appHash:ze(t.apiKey).toString()}))),this.addCustomRRWebEvent(sa.GET_SR_PROPS,{shouldRecord:n,eventProperties:i},10===this.eventCount),10===this.eventCount&&(this.eventCount=0),this.eventCount++,i},e.prototype.sendEvents=function(e){var t,r,n=e||(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId),i=this.getDeviceId();if(this.eventsManager&&n&&i){if(this.isBelowMinSessionDuration()){var o=this.sessionStartTime,s=this.config.minSessionDurationMs;return this.loggerProvider.log("Session ".concat(n," not sent: duration ").concat(Date.now()-o,"ms is below minimum ").concat(s,"ms.")),void this.suppressedSendCount++}if(!this.hasEmittedGateDecision&&void 0!==(null===(r=this.config)||void 0===r?void 0:r.minSessionDurationMs)&&this.recordCancelCallback&&this.recordFunction){this.hasEmittedGateDecision=!0;var a=void 0!==this.sessionStartTime?Date.now()-this.sessionStartTime:void 0;this.addCustomRRWebEvent(sa.REPLAY_GATE_DECISION,{sessionId:n,suppressedSendCount:this.suppressedSendCount,elapsedMs:a,minSessionDurationMs:this.config.minSessionDurationMs},!1)}this.eventsManager.sendCurrentSequenceEvents({sessionId:n,deviceId:i})}},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),l(this,void 0,void 0,function(){var r;return u(this,function(n){return(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId)?(r=this.getDeviceId())?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:r}),[2,this.recordEvents()]):(this.loggerProvider.log("Session is not being recorded due to lack of device id."),[2,Promise.resolve()]):(this.loggerProvider.log("Session is not being recorded due to lack of session id."),[2,Promise.resolve()])})})},e.prototype.shouldOptOut=function(){var e,t,r;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(r=_e(this.config.instanceName).identityStore.getIdentity().optOut);return void 0!==r?r: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.recordingEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured because recording was stopped.")),!1;if(!this.config.captureEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured due to capture being disabled for project or because the remote config could not be fetched.")),!1;if(this.shouldOptOut())return this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;var e,t,r=!1,n="",i=!1;this.config.targetingConfig?this.sessionTargetingMatch?(n="Capturing replays for session ".concat(this.identifiers.sessionId," due to matching targeting conditions."),this.loggerProvider.log(n),r=!0,i=!0):(n="Not capturing replays for session ".concat(this.identifiers.sessionId," due to not matching targeting conditions."),this.loggerProvider.log(n),r=!1,i=!1):(e=this.identifiers.sessionId,t=this.config.sampleRate,Fu(e.toString())%1e6/1e6<t)?(r=!0,i=!0):(n="Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate."),this.loggerProvider.log(n),r=!1,i=!1);return this.lastShouldRecordDecision!==r&&this.config.targetingConfig&&(this.addCustomRRWebEvent(sa.TARGETING_DECISION,{message:n,sessionId:this.identifiers.sessionId,matched:i,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=r),r},e.prototype.getBlockSelectors=function(){var e,t,r,n=null!==(r=null===(t=null===(e=this.config)||void 0===e?void 0:e.privacyConfig)||void 0===t?void 0:t.blockSelector)&&void 0!==r?r:[];if(0!==n.length)return n},e.prototype.getMaskTextSelectors=function(){var e,t,r=null===(e=this.config)||void 0===e?void 0:e.privacyConfig;if("conservative"===(r?Fa(this.currentPageUrl,r):void 0))return"*";if(null===(t=null==r?void 0:r.urlMaskLevels)||void 0===t?void 0:t.some(function(e){return"conservative"===e.maskLevel}))return"*";var n=null==r?void 0:r.urlMaskLevels;if("conservative"===(null==r?void 0:r.defaultMaskLevel)&&n&&n.length>0)return"*";var i=null==r?void 0:r.maskSelector;return i||void 0},e.prototype.getRecordingPlugins=function(e){var t,r,n,i,o,s;return l(this,void 0,void 0,function(){var a,l,c,d;return u(this,function(u){switch(u.label){case 0:a=[];try{l=qu({ugcFilterRules:(null===(r=null===(t=this.config)||void 0===t?void 0:t.interactionConfig)||void 0===r?void 0:r.ugcFilterRules)||[],enablePolling:(null===(n=this.config)||void 0===n?void 0:n.enableUrlChangePolling)||!1,pollingInterval:null===(i=this.config)||void 0===i?void 0:i.urlChangePollingInterval,captureDocumentTitle:null===(o=this.config)||void 0===o?void 0:o.captureDocumentTitle}),a.push(l)}catch(e){this.loggerProvider.warn("Failed to create URL tracking plugin:",e)}if(!(null===(s=null==e?void 0:e.console)||void 0===s?void 0:s.enabled))return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return oy})];case 2:return c=u.sent().getRecordConsolePlugin,a.push(c({level:e.console.levels})),[3,4];case 3:return d=u.sent(),this.loggerProvider.warn("Failed to load console plugin:",d),[3,4];case 4:return[2,a.length>0?a:void 0]}})})},e.prototype.getRecordFunction=function(){return l(this,void 0,void 0,function(){var e,t;return u(this,function(r){switch(r.label){case 0:if(this.recordFunction)return[2,this.recordFunction];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return rC})];case 2:return e=r.sent().record,this.recordFunction=e,[2,e];case 3:return t=r.sent(),this.loggerProvider.warn("Failed to load rrweb-record module:",t),[2,null];case 4:return[2]}})})},e.prototype.recordEvents=function(e){return void 0===e&&(e=!0),l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:if(this.recordEventsInFlight)return this.recordEventsPendingShouldLogMetadata=e,[2];this.recordEventsInFlight=!0,r.label=1;case 1:return r.trys.push([1,,6,7]),[4,this._recordEvents(e)];case 2:r.sent(),r.label=3;case 3:return null===this.recordEventsPendingShouldLogMetadata?[3,5]:(t=this.recordEventsPendingShouldLogMetadata,this.recordEventsPendingShouldLogMetadata=null,[4,this._recordEvents(t)]);case 4:return r.sent(),[3,3];case 5:return[3,7];case 6:return this.recordEventsInFlight=!1,this.recordEventsPendingShouldLogMetadata=null,[7];case 7:return[2]}})})},e.prototype.shouldAbandonRecordStart=function(e){return!this.recordingEnabled||e!==this.recordingGeneration},e.prototype._recordEvents=function(e){var t,r,n,i,o,a,c,d;return void 0===e&&(e=!0),l(this,void 0,void 0,function(){var l,h,p,f,g,v,m,y,b,w,S,x,k,C,E,I,O,P=this;return u(this,function(u){switch(u.label){case 0:return l=this.config,h=this.getShouldRecord(),p=null===(t=this.identifiers)||void 0===t?void 0:t.sessionId,h&&p&&l?(this.stopRecordingEvents(),f=this.recordingGeneration,[4,this.getRecordFunction()]):[2];case 1:return!(g=u.sent())||this.shouldAbandonRecordStart(f)?[2]:[4,this.initializeNetworkObservers()];case 2:if(u.sent(),this.shouldAbandonRecordStart(f))return[2];v=null===(r=l.loggingConfig)||void 0===r?void 0:r.network,m=Da(l.serverZone,l.trackServerUrl),y=[ka,Ca,Ea,m],null===(n=this.networkObservers)||void 0===n||n.start(function(e){y.some(function(t){return e.url.startsWith(t)})||P.addCustomRRWebEvent(sa.FETCH_REQUEST,e)},v),b=l.interactionConfig,w=l.loggingConfig,S=(null==b?void 0:b.enabled)?{mouseInteraction:this.eventsManager&&(null===(i=this.clickHandler)||void 0===i?void 0:i.createHook({eventsManager:this.eventsManager,sessionId:p,deviceIdFn:this.getDeviceId.bind(this),mirror:g.mirror,ugcFilterRules:null!==(o=b.ugcFilterRules)&&void 0!==o?o:[],performanceOptions:null===(a=l.performanceConfig)||void 0===a?void 0:a.interaction})),scroll:this.scrollHook}:{},x=(null==b?void 0:b.enabled)&&b.ugcFilterRules?b.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(p,".")),u.label=3;case 3:return u.trys.push([3,5,,6]),k=!!(null===(c=l.crossOriginIframes)||void 0===c?void 0:c.enabled),C=!1!==(null===(d=l.crossOriginIframes)||void 0===d?void 0:d.coordinateChildren),E=k&&function(){try{var e=z();return!!e&&e.parent!==e}catch(e){return!0}}(),E&&C?(this.crossOriginParentSignalCleanup=function(e){var t=z();if(!t)return function(){};var r=t.parent;function n(t){if(t.source===r){var n=t.data;(null==n?void 0:n.type)===Aa&&("start"===n.action?e.onStart():"stop"===n.action&&e.onStop())}}return t.addEventListener("message",n),function(){return t.removeEventListener("message",n)}}({onStart:function(){P.recordingEnabled&&P._recordEventsInChildMode(g,p,l,S)},onStop:function(){try{P.recordCancelCallback&&P.recordCancelCallback(),P.recordCancelCallback=null}catch(t){var e=t;P.loggerProvider.warn("Error occurred while stopping child iframe replay capture: ".concat(e.toString()))}}}),this.startChildRecordingOnSetup&&(this.startChildRecordingOnSetup=!1,this._recordEventsInChildMode(g,p,l,S)),[2]):(this.startChildRecordingOnSetup=!1,[4,this.getRecordingPlugins(w)]);case 4:return I=u.sent(),this.shouldAbandonRecordStart(f)?[2]:(this.recordCancelCallback=g(s(s({},this.buildRRWebRecordOptions(l,S,function(e){if(P.shouldOptOut()||!P.recordingEnabled)return P.loggerProvider.log(P.shouldOptOut()?"Opting session ".concat(p," out of recording due to optOut config."):"Session Replay capture stopping for ".concat(p,".")),P.stopRecordingEvents(),void P.sendEvents();e.type===el.Meta&&(e.data.href=Va(e.data.href,x)),P.eventCompressor?P.eventCompressor.enqueueEvent(e,p):P.pendingEmitEvents.push({event:e,sessionId:p})},"Error while capturing replay: ")),{plugins:I,recordCrossOriginIframes:k})),k&&!E&&C&&(this.crossOriginIframeCoordinator||(this.crossOriginIframeCoordinator=new zu),this.crossOriginIframeCoordinator.start()),this.addCustomRRWebEvent(sa.DEBUG_INFO),e&&this.addCustomRRWebEvent(sa.METADATA,this.metadata),[3,6]);case 5:return O=u.sent(),this.loggerProvider.warn("Failed to initialize session replay:",O),[3,6];case 6:return[2]}})})},e.prototype.buildRRWebRecordOptions=function(e,t,r,n){var i=this,o=e.privacyConfig;return s(s({emit:r,inlineStylesheet:e.shouldInlineStylesheet,inlineImages:e.inlineImages,hooks:t,maskAllInputs:!0,maskTextClass:Sa,blockClass:"amp-block",blockSelector:this.getBlockSelectors(),applyBackgroundColorToBlockedElements:e.applyBackgroundColorToBlockedElements,maskInputFn:ja("input",o,function(){return i.currentPageUrl}),maskTextFn:ja("text",o,function(){return i.currentPageUrl}),maskAttributeFn:Ba(o,function(){return i.currentPageUrl}),maskTextSelector:this.getMaskTextSelectors()},void 0!==e.fullSnapshotIntervalMs&&{checkoutEveryNms:e.fullSnapshotIntervalMs}),{recordCanvas:!1,captureAdoptedStyleSheets:e.captureAdoptedStyleSheets,slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0},errorHandler:function(e){var t=e;if(t.message.includes("insertRule")&&t.message.includes("CSSStyleSheet"))throw t;if(t._external_)throw t;return i.loggerProvider.warn(n,t.toString()),!0}})},e.prototype._recordEventsInChildMode=function(e,t,r,n){try{this.recordCancelCallback&&this.recordCancelCallback(),this.recordCancelCallback=null,this.recordCancelCallback=e(s(s({},this.buildRRWebRecordOptions(r,n,function(){},"Error while capturing replay (child iframe): ")),{recordCrossOriginIframes:!0})),this.loggerProvider.log("Session Replay child iframe capture beginning for session ".concat(t,"."))}catch(e){this.loggerProvider.warn("Failed to initialize session replay in child iframe mode:",e)}},e.prototype.getDeviceId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.deviceId},e.prototype.getSessionId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.sessionId},e.prototype.start=function(){return re(this._start())},e.prototype._start=function(){return l(this,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return this.recordingEnabled=!0,this.startChildRecordingOnSetup=!0,[4,this.recordEvents()];case 1:return e.sent(),[2]}})})},e.prototype.stop=function(){this.recordingEnabled=!1,this.startChildRecordingOnSetup=!1,this.recordingGeneration++,this.stopRecordingEvents(),this.sendEvents()},e.prototype.flush=function(e){var t;return void 0===e&&(e=!1),l(this,void 0,void 0,function(){return u(this,function(r){return[2,null===(t=this.eventsManager)||void 0===t?void 0:t.flush(e)]})})},e.prototype.shutdown=function(){var e,t;this.recordingEnabled=!1,this.startChildRecordingOnSetup=!1,this.recordingGeneration++,null===(e=this.urlChangeCleanup)||void 0===e||e.call(this),null===(t=this.crossOriginParentSignalCleanup)||void 0===t||t.call(this),this.crossOriginParentSignalCleanup=null,this.teardownEventListeners(!0),this.stopRecordingEvents(),this.sendEvents()},e.prototype.mapSDKType=function(e){return"plugin"===e?"@amplitude/plugin-session-replay-browser":"segment"===e?"@amplitude/segment-session-replay-plugin":null},e.prototype.setMetadata=function(e,t,r,n,i,o,s){var a=(null==e?void 0:e.toString())?ze(e.toString()):void 0;this.metadata={joinedConfig:t,localConfig:r,remoteConfig:n,sessionId:e,hashValue:a,sampleRate:t.sampleRate,replaySDKType:this.mapSDKType(s),replaySDKVersion:i,standaloneSDKType:"@amplitude/session-replay-browser",standaloneSDKVersion:o}},e.prototype.initializeNetworkObservers=function(){var e,t,r;return l(this,void 0,void 0,function(){var n,i;return u(this,function(o){switch(o.label){case 0:if(!(null===(r=null===(t=null===(e=this.config)||void 0===e?void 0:e.loggingConfig)||void 0===t?void 0:t.network)||void 0===r?void 0:r.enabled)||this.networkObservers)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return lC})];case 2:return n=o.sent().NetworkObservers,this.networkObservers=new n,[3,4];case 3:return i=o.sent(),this.loggerProvider.warn("Failed to import or instantiate NetworkObservers:",i),[3,4];case 4:return[2]}})})},e}(),Ku=function(e){return function(){var t=e.config||Ka();return{logger:t.loggerProvider,logLevel:t.logLevel}}},Gu=function(){var e=new Hu;return{init:be(e.init.bind(e),"init",Ku(e)),evaluateTargetingAndCapture:be(e.evaluateTargetingAndCapture.bind(e),"evaluateTargetingAndRecord",Ku(e)),setSessionId:be(e.setSessionId.bind(e),"setSessionId",Ku(e)),getSessionId:be(e.getSessionId.bind(e),"getSessionId",Ku(e)),getSessionReplayProperties:be(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",Ku(e)),flush:be(e.flush.bind(e),"flush",Ku(e)),start:be(e.start.bind(e),"start",Ku(e)),stop:be(e.stop.bind(e),"stop",Ku(e)),shutdown:be(e.shutdown.bind(e),"shutdown",Ku(e))}}(),Ju=Gu.init,Xu=Gu.setSessionId,Yu=Gu.getSessionId,Qu=Gu.getSessionReplayProperties,Zu=Gu.flush,ec=Gu.start,tc=Gu.stop,rc=Gu.shutdown,nc=Gu.evaluateTargetingAndCapture;!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(Wu||(Wu={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue"}(Vu||(Vu={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}($u||($u={}));var ic=[Wu.SET,Wu.SET_ONCE,Wu.ADD,Wu.APPEND,Wu.PREPEND,Wu.POSTINSERT],oc="1.35.2",sc="".concat("[Amplitude]"," Session Replay ID"),ac=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:Zu,getSessionId:Yu,getSessionReplayProperties:Qu,init:Ju,setSessionId:Xu,start:ec,stop:tc,shutdown:rc,evaluateTargetingAndCapture:nc},this.options=s({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var r,n,i,o,a,c,d,h;return l(this,void 0,void 0,function(){var t,l,p;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),null==e||e.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(oc,".")),this.config=e,this.options.forceSessionTracking&&("boolean"==typeof e.defaultTracking?!1===e.defaultTracking&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=s(s({},e.defaultTracking),{sessions:!0})),t=_e(this.config.instanceName).identityStore,l=t.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:null!==(r=this.options.deviceId)&&void 0!==r?r:this.config.deviceId,optOut:this.config.optOut,sessionId:this.options.customSessionId?void 0:this.config.sessionId,loggerProvider:this.config.loggerProvider,logLevel:this.config.logLevel,flushMaxRetries:this.config.flushMaxRetries,serverZone:this.config.serverZone,configServerUrl:this.options.configServerUrl||(null===(n=this.config.remoteConfig)||void 0===n?void 0:n.serverUrl),trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null===(i=this.options.privacyConfig)||void 0===i?void 0:i.blockSelector,maskSelector:null===(o=this.options.privacyConfig)||void 0===o?void 0:o.maskSelector,unmaskSelector:null===(a=this.options.privacyConfig)||void 0===a?void 0:a.unmaskSelector,defaultMaskLevel:null===(c=this.options.privacyConfig)||void 0===c?void 0:c.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,inlineImages:this.options.inlineImages,version:{type:"plugin",version:oc},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:null!==(d=this.options.useWebWorker)&&void 0!==d?d:null===(h=this.options.experimental)||void 0===h?void 0:h.useWebWorker,userProperties:l,applyBackgroundColorToBlockedElements:this.options.applyBackgroundColorToBlockedElements,interactionConfig:this.options.interactionConfig,captureDocumentTitle:this.options.captureDocumentTitle,enableUrlChangePolling:this.options.enableUrlChangePolling,urlChangePollingInterval:this.options.urlChangePollingInterval,captureAdoptedStyleSheets:this.options.captureAdoptedStyleSheets,crossOriginIframes:this.options.crossOriginIframes,flushIntervalConfig:this.options.flushIntervalConfig,eagerFullSnapshotSend:this.options.eagerFullSnapshotSend,captureFullSnapshotOnFocus:this.options.captureFullSnapshotOnFocus,maxPersistedEventsSizeBytes:this.options.maxPersistedEventsSizeBytes,maxSingleEventSizeBytes:this.options.maxSingleEventSizeBytes,sendTimeoutMs:this.options.sendTimeoutMs,handleSendEvents:this.options.handleSendEvents,handleFetchConfig:this.options.handleFetchConfig},[4,this.sessionReplay.init(e.apiKey,this.srInitOptions).promise];case 1:return u.sent(),[3,3];case 2:return p=u.sent(),null==e||e.loggerProvider.error("Session Replay: Failed to initialize due to ".concat(p.message)),[3,3];case 3:return[2]}})})},e.prototype.onSessionIdChanged=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return null===(t=this.config)||void 0===t||t.loggerProvider.debug("Analytics session id is changed to ".concat(e,", SR session id is ").concat(String(this.sessionReplay.getSessionId()),".")),[4,this.sessionReplay.setSessionId(e).promise];case 1:return r.sent(),[2]}})})},e.prototype.onOptOutChanged=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return null===(t=this.config)||void 0===t||t.loggerProvider.debug("optOut is changed to ".concat(String(e),", calling ").concat(e?"sessionReplay.shutdown()":"sessionReplay.init()",".")),e?(this.sessionReplay.shutdown(),[3,4]):[3,1];case 1:return null!=this.config?[4,this.sessionReplay.init(this.config.apiKey,this.srInitOptions).promise]:[3,3];case 2:r.sent(),r.label=3;case 3:r.label=4;case 4:return[2]}})})},e.prototype.execute=function(e){var t,r,n;return l(this,void 0,void 0,function(){var i,a,l,c,d;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,9,,10]),this.options.customSessionId?(i=this.options.customSessionId(e))?i===this.sessionReplay.getSessionId()?[3,2]:[4,this.sessionReplay.setSessionId(i).promise]:[3,3]:[3,4];case 1:u.sent(),u.label=2;case 2:c=this.sessionReplay.getSessionReplayProperties(),e.event_properties=s(s({},e.event_properties),c),u.label=3;case 3:return[3,8];case 4:return(i=null===(t=this.config)||void 0===t?void 0:t.sessionId)&&i!==this.sessionReplay.getSessionId()?[4,this.sessionReplay.setSessionId(i).promise]:[3,6];case 5:u.sent(),u.label=6;case 6:return i&&i===e.session_id?(a=void 0,e.event_type===o.IDENTIFY&&(a=function(e){if(e.user_properties){var t={};return Object.keys(e.user_properties).forEach(function(r){if(ic.includes(r)){var n=e.user_properties&&e.user_properties[r];t=s(s({},t),n)}}),t}}(e)),l=z(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:a,page:null!=(null===(r=null==l?void 0:l.location)||void 0===r?void 0:r.href)?{url:l.location.href}:void 0})]):[3,8];case 7:u.sent(),c=this.sessionReplay.getSessionReplayProperties(),e.event_properties=s(s({},e.event_properties),c),u.label=8;case 8:return e.event_type===o.IDENTIFY&&e.event_properties&&delete e.event_properties[sc],[2,Promise.resolve(e)];case 9:return d=u.sent(),null===(n=this.config)||void 0===n||n.loggerProvider.error("Session Replay: Failed to enrich event due to ".concat(d.message)),[2,Promise.resolve(e)];case 10:return[2]}})})},e.prototype.teardown=function(){var e;return l(this,void 0,void 0,function(){return u(this,function(t){try{this.sessionReplay.shutdown(),this.config=null}catch(t){null===(e=this.config)||void 0===e||e.loggerProvider.error("Session Replay: teardown failed due to ".concat(t.message))}return[2]})})},e.prototype.getSessionReplayProperties=function(){return this.sessionReplay.getSessionReplayProperties()},e.prototype.start=function(){return l(this,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,this.sessionReplay.start().promise];case 1:return e.sent(),[2]}})})},e.prototype.stop=function(){this.sessionReplay.stop()},e.pluginName="@amplitude/plugin-session-replay-browser",e}(),lc=function(e,t){return lc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},lc(e,t)};function uc(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}lc(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var cc=function(){return cc=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},cc.apply(this,arguments)};function dc(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})}function hc(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function pc(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function fc(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function gc(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var vc="is",mc="is not",yc="contains",bc="does not contain",wc="less",Sc="less or equal",xc="greater",kc="greater or equal",Cc="version less",Ec="version less or equal",Ic="version greater",Oc="version greater or equal",Pc="set is",Tc="set is not",Rc="set contains",Mc="set does not contain",Ac="set contains any",_c="set does not contain any",Nc="regex match",Dc="regex does not match",Lc=-862048943,Fc=461845907,Uc=function(e,t){void 0===t&&(t=0);for(var r=function(e){for(var t=[],r=0,n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return Uint8Array.from(t)}(e),n=r.length,i=n>>2,o=t,s=0;s<i;s++){var a=zc(r,s<<2);o=jc(a,o)}var l=i<<2,u=0;switch(n-l){case 3:u^=r[l+2]<<16,u^=r[l+1]<<8,u^=r[l],u=Math.imul(u,Lc),u=qc(u,15),o^=u=Math.imul(u,Fc);break;case 2:u^=r[l+1]<<8,u^=r[l],u=Math.imul(u,Lc),u=qc(u,15),o^=u=Math.imul(u,Fc);break;case 1:u^=r[l],u=Math.imul(u,Lc),u=qc(u,15),o^=u=Math.imul(u,Fc)}return Bc(o^=n)>>>0},jc=function(e,t){var r=e,n=t;return r=Math.imul(r,Lc),r=qc(r,15),r=Math.imul(r,Fc),n=qc(n^=r,13),(n=Math.imul(n,5))+-430675100|0},Bc=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-2048144789),t^=t>>>13,t=Math.imul(t,-1028477387),t^=t>>>16},qc=function(e,t,r){return void 0===r&&(r=32),t>r&&(t%=r),(e<<t|(e&4294967295<<r-t>>>0)>>>0>>>r-t>>>0)>>>0},zc=function(e,t){void 0===t&&(t=0);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return Wc(r)},Wc=function(e){return(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24},Vc=function(e,t){var r,n;if(t&&0!==t.length){try{for(var i=pc(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!s||!e||"object"!=typeof e)return;e=e[s]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return null==e?void 0:e}},$c="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),Hc=function(){function e(e,t,r,n){void 0===n&&(n=void 0),this.major=e,this.minor=t,this.patch=r,this.preRelease=n}return e.parse=function(t){if(t){var r=new RegExp($c).exec(t);if(r){var n=Number(r[1]),i=Number(r[2]);if(!isNaN(n)&&!isNaN(i))return new e(n,i,Number(r[4])||0,r[5]||void 0)}}},e.prototype.compareTo=function(e){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch||this.preRelease&&!e.preRelease?-1:!this.preRelease&&e.preRelease?1:this.preRelease&&e.preRelease?this.preRelease>e.preRelease?1:this.preRelease<e.preRelease?-1:0:0},e}(),Kc=function(){function e(){}return e.prototype.evaluate=function(e,t){var r,n,i={},o={context:e,result:i};try{for(var s=pc(t),a=s.next();!a.done;a=s.next()){var l=a.value,u=this.evaluateFlag(o,l);u&&(i[l.key]=u)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},e.prototype.evaluateFlag=function(e,t){var r,n,i;try{for(var o=pc(t.segments),s=o.next();!s.done;s=o.next()){var a=s.value;if(i=this.evaluateSegment(e,t,a)){var l=cc(cc(cc({},t.metadata),a.metadata),i.metadata);i=cc(cc({},i),{metadata:l});break}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e.prototype.evaluateSegment=function(e,t,r){var n;return r.conditions?this.evaluateConditions(e,r.conditions)&&void 0!==(n=this.bucket(e,r))?t.variants[n]:void 0:void 0!==(n=this.bucket(e,r))?t.variants[n]:void 0},e.prototype.evaluateConditions=function(e,t){var r,n,i,o;try{for(var s=pc(t),a=s.next();!a.done;a=s.next()){var l=a.value,u=!0;try{for(var c=(i=void 0,pc(l)),d=c.next();!d.done;d=c.next()){var h=d.value;if(!(u=this.matchCondition(e,h)))break}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}if(u)return!0}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return!1},e.prototype.matchCondition=function(e,t){var r=Vc(e,t.selector);if(null==r)return this.matchNull(t.op,t.values);if(this.isSetOperator(t.op)){var n=this.coerceStringArray(r);return!!n&&this.matchSet(n,t.op,t.values)}var i=this.coerceString(r);return void 0!==i&&this.matchString(i,t.op,t.values)},e.prototype.getHash=function(e){return Uc(e)},e.prototype.bucket=function(e,t){var r,n,i,o;if(!t.bucket)return t.variant;var s=this.coerceString(Vc(e,t.bucket.selector));if(!s||0===s.length)return t.variant;var a="".concat(t.bucket.salt,"/").concat(s),l=this.getHash(a),u=l%100,c=Math.floor(l/100);try{for(var d=pc(t.bucket.allocations),h=d.next();!h.done;h=d.next()){var p=h.value,f=p.range[0],g=p.range[1];if(u>=f&&u<g)try{for(var v=(i=void 0,pc(p.distributions)),m=v.next();!m.done;m=v.next()){var y=m.value,b=y.range[0],w=y.range[1];if(c>=b&&c<w)return y.variant}}catch(e){i={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return t.variant},e.prototype.matchNull=function(e,t){var r=this.containsNone(t);switch(e){case vc:case yc:case wc:case Sc:case xc:case kc:case Cc:case Ec:case Ic:case Oc:case Pc:case Rc:case Ac:return r;case mc:case bc:case Mc:case _c:return!r;default:return!1}},e.prototype.matchSet=function(e,t,r){switch(t){case Pc:return this.setEquals(e,r);case Tc:return!this.setEquals(e,r);case Rc:return this.matchesSetContainsAll(e,r);case Mc:return!this.matchesSetContainsAll(e,r);case Ac:return this.matchesSetContainsAny(e,r);case _c:return!this.matchesSetContainsAny(e,r);default:return!1}},e.prototype.matchString=function(e,t,r){var n=this;switch(t){case vc:return this.matchesIs(e,r);case mc:return!this.matchesIs(e,r);case yc:return this.matchesContains(e,r);case bc:return!this.matchesContains(e,r);case wc:case Sc:case xc:case kc:return this.matchesComparable(e,t,r,function(e){return n.parseNumber(e)},this.comparator);case Cc:case Ec:case Ic:case Oc:return this.matchesComparable(e,t,r,function(e){return Hc.parse(e)},this.versionComparator);case Nc:return this.matchesRegex(e,r);case Dc:return!this.matchesRegex(e,r);default:return!1}},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var r=e.toLowerCase();if("true"===r||"false"===r)return t.some(function(e){return e.toLowerCase()===r})}return t.some(function(t){return e===t})},e.prototype.matchesContains=function(e,t){var r,n;try{for(var i=pc(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.toLowerCase().includes(s.toLowerCase()))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e.prototype.matchesComparable=function(e,t,r,n,i){var o=this,s=n(e),a=r.map(function(e){return n(e)}).filter(function(e){return void 0!==e});return void 0===s||0===a.length?r.some(function(r){return o.comparator(e,t,r)}):a.some(function(e){return i(s,t,e)})},e.prototype.comparator=function(e,t,r){switch(t){case wc:case Cc:return e<r;case Sc:case Ec:return e<=r;case xc:case Ic:return e>r;case kc:case Oc:return e>=r;default:return!1}},e.prototype.versionComparator=function(e,t,r){var n=e.compareTo(r);switch(t){case wc:case Cc:return n<0;case Sc:case Ec:return n<=0;case xc:case Ic:return n>0;case kc:case Oc:return n>=0;default:return!1}},e.prototype.matchesRegex=function(e,t){return t.some(function(t){return Boolean(new RegExp(t).exec(e))})},e.prototype.containsNone=function(e){return e.some(function(e){return"(none)"===e})},e.prototype.containsBooleans=function(e){return e.some(function(e){switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})},e.prototype.parseNumber=function(e){var t;return null!==(t=Number(e))&&void 0!==t?t:void 0},e.prototype.coerceString=function(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e))return e.map(function(e){return t.coerceString(e)}).filter(Boolean);var r=String(e);try{var n=JSON.parse(r);return Array.isArray(n)?e.map(function(e){return t.coerceString(e)}).filter(Boolean):(i=this.coerceString(r))?[i]:void 0}catch(e){var i;return(i=this.coerceString(r))?[i]:void 0}},e.prototype.isSetOperator=function(e){switch(e){case Pc:case Tc:case Rc:case Mc:case Ac:case _c:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var r=new Set(e),n=new Set(t);return r.size===n.size&&gc([],fc(n),!1).every(function(e){return r.has(e)})},e.prototype.matchesSetContainsAll=function(e,t){var r,n;if(e.length<t.length)return!1;try{for(var i=pc(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!this.matchesIs(s,e))return!1}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0},e.prototype.matchesSetContainsAny=function(e,t){var r,n;try{for(var i=pc(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(this.matchesIs(s,e))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e}(),Gc=function(e,t,r){var n,i;void 0===r&&(r=[]);var o=t[e];if(o){if(!o.dependencies||0===o.dependencies.length)return delete t[o.key],[o];r.push(o.key);var s=[],a=function(e){if(r.some(function(t){return t===e}))throw Error("Detected a cycle between flags ".concat(r));var n=Gc(e,t,r);n&&s.push.apply(s,gc([],fc(n),!1))};try{for(var l=pc(o.dependencies),u=l.next();!u.done;u=l.next()){a(u.value)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}return s.push(o),r.pop(),delete t[o.key],s}};const Jc="function"==typeof Buffer,Xc=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),Yc=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Qc=(e=>{let t={};return e.forEach((e,r)=>t[e]=r),t})(Yc),Zc=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,ed=String.fromCharCode.bind(String),td=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_")),rd=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),nd=e=>{let t,r,n,i,o="";const s=e.length%3;for(let s=0;s<e.length;){if((r=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255||(i=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|i,o+=Yc[t>>18&63]+Yc[t>>12&63]+Yc[t>>6&63]+Yc[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},id="function"==typeof btoa?e=>btoa(e):Jc?e=>Buffer.from(e,"binary").toString("base64"):nd,od=Jc?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(ed.apply(null,e.subarray(r,r+4096)));return id(t.join(""))},sd=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?ed(192|t>>>6)+ed(128|63&t):ed(224|t>>>12&15)+ed(128|t>>>6&63)+ed(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return ed(240|t>>>18&7)+ed(128|t>>>12&63)+ed(128|t>>>6&63)+ed(128|63&t)},ad=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,ld=e=>e.replace(ad,sd),ud=Jc?e=>Buffer.from(e,"utf8").toString("base64"):Xc?e=>od(Xc.encode(e)):e=>id(ld(e)),cd=(e,t=!1)=>t?td(ud(e)):ud(e),dd=e=>cd(e,!0),hd=e=>{if(e=e.replace(/\s+/g,""),!Zc.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r,n,i="";for(let o=0;o<e.length;)t=Qc[e.charAt(o++)]<<18|Qc[e.charAt(o++)]<<12|(r=Qc[e.charAt(o++)])<<6|(n=Qc[e.charAt(o++)]),i+=64===r?ed(t>>16&255):64===n?ed(t>>16&255,t>>8&255):ed(t>>16&255,t>>8&255,255&t);return i},pd=dd;var fd=function(e){function t(r,n){var i=e.call(this,n)||this;return i.statusCode=r,Object.setPrototypeOf(i,t.prototype),i}return uc(t,e),t}(Error),gd=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return uc(t,e),t}(Error),vd=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getVariants=function(e,t){return dc(this,void 0,void 0,function(){var r,n,i,o;return hc(this,function(s){switch(s.label){case 0:return r=pd(JSON.stringify(e)),n={Authorization:"Api-Key ".concat(this.deploymentKey),"X-Amp-Exp-User":r},(null==t?void 0:t.flagKeys)&&(n["X-Amp-Exp-Flag-Keys"]=pd(JSON.stringify(t.flagKeys))),(null==t?void 0:t.trackingOption)&&(n["X-Amp-Exp-Track"]=t.trackingOption),i=new URL("".concat(this.serverUrl,"/sdk/v2/vardata?v=0")),(null==t?void 0:t.evaluationMode)&&i.searchParams.append("eval_mode",null==t?void 0:t.evaluationMode),(null==t?void 0:t.deliveryMethod)&&i.searchParams.append("delivery_method",null==t?void 0:t.deliveryMethod),[4,this.httpClient.request({requestUrl:i.toString(),method:"GET",headers:n,timeoutMillis:null==t?void 0:t.timeoutMillis})];case 1:if(200!=(o=s.sent()).status)throw new fd(o.status,"Fetch error response: status=".concat(o.status));return[2,JSON.parse(o.body)]}})})},e}(),md=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getFlags=function(e){return dc(this,void 0,void 0,function(){var t,r;return hc(this,function(n){switch(n.label){case 0:return t={Authorization:"Api-Key ".concat(this.deploymentKey)},(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]="".concat(e.libraryName,"/").concat(e.libraryVersion)),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=pd(JSON.stringify(e.user))),[4,this.httpClient.request({requestUrl:"".concat(this.serverUrl,"/sdk/v2/flags")+((null==e?void 0:e.deliveryMethod)?"?delivery_method=".concat(e.deliveryMethod):""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis})];case 1:if(200!=(r=n.sent()).status)throw Error("Flags error response: status=".concat(r.status));return[2,JSON.parse(r.body).reduce(function(e,t){return e[t.key]=t,e},{})]}})})},e}(),yd="undefined"!=typeof globalThis?globalThis:global||self,bd=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},wd=function(){function e(e,t){this.poller=void 0,this.action=e,this.ms=t}return e.prototype.start=function(){this.poller||(this.poller=yd.setInterval(this.action,this.ms),this.action())},e.prototype.stop=function(){this.poller&&(yd.clearInterval(this.poller),this.poller=void 0)},e}(),Sd={},xd={get exports(){return Sd},set exports(e){Sd=e}};!function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",l="model",u="name",c="type",d="vendor",h="version",p="architecture",f="console",g="mobile",v="tablet",m="smarttv",y="wearable",b="embedded",w="Amazon",S="Apple",x="ASUS",k="BlackBerry",C="Browser",E="Chrome",I="Firefox",O="Google",P="Huawei",T="LG",R="Microsoft",M="Motorola",A="Opera",_="Samsung",N="Sharp",D="Sony",L="Xiaomi",F="Zebra",U="Facebook",j=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},B=function(e,t){return typeof e===a&&-1!==q(t).indexOf(q(e))},q=function(e){return e.toLowerCase()},z=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,350)},W=function(e,t){for(var r,o,a,l,u,c,d=0;d<t.length&&!u;){var h=t[d],p=t[d+1];for(r=o=0;r<h.length&&!u;)if(u=h[r++].exec(e))for(a=0;a<p.length;a++)c=u[++o],typeof(l=p[a])===s&&l.length>0?2===l.length?typeof l[1]==i?this[l[0]]=l[1].call(this,c):this[l[0]]=l[1]:3===l.length?typeof l[1]!==i||l[1].exec&&l[1].test?this[l[0]]=c?c.replace(l[1],l[2]):n:this[l[0]]=c?l[1].call(this,c,l[2]):n:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):n):this[l]=c||n;d+=2}},V=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(B(t[r][i],e))return"?"===r?n:r}else if(B(t[r],e))return"?"===r?n:r;return e},$={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},H={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,h],[/opios[\/ ]+([\w\.]+)/i],[h,[u,A+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[u,A]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[u,"UC"+C]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[h,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[h,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+C],h],[/\bfocus\/([\w\.]+)/i],[h,[u,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[u,A+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[u,A+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[u,"MIUI "+C]],[/fxios\/([-\w\.]+)/i],[h,[u,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+C]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+C],h],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,U],h],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[u,E+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,E+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[u,"Android "+C]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,h],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[h,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[h,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[h,V,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[u,I+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,h],[/(cobalt)\/([\w\.]+)/i],[u,[h,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,q]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",q]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,q]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[d,_],[c,v]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[d,_],[c,g]],[/((ipod|iphone)\d+,\d+)/i],[l,[d,S],[c,g]],[/(ipad\d+,\d+)/i],[l,[d,S],[c,v]],[/\((ip(?:hone|od)[\w ]*);/i],[l,[d,S],[c,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[d,S],[c,v]],[/(macintosh);/i],[l,[d,S]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[d,P],[c,v]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[d,P],[c,g]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[l,/_/g," "],[d,L],[c,g]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[d,L],[c,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[d,"OPPO"],[c,g]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[d,"Vivo"],[c,g]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[l,[d,"Realme"],[c,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[l,[d,M],[c,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[d,M],[c,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[d,T],[c,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[d,T],[c,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[d,"Lenovo"],[c,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[d,"Nokia"],[c,g]],[/(pixel c)\b/i],[l,[d,O],[c,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[d,O],[c,g]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[d,D],[c,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[d,D],[c,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[d,"OnePlus"],[c,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[d,w],[c,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[d,w],[c,g]],[/(playbook);[-\w\),; ]+(rim)/i],[l,d,[c,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[d,k],[c,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[d,x],[c,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[d,x],[c,g]],[/(nexus 9)/i],[l,[d,"HTC"],[c,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[l,/_/g," "],[c,g]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[d,"Acer"],[c,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[d,"Meizu"],[c,g]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[d,N],[c,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,l,[c,g]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,l,[c,v]],[/(surface duo)/i],[l,[d,R],[c,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[d,"Fairphone"],[c,g]],[/(u304aa)/i],[l,[d,"AT&T"],[c,g]],[/\bsie-(\w*)/i],[l,[d,"Siemens"],[c,g]],[/\b(rct\w+) b/i],[l,[d,"RCA"],[c,v]],[/\b(venue[\d ]{2,7}) b/i],[l,[d,"Dell"],[c,v]],[/\b(q(?:mv|ta)\w+) b/i],[l,[d,"Verizon"],[c,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[d,"Barnes & Noble"],[c,v]],[/\b(tm\d{3}\w+) b/i],[l,[d,"NuVision"],[c,v]],[/\b(k88) b/i],[l,[d,"ZTE"],[c,v]],[/\b(nx\d{3}j) b/i],[l,[d,"ZTE"],[c,g]],[/\b(gen\d{3}) b.+49h/i],[l,[d,"Swiss"],[c,g]],[/\b(zur\d{3}) b/i],[l,[d,"Swiss"],[c,v]],[/\b((zeki)?tb.*\b) b/i],[l,[d,"Zeki"],[c,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],l,[c,v]],[/\b(ns-?\w{0,9}) b/i],[l,[d,"Insignia"],[c,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[d,"NextBook"],[c,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],l,[c,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],l,[c,g]],[/\b(ph-1) /i],[l,[d,"Essential"],[c,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[d,"Envizen"],[c,v]],[/\b(trio[-\w\. ]+) b/i],[l,[d,"MachSpeed"],[c,v]],[/\btu_(1491) b/i],[l,[d,"Rotor"],[c,v]],[/(shield[\w ]+) b/i],[l,[d,"Nvidia"],[c,v]],[/(sprint) (\w+)/i],[d,l,[c,g]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[d,R],[c,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[d,F],[c,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[d,F],[c,g]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,l,[c,f]],[/droid.+; (shield) bui/i],[l,[d,"Nvidia"],[c,f]],[/(playstation [345portablevi]+)/i],[l,[d,D],[c,f]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[d,R],[c,f]],[/smart-tv.+(samsung)/i],[d,[c,m]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[d,_],[c,m]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,T],[c,m]],[/(apple) ?tv/i],[d,[l,S+" TV"],[c,m]],[/crkey/i],[[l,E+"cast"],[d,O],[c,m]],[/droid.+aft(\w)( bui|\))/i],[l,[d,w],[c,m]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[d,N],[c,m]],[/(bravia[\w ]+)( bui|\))/i],[l,[d,D],[c,m]],[/(mitv-\w{5}) bui/i],[l,[d,L],[c,m]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,z],[l,z],[c,m]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[c,m]],[/((pebble))app/i],[d,l,[c,y]],[/droid.+; (glass) \d/i],[l,[d,O],[c,y]],[/droid.+; (wt63?0{2,3})\)/i],[l,[d,F],[c,y]],[/(quest( 2)?)/i],[l,[d,U],[c,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[c,b]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[l,[c,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[c,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[c,v]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[c,g]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[h,V,$]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[h,V,$]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[h,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,h],[/\(bb(10);/i],[h,[u,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[u,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[u,"webOS"]],[/crkey\/([\d\.]+)/i],[h,[u,E+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[u,"Chromium OS"],h],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,h],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,h]]},K=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof K))return new K(e,t).getResult();var i=e||(typeof r!==o&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),f=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(H,t):H;return this.getBrowser=function(){var e={};return e[u]=n,e[h]=n,W.call(e,i,f.browser),e.major=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e.version),e},this.getCPU=function(){var e={};return e[p]=n,W.call(e,i,f.cpu),e},this.getDevice=function(){var e={};return e[d]=n,e[l]=n,e[c]=n,W.call(e,i,f.device),e},this.getEngine=function(){var e={};return e[u]=n,e[h]=n,W.call(e,i,f.engine),e},this.getOS=function(){var e={};return e[u]=n,e[h]=n,W.call(e,i,f.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return i},this.setUA=function(e){return i=typeof e===a&&e.length>350?z(e,350):e,this},this.setUA(i),this};K.VERSION="0.7.33",K.BROWSER=j([u,h,"major"]),K.CPU=j([p]),K.DEVICE=j([l,d,c,f,g,m,v,y,b]),K.ENGINE=K.OS=j([u,h]),e.exports&&(t=e.exports=K),t.UAParser=K;var G=typeof r!==o&&(r.jQuery||r.Zepto);if(G&&!G.ua){var J=new K;G.ua=J.getResult(),G.ua.get=function(){return J.getUA()},G.ua.set=function(e){J.setUA(e);var t=J.getResult();for(var r in t)G.ua[r]=t[r]}}}("object"==typeof window?window:$)}(xd,Sd);var kd=function(){return kd=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},kd.apply(this,arguments)};function Cd(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})}function Ed(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function Id(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Od(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function Pd(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Td=function(e,t){var r,n;void 0===t&&(t=!1);var i=Rd(e,t),o=void 0,s=yd.document.cookie.split("; ");try{for(var a=Id(s),l=a.next();!l.done;l=a.next()){var u=Od(l.value.split("=",2),2),c=u[0],d=u[1];c===i&&(o=decodeURIComponent(d))}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}if(o)try{if(t){var h=atob(o);return JSON.parse(decodeURIComponent(h))}var p=o.split("."),f=void 0;return p.length>=2&&p[1]&&(f=atob(p[1])),{deviceId:p[0],userId:f}}catch(e){return}},Rd=function(e,t){if(t){if((null==e?void 0:e.length)<10)return;return"AMP_".concat(e.substring(0,10))}if(!((null==e?void 0:e.length)<6))return"amp_".concat(e.substring(0,6))},Md=function(){function e(e,t,r){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=r,this.loadPersistedState(),r<=0&&(this.setup=void 0)}return e.prototype.setup=function(e,t){return Cd(this,void 0,void 0,function(){return Ed(this,function(r){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener(function(){null==t||t.fetch()}),[2,this.waitForConnectorIdentity(this.timeoutMillis)]})})},e.prototype.getUser=function(){var e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}},e.prototype.track=function(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)},e.prototype.loadPersistedState=function(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;var e=Td(this.apiKey,!0);return(e||(e=Td(this.apiKey,!1))||(e=function(e){var t=Rd(e,!0);try{var r=yd.localStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}}(this.apiKey))||!!(e=function(e){var t=Rd(e,!0);try{var r=yd.sessionStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}}(this.apiKey)))&&(this.commitIdentityToConnector(e),!0)},e.prototype.commitIdentityToConnector=function(e){var t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()},e.prototype.waitForConnectorIdentity=function(e){return Cd(this,void 0,void 0,function(){var t,r=this;return Ed(this,function(n){return(t=this.identityStore.getIdentity()).userId||t.deviceId?[2]:[2,Promise.race([new Promise(function(e){var t=function(){e(),r.identityStore.removeIdentityListener(t)};r.identityStore.addIdentityListener(t)}),new Promise(function(t,r){yd.setTimeout(r,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")})])]})})},e}();var Ad,_d,Nd,Dd=yd.fetch||function(e,t){return t=t||{},new Promise(function(r,n){var i=new XMLHttpRequest,o=[],s=[],a={},l=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:l,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var u in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,r){o.push(t=t.toLowerCase()),s.push([t,r]),a[t]=a[t]?a[t]+","+r:r}),r(l())},i.onerror=n,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(u,t.headers[u]);i.send(t.body||null)})},Ld=function(){function e(e){this.client=e}return e.prototype.request=function(e){return Cd(this,void 0,void 0,function(){return Ed(this,function(t){switch(t.label){case 0:return[4,this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)];case 1:return[2,t.sent()]}})})},e}(),Fd={request:function(e,t,r,n,i){return function(e,t){return null==t||t<=0?e:new Promise(function(r,n){yd.setTimeout(function(){n(new gd("Request timeout after "+t+" milliseconds"))},t),e.then(r,n)})}(Cd(void 0,void 0,void 0,function(){var i,o;return Ed(this,function(s){switch(s.label){case 0:return[4,Dd(e,{method:t,headers:r,body:n})];case 1:return i=s.sent(),o={status:i.status},[4,i.text()];case 2:return o.body=s.sent(),[2,o]}})}),i)}};!function(e){e[e.Disable=0]="Disable",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug",e[e.Verbose=5]="Verbose"}(Ad||(Ad={})),function(e){e.LocalStorage="localStorage",e.InitialVariants="initialVariants"}(_d||(_d={})),function(e){e.LocalStorage="storage",e.InitialVariants="initial",e.SecondaryLocalStorage="secondary-storage",e.SecondaryInitialVariants="secondary-initial",e.FallbackInline="fallback-inline",e.FallbackConfig="fallback-config",e.LocalEvaluation="local-evaluation"}(Nd||(Nd={}));var Ud=function(e){return!e||e===Nd.FallbackInline||e===Nd.FallbackConfig||e===Nd.SecondaryInitialVariants},jd={debug:!1,logLevel:Ad.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:_d.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,throwOnError:!1,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:Fd},Bd="1.20.0",qd=function(){function e(e,t){var r,n=this;this.isReady=new Promise(function(e){n.resolve=e}),this.config=e,this.client=t;var i=null!==(r=e.instanceName)&&void 0!==r?r:jd.instanceName;this.queue=new Wd(i),this.cache=new zd(i)}return e.prototype.ready=function(){return this.integration?this.isReady:Promise.resolve()},e.prototype.setIntegration=function(e){var t=this;this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()},function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())},e.prototype.getUser=function(){return this.integration?this.integration.getUser():{}},e.prototype.track=function(e){if(this.cache.shouldTrack(e)){var t=this.getExposureEvent(e);this.queue.push(t)}},e.prototype.getExposureEvent=function(e){var t,r,n,i={eventType:"$exposure",eventProperties:e};return(null===(t=e.metadata)||void 0===t?void 0:t.exposureEvent)?i={eventType:null===(r=e.metadata)||void 0===r?void 0:r.exposureEvent,eventProperties:e}:"web"===(null===(n=e.metadata)||void 0===n?void 0:n.deliveryMethod)&&(i={eventType:"$impression",eventProperties:e}),i},e}(),zd=function(){function e(e){this.isSessionStorageAvailable=Vd(),this.inMemoryCache={},this.storageKey="EXP_sent_v2_".concat(e),this.isSessionStorageAvailable&&yd.sessionStorage.removeItem("EXP_sent_".concat(e))}return e.prototype.shouldTrack=function(e){var t;if("web"===(null===(t=e.metadata)||void 0===t?void 0:t.deliveryMethod))return!0;this.loadCache();var r=this.inMemoryCache[e.flag_key],n=!1;return r&&r.variant===e.variant||(n=!0,this.inMemoryCache[e.flag_key]=e),this.storeCache(),n},e.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=yd.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},e.prototype.storeCache=function(){this.isSessionStorageAvailable&&yd.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))},e}(),Wd=function(){function e(e,t){void 0===t&&(t=512),this.isLocalStorageAvailable=function(){var e=bd();if(e)try{var t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){return!1}return!1}(),this.inMemoryQueue=[],this.storageKey="EXP_unsent_".concat(e),this.maxQueueSize=t}return e.prototype.push=function(e){this.loadQueue(),this.inMemoryQueue.push(e),this.flush(),this.storeQueue()},e.prototype.setTracker=function(e){var t=this;this.tracker=e,this.poller=yd.setInterval(function(){t.loadFlushStore()},1e3),this.loadFlushStore()},e.prototype.flush=function(){var e,t;if(this.tracker&&0!==this.inMemoryQueue.length){try{for(var r=Id(this.inMemoryQueue),n=r.next();!n.done;n=r.next()){var i=n.value;try{if(!this.tracker(i))return}catch(e){return}}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.inMemoryQueue=[],this.poller&&(yd.clearInterval(this.poller),this.poller=void 0)}},e.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=yd.localStorage.getItem(this.storageKey);this.inMemoryQueue=e?JSON.parse(e):[]}},e.prototype.storeQueue=function(){this.isLocalStorageAvailable&&(this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),yd.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},e.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},e}(),Vd=function(){var e=bd();if(e)try{var t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){return!1}return!1},$d=function(){function e(e,t){void 0===t&&(t=Ad.Error),this.logger=e,this.logLevel=t}return e.prototype.error=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=Ad.Error&&(t=this.logger).error.apply(t,Pd([e],Od(r),!1))},e.prototype.warn=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=Ad.Warn&&(t=this.logger).warn.apply(t,Pd([e],Od(r),!1))},e.prototype.info=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=Ad.Info&&(t=this.logger).info.apply(t,Pd([e],Od(r),!1))},e.prototype.debug=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=Ad.Debug&&(t=this.logger).debug.apply(t,Pd([e],Od(r),!1))},e.prototype.verbose=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=Ad.Verbose&&(t=this.logger).verbose.apply(t,Pd([e],Od(r),!1))},e}(),Hd=function(){function e(){}return e.prototype.error=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.error.apply(console,Pd([e],Od(t),!1))},e.prototype.warn=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.warn.apply(console,Pd([e],Od(t),!1))},e.prototype.info=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.info.apply(console,Pd([e],Od(t),!1))},e.prototype.debug=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.debug.apply(console,Pd([e],Od(t),!1))},e.prototype.verbose=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.debug.apply(console,Pd([e],Od(t),!1))},e}(),Kd=function(){function e(){this.globalScope=bd()}return e.prototype.get=function(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.localStorage.getItem(e)},e.prototype.put=function(e,t){var r;null===(r=this.globalScope)||void 0===r||r.localStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null===(t=this.globalScope)||void 0===t||t.localStorage.removeItem(e)},e}(),Gd=function(){function e(e,t){this.namespace=e,this.storage=t}return e.prototype.get=function(){return this.value},e.prototype.put=function(e){this.value=e},e.prototype.load=function(){var e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))},e.prototype.store=function(){void 0===this.value?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))},e}(),Jd=function(){function e(e,t,r){this.cache={},this.namespace=e,this.storage=t,this.transformer=r}return e.prototype.get=function(e){return this.cache[e]},e.prototype.getAll=function(){return kd({},this.cache)},e.prototype.put=function(e,t){this.cache[e]=t},e.prototype.putAll=function(e){var t,r;try{for(var n=Id(Object.keys(e)),i=n.next();!i.done;i=n.next()){var o=i.value;this.cache[o]=e[o]}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.clear=function(){this.cache={}},e.prototype.load=function(){var e,t,r,n=this.storage.get(this.namespace);try{r=JSON.parse(n)||{}}catch(e){return}var i={};try{for(var o=Id(Object.keys(r)),s=o.next();!s.done;s=o.next()){var a=s.value;try{var l=void 0;(l=this.transformer?this.transformer(r[a]):r[a])&&(i[a]=l)}catch(e){}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.clear(),this.putAll(i)},e.prototype.store=function(e){void 0===e&&(e=this.cache),this.storage.put(this.namespace,JSON.stringify(e))},e}(),Xd=function(e){if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){var t=e.key,r=e.value,n=e.payload,i=e.metadata,o=e.expKey;i&&i.experimentKey?o=i.experimentKey:o&&((i=i||{}).experimentKey=o);var s={};return t?s.key=t:r&&(s.key=r),r&&(s.value=r),i&&(s.metadata=i),n&&(s.payload=n),o&&(s.expKey=o),s}},Yd=function(){function e(){this.globalScope=bd()}return e.prototype.get=function(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.sessionStorage.getItem(e)},e.prototype.put=function(e,t){var r;null===(r=this.globalScope)||void 0===r||r.sessionStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null===(t=this.globalScope)||void 0===t||t.sessionStorage.removeItem(e)},e}(),Qd=function(e){return null==e},Zd=function(e){return!!Qd(e)||e&&0===Object.keys(e).length},eh=function(e){var t;return"local"===(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.evaluationMode)},th=function(){function e(e,t,r,n){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=r,this.scalar=n}return e.prototype.start=function(e){return Cd(this,void 0,void 0,function(){return Ed(this,function(t){switch(t.label){case 0:if(this.started)throw Error("Backoff already started");return this.started=!0,[4,this.backoff(e,0,this.min)];case 1:return t.sent(),[2]}})})},e.prototype.cancel=function(){this.done=!0,clearTimeout(this.timeoutHandle)},e.prototype.backoff=function(e,t,r){return Cd(this,void 0,void 0,function(){var n=this;return Ed(this,function(i){return this.done||(this.timeoutHandle=yd.setTimeout(function(){return Cd(n,void 0,void 0,function(){var n,i;return Ed(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e()];case 1:return o.sent(),[3,3];case 2:return o.sent(),(n=t+1)<this.attempts&&(i=Math.min(r*this.scalar,this.max),this.backoff(e,n,i)),[3,3];case 3:return[2]}})})},r)),[2]})})},e}(),rh=function(e){return null==e?{}:"string"==typeof e?{key:e,value:e}:e},nh=function(e){if(!e)return{};var t=void 0;e.metadata&&(t=e.metadata.experimentKey);var r={};return e.key&&(r.key=e.key),e.value&&(r.value=e.value),e.payload&&(r.payload=e.payload),t&&(r.expKey=t),e.metadata&&(r.metadata=e.metadata),r},ih=function(){function e(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}return e.prototype.track=function(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))},e.prototype.setUserProperty=function(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)},e.prototype.unsetUserProperty=function(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))},e}(),oh=function(){function e(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}return e.prototype.track=function(e,t){var r={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,r)||(this.tracked={}),this.identity=r;var n=e.flag_key in this.tracked,i=this.tracked[e.flag_key];n&&i===e.variant||(this.tracked[e.flag_key]=e.variant,this.exposureTrackingProvider.track(e))},e.prototype.identityEquals=function(e,t){return e.userId===t.userId&&e.deviceId===t.deviceId},e}(),sh=function(){function e(t,r){var n,i,o,s,a=this;this.engine=new Kc,this.isRunning=!1,this.apiKey=t,r=function(e){var t,r;if(!e||"object"!=typeof e)return{};var n={};try{for(var i=Id(Object.entries(e)),o=i.next();!o.done;o=i.next()){var s=Od(o.value,2),a=s[0],l=s[1];Qd(l)||(n[a]=l)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}(r),this.config=kd(kd(kd({},jd),r),{serverUrl:(null==r?void 0:r.serverUrl)||("eu"===(null===(n=null==r?void 0:r.serverZone)||void 0===n?void 0:n.toLowerCase())?"https://api.lab.eu.amplitude.com":jd.serverUrl),flagsServerUrl:(null==r?void 0:r.flagsServerUrl)||("eu"===(null===(i=null==r?void 0:r.serverZone)||void 0===i?void 0:i.toLowerCase())?"https://flag.lab.eu.amplitude.com":jd.flagsServerUrl),flagConfigPollingIntervalMillis:r.flagConfigPollingIntervalMillis<6e4?6e4:null!==(o=r.flagConfigPollingIntervalMillis)&&void 0!==o?o:jd.flagConfigPollingIntervalMillis}),this.logger=new $d(this.config.loggerProvider||new Hd,e.getLogLevel(r));var l=null===(s=this.config)||void 0===s?void 0:s.internalInstanceNameSuffix;if(this.isWebExperiment="web"===l,this.poller=new wd(function(){return a.doFlags()},this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(var u in this.config.initialVariants)this.config.initialVariants[u]=Xd(this.config.initialVariants[u]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new ih(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new oh(this.config.exposureTrackingProvider)),this.integrationManager=new qd(this.config,this);var c,d=new Ld(this.config.httpClient||Fd);this.flagApi=new md(this.apiKey,this.config.flagsServerUrl,d),this.evaluationApi=new vd(this.apiKey,this.config.serverUrl,d);var h=l?"".concat(this.config.instanceName,"-").concat(l):this.config.instanceName;c=this.isWebExperiment?new Yd:new Kd,this.variants=function(e,t,r){var n=e.substring(e.length-6),i="amp-exp-".concat(t,"-").concat(n);return new Jd(i,r,Xd)}(this.apiKey,h,c),this.flags=function(e,t,r){void 0===r&&(r=new Kd);var n=e.substring(e.length-6),i="amp-exp-".concat(t,"-").concat(n,"-flags");return new Jd(i,r)}(this.apiKey,h,c),this.fetchVariantsOptions=function(e,t,r){void 0===r&&(r=new Kd);var n=e.substring(e.length-6),i="amp-exp-".concat(t,"-").concat(n,"-variants-options");return new Gd(i,r)}(this.apiKey,h,c);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch(e){}this.mergeInitialFlagsWithStorage()}return e.prototype.start=function(e){return Cd(this,void 0,void 0,function(){var t,r,n;return Ed(this,function(i){switch(i.label){case 0:if(this.isRunning)return[2];this.isRunning=!0,this.setUser(e),i.label=1;case 1:return i.trys.push([1,6,,7]),t=this.doFlags(),null===(n=this.config.fetchOnStart)||void 0===n||n?[4,Promise.all([this.fetch(e),t])]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,t];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:if(r=i.sent(),this.config.throwOnError)throw r;return[3,7];case 7:return this.config.pollOnStart&&this.poller.start(),[2]}})})},e.prototype.stop=function(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)},e.prototype.fetch=function(){return Cd(this,arguments,void 0,function(e,t){var r;return void 0===e&&(e=this.user),Ed(this,function(n){switch(n.label){case 0:this.setUser(e||{}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)];case 2:return n.sent(),[3,4];case 3:if(r=n.sent(),this.config.throwOnError)throw r;return r instanceof gd?this.logger.debug(r):this.logger.error(r),[3,4];case 4:return[2,this]}})})},e.prototype.variant=function(e,t){var r,n;if(!this.apiKey)return{value:void 0};var i=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,i),this.logger.debug("[Experiment] variant for ".concat(e," is ").concat((null===(r=i.variant)||void 0===r?void 0:r.key)||(null===(n=i.variant)||void 0===n?void 0:n.value))),i.variant||{}},e.prototype.exposure=function(e){var t=this.variantAndSource(e);this.exposureInternal(e,t)},e.prototype.all=function(){if(!this.apiKey)return{};var e=this.evaluate();for(var t in e){var r=this.flags.get(t);eh(r)||delete e[t]}return kd(kd(kd({},this.secondaryVariants()),this.sourceVariants()),e)},e.prototype.clear=function(){this.variants.clear();try{this.variants.store()}catch(e){}},e.prototype.getUser=function(){var e;if(!this.user)return this.user;if(null===(e=this.user)||void 0===e?void 0:e.user_properties){var t=kd({},this.user.user_properties);return kd(kd({},this.user),{user_properties:t})}return kd({},this.user)},e.prototype.setUser=function(e){var t;if(e)if(null===(t=this.user)||void 0===t?void 0:t.user_properties){var r=kd({},e.user_properties);this.user=kd(kd({},e),{user_properties:r})}else this.user=kd({},e);else this.user=null},e.prototype.getUserProvider=function(){return this.userProvider},e.prototype.setUserProvider=function(e){return this.userProvider=e,this},e.prototype.mergeInitialFlagsWithStorage=function(){var e=this;this.config.initialFlags&&JSON.parse(this.config.initialFlags).forEach(function(t){e.flags.get(t.key)||e.flags.put(t.key,t)})},e.prototype.evaluate=function(e){var t,r,n=this.addContext(this.user),i=function(e,t){var r,n,i=cc({},e),o=[],s=t||Object.keys(i);try{for(var a=pc(s),l=a.next();!l.done;l=a.next()){var u=l.value,c=Gc(u,i);c&&o.push.apply(o,gc([],fc(c),!1))}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o}(this.flags.getAll(),e),o=function(e){var t,r,n,i;if(!e)return{};var o={user:e},s=bd();s&&(o.page={url:s.location.href});var a={};if(!e.groups)return o;try{for(var l=Id(Object.keys(e.groups)),u=l.next();!u.done;u=l.next()){var c=u.value,d=e.groups[c];if(d.length>0&&d[0]){var h=d[0],p={group_name:h},f=null===(i=null===(n=e.group_properties)||void 0===n?void 0:n[c])||void 0===i?void 0:i[h];f&&Object.keys(f).length>0&&(p.group_properties=f),a[c]=p}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return Object.keys(a).length>0&&(o.groups=a),delete o.user.groups,delete o.user.group_properties,o}(n),s=this.engine.evaluate(o,i),a={};try{for(var l=Id(Object.keys(s)),u=l.next();!u.done;u=l.next()){var c=u.value;a[c]=nh(s[c])}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return a},e.prototype.variantAndSource=function(e,t){var r={};this.config.source===_d.LocalStorage?r=this.localStorageVariantAndSource(e,t):this.config.source===_d.InitialVariants&&(r=this.initialVariantsVariantAndSource(e,t));var n=this.flags.get(e);return(eh(n)||!r.variant&&n)&&(r=this.localEvaluationVariantAndSource(e,n,t)),r},e.prototype.localEvaluationVariantAndSource=function(e,t,r){var n,i={},o=this.evaluate([t.key])[e],s=Nd.LocalEvaluation,a=null===(n=null==o?void 0:o.metadata)||void 0===n?void 0:n.default;if(!Qd(o)&&!a)return{variant:rh(o),source:s,hasDefaultVariant:!1};if(a&&(i={variant:rh(o),source:s,hasDefaultVariant:!0}),!Qd(r))return{variant:rh(r),source:Nd.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var l=this.config.initialVariants[e];if(!Qd(l))return{variant:rh(l),source:Nd.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};var u=rh(this.config.fallbackVariant),c={variant:u,source:Nd.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return Zd(u)?i:c},e.prototype.localStorageVariantAndSource=function(e,t){var r,n={},i=this.variants.get(e),o=null===(r=null==i?void 0:i.metadata)||void 0===r?void 0:r.default;if(!Qd(i)&&!o)return{variant:rh(i),source:Nd.LocalStorage,hasDefaultVariant:!1};if(o&&(n={variant:rh(i),source:Nd.LocalStorage,hasDefaultVariant:!0}),!Qd(t))return{variant:rh(t),source:Nd.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var s=this.config.initialVariants[e];if(!Qd(s))return{variant:rh(s),source:Nd.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};var a=rh(this.config.fallbackVariant),l={variant:a,source:Nd.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return Zd(a)?n:l},e.prototype.initialVariantsVariantAndSource=function(e,t){var r,n={},i=this.config.initialVariants[e];if(!Qd(i))return{variant:rh(i),source:Nd.InitialVariants,hasDefaultVariant:!1};var o=this.variants.get(e),s=null===(r=null==o?void 0:o.metadata)||void 0===r?void 0:r.default;if(!Qd(o)&&!s)return{variant:rh(o),source:Nd.LocalStorage,hasDefaultVariant:!1};if(s&&(n={variant:rh(o),source:Nd.LocalStorage,hasDefaultVariant:!0}),!Qd(t))return{variant:rh(t),source:Nd.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var a=rh(this.config.fallbackVariant),l={variant:a,source:Nd.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return Zd(a)?n:l},e.prototype.fetchInternal=function(e,t,r,n){return Cd(this,void 0,void 0,function(){var i,o,s;return Ed(this,function(a){switch(a.label){case 0:if(!this.apiKey)throw Error("Experiment API key is empty");this.logger.debug("[Experiment] Fetch all: retry=".concat(r)),r&&this.stopRetries(),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.doFetch(e,t,kd({trackingOption:null===(s=this.fetchVariantsOptions.get())||void 0===s?void 0:s.trackingOption},n))];case 2:return i=a.sent(),[4,this.storeVariants(i,n)];case 3:return a.sent(),[2,i];case 4:throw o=a.sent(),r&&this.shouldRetryFetch(o)&&this.startRetries(e,n),o;case 5:return[2]}})})},e.prototype.setTracksAssignment=function(e){return Cd(this,void 0,void 0,function(){return Ed(this,function(t){return this.fetchVariantsOptions.put(kd(kd({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"})),this.fetchVariantsOptions.store(),[2]})})},e.prototype.cleanUserPropsForFetch=function(e){var t=kd({},e);return delete t.cookie,t},e.prototype.doFetch=function(e,t,r){return Cd(this,void 0,void 0,function(){var n,i,o,s,a,l,u;return Ed(this,function(c){switch(c.label){case 0:return[4,this.addContextOrWait(e)];case 1:return e=c.sent(),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e),[4,this.evaluationApi.getVariants(e,kd({timeoutMillis:t},r))];case 2:n=c.sent(),i={};try{for(o=Id(Object.keys(n)),s=o.next();!s.done;s=o.next())a=s.value,i[a]=nh(n[a])}catch(e){l={error:e}}finally{try{s&&!s.done&&(u=o.return)&&u.call(o)}finally{if(l)throw l.error}}return this.logger.debug("[Experiment] Received variants: ",i),[2,i]}})})},e.prototype.doFlags=function(){return Cd(this,void 0,void 0,function(){var e,t,r;return Ed(this,function(n){switch(n.label){case 0:return n.trys.push([0,4,,5]),e=void 0,this.isWebExperiment?[4,this.addContextOrWait(this.getUser())]:[3,2];case 1:e=n.sent(),n.label=2;case 2:return[4,this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:Bd,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?"web":void 0,user:(null==e?void 0:e.user_id)||(null==e?void 0:e.device_id)?{user_id:null==e?void 0:e.user_id,device_id:null==e?void 0:e.device_id}:void 0})];case 3:return t=n.sent(),this.flags.clear(),this.flags.putAll(t),[3,5];case 4:if(!((r=n.sent())instanceof gd))throw r;if(this.logger.debug(r),this.config.throwOnError)throw r;return[3,5];case 5:try{this.flags.store()}catch(e){}return this.mergeInitialFlagsWithStorage(),[2]}})})},e.prototype.storeVariants=function(e,t){return Cd(this,void 0,void 0,function(){var r,n,i,o;return Ed(this,function(s){for(o in 0===(r=t&&t.flagKeys?t.flagKeys:[]).length&&this.variants.clear(),n=function(t){r=r.filter(function(e){return e!==t}),i.variants.put(t,e[t])},i=this,e)n(o);for(o in r)this.variants.remove(o);try{this.variants.store()}catch(e){}return this.logger.debug("[Experiment] Stored variants: ",e),[2]})})},e.prototype.startRetries=function(e,t){return Cd(this,void 0,void 0,function(){var r=this;return Ed(this,function(n){return this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new th(8,500,1e4,1.5),this.retriesBackoff.start(function(){return Cd(r,void 0,void 0,function(){return Ed(this,function(r){switch(r.label){case 0:return[4,this.fetchInternal(e,1e4,!1,t)];case 1:return r.sent(),[2]}})})}),[2]})})},e.prototype.stopRetries=function(){this.retriesBackoff&&this.retriesBackoff.cancel()},e.prototype.addContext=function(e){var t,r=null===(t=this.userProvider)||void 0===t?void 0:t.getUser(),n=this.integrationManager.getUser(),i=kd(kd(kd({},null==r?void 0:r.user_properties),n.user_properties),null==e?void 0:e.user_properties);return kd(kd(kd(kd({library:"experiment-js-client/".concat(Bd)},r),n),e),{user_properties:i})},e.prototype.addContextOrWait=function(e){return Cd(this,void 0,void 0,function(){return Ed(this,function(t){switch(t.label){case 0:return[4,this.integrationManager.ready()];case 1:return t.sent(),[2,this.addContext(e)]}})})},e.prototype.sourceVariants=function(){return this.config.source==_d.LocalStorage?this.variants.getAll():this.config.source==_d.InitialVariants?this.config.initialVariants:void 0},e.prototype.secondaryVariants=function(){return this.config.source==_d.LocalStorage?this.config.initialVariants:this.config.source==_d.InitialVariants?this.variants.getAll():void 0},e.prototype.exposureInternal=function(e,t){var r,n,i,o,s,a,l,u,c;if(null===(i=null===(n=null===(r=t.variant)||void 0===r?void 0:r.metadata)||void 0===n?void 0:n.trackExposure)||void 0===i||i){this.legacyExposureInternal(e,t.variant,t.source);var d={flag_key:e},h=Ud(t.source);if(!h||t.hasDefaultVariant){(null===(o=t.variant)||void 0===o?void 0:o.expKey)&&(d.experiment_key=null===(s=t.variant)||void 0===s?void 0:s.expKey);var p=null===(a=t.variant)||void 0===a?void 0:a.metadata;if(h||(null==p?void 0:p.default)||((null===(l=t.variant)||void 0===l?void 0:l.key)?d.variant=t.variant.key:(null===(u=t.variant)||void 0===u?void 0:u.value)&&(d.variant=t.variant.value)),p&&(d.metadata=p),this.isWebExperiment&&(d.time=Date.now()),this.isWebExperiment){var f=bd();if(null==f?void 0:f.location)try{var g=f.location.href;d.metadata.url=g.split("?")[0]||""}catch(e){}}var v=this.addContext(this.getUser());null===(c=this.userSessionExposureTracker)||void 0===c||c.track(d,v),this.integrationManager.track(d)}}},e.prototype.legacyExposureInternal=function(e,t,r){var n,i,o,s,a;if(this.analyticsProvider){var l=function(e,t,r,n){var i,o=null==r?void 0:r.value,s="[Experiment] ".concat(t);return{name:"[Experiment] Exposure",user:e,key:t,variant:r,userProperty:s,properties:{key:t,variant:o,source:n},userProperties:(i={},i[s]=o,i)}}(this.addContext(this.getUser()),e,t,r);Ud(r)||!(null==t?void 0:t.value)?null===(i=null===(n=this.analyticsProvider)||void 0===n?void 0:n.unsetUserProperty)||void 0===i||i.call(n,l):(null==t?void 0:t.value)&&(null===(s=null===(o=this.analyticsProvider)||void 0===o?void 0:o.setUserProperty)||void 0===s||s.call(o,l),null===(a=this.analyticsProvider)||void 0===a||a.track(l))}},e.getLogLevel=function(e){var t;return!0===e.debug?Ad.Debug:null!==(t=e.logLevel)&&void 0!==t?t:Ad.Error},e.prototype.shouldRetryFetch=function(e){return!(e instanceof fd)||(e.statusCode<400||e.statusCode>=500||429===e.statusCode)},e.prototype.addPlugin=function(e){"integration"===e.type&&this.integrationManager.setIntegration(e)},e}(),ah=function(){function e(e,t){var r,n,i;this.globalScope=bd(),this.userAgent=void 0!==(null===(r=this.globalScope)||void 0===r?void 0:r.navigator)?null===(n=this.globalScope)||void 0===n?void 0:n.navigator.userAgent:void 0,this.ua=new Sd.UAParser(this.userAgent).getResult(),this.localStorage=new Kd,this.sessionStorage=new Yd,this.userProvider=e,this.apiKey=t,this.storageKey="EXP_".concat(null===(i=this.apiKey)||void 0===i?void 0:i.slice(0,10),"_DEFAULT_USER_PROVIDER")}return e.prototype.getUser=function(){var e,t,r,n,i,o=(null===(e=this.userProvider)||void 0===e?void 0:e.getUser())||{};return kd({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!==(r=null===(t=this.ua.device)||void 0===t?void 0:t.type)&&void 0!==r?r:"desktop",referring_url:null===(i=null===(n=this.globalScope)||void 0===n?void 0:n.document)||void 0===i?void 0:i.referrer.replace(/\/$/,""),cookie:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},o)},e.prototype.getLanguage=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},e.prototype.getOs=function(e){var t,r;return[null===(t=e.browser)||void 0===t?void 0:t.name,null===(r=e.browser)||void 0===r?void 0:r.major].filter(function(e){return null!=e}).join(" ")},e.prototype.getDeviceModel=function(e){var t;return null===(t=e.os)||void 0===t?void 0:t.name},e.prototype.getBrowser=function(e){var t,r=null===(t=e.browser)||void 0===t?void 0:t.name;return(null==r?void 0:r.includes("Chrom"))&&(r="Chrome"),(null==r?void 0:r.includes("Firefox"))&&(r="Firefox"),(null==r?void 0:r.includes("Safari"))&&(r="Safari"),(null==r?void 0:r.includes("Edge"))&&(r="Edge"),(null==r?void 0:r.includes("Opera"))&&(r="Opera"),r},e.prototype.getCookie=function(){var e,t,r,n,i;if(null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.document)||void 0===t?void 0:t.cookie)return Object.fromEntries(null===(i=null===(n=null===(r=this.globalScope)||void 0===r?void 0:r.document)||void 0===n?void 0:n.cookie)||void 0===i?void 0:i.split("; ").map(function(e){return e.split("=")}))},e.prototype.getLandingUrl=function(){var e,t;try{var r=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return r.landing_url||(r.landing_url=null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.location)||void 0===t?void 0:t.href.replace(/\/$/,""),this.sessionStorage.put(this.storageKey,JSON.stringify(r))),r.landing_url}catch(e){return}},e.prototype.getFirstSeen=function(){try{var e=JSON.parse(this.localStorage.get(this.storageKey)||"{}");return e.first_seen||(e.first_seen=(Date.now()/1e3).toString(),this.localStorage.put(this.storageKey,JSON.stringify(e))),e.first_seen}catch(e){return}},e.prototype.getUrlParam=function(){var e,t,r;if(this.globalScope){var n={};try{var i=new URL(this.globalScope.location.href);try{for(var o=Id(i.searchParams),s=o.next();!s.done;s=o.next()){var a=Od(s.value,2),l=a[0],u=a[1];n[l]=Pd(Pd([],Od(null!==(r=n[l])&&void 0!==r?r:[]),!1),Od(u.split(",")),!1)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){return}return Object.entries(n).reduce(function(e,t){var r=Od(t,2),n=r[0],i=r[1];return e[n]=1==i.length?i[0]:i,e},{})}},e}();yd.experimentInstances={};var lh=yd.experimentInstances,uh=function(e){return(null==e?void 0:e.instanceName)||jd.instanceName},ch=function(e,t,r){var n=function(e,t){var r=uh(t),n=null==t?void 0:t.internalInstanceNameSuffix;return n?"".concat(r,".").concat(e,".").concat(n):"".concat(r,".").concat(e)}(e,t),i=lh[n];return i||(i=function(e,t){return new sh(e,kd(kd({},t),{userProvider:new ah(null==t?void 0:t.userProvider,e)}))}(e,t),r&&i.addPlugin(r()),lh[n]=i,i)},dh=function(){function e(t){this.name=e.pluginName,this.config=t}return e.prototype.setup=function(e,t){var r,n;return l(this,void 0,void 0,function(){var t;return u(this,function(i){return t=void 0!==(null===(r=this.config)||void 0===r?void 0:r.instanceName)||void 0===e.instanceName?this.config:s(s({},this.config),{instanceName:e.instanceName}),this.experiment=function(e,t){return ch(e,t,function(){return new Md(e,Ae.getInstance(uh(t)),1e4)})}((null===(n=this.config)||void 0===n?void 0:n.deploymentKey)||e.apiKey,t),[2]})})},e.pluginName="@amplitude/experiment-analytics-plugin",e}(),hh=function(e){return new dh(e)},ph=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:fh(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),fh=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},gh=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(t){e(t)}),this.queue=[])},e}(),vh=function(){return vh=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},vh.apply(this,arguments)};function mh(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function yh(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}var bh=function(e,t){var r,n,i=typeof e;if(i!==typeof t)return!1;try{for(var o=mh(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next()){if(s.value===i)return e===t}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}if(null==e&&null==t)return!0;if(null==e||null==t||e.length!==t.length)return!1;var a=Array.isArray(e),l=Array.isArray(t);if(a!==l)return!1;if(!a||!l){var u=Object.keys(e).sort(),c=Object.keys(t).sort();if(!bh(u,c))return!1;var d=!0;return Object.keys(e).forEach(function(r){bh(e[r],t[r])||(d=!1)}),d}for(var h=0;h<e.length;h++)if(!bh(e[h],t[h]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=new Array(r);r--;)n[r]=[t[r],e[t[r]]];return n});var wh=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=vh({},this.identity.userProperties),r=vh(vh({},this.identity),{userProperties:t});return{setUserId:function(e){return r.userId=e,this},setDeviceId:function(e){return r.deviceId=e,this},setUserProperties:function(e){return r.userProperties=e,this},setOptOut:function(e){return r.optOut=e,this},updateUserProperties:function(e){var t,n,i,o,s,a,l=r.userProperties||{};try{for(var u=mh(Object.entries(e)),c=u.next();!c.done;c=u.next()){var d=yh(c.value,2),h=d[0],p=d[1];switch(h){case"$set":try{for(var f=(i=void 0,mh(Object.entries(p))),g=f.next();!g.done;g=f.next()){var v=yh(g.value,2),m=v[0],y=v[1];l[m]=y}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,mh(Object.keys(p))),w=b.next();!w.done;w=b.next()){delete l[m=w.value]}}catch(e){s={error:e}}finally{try{w&&!w.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":l={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return r.userProperties=l,this},commit:function(){return e.setIdentity(r),this}}},e.prototype.getIdentity=function(){return vh({},this.identity)},e.prototype.setIdentity=function(e){var t=vh({},this.identity);this.identity=vh({},e),bh(t,this.identity)||this.listeners.forEach(function(t){t(e)})},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),Sh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:self,xh=function(){function e(){this.identityStore=new wh,this.eventBridge=new gh,this.applicationContextProvider=new ph}return e.getInstance=function(t){return Sh.analyticsConnectorInstances||(Sh.analyticsConnectorInstances={}),Sh.analyticsConnectorInstances[t]||(Sh.analyticsConnectorInstances[t]=new e),Sh.analyticsConnectorInstances[t]},e}(),kh=["boot"],Ch=Symbol.for("amplitude-engagement-plugin-caller");var Eh=(e=>(e.Local="https://local.amplitude.com:3010/",e.Staging="https://apps.stag2.amplitude.com/",e.Production="https://app.amplitude.com/",e.ProductionEU="https://app.eu.amplitude.com/",e))(Eh||{});var Ih=((e=>{if(typeof window<"u"&&window.opener)for(let t of Object.values(Eh))window.opener.postMessage({message:e},t)})("ENGAGEMENT_SNIPPET"),function(e){var t,r,n,i,o,s,a,l,u,c;let d=typeof window<"u"?window.engagement:void 0,h=!1,p={_q:null!=(t=null==d?void 0:d._q)?t:[],_configuration:{apiKey:null!=(n=null==(r=null==d?void 0:d._configuration)?void 0:r.apiKey)?n:"",serverUrl:null==(i=null==d?void 0:d._configuration)?void 0:i.serverUrl,chatUrl:null==(o=null==d?void 0:d._configuration)?void 0:o.chatUrl,mediaUrl:null==(s=null==d?void 0:d._configuration)?void 0:s.mediaUrl,serverZone:null!=(l=null==(a=null==d?void 0:d._configuration)?void 0:a.serverZone)?l:"US",autoRefreshIntervalSeconds:null==(u=null==d?void 0:d._configuration)?void 0:u.autoRefreshIntervalSeconds,options:{...null==(c=null==d?void 0:d._configuration)?void 0:c.options}},init(t,r){var n,i,o,s;if(p._configuration.apiKey)return void console.log("Engagement SDK has already been initialized. Ignoring additional init call.");if(!0===(null==r?void 0:r.skip))return console.log("Engagement SDK init skipped via `skip: true`. The SDK bundle will not be loaded."),void(h=!0);if(h&&(p._q.length=0),h=!1,null!=r&&r.useEngagementDomain){let e="EU"===(null!=(n=r.serverZone)?n:p._configuration.serverZone),t="amplitudeengagement.com";r.serverUrl||(r.serverUrl=e?`https://gs.eu.${t}`:`https://gs.${t}`),r.chatUrl||(r.chatUrl=e?`https://houston-chat.eu.${t}`:`https://houston-chat.${t}`),r.mediaUrl||(r.mediaUrl=e?`https://engagement-static.eu.${t}`:`https://engagement-static.${t}`),r.cdnUrl||(r.cdnUrl=e?`https://cdn.eu.${t}`:`https://cdn.${t}`)}let a;if(p._configuration={...p._configuration,...r,apiKey:t,options:{splitting:!0,...p._configuration.options,...null==r?void 0:r.options}},null!=(o=null==(i=p._configuration)?void 0:i.options)&&o.logger&&p._configuration.options.logger.enable(null!=(s=p._configuration.options.logLevel)?s:2),null!=r&&r.cdnUrl)a=p._configuration.options.splitting?`${r.cdnUrl}/engagement-browser/prod/split/index.js`:r.cdnUrl+"/engagement-browser/prod/index.min.js.gz";else{let e="EU"===p._configuration.serverZone?"https://cdn.eu.amplitude.com":"https://cdn.amplitude.com";a=p._configuration.options.splitting?`${e}/engagement-browser/prod/split/index.js`:`${e}/engagement-browser/prod/index.min.js.gz`}let l=null,u=()=>{if(h=!0,l&&(clearTimeout(l),l=null),p._q&&p._q.length>0)for(console.warn(`Engagement SDK failed to load within ${c}ms. Resolving pending calls gracefully.`);p._q.length>0;){let e=p._q.shift();if(!e)continue;let t=e[0],r=kh.includes(t);if(console.warn(`Engagement SDK method '${t}' still in queue (isAsyncMethod=${r}); attempting to resolve as no-op.`),r&&e[1]instanceof Function&&e[2]instanceof Function){let r=e[1];console.warn(`Engagement SDK method '${t}' resolved as no-op due to script loading failure`),r(void 0)}}};e(a,p._configuration.options.splitting?"module":void 0,null==r?void 0:r.nonce,u);let c=1e4;l=setTimeout(()=>{u()},c)},plugin(e){let t=p.init,r=null==e?void 0:e.token,n=!0===(null==e?void 0:e.skip),i=(e,t)=>{let n=t.getIdentity(),i="function"==typeof r?r():r;return{user_id:e.getUserId(),device_id:e.getDeviceId(),user_properties:n.userProperties,getSessionId:e.getSessionId,...i?{token:i}:{}}};return{name:"@amplitude/engagement-browser",type:"enrichment",async setup(r,o){var s;if(n)return void t(r.apiKey,{skip:!0});let a=null!=(s=r.instanceName)?s:"$default_instance",l=xh.getInstance(a).identityStore;p._configuration._installedViaPlugin=!0,t(r.apiKey,{serverZone:r.serverZone,...e,options:{logLevel:r.logLevel,logger:r.loggerProvider,...null==e?void 0:e.options}});let u=[{track:e=>{o.track(e)}}];await window.engagement.boot({user:()=>i(o,l),integrations:u},Ch),l.addIdentityListener(e=>{var t,r,n,s;null!=(t=window.engagement)&&t._.user&&null!=(r=window.engagement)&&r._analytics.hasBooted?(null==(s=null==(n=window.engagement)?void 0:n._.user)?void 0:s.user_id)!==e.userId?(window.engagement.shutdown(Ch),window.engagement.boot({user:()=>i(o,l),integrations:u},Ch)):window.engagement._setUserProperties(e.userProperties):console.warn("Engagement SDK not booted. Ignoring identity change.")})},execute:async e=>(n||window.engagement.forwardEvent(e),e)}}},f=p;return new Proxy(p,{get:function(e,t){return t in f?f[t]:"then"!==t?"gs"===t||"rc"===t||"assistant"===t?new Proxy({},{get:function(e,r){return function(){let e=Array.from(arguments),n=`${t}.${r}`;e.unshift(n),p._q.push(e)}}}):kh.includes(t)?function(){let e=Array.prototype.slice.call(arguments);return new Promise((r,n)=>{e.unshift(t,r,n),p._q.push(e),h&&r(void 0)})}:function(){let e=Array.prototype.slice.call(arguments);e.unshift(t),p._q.push(e)}:void 0}})}((e,t,r,n)=>function(e,t,r,n){for(let i of e){let e=document.createElement("script");e.src=i,e.id="engagement-sdk-bundle",r&&e.setAttribute("nonce",r),t&&e.setAttribute("type",t),n&&(e.onerror=n);let o=document.getElementsByTagName("head")[0];o&&o.appendChild(e)}}([e||"https://cdn.amplitude.com/engagement-browser/prod/index.min.js.gz"],t,r,n))),Oh=e=>(typeof window<"u"&&!window.engagement&&(window.engagement=Ih),Ih.plugin(e)),Ph=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.sessionReplay=function(){return this._sessionReplay},t.prototype.experiment=function(){if(void 0!==this.config){var e=this.plugins(dh);return 0===e.length?void this.config.loggerProvider.debug("".concat(dh.pluginName," plugin is not found.")):1===e.length?e[0].experiment:void this.config.loggerProvider.debug("Multiple instances of ".concat(dh.pluginName," are found."))}},t.prototype.initAll=function(t,r){return l(this,void 0,void 0,function(){var n=this;return u(this,function(i){return this._initAllPromise||(this._initAllPromise=l(n,void 0,void 0,function(){var n,i;return u(this,function(o){switch(o.label){case 0:return n={serverZone:null==r?void 0:r.serverZone,instanceName:null==r?void 0:r.instanceName},e.prototype.add.call(this,{type:"enrichment",name:"@amplitude/unified-library-plugin",execute:function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(r){return e.library="".concat("amplitude-ts-unified","/").concat("1.1.35","-").concat(null!==(t=e.library)&&void 0!==t?t:""),[2,e]})})}}),[4,e.prototype.init.call(this,t,s(s({},null==r?void 0:r.analytics),n)).promise];case 1:return o.sent(),[4,e.prototype.add.call(this,(a=s(s({},null==r?void 0:r.sessionReplay),n),new ac(a))).promise];case 2:return o.sent(),[4,e.prototype.add.call(this,hh(s(s({},null==r?void 0:r.experiment),n))).promise];case 3:return o.sent(),void 0===(i=this.plugin(ac.pluginName))?this.config.loggerProvider.debug("".concat(ac.pluginName," plugin is not found.")):this._sessionReplay=i.sessionReplay,[4,e.prototype.add.call(this,Oh(s(s({},null==r?void 0:r.engagement),n))).promise];case 4:return o.sent(),[2]}var a})}).finally(function(){n._initAllPromise=void 0})),[2,this._initAllPromise]})})},t.prototype.init=function(t,r,n){return void 0===t&&(t=""),e.prototype.init.call(this,t,r,n)},t}(fa),Th=function(){var e=new Ph;return{_setDiagnosticsSampleRate:be(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",ve(e),ye(e,["config"])),experiment:be(e.experiment.bind(e),"experiment",ve(e),ye(e,["config"])),sessionReplay:be(e.sessionReplay.bind(e),"sessionReplay",ve(e),ye(e,["config"])),initAll:be(e.initAll.bind(e),"initAll",ve(e),ye(e,["config"])),init:be(e.init.bind(e),"init",ve(e),ye(e,["config"])),add:be(e.add.bind(e),"add",ve(e),ye(e,["config.apiKey","timeline.plugins"])),remove:be(e.remove.bind(e),"remove",ve(e),ye(e,["config.apiKey","timeline.plugins"])),track:be(e.track.bind(e),"track",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),logEvent:be(e.logEvent.bind(e),"logEvent",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),identify:be(e.identify.bind(e),"identify",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),groupIdentify:be(e.groupIdentify.bind(e),"groupIdentify",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),setGroup:be(e.setGroup.bind(e),"setGroup",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),revenue:be(e.revenue.bind(e),"revenue",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),flush:be(e.flush.bind(e),"flush",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),getUserId:be(e.getUserId.bind(e),"getUserId",ve(e),ye(e,["config","config.userId"])),setUserId:be(e.setUserId.bind(e),"setUserId",ve(e),ye(e,["config","config.userId"])),getDeviceId:be(e.getDeviceId.bind(e),"getDeviceId",ve(e),ye(e,["config","config.deviceId"])),setDeviceId:be(e.setDeviceId.bind(e),"setDeviceId",ve(e),ye(e,["config","config.deviceId"])),reset:be(e.reset.bind(e),"reset",ve(e),ye(e,["config","config.userId","config.deviceId"])),getSessionId:be(e.getSessionId.bind(e),"getSessionId",ve(e),ye(e,["config"])),setSessionId:be(e.setSessionId.bind(e),"setSessionId",ve(e),ye(e,["config"])),extendSession:be(e.extendSession.bind(e),"extendSession",ve(e),ye(e,["config"])),setOptOut:be(e.setOptOut.bind(e),"setOptOut",ve(e),ye(e,["config"])),getOptOut:be(e.getOptOut.bind(e),"getOptOut",ve(e),ye(e,["config"])),setTransport:be(e.setTransport.bind(e),"setTransport",ve(e),ye(e,["config"])),getIdentity:be(e.getIdentity.bind(e),"getIdentity",ve(e),ye(e,["config"])),setIdentity:be(e.setIdentity.bind(e),"setIdentity",ve(e),ye(e,["config","config.userId","config.deviceId"]))}},Rh=Th(),Mh=Rh._setDiagnosticsSampleRate,Ah=Rh.initAll,_h=Rh.experiment,Nh=Rh.sessionReplay,Dh=Rh.add,Lh=Rh.extendSession,Fh=Rh.flush,Uh=Rh.getDeviceId,jh=Rh.getIdentity,Bh=Rh.getOptOut,qh=Rh.getSessionId,zh=Rh.getUserId,Wh=Rh.groupIdentify,Vh=Rh.identify,$h=Rh.logEvent,Hh=Rh.remove,Kh=Rh.reset,Gh=Rh.revenue,Jh=Rh.setDeviceId,Xh=Rh.setGroup,Yh=Rh.setIdentity,Qh=Rh.setOptOut,Zh=Rh.setSessionId,ep=Rh.setTransport,tp=Rh.setUserId,rp=Rh.track,np=function(e,t){return np=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},np(e,t)};var ip=function(){return ip=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ip.apply(this,arguments)};function op(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}"function"==typeof SuppressedError&&SuppressedError;var sp="is",ap="is not",lp="contains",up="does not contain",cp="less",dp="less or equal",hp="greater",pp="greater or equal",fp="version less",gp="version less or equal",vp="version greater",mp="version greater or equal",yp="set is",bp="set is not",wp="set contains",Sp="set does not contain",xp="set contains any",kp="set does not contain any",Cp="regex match",Ep="regex does not match",Ip=-862048943,Op=461845907,Pp=function(e,t){void 0===t&&(t=0);for(var r=function(e){for(var t=[],r=0,n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return Uint8Array.from(t)}(e),n=r.length,i=n>>2,o=t,s=0;s<i;s++){var a=Ap(r,s<<2);o=Tp(a,o)}var l=i<<2,u=0;switch(n-l){case 3:u^=r[l+2]<<16,u^=r[l+1]<<8,u^=r[l],u=Math.imul(u,Ip),u=Mp(u,15),o^=u=Math.imul(u,Op);break;case 2:u^=r[l+1]<<8,u^=r[l],u=Math.imul(u,Ip),u=Mp(u,15),o^=u=Math.imul(u,Op);break;case 1:u^=r[l],u=Math.imul(u,Ip),u=Mp(u,15),o^=u=Math.imul(u,Op)}return Rp(o^=n)>>>0},Tp=function(e,t){var r=e,n=t;return r=Math.imul(r,Ip),r=Mp(r,15),r=Math.imul(r,Op),n=Mp(n^=r,13),(n=Math.imul(n,5))+-430675100|0},Rp=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-2048144789),t^=t>>>13,t=Math.imul(t,-1028477387),t^=t>>>16},Mp=function(e,t,r){return void 0===r&&(r=32),t>r&&(t%=r),(e<<t|(e&4294967295<<r-t>>>0)>>>0>>>r-t>>>0)>>>0},Ap=function(e,t){void 0===t&&(t=0);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return _p(r)},_p=function(e){return(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24},Np=function(e,t){var r,n;if(t&&0!==t.length){try{for(var i=op(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!s||!e||"object"!=typeof e)return;e=e[s]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e||void 0}},Dp="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),Lp=function(){function e(e,t,r,n){void 0===n&&(n=void 0),this.major=e,this.minor=t,this.patch=r,this.preRelease=n}return e.parse=function(t){if(t){var r=new RegExp(Dp).exec(t);if(r){var n=Number(r[1]),i=Number(r[2]);if(!isNaN(n)&&!isNaN(i))return new e(n,i,Number(r[4])||0,r[5]||void 0)}}},e.prototype.compareTo=function(e){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch||this.preRelease&&!e.preRelease?-1:!this.preRelease&&e.preRelease?1:this.preRelease&&e.preRelease?this.preRelease>e.preRelease?1:this.preRelease<e.preRelease?-1:0:0},e}(),Fp=function(){function e(){}return e.prototype.evaluate=function(e,t){var r,n,i={},o={context:e,result:i};try{for(var s=op(t),a=s.next();!a.done;a=s.next()){var l=a.value,u=this.evaluateFlag(o,l);u&&(i[l.key]=u)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},e.prototype.evaluateFlag=function(e,t){var r,n,i;try{for(var o=op(t.segments),s=o.next();!s.done;s=o.next()){var a=s.value;if(i=this.evaluateSegment(e,t,a)){var l=ip(ip(ip({},t.metadata),a.metadata),i.metadata);i=ip(ip({},i),{metadata:l});break}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e.prototype.evaluateSegment=function(e,t,r){var n,i,o,s;if(!r.conditions)return void 0!==(u=this.bucket(e,r))?t.variants[u]:void 0;try{for(var a=op(r.conditions),l=a.next();!l.done;l=a.next()){var u,c=l.value,d=!0;try{for(var h=(o=void 0,op(c)),p=h.next();!p.done;p=h.next()){var f=p.value;if(!(d=this.matchCondition(e,f)))break}}catch(e){o={error:e}}finally{try{p&&!p.done&&(s=h.return)&&s.call(h)}finally{if(o)throw o.error}}if(d)return void 0!==(u=this.bucket(e,r))?t.variants[u]:void 0}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}},e.prototype.matchCondition=function(e,t){var r=Np(e,t.selector);if(r){if(this.isSetOperator(t.op)){var n=this.coerceStringArray(r);return!!n&&this.matchSet(n,t.op,t.values)}var i=this.coerceString(r);return void 0!==i&&this.matchString(i,t.op,t.values)}return this.matchNull(t.op,t.values)},e.prototype.getHash=function(e){return Pp(e)},e.prototype.bucket=function(e,t){var r,n,i,o;if(!t.bucket)return t.variant;var s=this.coerceString(Np(e,t.bucket.selector));if(!s||0===s.length)return t.variant;var a="".concat(t.bucket.salt,"/").concat(s),l=this.getHash(a),u=l%100,c=Math.floor(l/100);try{for(var d=op(t.bucket.allocations),h=d.next();!h.done;h=d.next()){var p=h.value,f=p.range[0],g=p.range[1];if(u>=f&&u<g)try{for(var v=(i=void 0,op(p.distributions)),m=v.next();!m.done;m=v.next()){var y=m.value,b=y.range[0],w=y.range[1];if(c>=b&&c<w)return y.variant}}catch(e){i={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return t.variant},e.prototype.matchNull=function(e,t){var r=this.containsNone(t);switch(e){case sp:case lp:case cp:case dp:case hp:case pp:case fp:case gp:case vp:case mp:case yp:case wp:case xp:return r;case ap:case up:case Sp:case kp:return!r;default:return!1}},e.prototype.matchSet=function(e,t,r){switch(t){case yp:return this.setEquals(e,r);case bp:return!this.setEquals(e,r);case wp:return this.matchesSetContainsAll(e,r);case Sp:return!this.matchesSetContainsAll(e,r);case xp:return this.matchesSetContainsAny(e,r);case kp:return!this.matchesSetContainsAny(e,r);default:return!1}},e.prototype.matchString=function(e,t,r){var n=this;switch(t){case sp:return this.matchesIs(e,r);case ap:return!this.matchesIs(e,r);case lp:return this.matchesContains(e,r);case up:return!this.matchesContains(e,r);case cp:case dp:case hp:case pp:return this.matchesComparable(e,t,r,function(e){return n.parseNumber(e)},this.comparator);case fp:case gp:case vp:case mp:return this.matchesComparable(e,t,r,function(e){return Lp.parse(e)},this.versionComparator);case Cp:return this.matchesRegex(e,r);case Ep:return!this.matchesRegex(e,r);default:return!1}},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var r=e.toLowerCase();if("true"===r||"false"===r)return t.some(function(e){return e.toLowerCase()===r})}return t.some(function(t){return e===t})},e.prototype.matchesContains=function(e,t){var r,n;try{for(var i=op(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.toLowerCase().includes(s.toLowerCase()))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e.prototype.matchesComparable=function(e,t,r,n,i){var o=this,s=n(e),a=r.map(function(e){return n(e)}).filter(function(e){return void 0!==e});return void 0===s||0===a.length?r.some(function(r){return o.comparator(e,t,r)}):a.some(function(e){return i(s,t,e)})},e.prototype.comparator=function(e,t,r){switch(t){case cp:case fp:return e<r;case dp:case gp:return e<=r;case hp:case vp:return e>r;case pp:case mp:return e>=r;default:return!1}},e.prototype.versionComparator=function(e,t,r){var n=e.compareTo(r);switch(t){case cp:case fp:return n<0;case dp:case gp:return n<=0;case hp:case vp:return n>0;case pp:case mp:return n>=0;default:return!1}},e.prototype.matchesRegex=function(e,t){return t.some(function(t){return Boolean(new RegExp(t).exec(e))})},e.prototype.containsNone=function(e){return e.some(function(e){return"(none)"===e})},e.prototype.containsBooleans=function(e){return e.some(function(e){switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})},e.prototype.parseNumber=function(e){var t;return null!==(t=Number(e))&&void 0!==t?t:void 0},e.prototype.coerceString=function(e){if(e)return"object"==typeof e?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e))return e.map(function(e){return t.coerceString(e)}).filter(Boolean);var r=String(e);try{var n=JSON.parse(r);return Array.isArray(n)?e.map(function(e){return t.coerceString(e)}).filter(Boolean):void 0}catch(e){return}},e.prototype.isSetOperator=function(e){switch(e){case yp:case bp:case wp:case Sp:case xp:case kp:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var r=new Set(e),n=new Set(t);return r.size===n.size&&function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([],function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}(n),!1).every(function(e){return r.has(e)})},e.prototype.matchesSetContainsAll=function(e,t){var r,n;if(e.length<t.length)return!1;try{for(var i=op(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!this.matchesIs(s,e))return!1}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0},e.prototype.matchesSetContainsAny=function(e,t){var r,n;try{for(var i=op(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(this.matchesIs(s,e))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e}();"function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder;(e=>{let t={};e.forEach((e,r)=>t[e]=r)})(Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")),String.fromCharCode.bind(String),"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),function(e){function t(r,n){var i=e.call(this,n)||this;return i.statusCode=r,Object.setPrototypeOf(i,t.prototype),i}(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}np(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)})(t,e)}(Error);var Up,jp=function(){var e=this;this.dbs={},this.createStore=function(t){return l(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,Tl(t,1,{upgrade:function(e){e.objectStoreNames.contains("eventTypesForSession")||e.createObjectStore("eventTypesForSession",{keyPath:"sessionId"})}})];case 1:return[2,e.sent()]}})})},this.openOrCreateDB=function(t){return l(e,void 0,void 0,function(){var e,r;return u(this,function(n){switch(n.label){case 0:return this.dbs&&this.dbs[t]?[2,this.dbs[t]]:(e="".concat(t.substring(0,10),"_amp_targeting"),[4,this.createStore(e)]);case 1:return r=n.sent(),this.dbs[t]=r,[2,r]}})})},this.updateEventListForSession=function(t){var r=t.sessionId,n=t.eventType,i=t.eventTime,o=t.loggerProvider,a=t.tx;return l(e,void 0,void 0,function(){var e,t,l,c,d,h,p,f,g;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,3,,4]),e=String(r),[4,a.store.get(e)];case 1:return t=u.sent(),l=t?t.eventTypes:{},c=l[n]||{},d=s(s({},l),((f={})[n]=s(s({},c),((g={})[i]={event_type:n},g)),f)),h={sessionId:e,eventTypes:d,lastUpdated:Date.now()},[4,a.store.put(h)];case 2:return u.sent(),[2,d];case 3:return p=u.sent(),o.warn("Failed to store events for targeting ".concat(r,": ").concat(p)),[3,4];case 4:return[2,void 0]}})})},this.deleteOldSessionEventTypes=function(t){var r=t.currentSessionId,n=t.loggerProvider,i=t.tx;return l(e,void 0,void 0,function(){var e,t,o,s,a,l;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,6,,7]),e=String(r),[4,i.store.getAll()];case 1:t=u.sent(),o=0,u.label=2;case 2:return o<t.length?(s=t[o],a=Date.now()-s.lastUpdated,s.sessionId!==e&&a>1728e5?[4,i.store.delete(s.sessionId)]:[3,4]):[3,5];case 3:u.sent(),u.label=4;case 4:return o++,[3,2];case 5:return[3,7];case 6:return l=u.sent(),n.warn("Failed to clear old session event types for targeting: ".concat(l)),[3,7];case 7:return[2]}})})},this.storeEventTypeForSession=function(t){var r=t.loggerProvider,n=t.sessionId,i=t.eventType,o=t.eventTime,s=t.apiKey;return l(e,void 0,void 0,function(){var e,t,a,l;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,5,,6]),[4,this.openOrCreateDB(s)];case 1:return e=u.sent(),(t=e.transaction("eventTypesForSession","readwrite"))?[4,this.updateEventListForSession({sessionId:n,tx:t,loggerProvider:r,eventType:i,eventTime:o})]:[2];case 2:return a=u.sent(),[4,this.deleteOldSessionEventTypes({currentSessionId:n,tx:t,loggerProvider:r})];case 3:return u.sent(),[4,t.done];case 4:return u.sent(),[2,a];case 5:return l=u.sent(),r.warn("Failed to store events for targeting ".concat(n,": ").concat(l)),[3,6];case 6:return[2,void 0]}})})}},Bp=new jp,qp=function(){var e=this;this.evaluateTargeting=function(t){var r=t.apiKey,n=t.loggerProvider,i=t.event,o=t.sessionId,a=t.userProperties,c=t.deviceId,d=t.page,h=t.flag;return l(e,void 0,void 0,function(){var e,t,l,p;return u(this,function(u){switch(u.label){case 0:return i&&i.time?[4,Bp.storeEventTypeForSession({loggerProvider:n,apiKey:r,sessionId:o,eventType:i.event_type,eventTime:i.time})]:[3,2];case 1:return t=u.sent(),[3,3];case 2:t=void 0,u.label=3;case 3:return l=(e=t)&&new Set(Object.keys(e)),p={session_id:o,event:i,event_types:l&&Array.from(l),user:s(s({},a),{device_id:c,user_properties:a}),page:d},[2,this.evaluationEngine.evaluate(p,[h])]}})})},this.evaluationEngine=new Fp},zp=function(){var e=new qp;return{evaluateTargeting:e.evaluateTargeting.bind(e)}}().evaluateTargeting,Wp=Object.freeze({__proto__:null,evaluateTargeting:zp}),Vp=Object.freeze({__proto__:null,compressionScript:'var WebWorker=function(e){"use strict";onmessage=function(e){var s="string"==typeof e.data?JSON.parse(e.data):e.data,t=s.event,a=s.sessionId,n=t.type,r=t.timestamp,i=t.delay,o=t.data,d=null!=i?JSON.stringify({type:n,timestamp:r,delay:i,data:o}):JSON.stringify({type:n,timestamp:r,data:o});postMessage({compressedEvent:d,sessionId:a})};var s=onmessage;return e.compressionOnMessage=s,Object.defineProperty(e,"__esModule",{value:!0}),e}({});\n',trackDestinationScript:'var WebWorker=function(e){"use strict";var t,r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)};function n(e,t,r,n){return new(r||(r=Promise))(function(s,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function i(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,i)}u((n=n.apply(e,t||[])).next())})}function s(e,t){var r,n,s,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=i(0),a.throw=i(1),a.return=i(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(o=0)),o;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(6===i[0]&&o.label<s[1]){o.label=s[1],s=i;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(i);break}s[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}"function"==typeof SuppressedError&&SuppressedError,function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(t||(t={})),t.US;var o,a=/payload.*exceed/i,i="X-Session-Replay-Event-Skipped";!function(e){e.GET_SR_PROPS="get-sr-props",e.DEBUG_INFO="debug-info",e.FETCH_REQUEST="fetch-request",e.METADATA="metadata",e.TARGETING_DECISION="targeting-decision",e.REPLAY_GATE_DECISION="replay-gate-decision"}(o||(o={}));var u="Network error occurred, event batch rejected";function c(e,t){return n(this,void 0,void 0,function(){var r,o,a,i,u,c,l,d,p,f,v,y,h,b,g=this;return s(this,function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),r=t.CompressionStream,o=new r("gzip"),a=o.writable.getWriter(),i=o.readable.getReader(),u=[],c=n(g,void 0,void 0,function(){var e,t,r;return s(this,function(n){switch(n.label){case 0:return[4,i.read()];case 1:if(e=n.sent(),t=e.done,r=e.value,t)return[3,3];u.push(r),n.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,a.write((new TextEncoder).encode(e))];case 1:return m.sent(),[4,a.close()];case 2:return m.sent(),[4,c];case 3:m.sent(),l=u.reduce(function(e,t){return e+t.length},0),d=new Uint8Array(l),p=0;try{for(f=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(u),v=f.next();!v.done;v=f.next())y=v.value,d.set(y,p),p+=y.length}catch(e){h={error:e}}finally{try{v&&!v.done&&(b=f.return)&&b.call(f)}finally{if(h)throw h.error}}return[2,d];case 4:return m.sent(),[2,null];case 5:return[2]}})})}var l=0,d=new Map,p=function(e,t){return fetch(e,t)},f=function(e,t){var r="".concat(++l);return new Promise(function(n,s){var o=t.signal,a=function(){d.delete(r);var e=new Error("Delegated session replay fetch aborted by send timeout");e.name="AbortError",s(e)};o.addEventListener("abort",a,{once:!0}),d.set(r,function(e){o.removeEventListener("abort",a),e.error?s(new Error(e.body)):n({status:e.status,headers:{get:function(t){return t===i?e.skipHeader:null}},text:function(){return Promise.resolve(e.body)}})}),postMessage({type:"fetch-request",requestId:r,url:e,method:"POST",headers:t.headers,body:t.body,keepalive:t.keepalive})})};function v(e,t,o){var l,d,p,f,v,y,h,b;return n(this,void 0,void 0,function(){var n,g,m,w,S,T,E,k,R,x,C,I,A,M,O;return s(this,function(s){switch(s.label){case 0:n=null!==(l=t.sendTimeoutMs)&&void 0!==l?l:1e4,s.label=1;case 1:return s.trys.push([1,14,,15]),!1!==t.enableTransportCompression&&"CompressionStream"in self?[4,c(e,self)]:[3,3];case 2:return m=s.sent(),[3,4];case 3:m=null,s.label=4;case 4:g=m,w="".concat(null!==(p=null===(d=t.version)||void 0===d?void 0:d.type)&&void 0!==p?p:"standalone","/").concat(null!==(v=null===(f=t.version)||void 0===f?void 0:f.version)&&void 0!==v?v:t.sdkVersion),S=new URLSearchParams({device_id:t.deviceId,session_id:"".concat(t.sessionId),type:t.eventType}),T="".concat((U=t.serverZone,P=t.trackServerUrl,P||("STAGING"===U?"https://api-sr.stag2.amplitude.com/sessions/v2/track":"EU"===U?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track")),"?").concat(S.toString()),E=r({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(t.apiKey),"X-Client-Version":t.sdkVersion,"X-Client-Library":w,"X-Client-Url":t.currentUrl.substring(0,1e3),"X-Client-Sample-Rate":"".concat(t.sampleRate),"X-Sampling-Hash-Alg":"xxhash32"},g?{"Content-Encoding":"gzip"}:{}),k=g?g.byteLength:new Blob([e]).size,R=new AbortController,x=n>0?setTimeout(function(){R.abort()},n):void 0,C=void 0,s.label=5;case 5:return s.trys.push([5,,7,8]),[4,o(T,{method:"POST",headers:E,body:null!=g?g:e,keepalive:k<=65536,signal:R.signal})];case 6:return C=s.sent(),[3,8];case 7:return x&&clearTimeout(x),[7];case 8:if(null===C)return[2,{shouldRetry:!1,success:!1,message:"Unexpected error occurred"}];if(C.status>=200&&C.status<300)return I=Math.round(new Blob(t.events).size/1024),A=null!==(b=null===(h=null===(y=C.headers)||void 0===y?void 0:y.get)||void 0===h?void 0:h.call(y,i))&&void 0!==b?b:null,[2,{shouldRetry:!1,success:!0,message:"Session replay event batch tracked successfully for session id ".concat(t.sessionId,", size of events: ").concat(I," KB"),skipCode:A}];if(413!==C.status)return[3,13];M="",s.label=9;case 9:return s.trys.push([9,11,,12]),[4,C.text()];case 10:return M=s.sent(),[3,12];case 11:return s.sent(),[3,12];case 12:return[2,{shouldRetry:!1,success:!1,message:u,payloadTooLarge:!0,isWaf:a.test(M)}];case 13:return C.status>=500||408===C.status||429===C.status||499===C.status?[2,{shouldRetry:!0,success:!1,message:"HTTP ".concat(C.status)}]:[2,{shouldRetry:!1,success:!1,message:u}];case 14:return(O=s.sent())&&"object"==typeof O&&"AbortError"===O.name?[2,{shouldRetry:!0,success:!1,message:"Session replay worker request timed out after ".concat(n,"ms")}]:[2,{shouldRetry:!1,success:!1,message:String(O)}];case 15:return[2]}var U,P})})}function y(e,t,r,o,a){var i;return n(this,void 0,void 0,function(){var n,u,c;return s(this,function(s){switch(s.label){case 0:n=1,s.label=1;case 1:return[4,v(t,r,a)];case 2:return(u=s.sent()).success?(postMessage({type:"log",id:e,message:u.message}),postMessage({type:"complete",id:e,skipCode:null!==(i=u.skipCode)&&void 0!==i?i:null}),[2]):u.payloadTooLarge&&o?(postMessage({type:"payload_too_large",id:e,isWaf:!0===u.isWaf}),[2]):o&&u.shouldRetry&&n<r.flushMaxRetries?[4,new Promise(function(e){return setTimeout(e,Math.random()*n*1e3)})]:[3,4];case 3:return s.sent(),n++,[3,5];case 4:return c=n>=r.flushMaxRetries?"Session replay event batch rejected due to exceeded retry count":u.message,postMessage({type:"warn",id:e,message:c}),postMessage({type:"complete",id:e}),[2];case 5:return[3,1];case 6:return[2]}})})}onmessage=function(e){return n(void 0,void 0,void 0,function(){var t,r,n,o,a,i,u,c;return s(this,function(s){switch(s.label){case 0:return"fetch-response"===(t=e.data).type?((r=d.get(t.requestId))&&(d.delete(t.requestId),r(t)),[2]):"send"!==t.type?[3,2]:(n=t.id,o=t.payload,a=t.context,i=t.useRetry,u=t.useCustomTransport,c=JSON.stringify(o),[4,y(n,c,a,i,u?f:p)]);case 1:s.sent(),s.label=2;case 2:return[2]}})})};var h=onmessage;return e.trackDestinationOnMessage=h,Object.defineProperty(e,"__esModule",{value:!0}),e}({});\n'}),$p=Object.defineProperty,Hp=(e,t,r)=>((e,t,r)=>t in e?$p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),Kp=Object.defineProperty,Gp=(e,t,r)=>((e,t,r)=>t in e?Kp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),Jp=Object.defineProperty,Xp=(e,t,r)=>((e,t,r)=>t in e?Jp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const Yp={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Qp={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Zp={};function ef(e){if(Zp[e])return Zp[e];const t=function(e){var t,r;const n=null==(r=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:r.call(t,e);return n&&globalThis[n]?globalThis[n]:void 0}(e)||globalThis[e],r=t.prototype,n=e in Yp?Yp[e]:void 0,i=Boolean(n&&n.every(e=>{var t,n;return Boolean(null==(n=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),o=e in Qp?Qp[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return Zp[e]=t.prototype,t.prototype;try{const n=document.createElement("iframe");document.body.appendChild(n);const i=n.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(n),o?Zp[e]=o:r}catch{return r}}const tf={};function rf(e,t,r){var n;const i=`${e}.${String(r)}`;if(tf[i])return tf[i].call(t);const o=ef(e),s=null==(n=Object.getOwnPropertyDescriptor(o,r))?void 0:n.get;return s?(tf[i]=s,s.call(t)):t[r]}const nf={};function of(e,t,r){const n=`${e}.${String(r)}`;if(nf[n])return nf[n].bind(t);const i=ef(e)[r];return"function"!=typeof i?t[r]:(nf[n]=i,i.bind(t))}const sf={childNodes:function(e){return rf("Node",e,"childNodes")},parentNode:function(e){return rf("Node",e,"parentNode")},parentElement:function(e){return rf("Node",e,"parentElement")},textContent:function(e){return rf("Node",e,"textContent")},contains:function(e,t){return of("Node",e,"contains")(t)},getRootNode:function(e){return of("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?rf("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?rf("Element",e,"shadowRoot"):null},querySelector:function(e,t){return rf("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return rf("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return ef("MutationObserver").constructor}};class af{constructor(){Xp(this,"idNodeMap",new Map),Xp(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;return(null==(t=this.getMeta(e))?void 0:t.id)??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const e=this.nodeMetaMap.get(r);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function lf(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&lf(sf.parentNode(e),t,r);for(let r=e.classList.length;r--;){const n=e.classList[r];if(t.test(n))return!0}return!!r&&lf(sf.parentNode(e),t,r)}function uf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function cf(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var df,hf={exports:{}};function pf(){if(df)return hf.exports;df=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return hf.exports=t(),hf.exports.createColors=t,hf.exports}const ff=cf(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var gf,vf;function mf(){if(vf)return gf;vf=1;let e=pf(),t=ff;class r extends Error{constructor(e,t,n,i,o,s){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),void 0!==t&&void 0!==n&&("number"==typeof t?(this.line=t,this.column=n):(this.line=t.line,this.column=t.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,r)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(r){if(!this.source)return"";let n=this.source;null==r&&(r=e.isColorSupported),t&&r&&(n=t(n));let i,o,s=n.split(/\r?\n/),a=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;if(r){let{bold:t,gray:r,red:n}=e.createColors(!0);i=e=>t(n(e)),o=e=>r(e)}else i=o=e=>e;return s.slice(a,l).map((e,t)=>{let r=a+1+t,n=" "+(" "+r).slice(-u)+" | ";if(r===this.line){let t=o(n.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+o(n)+e+"\n "+t+i("^")}return" "+o(n)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return gf=r,r.default=r,gf}var yf,bf,wf,Sf,xf,kf,Cf,Ef,If,Of,Pf,Tf,Rf,Mf,Af,_f,Nf,Df,Lf,Ff,Uf,jf,Bf,qf,zf,Wf,Vf,$f,Hf,Kf,Gf,Jf,Xf,Yf,Qf,Zf,eg,tg,rg,ng,ig,og,sg,ag,lg,ug,cg,dg,hg,pg,fg,gg,vg,mg={};function yg(){return yf||(yf=1,mg.isClean=Symbol("isClean"),mg.my=Symbol("my")),mg}function bg(){if(wf)return bf;wf=1;const e={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};class t{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let i=(e.raws.between||"")+(t?";":"");this.builder(r+n+i,e)}}beforeAfter(e,t){let r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let n=e.parent,i=0;for(;n&&"root"!==n.type;)i+=1,n=n.parent;if(r.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)r+=t}return r}block(e,t){let r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let i=e.nodes[n],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==n||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],void 0!==i))return i;let o=t.parent;if("before"===n){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[n];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[n])return s.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(t,n);{let e="raw"+((a=n)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[r],void 0!==i)return!1})}var a;return void 0===i&&(i=e[n]),s.rawCache[n]=i,i}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return t=r.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){let e=r.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}}return bf=t,t.default=t,bf}function wg(){if(xf)return Sf;xf=1;let e=bg();function t(t,r){new e(r).stringify(t)}return Sf=t,t.default=t,Sf}function Sg(){if(Cf)return kf;Cf=1;let{isClean:e,my:t}=yg(),r=mf(),n=bg(),i=wg();function o(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if("proxyCache"===n)continue;let i=e[n],s=typeof i;"parent"===n&&"object"===s?t&&(r[n]=t):"source"===n?r[n]=i:Array.isArray(i)?r[n]=i.map(e=>o(e,r)):("object"===s&&null!==i&&(i=o(i)),r[n]=i)}return r}class s{constructor(r={}){this.raws={},this[e]=!1,this[t]=!0;for(let e in r)if("nodes"===e){this.nodes=[];for(let t of r[e])"function"==typeof t.clone?this.append(t.clone()):this.append(t)}else this[e]=r[e]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=o(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new r(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[e]){this[e]=!1;let t=this;for(;t=t.parent;)t[e]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let n=(t=this.toString()).indexOf(e.word);-1!==n&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===r[t]?(n=1,i+=1):n+=1;return{column:n,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let n=this.toString(),i=n.indexOf(e.word);-1!==i&&(t=this.positionInside(i,n),r=this.positionInside(i+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return(new n).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let r={},n=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let n=this[e];if(Array.isArray(n))r[e]=n.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof n&&n.toJSON)r[e]=n.toJSON(null,t);else if("source"===e){let o=t.get(n.input);null==o&&(o=i,t.set(n.input,i),i++),r[e]={end:n.end,inputId:o,start:n.start}}else r[e]=n}return n&&(r.inputs=[...t.keys()].map(e=>e.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=i){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,r){let n={node:this};for(let e in r)n[e]=r[e];return e.warn(t,n)}get proxyOf(){return this}}return kf=s,s.default=s,kf}function xg(){if(If)return Ef;If=1;let e=Sg();class t extends e{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}}return Ef=t,t.default=t,Ef}function kg(){if(Pf)return Of;Pf=1;return Of={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n}},Of}function Cg(){if(Rf)return Tf;Rf=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=ff,{existsSync:r,readFileSync:n}=ff,{dirname:i,join:o}=ff;class s{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=i(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new e(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}loadFile(e){if(this.root=i(e),r(e))return this.mapFile=e,n(e,"utf-8").toString().trim()}loadMap(r,n){if(!1===n)return!1;if(n){if("string"==typeof n)return n;if("function"!=typeof n){if(n instanceof e)return t.fromSourceMap(n).toString();if(n instanceof t)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}{let e=n(r);if(e){let t=this.loadFile(e);if(!t)throw new Error("Unable to load previous source map: "+e.toString());return t}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let e=this.annotation;return r&&(e=o(i(r),e)),this.loadFile(e)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return Tf=s,s.default=s,Tf}function Eg(){if(Af)return Mf;Af=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=ff,{fileURLToPath:r,pathToFileURL:n}=ff,{isAbsolute:i,resolve:o}=ff,{nanoid:s}=kg(),a=ff,l=mf(),u=Cg(),c=Symbol("fromOffsetCache"),d=Boolean(e&&t),h=Boolean(o&&i);class p{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!h||/^\w+:\/\//.test(t.from)||i(t.from)?this.file=t.from:this.file=o(t.from)),h&&d){let e=new u(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+s(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let o,s,a;if(t&&"object"==typeof t){let e=t,n=r;if("number"==typeof e.offset){let n=this.fromOffset(e.offset);t=n.line,r=n.col}else t=e.line,r=e.column;if("number"==typeof n.offset){let e=this.fromOffset(n.offset);s=e.line,a=e.col}else s=n.line,a=n.column}else if(!r){let e=this.fromOffset(t);t=e.line,r=e.col}let u=this.origin(t,r,s,a);return o=u?new l(e,void 0===u.endLine?u.line:{column:u.column,line:u.line},void 0===u.endLine?u.column:{column:u.endColumn,line:u.endLine},u.source,u.file,i.plugin):new l(e,void 0===s?t:{column:r,line:t},void 0===s?r:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:r,endColumn:a,endLine:s,line:t,source:this.css},this.file&&(n&&(o.input.url=n(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[c])r=this[c];else{let e=this.css.split("\n");r=new Array(e.length);let t=0;for(let n=0,i=e.length;n<i;n++)r[n]=t,t+=e[n].length+1;this[c]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let t,i=r.length-2;for(;n<i;)if(t=n+(i-n>>1),e<r[t])i=t-1;else{if(!(e>=r[t+1])){n=t;break}n=t+1}}return{col:e-r[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:o(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,o,s){if(!this.map)return!1;let a,l,u=this.map.consumer(),c=u.originalPositionFor({column:t,line:e});if(!c.source)return!1;"number"==typeof o&&(a=u.originalPositionFor({column:s,line:o})),l=i(c.source)?n(c.source):new URL(c.source,this.map.consumer().sourceRoot||n(this.map.mapFile));let d={column:c.column,endColumn:a&&a.column,endLine:a&&a.line,line:c.line,url:l.toString()};if("file:"===l.protocol){if(!r)throw new Error("file: protocol is not available in this PostCSS build");d.file=r(l)}let h=u.sourceContentFor(c.source);return h&&(d.source=h),d}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}}return Mf=p,p.default=p,a&&a.registerInput&&a.registerInput(p),Mf}function Ig(){if(Nf)return _f;Nf=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=ff,{dirname:r,relative:n,resolve:i,sep:o}=ff,{pathToFileURL:s}=ff,a=Eg(),l=Boolean(e&&t),u=Boolean(r&&i&&n&&o);return _f=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let t of this.previous()){let n,i=this.toUrl(this.path(t.file)),o=t.root||r(t.file);!1===this.mapOpts.sourcesContent?(n=new e(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,i,this.toUrl(this.path(o)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),u&&l&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=t.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0});let e,r,n=1,i=1,o="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(t,a,l)=>{if(this.css+=t,a&&"end"!==l&&(s.generated.line=n,s.generated.column=i-1,a.source&&a.source.start?(s.source=this.sourcePath(a),s.original.line=a.source.start.line,s.original.column=a.source.start.column-1,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,this.map.addMapping(s))),e=t.match(/\n/g),e?(n+=e.length,r=t.lastIndexOf("\n"),i=t.length-r):i+=t.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===e.last&&!e.raws.semicolon||(a.source&&a.source.end?(s.source=this.sourcePath(a),s.original.line=a.source.end.line,s.original.column=a.source.end.column-1,s.generated.line=n,s.generated.column=i-2,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=i-1,this.map.addMapping(s)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let o=this.opts.to?r(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=r(i(o,this.mapOpts.annotation)));let s=n(o,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new a(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(s){let t=s(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===o&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},_f}function Og(){if(Lf)return Df;Lf=1;let e=Sg();class t extends e{constructor(e){super(e),this.type="comment"}}return Df=t,t.default=t,Df}function Pg(){if(Uf)return Ff;Uf=1;let e,t,r,n,{isClean:i,my:o}=yg(),s=xg(),a=Og(),l=Sg();function u(e){return e.map(e=>(e.nodes&&(e.nodes=u(e.nodes)),delete e.source,e))}function c(e){if(e[i]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class d extends l{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,r,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],r=e(this.proxyOf.nodes[t],t),!1!==r);)this.indexes[n]+=1;return delete this.indexes[n],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...r)=>e[t](...r.map(e=>"function"==typeof e?(t,r)=>e(t.toProxy(),r):e)):"every"===t||"some"===t?r=>e[t]((e,...t)=>r(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r,n=this.index(e),i=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(let e of i)this.proxyOf.nodes.splice(n+1,0,e);for(let e in this.indexes)r=this.indexes[e],n<r&&(this.indexes[e]=r+i.length);return this.markDirty(),this}insertBefore(e,t){let r,n=this.index(e),i=0===n&&"prepend",o=this.normalize(t,this.proxyOf.nodes[n],i).reverse();n=this.index(e);for(let e of o)this.proxyOf.nodes.splice(n,0,e);for(let e in this.indexes)r=this.indexes[e],n<=r&&(this.indexes[e]=r+o.length);return this.markDirty(),this}normalize(n,l){if("string"==typeof n)n=u(e(n).nodes);else if(void 0===n)n=[];else if(Array.isArray(n)){n=n.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===n.type&&"document"!==this.type){n=n.nodes.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if(n.type)n=[n];else if(n.prop){if(void 0===n.value)throw new Error("Value field is missed in node creation");"string"!=typeof n.value&&(n.value=String(n.value)),n=[new s(n)]}else if(n.selector)n=[new t(n)];else if(n.name)n=[new r(n)];else{if(!n.text)throw new Error("Unknown node type in node creation");n=[new a(n)]}return n.map(e=>(e[o]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[i]&&c(e),void 0===e.raws.before&&l&&void 0!==l.raws.before&&(e.raws.before=l.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let n;try{n=e(t,r)}catch(e){throw t.addToError(e)}return!1!==n&&t.walk&&(n=t.walk(e)),n})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("atrule"===r.type&&e.test(r.name))return t(r,n)}):this.walk((r,n)=>{if("atrule"===r.type&&r.name===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("atrule"===e.type)return t(e,r)}))}walkComments(e){return this.walk((t,r)=>{if("comment"===t.type)return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("decl"===r.type&&e.test(r.prop))return t(r,n)}):this.walk((r,n)=>{if("decl"===r.type&&r.prop===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("decl"===e.type)return t(e,r)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("rule"===r.type&&e.test(r.selector))return t(r,n)}):this.walk((r,n)=>{if("rule"===r.type&&r.selector===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("rule"===e.type)return t(e,r)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return d.registerParse=t=>{e=t},d.registerRule=e=>{t=e},d.registerAtRule=e=>{r=e},d.registerRoot=e=>{n=e},Ff=d,d.default=d,d.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,r.prototype):"rule"===e.type?Object.setPrototypeOf(e,t.prototype):"decl"===e.type?Object.setPrototypeOf(e,s.prototype):"comment"===e.type?Object.setPrototypeOf(e,a.prototype):"root"===e.type&&Object.setPrototypeOf(e,n.prototype),e[o]=!0,e.nodes&&e.nodes.forEach(e=>{d.rebuild(e)})},Ff}function Tg(){if(Bf)return jf;Bf=1;let e,t,r=Pg();class n extends r{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},jf=n,n.default=n,jf}function Rg(){if(zf)return qf;zf=1;let e={};return qf=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function Mg(){if(Vf)return Wf;Vf=1;class e{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return Wf=e,e.default=e,Wf}function Ag(){if(Hf)return $f;Hf=1;let e=Mg();class t{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new e(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}}return $f=t,t.default=t,$f}function _g(){if(Xf)return Jf;Xf=1;let e=Pg();class t extends e{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}return Jf=t,t.default=t,e.registerAtRule(t),Jf}function Ng(){if(Qf)return Yf;Qf=1;let e,t,r=Pg();class n extends r{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let n=super.normalize(e);if(t)if("prepend"===r)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of n)e.raws.before=t.raws.before;return n}removeChild(e,t){let r=this.index(e);return!t&&0===r&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},Yf=n,n.default=n,r.registerRoot(n),Yf}function Dg(){if(eg)return Zf;eg=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,r){let n=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let r of e)u?u=!1:"\\"===r?u=!0:a?r===l&&(a=!1):'"'===r||"'"===r?(a=!0,l=r):"("===r?s+=1:")"===r?s>0&&(s-=1):0===s&&t.includes(r)&&(o=!0),o?(""!==i&&n.push(i.trim()),i="",o=!1):i+=r;return(r||""!==i)&&n.push(i.trim()),n}};return Zf=e,e.default=e,Zf}function Lg(){if(rg)return tg;rg=1;let e=Pg(),t=Dg();class r extends e{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return t.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}}return tg=r,r.default=r,e.registerRule(r),tg}function Fg(){if(ig)return ng;ig=1;let e=xg(),t=function(){if(Gf)return Kf;Gf=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),r="\\".charCodeAt(0),n="/".charCodeAt(0),i="\n".charCodeAt(0),o=" ".charCodeAt(0),s="\f".charCodeAt(0),a="\t".charCodeAt(0),l="\r".charCodeAt(0),u="[".charCodeAt(0),c="]".charCodeAt(0),d="(".charCodeAt(0),h=")".charCodeAt(0),p="{".charCodeAt(0),f="}".charCodeAt(0),g=";".charCodeAt(0),v="*".charCodeAt(0),m=":".charCodeAt(0),y="@".charCodeAt(0),b=/[\t\n\f\r "#'()/;[\\\]{}]/g,w=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,S=/.[\r\n"'(/\\]/,x=/[\da-f]/i;return Kf=function(k,C={}){let E,I,O,P,T,R,M,A,_,N,D=k.css.valueOf(),L=C.ignoreErrors,F=D.length,U=0,j=[],B=[];function q(e){throw k.error("Unclosed "+e,U)}return{back:function(e){B.push(e)},endOfFile:function(){return 0===B.length&&U>=F},nextToken:function(k){if(B.length)return B.pop();if(U>=F)return;let C=!!k&&k.ignoreUnclosed;switch(E=D.charCodeAt(U),E){case i:case o:case a:case l:case s:I=U;do{I+=1,E=D.charCodeAt(I)}while(E===o||E===i||E===a||E===l||E===s);N=["space",D.slice(U,I)],U=I-1;break;case u:case c:case p:case f:case m:case g:case h:{let e=String.fromCharCode(E);N=[e,e,U];break}case d:if(A=j.length?j.pop()[1]:"",_=D.charCodeAt(U+1),"url"===A&&_!==e&&_!==t&&_!==o&&_!==i&&_!==a&&_!==s&&_!==l){I=U;do{if(R=!1,I=D.indexOf(")",I+1),-1===I){if(L||C){I=U;break}q("bracket")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["brackets",D.slice(U,I+1),U,I],U=I}else I=D.indexOf(")",U+1),P=D.slice(U,I+1),-1===I||S.test(P)?N=["(","(",U]:(N=["brackets",P,U,I],U=I);break;case e:case t:O=E===e?"'":'"',I=U;do{if(R=!1,I=D.indexOf(O,I+1),-1===I){if(L||C){I=U+1;break}q("string")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["string",D.slice(U,I+1),U,I],U=I;break;case y:b.lastIndex=U+1,b.test(D),I=0===b.lastIndex?D.length-1:b.lastIndex-2,N=["at-word",D.slice(U,I+1),U,I],U=I;break;case r:for(I=U,T=!0;D.charCodeAt(I+1)===r;)I+=1,T=!T;if(E=D.charCodeAt(I+1),T&&E!==n&&E!==o&&E!==i&&E!==a&&E!==l&&E!==s&&(I+=1,x.test(D.charAt(I)))){for(;x.test(D.charAt(I+1));)I+=1;D.charCodeAt(I+1)===o&&(I+=1)}N=["word",D.slice(U,I+1),U,I],U=I;break;default:E===n&&D.charCodeAt(U+1)===v?(I=D.indexOf("*/",U+2)+1,0===I&&(L||C?I=D.length:q("comment")),N=["comment",D.slice(U,I+1),U,I],U=I):(w.lastIndex=U+1,w.test(D),I=0===w.lastIndex?D.length-1:w.lastIndex-2,N=["word",D.slice(U,I+1),U,I],j.push(N),U=I)}return U++,N},position:function(){return U}}}}(),r=Og(),n=_g(),i=Ng(),o=Lg();const s={empty:!0,space:!0};return ng=class{constructor(e){this.input=e,this.root=new i,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,r,i,o=new n;o.name=e[1].slice(1),""===o.name&&this.unnamedAtrule(o,e),this.init(o,e[2]);let s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?u.push("("===t?")":"]"):"{"===t&&u.length>0?u.push("}"):t===u[u.length-1]&&u.pop(),0===u.length){if(";"===t){o.source.end=this.getPosition(e[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===t){a=!0;break}if("}"===t){if(l.length>0){for(i=l.length-1,r=l[i];r&&"space"===r[0];)r=l[--i];r&&(o.source.end=this.getPosition(r[3]||r[2]),o.source.end.offset++)}this.end(e);break}l.push(e)}else l.push(e);if(this.tokenizer.endOfFile()){s=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(o.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(o,"params",l),s&&(e=l[l.length-1],o.source.end=this.getPosition(e[3]||e[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),a&&(o.nodes=[],this.current=o)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let r,n=0;for(let i=t-1;i>=0&&(r=e[i],"space"===r[0]||(n+=1,2!==n));i--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}colon(e){let t,r,n,i=0;for(let[o,s]of e.entries()){if(t=s,r=t[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return o}this.doubleColon(t)}n=t}return!1}comment(e){let t=new r;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=t(this.input)}decl(t,r){let n=new e;this.init(n,t[0][2]);let i,o=t[t.length-1];for(";"===o[0]&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}(t)),n.source.end.offset++;"word"!==t[0][0];)1===t.length&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let e=t[0][0];if(":"===e||"space"===e||"comment"===e)break;n.prop+=t.shift()[1]}for(n.raws.between="";t.length;){if(i=t.shift(),":"===i[0]){n.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s,a=[];for(;t.length&&(s=t[0][0],"space"===s||"comment"===s);)a.push(t.shift());this.precheckMissedSemicolon(t);for(let e=t.length-1;e>=0;e--){if(i=t[e],"!important"===i[1].toLowerCase()){n.important=!0;let r=this.stringFrom(t,e);r=this.spacesFromEnd(t)+r," !important"!==r&&(n.raws.important=r);break}if("important"===i[1].toLowerCase()){let r=t.slice(0),i="";for(let t=e;t>0;t--){let e=r[t][0];if(0===i.trim().indexOf("!")&&"space"!==e)break;i=r.pop()[1]+i}0===i.trim().indexOf("!")&&(n.important=!0,n.raws.important=i,t=r)}if("space"!==i[0]&&"comment"!==i[0])break}t.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(n.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(n,"value",a.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new o;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,r=null,n=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(r=l[0],a.push(l),"("===r||"["===r)i||(i=l),o.push("("===r?")":"]");else if(s&&n&&"{"===r)i||(i=l),o.push("}");else if(0===o.length){if(";"===r){if(n)return void this.decl(a,s);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),t&&n){if(!s)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,n){let i,o,a,l,u=r.length,c="",d=!0;for(let e=0;e<u;e+=1)i=r[e],o=i[0],"space"!==o||e!==u-1||n?"comment"===o?(l=r[e-1]?r[e-1][0]:"empty",a=r[e+1]?r[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let n=r.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:n,value:c}}e[t]=c}rule(e){e.pop();let t=new o;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},ng}function Ug(){if(sg)return og;sg=1;let e=Pg(),t=Fg(),r=Eg();function n(e,n){let i=new r(e,n),o=new t(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&n&&n.from&&(/\.scss$/i.test(n.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(n.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(n.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return o.root}return og=n,n.default=n,e.registerParse(n),og}function jg(){if(lg)return ag;lg=1;let{isClean:e,my:t}=yg(),r=Ig(),n=wg(),i=Pg(),o=Tg(),s=Rg(),a=Ag(),l=Ug(),u=Ng();const c={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},d={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},h={Once:!0,postcssPlugin:!0,prepare:!0};function p(e){return"object"==typeof e&&"function"==typeof e.then}function f(e){let t=!1,r=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function g(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:f(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function v(t){return t[e]=!1,t.nodes&&t.nodes.forEach(e=>v(e)),t}let m={};class y{constructor(e,r,n){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof r||null===r||"root"!==r.type&&"document"!==r.type)if(r instanceof y||r instanceof a)o=v(r.root),r.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let e=l;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{o=e(r,n)}catch(e){this.processed=!0,this.error=e}o&&!o[t]&&i.rebuild(o)}else o=v(r);this.result=new a(e,o,n),this.helpers={...m,postcss:m,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(r.postcssVersion&&"production"!==process.env.NODE_ENV){let e=r.postcssPlugin,t=r.postcssVersion,n=this.result.processor.version,i=t.split("."),o=n.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+n+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=r.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,r)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,r])};for(let t of this.plugins)if("object"==typeof t)for(let r in t){if(!d[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[r])if("object"==typeof t[r])for(let n in t[r])e(t,"*"===n?r:r+"-"+n.toLowerCase(),t[r][n]);else"function"==typeof t[r]&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(p(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];){t[e]=!0;let r=[g(t)];for(;r.length>0;){let e=this.visitTick(r);if(p(e))try{await e}catch(e){let t=r[r.length-1].node;throw this.handleError(e,t)}}}if(this.listeners.OnceExit)for(let[e,r]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map(e=>r(e,this.helpers));await Promise.all(e)}else await r(t,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return p(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=n;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new r(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(p(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];)t[e]=!0,this.walkSync(t);if(this.listeners.OnceExit)if("document"===t.type)for(let e of t.nodes)this.visitSync(this.listeners.OnceExit,e);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||s("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,n]of e){let e;this.result.lastPlugin=r;try{e=n(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(p(e))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void t.pop();if(i.length>0&&r.visitorIndex<i.length){let[e,t]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=e;try{return t(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==r.iterator){let i,o=r.iterator;for(;i=n.nodes[n.indexes[o]];)if(n.indexes[o]+=1,!i[e])return i[e]=!0,void t.push(g(i));r.iterator=0,delete n.indexes[o]}let o=r.events;for(;r.eventIndex<o.length;){let t=o[r.eventIndex];if(r.eventIndex+=1,0===t)return void(n.nodes&&n.nodes.length&&(n[e]=!0,r.iterator=n.getIterator()));if(this.listeners[t])return void(r.visitors=this.listeners[t])}t.pop()}walkSync(t){t[e]=!0;let r=f(t);for(let n of r)if(0===n)t.nodes&&t.each(t=>{t[e]||this.walkSync(t)});else{let e=this.listeners[n];if(e&&this.visitSync(e,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return y.registerPostcss=e=>{m=e},ag=y,y.default=y,u.registerLazyResult(y),o.registerLazyResult(y),ag}function Bg(){if(hg)return dg;hg=1;let e=function(){if(cg)return ug;cg=1;let e=Ig(),t=wg(),r=Rg(),n=Ug();const i=Ag();class o{constructor(r,n,o){let s;n=n.toString(),this.stringified=!1,this._processor=r,this._css=n,this._opts=o,this._map=void 0;let a=t;this.result=new i(this._processor,s,this._opts),this.result.css=n;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,n);if(u.isMap()){let[e,t]=u.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else u.clearAnnotation(),this.result.css=u.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||r("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=n;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}}return ug=o,o.default=o,ug}(),t=jg(),r=Tg(),n=Ng();class i{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(!0===r.postcss?r=r():r.postcss&&(r=r.postcss),"object"==typeof r&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if("object"==typeof r&&r.postcssPlugin)t.push(r);else if("function"==typeof r)t.push(r);else{if("object"!=typeof r||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(r,n={}){return this.plugins.length||n.parser||n.stringifier||n.syntax?new t(this,r,n):new e(this,r,n)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return dg=i,i.default=i,n.registerProcessor(i),r.registerProcessor(i),dg}const qg=uf(function(){if(vg)return gg;vg=1;let e=mf(),t=xg(),r=jg(),n=Pg(),i=Bg(),o=wg(),s=function(){if(fg)return pg;fg=1;let e=xg(),t=Cg(),r=Og(),n=_g(),i=Eg(),o=Ng(),s=Lg();function a(l,u){if(Array.isArray(l))return l.map(e=>a(e));let{inputs:c,...d}=l;if(c){u=[];for(let e of c){let r={...e,__proto__:i.prototype};r.map&&(r.map={...r.map,__proto__:t.prototype}),u.push(r)}}if(d.nodes&&(d.nodes=l.nodes.map(e=>a(e,u))),d.source){let{inputId:e,...t}=d.source;d.source=t,null!=e&&(d.source.input=u[e])}if("root"===d.type)return new o(d);if("decl"===d.type)return new e(d);if("rule"===d.type)return new s(d);if("comment"===d.type)return new r(d);if("atrule"===d.type)return new n(d);throw new Error("Unknown node type: "+l.type)}return pg=a,a.default=a,pg}(),a=Tg(),l=Mg(),u=Og(),c=_g(),d=Ag(),h=Eg(),p=Ug(),f=Dg(),g=Lg(),v=Ng(),m=Sg();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new i(e)}return y.plugin=function(e,t){let r,n=!1;function o(...r){console&&console.warn&&!n&&(n=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226"));let o=t(...r);return o.postcssPlugin=e,o.postcssVersion=(new i).version,o}return Object.defineProperty(o,"postcss",{get:()=>(r||(r=o()),r)}),o.process=function(e,t,r){return y([o(r)]).process(e,t)},o},y.stringify=o,y.parse=p,y.fromJSON=s,y.list=f,y.comment=e=>new u(e),y.atRule=e=>new c(e),y.decl=e=>new t(e),y.rule=e=>new g(e),y.root=e=>new v(e),y.document=e=>new a(e),y.CssSyntaxError=e,y.Declaration=t,y.Container=n,y.Processor=i,y.Document=a,y.Comment=u,y.Warning=l,y.AtRule=c,y.Result=d,y.Input=h,y.Rule=g,y.Root=v,y.Node=m,r.registerPostcss(y),gg=y,y.default=y,gg}());qg.stringify,qg.fromJSON,qg.plugin,qg.parse,qg.list,qg.document,qg.comment,qg.atRule,qg.rule,qg.decl,qg.root,qg.CssSyntaxError,qg.Declaration,qg.Container,qg.Processor,qg.Document,qg.Comment,qg.Warning,qg.AtRule,qg.Result,qg.Input,qg.Rule,qg.Root,qg.Node;var zg=Object.defineProperty,Wg=(e,t,r)=>((e,t,r)=>t in e?zg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);function Vg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function $g(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var Hg,Kg={exports:{}};function Gg(){if(Hg)return Kg.exports;Hg=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return Kg.exports=t(),Kg.exports.createColors=t,Kg.exports}const Jg=$g(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Xg,Yg;function Qg(){if(Yg)return Xg;Yg=1;let e=Gg(),t=Jg;class r extends Error{constructor(e,t,n,i,o,s){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),void 0!==t&&void 0!==n&&("number"==typeof t?(this.line=t,this.column=n):(this.line=t.line,this.column=t.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,r)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(r){if(!this.source)return"";let n=this.source;null==r&&(r=e.isColorSupported),t&&r&&(n=t(n));let i,o,s=n.split(/\r?\n/),a=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;if(r){let{bold:t,gray:r,red:n}=e.createColors(!0);i=e=>t(n(e)),o=e=>r(e)}else i=o=e=>e;return s.slice(a,l).map((e,t)=>{let r=a+1+t,n=" "+(" "+r).slice(-u)+" | ";if(r===this.line){let t=o(n.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+o(n)+e+"\n "+t+i("^")}return" "+o(n)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return Xg=r,r.default=r,Xg}var Zg,ev,tv,rv,nv,iv,ov,sv,av,lv,uv,cv,dv,hv,pv,fv,gv,vv,mv,yv,bv,wv,Sv,xv,kv,Cv,Ev,Iv,Ov,Pv,Tv,Rv,Mv,Av,_v,Nv,Dv,Lv,Fv,Uv,jv,Bv,qv,zv,Wv,Vv,$v,Hv,Kv,Gv,Jv,Xv,Yv,Qv={};function Zv(){return Zg||(Zg=1,Qv.isClean=Symbol("isClean"),Qv.my=Symbol("my")),Qv}function em(){if(tv)return ev;tv=1;const e={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};class t{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let i=(e.raws.between||"")+(t?";":"");this.builder(r+n+i,e)}}beforeAfter(e,t){let r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let n=e.parent,i=0;for(;n&&"root"!==n.type;)i+=1,n=n.parent;if(r.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)r+=t}return r}block(e,t){let r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let i=e.nodes[n],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==n||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],void 0!==i))return i;let o=t.parent;if("before"===n){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[n];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[n])return s.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(t,n);{let e="raw"+((a=n)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[r],void 0!==i)return!1})}var a;return void 0===i&&(i=e[n]),s.rawCache[n]=i,i}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return t=r.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){let e=r.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}}return ev=t,t.default=t,ev}function tm(){if(nv)return rv;nv=1;let e=em();function t(t,r){new e(r).stringify(t)}return rv=t,t.default=t,rv}function rm(){if(ov)return iv;ov=1;let{isClean:e,my:t}=Zv(),r=Qg(),n=em(),i=tm();function o(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if("proxyCache"===n)continue;let i=e[n],s=typeof i;"parent"===n&&"object"===s?t&&(r[n]=t):"source"===n?r[n]=i:Array.isArray(i)?r[n]=i.map(e=>o(e,r)):("object"===s&&null!==i&&(i=o(i)),r[n]=i)}return r}class s{constructor(r={}){this.raws={},this[e]=!1,this[t]=!0;for(let e in r)if("nodes"===e){this.nodes=[];for(let t of r[e])"function"==typeof t.clone?this.append(t.clone()):this.append(t)}else this[e]=r[e]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=o(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new r(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[e]){this[e]=!1;let t=this;for(;t=t.parent;)t[e]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let n=(t=this.toString()).indexOf(e.word);-1!==n&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===r[t]?(n=1,i+=1):n+=1;return{column:n,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let n=this.toString(),i=n.indexOf(e.word);-1!==i&&(t=this.positionInside(i,n),r=this.positionInside(i+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return(new n).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let r={},n=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let n=this[e];if(Array.isArray(n))r[e]=n.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof n&&n.toJSON)r[e]=n.toJSON(null,t);else if("source"===e){let o=t.get(n.input);null==o&&(o=i,t.set(n.input,i),i++),r[e]={end:n.end,inputId:o,start:n.start}}else r[e]=n}return n&&(r.inputs=[...t.keys()].map(e=>e.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=i){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,r){let n={node:this};for(let e in r)n[e]=r[e];return e.warn(t,n)}get proxyOf(){return this}}return iv=s,s.default=s,iv}function nm(){if(av)return sv;av=1;let e=rm();class t extends e{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}}return sv=t,t.default=t,sv}function im(){if(uv)return lv;uv=1;return lv={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n}},lv}function om(){if(dv)return cv;dv=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Jg,{existsSync:r,readFileSync:n}=Jg,{dirname:i,join:o}=Jg;class s{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=i(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new e(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}loadFile(e){if(this.root=i(e),r(e))return this.mapFile=e,n(e,"utf-8").toString().trim()}loadMap(r,n){if(!1===n)return!1;if(n){if("string"==typeof n)return n;if("function"!=typeof n){if(n instanceof e)return t.fromSourceMap(n).toString();if(n instanceof t)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}{let e=n(r);if(e){let t=this.loadFile(e);if(!t)throw new Error("Unable to load previous source map: "+e.toString());return t}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let e=this.annotation;return r&&(e=o(i(r),e)),this.loadFile(e)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return cv=s,s.default=s,cv}function sm(){if(pv)return hv;pv=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Jg,{fileURLToPath:r,pathToFileURL:n}=Jg,{isAbsolute:i,resolve:o}=Jg,{nanoid:s}=im(),a=Jg,l=Qg(),u=om(),c=Symbol("fromOffsetCache"),d=Boolean(e&&t),h=Boolean(o&&i);class p{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!h||/^\w+:\/\//.test(t.from)||i(t.from)?this.file=t.from:this.file=o(t.from)),h&&d){let e=new u(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+s(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let o,s,a;if(t&&"object"==typeof t){let e=t,n=r;if("number"==typeof e.offset){let n=this.fromOffset(e.offset);t=n.line,r=n.col}else t=e.line,r=e.column;if("number"==typeof n.offset){let e=this.fromOffset(n.offset);s=e.line,a=e.col}else s=n.line,a=n.column}else if(!r){let e=this.fromOffset(t);t=e.line,r=e.col}let u=this.origin(t,r,s,a);return o=u?new l(e,void 0===u.endLine?u.line:{column:u.column,line:u.line},void 0===u.endLine?u.column:{column:u.endColumn,line:u.endLine},u.source,u.file,i.plugin):new l(e,void 0===s?t:{column:r,line:t},void 0===s?r:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:r,endColumn:a,endLine:s,line:t,source:this.css},this.file&&(n&&(o.input.url=n(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[c])r=this[c];else{let e=this.css.split("\n");r=new Array(e.length);let t=0;for(let n=0,i=e.length;n<i;n++)r[n]=t,t+=e[n].length+1;this[c]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let t,i=r.length-2;for(;n<i;)if(t=n+(i-n>>1),e<r[t])i=t-1;else{if(!(e>=r[t+1])){n=t;break}n=t+1}}return{col:e-r[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:o(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,o,s){if(!this.map)return!1;let a,l,u=this.map.consumer(),c=u.originalPositionFor({column:t,line:e});if(!c.source)return!1;"number"==typeof o&&(a=u.originalPositionFor({column:s,line:o})),l=i(c.source)?n(c.source):new URL(c.source,this.map.consumer().sourceRoot||n(this.map.mapFile));let d={column:c.column,endColumn:a&&a.column,endLine:a&&a.line,line:c.line,url:l.toString()};if("file:"===l.protocol){if(!r)throw new Error("file: protocol is not available in this PostCSS build");d.file=r(l)}let h=u.sourceContentFor(c.source);return h&&(d.source=h),d}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}}return hv=p,p.default=p,a&&a.registerInput&&a.registerInput(p),hv}function am(){if(gv)return fv;gv=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Jg,{dirname:r,relative:n,resolve:i,sep:o}=Jg,{pathToFileURL:s}=Jg,a=sm(),l=Boolean(e&&t),u=Boolean(r&&i&&n&&o);return fv=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let t of this.previous()){let n,i=this.toUrl(this.path(t.file)),o=t.root||r(t.file);!1===this.mapOpts.sourcesContent?(n=new e(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,i,this.toUrl(this.path(o)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),u&&l&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=t.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0});let e,r,n=1,i=1,o="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(t,a,l)=>{if(this.css+=t,a&&"end"!==l&&(s.generated.line=n,s.generated.column=i-1,a.source&&a.source.start?(s.source=this.sourcePath(a),s.original.line=a.source.start.line,s.original.column=a.source.start.column-1,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,this.map.addMapping(s))),e=t.match(/\n/g),e?(n+=e.length,r=t.lastIndexOf("\n"),i=t.length-r):i+=t.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===e.last&&!e.raws.semicolon||(a.source&&a.source.end?(s.source=this.sourcePath(a),s.original.line=a.source.end.line,s.original.column=a.source.end.column-1,s.generated.line=n,s.generated.column=i-2,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=i-1,this.map.addMapping(s)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let o=this.opts.to?r(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=r(i(o,this.mapOpts.annotation)));let s=n(o,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new a(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(s){let t=s(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===o&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},fv}function lm(){if(mv)return vv;mv=1;let e=rm();class t extends e{constructor(e){super(e),this.type="comment"}}return vv=t,t.default=t,vv}function um(){if(bv)return yv;bv=1;let e,t,r,n,{isClean:i,my:o}=Zv(),s=nm(),a=lm(),l=rm();function u(e){return e.map(e=>(e.nodes&&(e.nodes=u(e.nodes)),delete e.source,e))}function c(e){if(e[i]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class d extends l{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,r,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],r=e(this.proxyOf.nodes[t],t),!1!==r);)this.indexes[n]+=1;return delete this.indexes[n],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...r)=>e[t](...r.map(e=>"function"==typeof e?(t,r)=>e(t.toProxy(),r):e)):"every"===t||"some"===t?r=>e[t]((e,...t)=>r(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r,n=this.index(e),i=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(let e of i)this.proxyOf.nodes.splice(n+1,0,e);for(let e in this.indexes)r=this.indexes[e],n<r&&(this.indexes[e]=r+i.length);return this.markDirty(),this}insertBefore(e,t){let r,n=this.index(e),i=0===n&&"prepend",o=this.normalize(t,this.proxyOf.nodes[n],i).reverse();n=this.index(e);for(let e of o)this.proxyOf.nodes.splice(n,0,e);for(let e in this.indexes)r=this.indexes[e],n<=r&&(this.indexes[e]=r+o.length);return this.markDirty(),this}normalize(n,l){if("string"==typeof n)n=u(e(n).nodes);else if(void 0===n)n=[];else if(Array.isArray(n)){n=n.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===n.type&&"document"!==this.type){n=n.nodes.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if(n.type)n=[n];else if(n.prop){if(void 0===n.value)throw new Error("Value field is missed in node creation");"string"!=typeof n.value&&(n.value=String(n.value)),n=[new s(n)]}else if(n.selector)n=[new t(n)];else if(n.name)n=[new r(n)];else{if(!n.text)throw new Error("Unknown node type in node creation");n=[new a(n)]}return n.map(e=>(e[o]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[i]&&c(e),void 0===e.raws.before&&l&&void 0!==l.raws.before&&(e.raws.before=l.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let n;try{n=e(t,r)}catch(e){throw t.addToError(e)}return!1!==n&&t.walk&&(n=t.walk(e)),n})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("atrule"===r.type&&e.test(r.name))return t(r,n)}):this.walk((r,n)=>{if("atrule"===r.type&&r.name===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("atrule"===e.type)return t(e,r)}))}walkComments(e){return this.walk((t,r)=>{if("comment"===t.type)return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("decl"===r.type&&e.test(r.prop))return t(r,n)}):this.walk((r,n)=>{if("decl"===r.type&&r.prop===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("decl"===e.type)return t(e,r)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("rule"===r.type&&e.test(r.selector))return t(r,n)}):this.walk((r,n)=>{if("rule"===r.type&&r.selector===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("rule"===e.type)return t(e,r)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return d.registerParse=t=>{e=t},d.registerRule=e=>{t=e},d.registerAtRule=e=>{r=e},d.registerRoot=e=>{n=e},yv=d,d.default=d,d.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,r.prototype):"rule"===e.type?Object.setPrototypeOf(e,t.prototype):"decl"===e.type?Object.setPrototypeOf(e,s.prototype):"comment"===e.type?Object.setPrototypeOf(e,a.prototype):"root"===e.type&&Object.setPrototypeOf(e,n.prototype),e[o]=!0,e.nodes&&e.nodes.forEach(e=>{d.rebuild(e)})},yv}function cm(){if(Sv)return wv;Sv=1;let e,t,r=um();class n extends r{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},wv=n,n.default=n,wv}function dm(){if(kv)return xv;kv=1;let e={};return xv=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function hm(){if(Ev)return Cv;Ev=1;class e{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return Cv=e,e.default=e,Cv}function pm(){if(Ov)return Iv;Ov=1;let e=hm();class t{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new e(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}}return Iv=t,t.default=t,Iv}function fm(){if(Mv)return Rv;Mv=1;let e=um();class t extends e{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}return Rv=t,t.default=t,e.registerAtRule(t),Rv}function gm(){if(_v)return Av;_v=1;let e,t,r=um();class n extends r{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let n=super.normalize(e);if(t)if("prepend"===r)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of n)e.raws.before=t.raws.before;return n}removeChild(e,t){let r=this.index(e);return!t&&0===r&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},Av=n,n.default=n,r.registerRoot(n),Av}function vm(){if(Dv)return Nv;Dv=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,r){let n=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let r of e)u?u=!1:"\\"===r?u=!0:a?r===l&&(a=!1):'"'===r||"'"===r?(a=!0,l=r):"("===r?s+=1:")"===r?s>0&&(s-=1):0===s&&t.includes(r)&&(o=!0),o?(""!==i&&n.push(i.trim()),i="",o=!1):i+=r;return(r||""!==i)&&n.push(i.trim()),n}};return Nv=e,e.default=e,Nv}function mm(){if(Fv)return Lv;Fv=1;let e=um(),t=vm();class r extends e{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return t.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}}return Lv=r,r.default=r,e.registerRule(r),Lv}function ym(){if(jv)return Uv;jv=1;let e=nm(),t=function(){if(Tv)return Pv;Tv=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),r="\\".charCodeAt(0),n="/".charCodeAt(0),i="\n".charCodeAt(0),o=" ".charCodeAt(0),s="\f".charCodeAt(0),a="\t".charCodeAt(0),l="\r".charCodeAt(0),u="[".charCodeAt(0),c="]".charCodeAt(0),d="(".charCodeAt(0),h=")".charCodeAt(0),p="{".charCodeAt(0),f="}".charCodeAt(0),g=";".charCodeAt(0),v="*".charCodeAt(0),m=":".charCodeAt(0),y="@".charCodeAt(0),b=/[\t\n\f\r "#'()/;[\\\]{}]/g,w=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,S=/.[\r\n"'(/\\]/,x=/[\da-f]/i;return Pv=function(k,C={}){let E,I,O,P,T,R,M,A,_,N,D=k.css.valueOf(),L=C.ignoreErrors,F=D.length,U=0,j=[],B=[];function q(e){throw k.error("Unclosed "+e,U)}return{back:function(e){B.push(e)},endOfFile:function(){return 0===B.length&&U>=F},nextToken:function(k){if(B.length)return B.pop();if(U>=F)return;let C=!!k&&k.ignoreUnclosed;switch(E=D.charCodeAt(U),E){case i:case o:case a:case l:case s:I=U;do{I+=1,E=D.charCodeAt(I)}while(E===o||E===i||E===a||E===l||E===s);N=["space",D.slice(U,I)],U=I-1;break;case u:case c:case p:case f:case m:case g:case h:{let e=String.fromCharCode(E);N=[e,e,U];break}case d:if(A=j.length?j.pop()[1]:"",_=D.charCodeAt(U+1),"url"===A&&_!==e&&_!==t&&_!==o&&_!==i&&_!==a&&_!==s&&_!==l){I=U;do{if(R=!1,I=D.indexOf(")",I+1),-1===I){if(L||C){I=U;break}q("bracket")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["brackets",D.slice(U,I+1),U,I],U=I}else I=D.indexOf(")",U+1),P=D.slice(U,I+1),-1===I||S.test(P)?N=["(","(",U]:(N=["brackets",P,U,I],U=I);break;case e:case t:O=E===e?"'":'"',I=U;do{if(R=!1,I=D.indexOf(O,I+1),-1===I){if(L||C){I=U+1;break}q("string")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["string",D.slice(U,I+1),U,I],U=I;break;case y:b.lastIndex=U+1,b.test(D),I=0===b.lastIndex?D.length-1:b.lastIndex-2,N=["at-word",D.slice(U,I+1),U,I],U=I;break;case r:for(I=U,T=!0;D.charCodeAt(I+1)===r;)I+=1,T=!T;if(E=D.charCodeAt(I+1),T&&E!==n&&E!==o&&E!==i&&E!==a&&E!==l&&E!==s&&(I+=1,x.test(D.charAt(I)))){for(;x.test(D.charAt(I+1));)I+=1;D.charCodeAt(I+1)===o&&(I+=1)}N=["word",D.slice(U,I+1),U,I],U=I;break;default:E===n&&D.charCodeAt(U+1)===v?(I=D.indexOf("*/",U+2)+1,0===I&&(L||C?I=D.length:q("comment")),N=["comment",D.slice(U,I+1),U,I],U=I):(w.lastIndex=U+1,w.test(D),I=0===w.lastIndex?D.length-1:w.lastIndex-2,N=["word",D.slice(U,I+1),U,I],j.push(N),U=I)}return U++,N},position:function(){return U}}}}(),r=lm(),n=fm(),i=gm(),o=mm();const s={empty:!0,space:!0};return Uv=class{constructor(e){this.input=e,this.root=new i,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,r,i,o=new n;o.name=e[1].slice(1),""===o.name&&this.unnamedAtrule(o,e),this.init(o,e[2]);let s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?u.push("("===t?")":"]"):"{"===t&&u.length>0?u.push("}"):t===u[u.length-1]&&u.pop(),0===u.length){if(";"===t){o.source.end=this.getPosition(e[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===t){a=!0;break}if("}"===t){if(l.length>0){for(i=l.length-1,r=l[i];r&&"space"===r[0];)r=l[--i];r&&(o.source.end=this.getPosition(r[3]||r[2]),o.source.end.offset++)}this.end(e);break}l.push(e)}else l.push(e);if(this.tokenizer.endOfFile()){s=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(o.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(o,"params",l),s&&(e=l[l.length-1],o.source.end=this.getPosition(e[3]||e[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),a&&(o.nodes=[],this.current=o)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let r,n=0;for(let i=t-1;i>=0&&(r=e[i],"space"===r[0]||(n+=1,2!==n));i--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}colon(e){let t,r,n,i=0;for(let[o,s]of e.entries()){if(t=s,r=t[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return o}this.doubleColon(t)}n=t}return!1}comment(e){let t=new r;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=t(this.input)}decl(t,r){let n=new e;this.init(n,t[0][2]);let i,o=t[t.length-1];for(";"===o[0]&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}(t)),n.source.end.offset++;"word"!==t[0][0];)1===t.length&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let e=t[0][0];if(":"===e||"space"===e||"comment"===e)break;n.prop+=t.shift()[1]}for(n.raws.between="";t.length;){if(i=t.shift(),":"===i[0]){n.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s,a=[];for(;t.length&&(s=t[0][0],"space"===s||"comment"===s);)a.push(t.shift());this.precheckMissedSemicolon(t);for(let e=t.length-1;e>=0;e--){if(i=t[e],"!important"===i[1].toLowerCase()){n.important=!0;let r=this.stringFrom(t,e);r=this.spacesFromEnd(t)+r," !important"!==r&&(n.raws.important=r);break}if("important"===i[1].toLowerCase()){let r=t.slice(0),i="";for(let t=e;t>0;t--){let e=r[t][0];if(0===i.trim().indexOf("!")&&"space"!==e)break;i=r.pop()[1]+i}0===i.trim().indexOf("!")&&(n.important=!0,n.raws.important=i,t=r)}if("space"!==i[0]&&"comment"!==i[0])break}t.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(n.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(n,"value",a.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new o;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,r=null,n=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(r=l[0],a.push(l),"("===r||"["===r)i||(i=l),o.push("("===r?")":"]");else if(s&&n&&"{"===r)i||(i=l),o.push("}");else if(0===o.length){if(";"===r){if(n)return void this.decl(a,s);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),t&&n){if(!s)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,n){let i,o,a,l,u=r.length,c="",d=!0;for(let e=0;e<u;e+=1)i=r[e],o=i[0],"space"!==o||e!==u-1||n?"comment"===o?(l=r[e-1]?r[e-1][0]:"empty",a=r[e+1]?r[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let n=r.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:n,value:c}}e[t]=c}rule(e){e.pop();let t=new o;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},Uv}function bm(){if(qv)return Bv;qv=1;let e=um(),t=ym(),r=sm();function n(e,n){let i=new r(e,n),o=new t(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&n&&n.from&&(/\.scss$/i.test(n.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(n.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(n.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return o.root}return Bv=n,n.default=n,e.registerParse(n),Bv}function wm(){if(Wv)return zv;Wv=1;let{isClean:e,my:t}=Zv(),r=am(),n=tm(),i=um(),o=cm(),s=dm(),a=pm(),l=bm(),u=gm();const c={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},d={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},h={Once:!0,postcssPlugin:!0,prepare:!0};function p(e){return"object"==typeof e&&"function"==typeof e.then}function f(e){let t=!1,r=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function g(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:f(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function v(t){return t[e]=!1,t.nodes&&t.nodes.forEach(e=>v(e)),t}let m={};class y{constructor(e,r,n){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof r||null===r||"root"!==r.type&&"document"!==r.type)if(r instanceof y||r instanceof a)o=v(r.root),r.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let e=l;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{o=e(r,n)}catch(e){this.processed=!0,this.error=e}o&&!o[t]&&i.rebuild(o)}else o=v(r);this.result=new a(e,o,n),this.helpers={...m,postcss:m,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(r.postcssVersion&&"production"!==process.env.NODE_ENV){let e=r.postcssPlugin,t=r.postcssVersion,n=this.result.processor.version,i=t.split("."),o=n.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+n+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=r.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,r)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,r])};for(let t of this.plugins)if("object"==typeof t)for(let r in t){if(!d[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[r])if("object"==typeof t[r])for(let n in t[r])e(t,"*"===n?r:r+"-"+n.toLowerCase(),t[r][n]);else"function"==typeof t[r]&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(p(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];){t[e]=!0;let r=[g(t)];for(;r.length>0;){let e=this.visitTick(r);if(p(e))try{await e}catch(e){let t=r[r.length-1].node;throw this.handleError(e,t)}}}if(this.listeners.OnceExit)for(let[e,r]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map(e=>r(e,this.helpers));await Promise.all(e)}else await r(t,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return p(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=n;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new r(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(p(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];)t[e]=!0,this.walkSync(t);if(this.listeners.OnceExit)if("document"===t.type)for(let e of t.nodes)this.visitSync(this.listeners.OnceExit,e);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||s("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,n]of e){let e;this.result.lastPlugin=r;try{e=n(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(p(e))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void t.pop();if(i.length>0&&r.visitorIndex<i.length){let[e,t]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=e;try{return t(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==r.iterator){let i,o=r.iterator;for(;i=n.nodes[n.indexes[o]];)if(n.indexes[o]+=1,!i[e])return i[e]=!0,void t.push(g(i));r.iterator=0,delete n.indexes[o]}let o=r.events;for(;r.eventIndex<o.length;){let t=o[r.eventIndex];if(r.eventIndex+=1,0===t)return void(n.nodes&&n.nodes.length&&(n[e]=!0,r.iterator=n.getIterator()));if(this.listeners[t])return void(r.visitors=this.listeners[t])}t.pop()}walkSync(t){t[e]=!0;let r=f(t);for(let n of r)if(0===n)t.nodes&&t.each(t=>{t[e]||this.walkSync(t)});else{let e=this.listeners[n];if(e&&this.visitSync(e,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return y.registerPostcss=e=>{m=e},zv=y,y.default=y,u.registerLazyResult(y),o.registerLazyResult(y),zv}function Sm(){if(Kv)return Hv;Kv=1;let e=function(){if($v)return Vv;$v=1;let e=am(),t=tm(),r=dm(),n=bm();const i=pm();class o{constructor(r,n,o){let s;n=n.toString(),this.stringified=!1,this._processor=r,this._css=n,this._opts=o,this._map=void 0;let a=t;this.result=new i(this._processor,s,this._opts),this.result.css=n;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,n);if(u.isMap()){let[e,t]=u.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else u.clearAnnotation(),this.result.css=u.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||r("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=n;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}}return Vv=o,o.default=o,Vv}(),t=wm(),r=cm(),n=gm();class i{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(!0===r.postcss?r=r():r.postcss&&(r=r.postcss),"object"==typeof r&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if("object"==typeof r&&r.postcssPlugin)t.push(r);else if("function"==typeof r)t.push(r);else{if("object"!=typeof r||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(r,n={}){return this.plugins.length||n.parser||n.stringifier||n.syntax?new t(this,r,n):new e(this,r,n)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return Hv=i,i.default=i,n.registerProcessor(i),r.registerProcessor(i),Hv}const xm=Vg(function(){if(Yv)return Xv;Yv=1;let e=Qg(),t=nm(),r=wm(),n=um(),i=Sm(),o=tm(),s=function(){if(Jv)return Gv;Jv=1;let e=nm(),t=om(),r=lm(),n=fm(),i=sm(),o=gm(),s=mm();function a(l,u){if(Array.isArray(l))return l.map(e=>a(e));let{inputs:c,...d}=l;if(c){u=[];for(let e of c){let r={...e,__proto__:i.prototype};r.map&&(r.map={...r.map,__proto__:t.prototype}),u.push(r)}}if(d.nodes&&(d.nodes=l.nodes.map(e=>a(e,u))),d.source){let{inputId:e,...t}=d.source;d.source=t,null!=e&&(d.source.input=u[e])}if("root"===d.type)return new o(d);if("decl"===d.type)return new e(d);if("rule"===d.type)return new s(d);if("comment"===d.type)return new r(d);if("atrule"===d.type)return new n(d);throw new Error("Unknown node type: "+l.type)}return Gv=a,a.default=a,Gv}(),a=cm(),l=hm(),u=lm(),c=fm(),d=pm(),h=sm(),p=bm(),f=vm(),g=mm(),v=gm(),m=rm();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new i(e)}return y.plugin=function(e,t){let r,n=!1;function o(...r){console&&console.warn&&!n&&(n=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226"));let o=t(...r);return o.postcssPlugin=e,o.postcssVersion=(new i).version,o}return Object.defineProperty(o,"postcss",{get:()=>(r||(r=o()),r)}),o.process=function(e,t,r){return y([o(r)]).process(e,t)},o},y.stringify=o,y.parse=p,y.fromJSON=s,y.list=f,y.comment=e=>new u(e),y.atRule=e=>new c(e),y.decl=e=>new t(e),y.rule=e=>new g(e),y.root=e=>new v(e),y.document=e=>new a(e),y.CssSyntaxError=e,y.Declaration=t,y.Container=n,y.Processor=i,y.Document=a,y.Comment=u,y.Warning=l,y.AtRule=c,y.Result=d,y.Input=h,y.Rule=g,y.Root=v,y.Node=m,r.registerPostcss(y),Xv=y,y.default=y,Xv}());xm.stringify,xm.fromJSON,xm.plugin,xm.parse,xm.list,xm.document,xm.comment,xm.atRule,xm.rule,xm.decl,xm.root,xm.CssSyntaxError,xm.Declaration,xm.Container,xm.Processor,xm.Document,xm.Comment,xm.Warning,xm.AtRule,xm.Result,xm.Input,xm.Rule,xm.Root,xm.Node;class km{constructor(...e){Wg(this,"parentElement",null),Wg(this,"parentNode",null),Wg(this,"ownerDocument"),Wg(this,"firstChild",null),Wg(this,"lastChild",null),Wg(this,"previousSibling",null),Wg(this,"nextSibling",null),Wg(this,"ELEMENT_NODE",1),Wg(this,"TEXT_NODE",3),Wg(this,"nodeType"),Wg(this,"nodeName"),Wg(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof km))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}const Cm={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Em={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Im={};function Om(e){if(Im[e])return Im[e];const t=function(e){var t,r;const n=null==(r=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:r.call(t,e);return n&&globalThis[n]?globalThis[n]:void 0}(e)||globalThis[e],r=t.prototype,n=e in Cm?Cm[e]:void 0,i=Boolean(n&&n.every(e=>{var t,n;return Boolean(null==(n=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),o=e in Em?Em[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return Im[e]=t.prototype,t.prototype;try{const n=document.createElement("iframe");document.body.appendChild(n);const i=n.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(n),o?Im[e]=o:r}catch{return r}}const Pm={};function Tm(e,t,r){var n;const i=`${e}.${String(r)}`;if(Pm[i])return Pm[i].call(t);const o=Om(e),s=null==(n=Object.getOwnPropertyDescriptor(o,r))?void 0:n.get;return s?(Pm[i]=s,s.call(t)):t[r]}const Rm={};function Mm(e,t,r){const n=`${e}.${String(r)}`;if(Rm[n])return Rm[n].bind(t);const i=Om(e)[r];return"function"!=typeof i?t[r]:(Rm[n]=i,i.bind(t))}const Am={childNodes:function(e){return Tm("Node",e,"childNodes")},parentNode:function(e){return Tm("Node",e,"parentNode")},parentElement:function(e){return Tm("Node",e,"parentElement")},textContent:function(e){return Tm("Node",e,"textContent")},contains:function(e,t){return Mm("Node",e,"contains")(t)},getRootNode:function(e){return Mm("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Tm("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Tm("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Tm("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Tm("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return Om("MutationObserver").constructor}};const _m="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.";let Nm={map:{},getId:()=>(console.error(_m),-1),getNode:()=>(console.error(_m),null),removeNodeFromMap(){console.error(_m)},has:()=>(console.error(_m),!1),reset(){console.error(_m)}};"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Nm=new Proxy(Nm,{get:(e,t,r)=>("map"===t&&console.error(_m),Reflect.get(e,t,r))}));let Dm=Date.now;function Lm(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:Am.parentElement(e)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Dm=()=>(new Date).getTime());function Fm(e){var t;let r=null;return"getRootNode"in e&&(null==(t=Am.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Am.host(Am.getRootNode(e))&&(r=Am.host(Am.getRootNode(e))),r}function Um(e){let t,r=e;for(;t=Fm(r);)r=t;return r}function jm(e){const t=e.ownerDocument;if(!t)return!1;const r=Um(e);return Am.contains(t,r)}const Bm=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:class{constructor(){Gp(this,"id",1),Gp(this,"styleIDMap",new WeakMap),Gp(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}},get _mirror(){return Nm},closestElementOfNode:Lm,getBaseDimension:function e(t,r){var n,i;const o=null==(i=null==(n=t.ownerDocument)?void 0:n.defaultView)?void 0:i.frameElement;if(!o||o===r)return{x:0,y:0,relativeScale:1,absoluteScale:1};const s=o.getBoundingClientRect(),a=e(o,r),l=s.height/o.clientHeight;return{x:s.x*a.relativeScale+a.x,y:s.y*a.relativeScale+a.y,relativeScale:l,absoluteScale:a.absoluteScale*l}},getNestedRule:function e(t,r){const n=t[r[0]];return 1===r.length?n:e(n.cssRules[r[1]].cssRules,r.slice(2))},getPositionsAndIndex:function(e){const t=[...e],r=t.pop();return{positions:t,index:r}},getRootShadowHost:Um,getShadowHost:Fm,getWindowHeight:function(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight},getWindowScroll:function(e){var t,r,n,i;const o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:o.documentElement.scrollLeft||(null==o?void 0:o.body)&&(null==(t=Am.parentElement(o.body))?void 0:t.scrollLeft)||(null==(r=null==o?void 0:o.body)?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==o?void 0:o.documentElement.scrollTop)||(null==o?void 0:o.body)&&(null==(n=Am.parentElement(o.body))?void 0:n.scrollTop)||(null==(i=null==o?void 0:o.body)?void 0:i.scrollTop)||0}},getWindowWidth:function(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth},hasShadowRoot:function(e){return!!e&&(e instanceof km&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Am.shadowRoot(e)))},hookSetter:function e(t,r,n,i,o=window){const s=o.Object.getOwnPropertyDescriptor(t,r);return o.Object.defineProperty(t,r,i?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),s&&s.set&&s.set.call(this,e)}}),()=>e(t,r,s||{},!0)},inDom:function(e){const t=e.ownerDocument;return!!t&&(Am.contains(t,e)||jm(e))},isAncestorRemoved:function e(t,r){if(function(e){const t=e&&"host"in e&&"mode"in e&&sf.host(e)||null;return Boolean(t&&"shadowRoot"in t&&sf.shadowRoot(t)===e)}(t))return!1;const n=r.getId(t);if(!r.has(n))return!0;const i=Am.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||e(i,r))},isBlocked:function(e,t,r,n){if(!e)return!1;const i=Lm(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(n&&null!==i.closest("."+t))return!0}else if(lf(i,t,n))return!0}catch(e){}if(r){if(i.matches(r))return!0;if(n&&null!==i.closest(r))return!0}return!1},isIgnored:function(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||-2===t.getId(e)},isSerialized:function(e,t){return-1!==t.getId(e)},isSerializedIframe:function(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))},isSerializedStylesheet:function(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))},iterateResolveTree:function e(t,r){r(t.value);for(let n=t.children.length-1;n>=0;n--)e(t.children[n],r)},legacy_isTouchEvent:function(e){return Boolean(e.changedTouches)},get nowTimestamp(){return Dm},on:function(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)},patch:function(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],i=r(n);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}},polyfill: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)},queueToResolveTrees:function(e){const t={},r=(e,r)=>{const n={value:e,parent:r,children:[]};return t[e.node.id]=n,n},n=[];for(const i of e){const{nextId:e,parentId:o}=i;if(e&&e in t){const o=t[e];if(o.parent){const e=o.parent.children.indexOf(o);o.parent.children.splice(e,0,r(i,o.parent))}else{const e=n.indexOf(o);n.splice(e,0,r(i,null))}continue}if(o in t){const e=t[o];e.children.push(r(i,e));continue}n.push(r(i,null))}return n},shadowHostInDom:jm,throttle:function(e,t,r={}){let n=null,i=0;return function(...o){const s=Date.now();i||!1!==r.leading||(i=s);const a=t-(s-i),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),i=s,e.apply(l,o)):n||!1===r.trailing||(n=setTimeout(()=>{i=!1===r.leading?0:Date.now(),n=null,e.apply(l,o)},a))}},uniqueTextMutations:function(e){const t=new Set,r=[];for(let n=e.length;n--;){const i=e[n];t.has(i.id)||(r.push(i),t.add(i.id))}return r}},Symbol.toStringTag,{value:"Module"}));for(var qm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zm="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Wm=0;Wm<64;Wm++)zm[qm.charCodeAt(Wm)]=Wm;"undefined"!=typeof self&&self.Blob&&new Blob(['(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext("2d");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map\n'],{type:"text/javascript;charset=utf-8"});try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(Up=e.contentWindow)?void 0:Up.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var Vm,$m;new af,($m=Vm||(Vm={}))[$m.NotStarted=0]="NotStarted",$m[$m.Running=1]="Running",$m[$m.Stopped=2]="Stopped";class Hm{constructor(e){Hp(this,"fileName"),Hp(this,"functionName"),Hp(this,"lineNumber"),Hp(this,"columnNumber"),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}}const Km=/(^|@)\S+:\d+/,Gm=/^\s*at .*(\S+:\d+|\(native\))/m,Jm=/^(eval@)?(\[native code])?$/,Xm={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Gm)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(Gm)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const r=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=r?t.replace(r[0],""):t;const n=t.split(/\s+/).slice(1),i=this.extractLocation(r?r[1]:n.pop()),o=n.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new Hm({functionName:o,fileName:s,lineNumber:i[1],columnNumber:i[2]})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(Jm)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new Hm({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),n=r&&r[1]?r[1]:void 0,i=this.extractLocation(e.replace(t,""));return new Hm({functionName:n,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})}},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),n=[];for(let e=2,i=r.length;e<i;e+=2){const i=t.exec(r[e]);i&&n.push(new Hm({fileName:i[2],lineNumber:parseFloat(i[1])}))}return n},parseOpera10:function(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),n=[];for(let e=0,i=r.length;e<i;e+=2){const i=t.exec(r[e]);i&&n.push(new Hm({functionName:i[3]||void 0,fileName:i[2],lineNumber:parseFloat(i[1])}))}return n},parseOpera11:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(Km)&&!e.match(/^Error created at/)},this).map(function(e){const t=e.split("@"),r=this.extractLocation(t.pop()),n=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Hm({functionName:n,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})},this)}};function Ym(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let r=e.localName;if(!r)break;r=r.toLowerCase();const n=e.parentElement,i=[];if(n.children&&n.children.length>0)for(let e=0;e<n.children.length;e++){const t=n.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===r&&i.push(t)}i.length>1&&(r+=`:eq(${i.indexOf(e)})`),t=r+(t?">"+t:""),e=n}return t}function Qm(e){return"[object Object]"===Object.prototype.toString.call(e)}function Zm(e,t){if(0===t)return!0;const r=Object.keys(e);for(const n of r)if(Qm(e[n])&&Zm(e[n],t-1))return!0;return!1}function ey(e,t){const r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);const n=[],i=[];return JSON.stringify(e,function(e,t){if(n.length>0){const r=n.indexOf(this);~r?n.splice(r+1):n.push(this),~r?i.splice(r,1/0,e):i.push(e),~n.indexOf(t)&&(t=n[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,n.indexOf(t)).join(".")+"]")}else n.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(function(e){if(Qm(e)&&Object.keys(e).length>r.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(Qm(e)&&Zm(e,r.depthOfLimit))return!0;return!1}(t))return function(e){let t=e.toString();r.stringLengthLimit&&t.length>r.stringLengthLimit&&(t=`${t.slice(0,r.stringLengthLimit)}...`);return t}(t);if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const r in t){const n=t[r];Array.isArray(n)?e[r]=Ym(n.length?n[0]:null):e[r]=n}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}const ty={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function ry(e,t,r){const n=r?Object.assign({},ty,r):ty,i=n.logger;if(!i)return()=>{};let o;o="string"==typeof i?t[i]:i;let s=0,a=!1;const l=[];if(n.level.includes("error")){const r=t=>{const r=t.message,i=t.error,o=Xm.parse(i).map(e=>e.toString()),s=[ey(r,n.stringifyOptions)];e({level:"error",trace:o,payload:s})};t.addEventListener("error",r),l.push(()=>{t.removeEventListener("error",r)});const i=t=>{let r,i;t.reason instanceof Error?(r=t.reason,i=[ey(`Uncaught (in promise) ${r.name}: ${r.message}`,n.stringifyOptions)]):(r=new Error,i=[ey("Uncaught (in promise)",n.stringifyOptions),ey(t.reason,n.stringifyOptions)]);const o=Xm.parse(r).map(e=>e.toString());e({level:"error",trace:o,payload:i})};t.addEventListener("unhandledrejection",i),l.push(()=>{t.removeEventListener("unhandledrejection",i)})}for(const e of n.level)l.push(u(o,e));return()=>{l.forEach(e=>e())};function u(t,r){return t[r]?Bm.patch(t,r,t=>(...i)=>{if(t.apply(this,i),!("assert"===r&&i[0]||a)){a=!0;try{const t=Xm.parse(new Error).map(e=>e.toString()).splice(1),o=("assert"===r?i.slice(1):i).map(e=>ey(e,n.stringifyOptions));s++,s<n.lengthThreshold?e({level:r,trace:t,payload:o}):s===n.lengthThreshold&&e({level:"warn",trace:[],payload:[ey("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...i)}finally{a=!1}}}):()=>{}}}const ny="rrweb/console@1";var iy,oy=Object.freeze({__proto__:null,PLUGIN_NAME:ny,getRecordConsolePlugin:e=>({name:ny,observer:ry,options:e})}),sy=Object.defineProperty,ay=(e,t,r)=>((e,t,r)=>t in e?sy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),ly=Object.defineProperty,uy=(e,t,r)=>((e,t,r)=>t in e?ly(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),cy=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(cy||{});const dy={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},hy={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},py={};function fy(e){if(py[e])return py[e];const t=function(e){var t,r;const n=null==(r=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:r.call(t,e);return n&&globalThis[n]?globalThis[n]:void 0}(e)||globalThis[e],r=t.prototype,n=e in dy?dy[e]:void 0,i=Boolean(n&&n.every(e=>{var t,n;return Boolean(null==(n=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),o=e in hy?hy[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return py[e]=t.prototype,t.prototype;try{const n=document.createElement("iframe");document.body.appendChild(n);const i=n.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(n),o?py[e]=o:r}catch{return r}}const gy={};function vy(e,t,r){var n;const i=`${e}.${String(r)}`;if(gy[i])return gy[i].call(t);const o=fy(e),s=null==(n=Object.getOwnPropertyDescriptor(o,r))?void 0:n.get;return s?(gy[i]=s,s.call(t)):t[r]}const my={};function yy(e,t,r){const n=`${e}.${String(r)}`;if(my[n])return my[n].bind(t);const i=fy(e)[r];return"function"!=typeof i?t[r]:(my[n]=i,i.bind(t))}const by={childNodes:function(e){return vy("Node",e,"childNodes")},parentNode:function(e){return vy("Node",e,"parentNode")},parentElement:function(e){return vy("Node",e,"parentElement")},textContent:function(e){return vy("Node",e,"textContent")},contains:function(e,t){return yy("Node",e,"contains")(t)},getRootNode:function(e){return yy("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?vy("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?vy("Element",e,"shadowRoot"):null},querySelector:function(e,t){return vy("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return vy("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return fy("MutationObserver").constructor}};function wy(e){return e.nodeType===e.ELEMENT_NODE}function Sy(e){const t=e&&"host"in e&&"mode"in e&&by.host(e)||null;return Boolean(t&&"shadowRoot"in t&&by.shadowRoot(t)===e)}function xy(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function ky(e){try{const r=e.rules||e.cssRules;if(!r)return null;let n=e.href;!n&&e.ownerNode&&e.ownerNode.ownerDocument&&(n=e.ownerNode.ownerDocument.location.href);const i=Array.from(r,e=>Cy(e,n)).join("");return(t=i).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}catch(e){return null}var t}function Cy(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=ky(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const r=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}(e)}catch(r){t=e.cssText}return e.styleSheet.href?Dy(t,e.styleSheet.href):t}{let r=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(r=function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(r)),t?Dy(r,t):r}}class Ey{constructor(){uy(this,"idNodeMap",new Map),uy(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;return(null==(t=this.getMeta(e))?void 0:t.id)??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const e=this.nodeMetaMap.get(r);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Iy({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:o}){let s=i||"";const a=n&&Oy(n);return(t[r.toLowerCase()]||a&&t[a])&&(s=o?o(s,e):"*".repeat(s.length)),s}function Oy(e){return e.toLowerCase()}const Py="__rrweb_original__";function Ty(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Oy(t):null}function Ry(e,t){let r;try{r=new URL(e,t??window.location.href)}catch(e){return null}const n=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(null==n?void 0:n[1])??null}const My=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Ay=/^(?:[a-z+]+:)?\/\//i,_y=/^www\..*/i,Ny=/^(data:)([^,]*),(.*)/i;function Dy(e,t){return(e||"").replace(My,(e,r,n,i,o,s)=>{const a=n||o||s,l=r||i||"";if(!a)return e;if(Ay.test(a)||_y.test(a))return`url(${l}${a}${l})`;if(Ny.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${l})`;const u=t.split("/"),c=a.split("/");u.pop();for(const e of c)"."!==e&&(".."===e?u.pop():u.push(e));return`url(${l}${u.join("/")}${l})`})}function Ly(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Fy(e,t){return function(e,t,r=!1){const n=Array.from(t.childNodes),i=[];let o=0;if(n.length>1&&e&&"string"==typeof e){let t=Ly(e,r);const s=t.length/e.length;for(let a=1;a<n.length;a++)if(n[a].textContent&&"string"==typeof n[a].textContent){const l=Ly(n[a].textContent,r),u=100;let c=3;for(;c<l.length&&(l[c].match(/[a-zA-Z0-9]/)||-1!==l.indexOf(l.substring(0,c),1));c++);for(;c<l.length;c++){let d=l.substring(0,c),h=t.split(d),p=-1;if(2===h.length)p=h[0].length;else if(h.length>2&&""===h[0]&&""!==n[a-1].textContent)p=t.indexOf(d,1);else if(1===h.length){if(d=d.substring(0,d.length-1),h=t.split(d),h.length<=1)return i.push(e),i;c=u+1}else c===l.length-1&&(p=t.indexOf(d));if(h.length>=2&&c>u){const e=n[a-1].textContent;if(e&&"string"==typeof e){const r=Ly(e).length;p=t.indexOf(d,r)}-1===p&&(p=h[0].length)}if(-1!==p){let a=Math.floor(p/s);for(;a>0&&a<e.length;){if(o+=1,o>50*n.length)return i.push(e),i;const l=Ly(e.substring(0,a),r);if(l.length===p){i.push(e.substring(0,a)),e=e.substring(a),t=t.substring(p);break}l.length<p?a+=Math.max(1,Math.floor((p-l.length)/s)):a-=Math.max(1,Math.floor((l.length-p)*s))}break}}}}return i.push(e),i}(e,t).join("/* rr_split */")}const Uy="lightgrey";let jy=1;const By=new RegExp("[^a-z0-9-_:]");function qy(){return jy++}let zy,Wy;const Vy=/^[^ \t\n\r\u000c]+/,$y=/^[, \t\n\r\u000c]+/;const Hy=new WeakMap;function Ky(e,t){return t&&""!==t.trim()?Jy(e,t):t}function Gy(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function Jy(e,t){let r=Hy.get(e);if(r||(r=e.createElement("a"),Hy.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function Xy(e,t,r,n){return n?"src"===r||"href"===r&&("use"!==t||"#"!==n[0])||"xlink:href"===r&&"#"!==n[0]?Ky(e,n):"background"!==r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r?function(e,t){if(""===t.trim())return t;let r=0;function n(e){let n;const i=e.exec(t.substring(r));return i?(n=i[0],r+=n.length,n):""}const i=[];for(;n($y),!(r>=t.length);){let o=n(Vy);if(","===o.slice(-1))o=Ky(e,o.substring(0,o.length-1)),i.push(o);else{let n="";o=Ky(e,o);let s=!1;for(;;){const e=t.charAt(r);if(""===e){i.push((o+n).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){r+=1,i.push((o+n).trim());break}"("===e&&(s=!0)}n+=e,r+=1}}}return i.join(", ")}(e,n):"style"===r?Dy(n,Jy(e)):"object"===t&&"data"===r?Ky(e,n):n:Ky(e,n):n}function Yy(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function Qy(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&Qy(by.parentNode(e),t,r);for(let r=e.classList.length;r--;){const n=e.classList[r];if(t.test(n))return!0}return!!r&&Qy(by.parentNode(e),t,r)}function Zy(e,t,r,n){let i;if(wy(e)){if(i=e,!by.childNodes(i).length)return!1}else{if(null===by.parentElement(e))return!1;i=by.parentElement(e)}try{if("string"==typeof t){if(n){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(Qy(i,t,n))return!0;if(r)if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}catch(e){}return!1}function eb(e,t){const{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,maskAttributeFn:d,dataURLOptions:h={},inlineImages:p,recordCanvas:f,keepIframeSrcFn:g,newlyAddedElement:v=!1,cssCaptured:m=!1,applyBackgroundColorToBlockedElements:y=!1}=t,b=function(e,t){if(!t.hasNode(e))return;const r=t.getId(e);return 1===r?void 0:r}(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:cy.Document,childNodes:[],compatMode:e.compatMode}:{type:cy.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:cy.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return function(e,t){const{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:a,maskAttributeFn:l,dataURLOptions:u={},inlineImages:c,recordCanvas:d,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:f,applyBackgroundColorToBlockedElements:g=!1}=t,v=function(e,t,r){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let r=e.classList.length;r--;){const n=e.classList[r];if(t.test(n))return!0}if(r)return e.matches(r)}catch(e){}return!1}(e,n,i),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=Oy(e.tagName);return By.test(t)?"div":t}(e);let y={};const b=e.attributes.length;for(let t=0;t<b;t++){const n=e.attributes[t];if(!Yy(m,n.name,n.value)){const t=Xy(r,m,Oy(n.name),n.value);if(l&&null!==t){const r=l(n.name,t,e);null!==r&&(y[n.name]=r)}else y[n.name]=t}}if("link"===m&&o){const t=Array.from(r.styleSheets).find(t=>t.href===e.href);let n=null;t&&(n=ky(t)),n&&(delete y.rel,delete y.href,y._cssText=n)}if("style"===m&&e.sheet){let t=ky(e.sheet);t&&(e.childNodes.length>1&&(t=Fy(t,e)),y._cssText=t)}if("input"===m||"textarea"===m||"select"===m){const t=e.value,r=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=Iy({element:e,type:Ty(e),tagName:m,value:t,maskInputOptions:s,maskInputFn:a}):r&&(y.checked=r)}"option"===m&&(e.selected&&!s.select?y.selected=!0:delete y.selected);"dialog"===m&&e.open&&(y.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal");if("canvas"===m&&d)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let r=0;r<e.width;r+=50)for(let n=0;n<e.height;n+=50){const i=t.getImageData,o=Py in i?i[Py]:i;if(new Uint32Array(o.call(t,r,n,Math.min(50,e.width-r),Math.min(50,e.height-n)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(y.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const t=e.toDataURL(u.type,u.quality),n=r.createElement("canvas");n.width=e.width,n.height=e.height;t!==n.toDataURL(u.type,u.quality)&&(y.rr_dataURL=t)}if("img"===m&&c){zy||(zy=r.createElement("canvas"),Wy=zy.getContext("2d"));const t=e,n=t.currentSrc||t.getAttribute("src")||"<unknown-src>",i=t.crossOrigin,o=()=>{t.removeEventListener("load",o);try{zy.width=t.naturalWidth,zy.height=t.naturalHeight,Wy.drawImage(t,0,0),y.rr_dataURL=zy.toDataURL(u.type,u.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(i?y.crossOrigin=i:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if("audio"===m||"video"===m){const t=y;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}p||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(v){const{width:t,height:r}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${r}px`,...g?{rr_background_color:Uy}:{}}}"iframe"!==m||h(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);let w;try{customElements.get(m)&&(w=!0)}catch(e){}return{type:cy.Element,tagName:m,attributes:y,childNodes:[],isSVG:Gy(e)||void 0,needBlock:v,rootId:f,isCustom:w}}(e,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,maskAttributeFn:d,dataURLOptions:h,inlineImages:p,recordCanvas:f,keepIframeSrcFn:g,newlyAddedElement:v,rootId:b,applyBackgroundColorToBlockedElements:y});case e.TEXT_NODE:return function(e,t){const{needsMask:r,maskTextFn:n,rootId:i,cssCaptured:o}=t,s=by.parentNode(e),a=s&&s.tagName;let l="";const u="STYLE"===a||void 0,c="SCRIPT"===a||void 0;c?l="SCRIPT_PLACEHOLDER":o||(l=by.textContent(e),u&&l&&(l=Dy(l,Jy(t.doc))));!u&&!c&&l&&r&&(l=n?n(l,by.parentElement(e)):l.replace(/[\S]/g,"*"));return{type:cy.Text,textContent:l||"",rootId:i}}(e,{doc:r,needsMask:s,maskTextFn:u,rootId:b,cssCaptured:m});case e.CDATA_SECTION_NODE:return{type:cy.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:cy.Comment,textContent:by.textContent(e)||"",rootId:b};default:return!1}}function tb(e){return null==e?"":e.toLowerCase()}function rb(e,t,r){return Array.from(e).map(e=>{const n=t(e);let i=[];if(!r.has(n)){r.add(n);try{i=Array.from(e.cssRules,(t,r)=>({rule:Cy(t,e.href),index:r}))}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}return{styleId:n,rules:i}})}function nb(e,t){var r,n;const{doc:i,mirror:o,blockClass:s,blockSelector:a,maskTextClass:l,maskTextSelector:u,skipChild:c=!1,inlineStylesheet:d=!0,maskInputOptions:h={},maskTextFn:p,maskInputFn:f,maskAttributeFn:g,slimDOMOptions:v,dataURLOptions:m={},inlineImages:y=!1,recordCanvas:b=!1,onSerialize:w,onAdoptedStyleSheet:S,onIframeLoad:x,iframeLoadTimeout:k=5e3,onStylesheetLoad:C,stylesheetLoadTimeout:E=5e3,keepIframeSrcFn:I=()=>!1,newlyAddedElement:O=!1,cssCaptured:P=!1,applyBackgroundColorToBlockedElements:T=!1}=t,R=t._emittedStyleIds??new Set;let{needsMask:M}=t,{preserveWhiteSpace:A=!0}=t;if(!M){M=Zy(e,l,u,void 0===M)}const _=eb(e,{doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:M,inlineStylesheet:d,maskInputOptions:h,maskTextFn:p,maskInputFn:f,maskAttributeFn:g,dataURLOptions:m,inlineImages:y,recordCanvas:b,keepIframeSrcFn:I,newlyAddedElement:O,cssCaptured:P,applyBackgroundColorToBlockedElements:T});if(!_)return console.warn(e,"not serialized"),null;let N;N=o.hasNode(e)?o.getId(e):function(e,t){if(t.comment&&e.type===cy.Comment)return!0;if(e.type===cy.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&&"js"===Ry(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(tb(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===tb(e.attributes.name)||"icon"===tb(e.attributes.rel)||"apple-touch-icon"===tb(e.attributes.rel)||"shortcut icon"===tb(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&tb(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(tb(e.attributes.property).match(/^(og|twitter|fb):/)||tb(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===tb(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===tb(e.attributes.name)||"googlebot"===tb(e.attributes.name)||"bingbot"===tb(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===tb(e.attributes.name)||"generator"===tb(e.attributes.name)||"framework"===tb(e.attributes.name)||"publisher"===tb(e.attributes.name)||"progid"===tb(e.attributes.name)||tb(e.attributes.property).match(/^article:/)||tb(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===tb(e.attributes.name)||"yandex-verification"===tb(e.attributes.name)||"csrf-token"===tb(e.attributes.name)||"p:domain_verify"===tb(e.attributes.name)||"verify-v1"===tb(e.attributes.name)||"verification"===tb(e.attributes.name)||"shopify-checkout-api-token"===tb(e.attributes.name)))return!0}}return!1}(_,v)||!A&&_.type===cy.Text&&!_.textContent.replace(/^\s+|\s+$/gm,"").length?-2:qy();const D=Object.assign(_,{id:N});if(o.add(e,D),-2===N)return null;w&&w(e);let L=!c;if(D.type===cy.Element){L=L&&!D.needBlock,delete D.needBlock;const t=by.shadowRoot(e);t&&xy(t)&&(D.isShadowHost=!0,S&&(null==(r=t.adoptedStyleSheets)?void 0:r.length)&&(D.adoptedStyleSheets=rb(t.adoptedStyleSheets,S,R)))}if(D.type===cy.Document&&S){const t=e;(null==(n=t.adoptedStyleSheets)?void 0:n.length)&&(D.adoptedStyleSheets=rb(t.adoptedStyleSheets,S,R))}if((D.type===cy.Document||D.type===cy.Element)&&L){v.headWhitespace&&D.type===cy.Element&&"head"===D.tagName&&(A=!1);const t={doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:M,maskTextClass:l,maskTextSelector:u,skipChild:c,inlineStylesheet:d,maskInputOptions:h,maskTextFn:p,maskInputFn:f,maskAttributeFn:g,slimDOMOptions:v,dataURLOptions:m,inlineImages:y,recordCanvas:b,preserveWhiteSpace:A,onSerialize:w,onAdoptedStyleSheet:S,_emittedStyleIds:R,onIframeLoad:x,iframeLoadTimeout:k,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I,cssCaptured:!1,applyBackgroundColorToBlockedElements:T};if(D.type===cy.Element&&"textarea"===D.tagName&&void 0!==D.attributes.value);else{D.type===cy.Element&&void 0!==D.attributes._cssText&&"string"==typeof D.attributes._cssText&&(t.cssCaptured=!0);for(const r of Array.from(by.childNodes(e))){const e=nb(r,t);e&&D.childNodes.push(e)}}let r=null;if(wy(e)&&(r=by.shadowRoot(e)))for(const e of Array.from(by.childNodes(r))){const n=nb(e,t);n&&(xy(r)&&(n.isShadow=!0),D.childNodes.push(n))}}const F=by.parentNode(e);return F&&Sy(F)&&xy(F)&&(D.isShadow=!0),D.type===cy.Element&&"iframe"===D.tagName&&function(e,t,r){const n=e.contentWindow;if(!n)return;let i,o=!1;try{i=n.document.readyState}catch(e){return}if("complete"!==i){const n=setTimeout(()=>{o||(t(),o=!0)},r);return void e.addEventListener("load",()=>{clearTimeout(n),o=!0,t()})}const s="about:blank";if(n.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,()=>{const t=e.contentDocument;if(t&&x){const r=nb(t,{doc:t,mirror:o,blockClass:s,blockSelector:a,needsMask:M,maskTextClass:l,maskTextSelector:u,skipChild:!1,inlineStylesheet:d,maskInputOptions:h,maskTextFn:p,maskInputFn:f,maskAttributeFn:g,slimDOMOptions:v,dataURLOptions:m,inlineImages:y,recordCanvas:b,preserveWhiteSpace:A,onSerialize:w,onAdoptedStyleSheet:S,onIframeLoad:x,iframeLoadTimeout:k,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I});r&&x(e,r)}},k),D.type===cy.Element&&"link"===D.tagName&&"string"==typeof D.attributes.rel&&("stylesheet"===D.attributes.rel||"preload"===D.attributes.rel&&"string"==typeof D.attributes.href&&"css"===Ry(D.attributes.href))&&function(e,t,r){let n,i=!1;try{n=e.sheet}catch(e){return}if(n)return;const o=setTimeout(()=>{i||(t(),i=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),i=!0,t()})}(e,()=>{if(C){const t=nb(e,{doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:M,maskTextClass:l,maskTextSelector:u,skipChild:!1,inlineStylesheet:d,maskInputOptions:h,maskTextFn:p,maskInputFn:f,maskAttributeFn:g,slimDOMOptions:v,dataURLOptions:m,inlineImages:y,recordCanvas:b,preserveWhiteSpace:A,onSerialize:w,onIframeLoad:x,iframeLoadTimeout:k,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I});t&&C(e,t)}},E),D}function ib(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ob(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var sb,ab={exports:{}};function lb(){if(sb)return ab.exports;sb=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return ab.exports=t(),ab.exports.createColors=t,ab.exports}const ub=ob(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var cb,db;function hb(){if(db)return cb;db=1;let e=lb(),t=ub;class r extends Error{constructor(e,t,n,i,o,s){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),void 0!==t&&void 0!==n&&("number"==typeof t?(this.line=t,this.column=n):(this.line=t.line,this.column=t.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,r)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(r){if(!this.source)return"";let n=this.source;null==r&&(r=e.isColorSupported),t&&r&&(n=t(n));let i,o,s=n.split(/\r?\n/),a=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;if(r){let{bold:t,gray:r,red:n}=e.createColors(!0);i=e=>t(n(e)),o=e=>r(e)}else i=o=e=>e;return s.slice(a,l).map((e,t)=>{let r=a+1+t,n=" "+(" "+r).slice(-u)+" | ";if(r===this.line){let t=o(n.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+o(n)+e+"\n "+t+i("^")}return" "+o(n)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return cb=r,r.default=r,cb}var pb,fb,gb,vb,mb,yb,bb,wb,Sb,xb,kb,Cb,Eb,Ib,Ob,Pb,Tb,Rb,Mb,Ab,_b,Nb,Db,Lb,Fb,Ub,jb,Bb,qb,zb,Wb,Vb,$b,Hb,Kb,Gb,Jb,Xb,Yb,Qb,Zb,ew,tw,rw,nw,iw,ow,sw,aw,lw,uw,cw,dw,hw={};function pw(){return pb||(pb=1,hw.isClean=Symbol("isClean"),hw.my=Symbol("my")),hw}function fw(){if(gb)return fb;gb=1;const e={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};class t{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let i=(e.raws.between||"")+(t?";":"");this.builder(r+n+i,e)}}beforeAfter(e,t){let r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let n=e.parent,i=0;for(;n&&"root"!==n.type;)i+=1,n=n.parent;if(r.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)r+=t}return r}block(e,t){let r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let i=e.nodes[n],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==n||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],void 0!==i))return i;let o=t.parent;if("before"===n){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[n];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[n])return s.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(t,n);{let e="raw"+((a=n)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[r],void 0!==i)return!1})}var a;return void 0===i&&(i=e[n]),s.rawCache[n]=i,i}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return t=r.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){let e=r.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}}return fb=t,t.default=t,fb}function gw(){if(mb)return vb;mb=1;let e=fw();function t(t,r){new e(r).stringify(t)}return vb=t,t.default=t,vb}function vw(){if(bb)return yb;bb=1;let{isClean:e,my:t}=pw(),r=hb(),n=fw(),i=gw();function o(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if("proxyCache"===n)continue;let i=e[n],s=typeof i;"parent"===n&&"object"===s?t&&(r[n]=t):"source"===n?r[n]=i:Array.isArray(i)?r[n]=i.map(e=>o(e,r)):("object"===s&&null!==i&&(i=o(i)),r[n]=i)}return r}class s{constructor(r={}){this.raws={},this[e]=!1,this[t]=!0;for(let e in r)if("nodes"===e){this.nodes=[];for(let t of r[e])"function"==typeof t.clone?this.append(t.clone()):this.append(t)}else this[e]=r[e]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=o(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new r(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[e]){this[e]=!1;let t=this;for(;t=t.parent;)t[e]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let n=(t=this.toString()).indexOf(e.word);-1!==n&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===r[t]?(n=1,i+=1):n+=1;return{column:n,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let n=this.toString(),i=n.indexOf(e.word);-1!==i&&(t=this.positionInside(i,n),r=this.positionInside(i+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return(new n).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let r={},n=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let n=this[e];if(Array.isArray(n))r[e]=n.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof n&&n.toJSON)r[e]=n.toJSON(null,t);else if("source"===e){let o=t.get(n.input);null==o&&(o=i,t.set(n.input,i),i++),r[e]={end:n.end,inputId:o,start:n.start}}else r[e]=n}return n&&(r.inputs=[...t.keys()].map(e=>e.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=i){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,r){let n={node:this};for(let e in r)n[e]=r[e];return e.warn(t,n)}get proxyOf(){return this}}return yb=s,s.default=s,yb}function mw(){if(Sb)return wb;Sb=1;let e=vw();class t extends e{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}}return wb=t,t.default=t,wb}function yw(){if(kb)return xb;kb=1;return xb={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n}},xb}function bw(){if(Eb)return Cb;Eb=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=ub,{existsSync:r,readFileSync:n}=ub,{dirname:i,join:o}=ub;class s{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=i(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new e(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}loadFile(e){if(this.root=i(e),r(e))return this.mapFile=e,n(e,"utf-8").toString().trim()}loadMap(r,n){if(!1===n)return!1;if(n){if("string"==typeof n)return n;if("function"!=typeof n){if(n instanceof e)return t.fromSourceMap(n).toString();if(n instanceof t)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}{let e=n(r);if(e){let t=this.loadFile(e);if(!t)throw new Error("Unable to load previous source map: "+e.toString());return t}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let e=this.annotation;return r&&(e=o(i(r),e)),this.loadFile(e)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return Cb=s,s.default=s,Cb}function ww(){if(Ob)return Ib;Ob=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=ub,{fileURLToPath:r,pathToFileURL:n}=ub,{isAbsolute:i,resolve:o}=ub,{nanoid:s}=yw(),a=ub,l=hb(),u=bw(),c=Symbol("fromOffsetCache"),d=Boolean(e&&t),h=Boolean(o&&i);class p{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!h||/^\w+:\/\//.test(t.from)||i(t.from)?this.file=t.from:this.file=o(t.from)),h&&d){let e=new u(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+s(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let o,s,a;if(t&&"object"==typeof t){let e=t,n=r;if("number"==typeof e.offset){let n=this.fromOffset(e.offset);t=n.line,r=n.col}else t=e.line,r=e.column;if("number"==typeof n.offset){let e=this.fromOffset(n.offset);s=e.line,a=e.col}else s=n.line,a=n.column}else if(!r){let e=this.fromOffset(t);t=e.line,r=e.col}let u=this.origin(t,r,s,a);return o=u?new l(e,void 0===u.endLine?u.line:{column:u.column,line:u.line},void 0===u.endLine?u.column:{column:u.endColumn,line:u.endLine},u.source,u.file,i.plugin):new l(e,void 0===s?t:{column:r,line:t},void 0===s?r:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:r,endColumn:a,endLine:s,line:t,source:this.css},this.file&&(n&&(o.input.url=n(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[c])r=this[c];else{let e=this.css.split("\n");r=new Array(e.length);let t=0;for(let n=0,i=e.length;n<i;n++)r[n]=t,t+=e[n].length+1;this[c]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let t,i=r.length-2;for(;n<i;)if(t=n+(i-n>>1),e<r[t])i=t-1;else{if(!(e>=r[t+1])){n=t;break}n=t+1}}return{col:e-r[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:o(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,o,s){if(!this.map)return!1;let a,l,u=this.map.consumer(),c=u.originalPositionFor({column:t,line:e});if(!c.source)return!1;"number"==typeof o&&(a=u.originalPositionFor({column:s,line:o})),l=i(c.source)?n(c.source):new URL(c.source,this.map.consumer().sourceRoot||n(this.map.mapFile));let d={column:c.column,endColumn:a&&a.column,endLine:a&&a.line,line:c.line,url:l.toString()};if("file:"===l.protocol){if(!r)throw new Error("file: protocol is not available in this PostCSS build");d.file=r(l)}let h=u.sourceContentFor(c.source);return h&&(d.source=h),d}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}}return Ib=p,p.default=p,a&&a.registerInput&&a.registerInput(p),Ib}function Sw(){if(Tb)return Pb;Tb=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=ub,{dirname:r,relative:n,resolve:i,sep:o}=ub,{pathToFileURL:s}=ub,a=ww(),l=Boolean(e&&t),u=Boolean(r&&i&&n&&o);return Pb=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let t of this.previous()){let n,i=this.toUrl(this.path(t.file)),o=t.root||r(t.file);!1===this.mapOpts.sourcesContent?(n=new e(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,i,this.toUrl(this.path(o)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),u&&l&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=t.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0});let e,r,n=1,i=1,o="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(t,a,l)=>{if(this.css+=t,a&&"end"!==l&&(s.generated.line=n,s.generated.column=i-1,a.source&&a.source.start?(s.source=this.sourcePath(a),s.original.line=a.source.start.line,s.original.column=a.source.start.column-1,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,this.map.addMapping(s))),e=t.match(/\n/g),e?(n+=e.length,r=t.lastIndexOf("\n"),i=t.length-r):i+=t.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===e.last&&!e.raws.semicolon||(a.source&&a.source.end?(s.source=this.sourcePath(a),s.original.line=a.source.end.line,s.original.column=a.source.end.column-1,s.generated.line=n,s.generated.column=i-2,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=i-1,this.map.addMapping(s)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let o=this.opts.to?r(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=r(i(o,this.mapOpts.annotation)));let s=n(o,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new a(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(s){let t=s(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===o&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},Pb}function xw(){if(Mb)return Rb;Mb=1;let e=vw();class t extends e{constructor(e){super(e),this.type="comment"}}return Rb=t,t.default=t,Rb}function kw(){if(_b)return Ab;_b=1;let e,t,r,n,{isClean:i,my:o}=pw(),s=mw(),a=xw(),l=vw();function u(e){return e.map(e=>(e.nodes&&(e.nodes=u(e.nodes)),delete e.source,e))}function c(e){if(e[i]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class d extends l{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,r,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],r=e(this.proxyOf.nodes[t],t),!1!==r);)this.indexes[n]+=1;return delete this.indexes[n],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...r)=>e[t](...r.map(e=>"function"==typeof e?(t,r)=>e(t.toProxy(),r):e)):"every"===t||"some"===t?r=>e[t]((e,...t)=>r(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r,n=this.index(e),i=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(let e of i)this.proxyOf.nodes.splice(n+1,0,e);for(let e in this.indexes)r=this.indexes[e],n<r&&(this.indexes[e]=r+i.length);return this.markDirty(),this}insertBefore(e,t){let r,n=this.index(e),i=0===n&&"prepend",o=this.normalize(t,this.proxyOf.nodes[n],i).reverse();n=this.index(e);for(let e of o)this.proxyOf.nodes.splice(n,0,e);for(let e in this.indexes)r=this.indexes[e],n<=r&&(this.indexes[e]=r+o.length);return this.markDirty(),this}normalize(n,l){if("string"==typeof n)n=u(e(n).nodes);else if(void 0===n)n=[];else if(Array.isArray(n)){n=n.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===n.type&&"document"!==this.type){n=n.nodes.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if(n.type)n=[n];else if(n.prop){if(void 0===n.value)throw new Error("Value field is missed in node creation");"string"!=typeof n.value&&(n.value=String(n.value)),n=[new s(n)]}else if(n.selector)n=[new t(n)];else if(n.name)n=[new r(n)];else{if(!n.text)throw new Error("Unknown node type in node creation");n=[new a(n)]}return n.map(e=>(e[o]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[i]&&c(e),void 0===e.raws.before&&l&&void 0!==l.raws.before&&(e.raws.before=l.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let n;try{n=e(t,r)}catch(e){throw t.addToError(e)}return!1!==n&&t.walk&&(n=t.walk(e)),n})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("atrule"===r.type&&e.test(r.name))return t(r,n)}):this.walk((r,n)=>{if("atrule"===r.type&&r.name===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("atrule"===e.type)return t(e,r)}))}walkComments(e){return this.walk((t,r)=>{if("comment"===t.type)return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("decl"===r.type&&e.test(r.prop))return t(r,n)}):this.walk((r,n)=>{if("decl"===r.type&&r.prop===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("decl"===e.type)return t(e,r)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("rule"===r.type&&e.test(r.selector))return t(r,n)}):this.walk((r,n)=>{if("rule"===r.type&&r.selector===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("rule"===e.type)return t(e,r)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return d.registerParse=t=>{e=t},d.registerRule=e=>{t=e},d.registerAtRule=e=>{r=e},d.registerRoot=e=>{n=e},Ab=d,d.default=d,d.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,r.prototype):"rule"===e.type?Object.setPrototypeOf(e,t.prototype):"decl"===e.type?Object.setPrototypeOf(e,s.prototype):"comment"===e.type?Object.setPrototypeOf(e,a.prototype):"root"===e.type&&Object.setPrototypeOf(e,n.prototype),e[o]=!0,e.nodes&&e.nodes.forEach(e=>{d.rebuild(e)})},Ab}function Cw(){if(Db)return Nb;Db=1;let e,t,r=kw();class n extends r{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},Nb=n,n.default=n,Nb}function Ew(){if(Fb)return Lb;Fb=1;let e={};return Lb=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function Iw(){if(jb)return Ub;jb=1;class e{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return Ub=e,e.default=e,Ub}function Ow(){if(qb)return Bb;qb=1;let e=Iw();class t{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new e(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}}return Bb=t,t.default=t,Bb}function Pw(){if($b)return Vb;$b=1;let e=kw();class t extends e{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}return Vb=t,t.default=t,e.registerAtRule(t),Vb}function Tw(){if(Kb)return Hb;Kb=1;let e,t,r=kw();class n extends r{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let n=super.normalize(e);if(t)if("prepend"===r)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of n)e.raws.before=t.raws.before;return n}removeChild(e,t){let r=this.index(e);return!t&&0===r&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},Hb=n,n.default=n,r.registerRoot(n),Hb}function Rw(){if(Jb)return Gb;Jb=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,r){let n=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let r of e)u?u=!1:"\\"===r?u=!0:a?r===l&&(a=!1):'"'===r||"'"===r?(a=!0,l=r):"("===r?s+=1:")"===r?s>0&&(s-=1):0===s&&t.includes(r)&&(o=!0),o?(""!==i&&n.push(i.trim()),i="",o=!1):i+=r;return(r||""!==i)&&n.push(i.trim()),n}};return Gb=e,e.default=e,Gb}function Mw(){if(Yb)return Xb;Yb=1;let e=kw(),t=Rw();class r extends e{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return t.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}}return Xb=r,r.default=r,e.registerRule(r),Xb}function Aw(){if(Zb)return Qb;Zb=1;let e=mw(),t=function(){if(Wb)return zb;Wb=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),r="\\".charCodeAt(0),n="/".charCodeAt(0),i="\n".charCodeAt(0),o=" ".charCodeAt(0),s="\f".charCodeAt(0),a="\t".charCodeAt(0),l="\r".charCodeAt(0),u="[".charCodeAt(0),c="]".charCodeAt(0),d="(".charCodeAt(0),h=")".charCodeAt(0),p="{".charCodeAt(0),f="}".charCodeAt(0),g=";".charCodeAt(0),v="*".charCodeAt(0),m=":".charCodeAt(0),y="@".charCodeAt(0),b=/[\t\n\f\r "#'()/;[\\\]{}]/g,w=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,S=/.[\r\n"'(/\\]/,x=/[\da-f]/i;return zb=function(k,C={}){let E,I,O,P,T,R,M,A,_,N,D=k.css.valueOf(),L=C.ignoreErrors,F=D.length,U=0,j=[],B=[];function q(e){throw k.error("Unclosed "+e,U)}return{back:function(e){B.push(e)},endOfFile:function(){return 0===B.length&&U>=F},nextToken:function(k){if(B.length)return B.pop();if(U>=F)return;let C=!!k&&k.ignoreUnclosed;switch(E=D.charCodeAt(U),E){case i:case o:case a:case l:case s:I=U;do{I+=1,E=D.charCodeAt(I)}while(E===o||E===i||E===a||E===l||E===s);N=["space",D.slice(U,I)],U=I-1;break;case u:case c:case p:case f:case m:case g:case h:{let e=String.fromCharCode(E);N=[e,e,U];break}case d:if(A=j.length?j.pop()[1]:"",_=D.charCodeAt(U+1),"url"===A&&_!==e&&_!==t&&_!==o&&_!==i&&_!==a&&_!==s&&_!==l){I=U;do{if(R=!1,I=D.indexOf(")",I+1),-1===I){if(L||C){I=U;break}q("bracket")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["brackets",D.slice(U,I+1),U,I],U=I}else I=D.indexOf(")",U+1),P=D.slice(U,I+1),-1===I||S.test(P)?N=["(","(",U]:(N=["brackets",P,U,I],U=I);break;case e:case t:O=E===e?"'":'"',I=U;do{if(R=!1,I=D.indexOf(O,I+1),-1===I){if(L||C){I=U+1;break}q("string")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["string",D.slice(U,I+1),U,I],U=I;break;case y:b.lastIndex=U+1,b.test(D),I=0===b.lastIndex?D.length-1:b.lastIndex-2,N=["at-word",D.slice(U,I+1),U,I],U=I;break;case r:for(I=U,T=!0;D.charCodeAt(I+1)===r;)I+=1,T=!T;if(E=D.charCodeAt(I+1),T&&E!==n&&E!==o&&E!==i&&E!==a&&E!==l&&E!==s&&(I+=1,x.test(D.charAt(I)))){for(;x.test(D.charAt(I+1));)I+=1;D.charCodeAt(I+1)===o&&(I+=1)}N=["word",D.slice(U,I+1),U,I],U=I;break;default:E===n&&D.charCodeAt(U+1)===v?(I=D.indexOf("*/",U+2)+1,0===I&&(L||C?I=D.length:q("comment")),N=["comment",D.slice(U,I+1),U,I],U=I):(w.lastIndex=U+1,w.test(D),I=0===w.lastIndex?D.length-1:w.lastIndex-2,N=["word",D.slice(U,I+1),U,I],j.push(N),U=I)}return U++,N},position:function(){return U}}}}(),r=xw(),n=Pw(),i=Tw(),o=Mw();const s={empty:!0,space:!0};return Qb=class{constructor(e){this.input=e,this.root=new i,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,r,i,o=new n;o.name=e[1].slice(1),""===o.name&&this.unnamedAtrule(o,e),this.init(o,e[2]);let s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?u.push("("===t?")":"]"):"{"===t&&u.length>0?u.push("}"):t===u[u.length-1]&&u.pop(),0===u.length){if(";"===t){o.source.end=this.getPosition(e[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===t){a=!0;break}if("}"===t){if(l.length>0){for(i=l.length-1,r=l[i];r&&"space"===r[0];)r=l[--i];r&&(o.source.end=this.getPosition(r[3]||r[2]),o.source.end.offset++)}this.end(e);break}l.push(e)}else l.push(e);if(this.tokenizer.endOfFile()){s=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(o.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(o,"params",l),s&&(e=l[l.length-1],o.source.end=this.getPosition(e[3]||e[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),a&&(o.nodes=[],this.current=o)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let r,n=0;for(let i=t-1;i>=0&&(r=e[i],"space"===r[0]||(n+=1,2!==n));i--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}colon(e){let t,r,n,i=0;for(let[o,s]of e.entries()){if(t=s,r=t[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return o}this.doubleColon(t)}n=t}return!1}comment(e){let t=new r;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=t(this.input)}decl(t,r){let n=new e;this.init(n,t[0][2]);let i,o=t[t.length-1];for(";"===o[0]&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}(t)),n.source.end.offset++;"word"!==t[0][0];)1===t.length&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let e=t[0][0];if(":"===e||"space"===e||"comment"===e)break;n.prop+=t.shift()[1]}for(n.raws.between="";t.length;){if(i=t.shift(),":"===i[0]){n.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s,a=[];for(;t.length&&(s=t[0][0],"space"===s||"comment"===s);)a.push(t.shift());this.precheckMissedSemicolon(t);for(let e=t.length-1;e>=0;e--){if(i=t[e],"!important"===i[1].toLowerCase()){n.important=!0;let r=this.stringFrom(t,e);r=this.spacesFromEnd(t)+r," !important"!==r&&(n.raws.important=r);break}if("important"===i[1].toLowerCase()){let r=t.slice(0),i="";for(let t=e;t>0;t--){let e=r[t][0];if(0===i.trim().indexOf("!")&&"space"!==e)break;i=r.pop()[1]+i}0===i.trim().indexOf("!")&&(n.important=!0,n.raws.important=i,t=r)}if("space"!==i[0]&&"comment"!==i[0])break}t.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(n.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(n,"value",a.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new o;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,r=null,n=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(r=l[0],a.push(l),"("===r||"["===r)i||(i=l),o.push("("===r?")":"]");else if(s&&n&&"{"===r)i||(i=l),o.push("}");else if(0===o.length){if(";"===r){if(n)return void this.decl(a,s);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),t&&n){if(!s)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,n){let i,o,a,l,u=r.length,c="",d=!0;for(let e=0;e<u;e+=1)i=r[e],o=i[0],"space"!==o||e!==u-1||n?"comment"===o?(l=r[e-1]?r[e-1][0]:"empty",a=r[e+1]?r[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let n=r.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:n,value:c}}e[t]=c}rule(e){e.pop();let t=new o;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},Qb}function _w(){if(tw)return ew;tw=1;let e=kw(),t=Aw(),r=ww();function n(e,n){let i=new r(e,n),o=new t(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&n&&n.from&&(/\.scss$/i.test(n.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(n.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(n.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return o.root}return ew=n,n.default=n,e.registerParse(n),ew}function Nw(){if(nw)return rw;nw=1;let{isClean:e,my:t}=pw(),r=Sw(),n=gw(),i=kw(),o=Cw(),s=Ew(),a=Ow(),l=_w(),u=Tw();const c={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},d={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},h={Once:!0,postcssPlugin:!0,prepare:!0};function p(e){return"object"==typeof e&&"function"==typeof e.then}function f(e){let t=!1,r=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function g(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:f(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function v(t){return t[e]=!1,t.nodes&&t.nodes.forEach(e=>v(e)),t}let m={};class y{constructor(e,r,n){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof r||null===r||"root"!==r.type&&"document"!==r.type)if(r instanceof y||r instanceof a)o=v(r.root),r.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let e=l;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{o=e(r,n)}catch(e){this.processed=!0,this.error=e}o&&!o[t]&&i.rebuild(o)}else o=v(r);this.result=new a(e,o,n),this.helpers={...m,postcss:m,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(r.postcssVersion&&"production"!==process.env.NODE_ENV){let e=r.postcssPlugin,t=r.postcssVersion,n=this.result.processor.version,i=t.split("."),o=n.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+n+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=r.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,r)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,r])};for(let t of this.plugins)if("object"==typeof t)for(let r in t){if(!d[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[r])if("object"==typeof t[r])for(let n in t[r])e(t,"*"===n?r:r+"-"+n.toLowerCase(),t[r][n]);else"function"==typeof t[r]&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(p(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];){t[e]=!0;let r=[g(t)];for(;r.length>0;){let e=this.visitTick(r);if(p(e))try{await e}catch(e){let t=r[r.length-1].node;throw this.handleError(e,t)}}}if(this.listeners.OnceExit)for(let[e,r]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map(e=>r(e,this.helpers));await Promise.all(e)}else await r(t,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return p(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=n;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new r(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(p(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];)t[e]=!0,this.walkSync(t);if(this.listeners.OnceExit)if("document"===t.type)for(let e of t.nodes)this.visitSync(this.listeners.OnceExit,e);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||s("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,n]of e){let e;this.result.lastPlugin=r;try{e=n(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(p(e))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void t.pop();if(i.length>0&&r.visitorIndex<i.length){let[e,t]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=e;try{return t(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==r.iterator){let i,o=r.iterator;for(;i=n.nodes[n.indexes[o]];)if(n.indexes[o]+=1,!i[e])return i[e]=!0,void t.push(g(i));r.iterator=0,delete n.indexes[o]}let o=r.events;for(;r.eventIndex<o.length;){let t=o[r.eventIndex];if(r.eventIndex+=1,0===t)return void(n.nodes&&n.nodes.length&&(n[e]=!0,r.iterator=n.getIterator()));if(this.listeners[t])return void(r.visitors=this.listeners[t])}t.pop()}walkSync(t){t[e]=!0;let r=f(t);for(let n of r)if(0===n)t.nodes&&t.each(t=>{t[e]||this.walkSync(t)});else{let e=this.listeners[n];if(e&&this.visitSync(e,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return y.registerPostcss=e=>{m=e},rw=y,y.default=y,u.registerLazyResult(y),o.registerLazyResult(y),rw}function Dw(){if(aw)return sw;aw=1;let e=function(){if(ow)return iw;ow=1;let e=Sw(),t=gw(),r=Ew(),n=_w();const i=Ow();class o{constructor(r,n,o){let s;n=n.toString(),this.stringified=!1,this._processor=r,this._css=n,this._opts=o,this._map=void 0;let a=t;this.result=new i(this._processor,s,this._opts),this.result.css=n;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,n);if(u.isMap()){let[e,t]=u.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else u.clearAnnotation(),this.result.css=u.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||r("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=n;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}}return iw=o,o.default=o,iw}(),t=Nw(),r=Cw(),n=Tw();class i{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(!0===r.postcss?r=r():r.postcss&&(r=r.postcss),"object"==typeof r&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if("object"==typeof r&&r.postcssPlugin)t.push(r);else if("function"==typeof r)t.push(r);else{if("object"!=typeof r||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(r,n={}){return this.plugins.length||n.parser||n.stringifier||n.syntax?new t(this,r,n):new e(this,r,n)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return sw=i,i.default=i,n.registerProcessor(i),r.registerProcessor(i),sw}var Lw=function(){if(dw)return cw;dw=1;let e=hb(),t=mw(),r=Nw(),n=kw(),i=Dw(),o=gw(),s=function(){if(uw)return lw;uw=1;let e=mw(),t=bw(),r=xw(),n=Pw(),i=ww(),o=Tw(),s=Mw();function a(l,u){if(Array.isArray(l))return l.map(e=>a(e));let{inputs:c,...d}=l;if(c){u=[];for(let e of c){let r={...e,__proto__:i.prototype};r.map&&(r.map={...r.map,__proto__:t.prototype}),u.push(r)}}if(d.nodes&&(d.nodes=l.nodes.map(e=>a(e,u))),d.source){let{inputId:e,...t}=d.source;d.source=t,null!=e&&(d.source.input=u[e])}if("root"===d.type)return new o(d);if("decl"===d.type)return new e(d);if("rule"===d.type)return new s(d);if("comment"===d.type)return new r(d);if("atrule"===d.type)return new n(d);throw new Error("Unknown node type: "+l.type)}return lw=a,a.default=a,lw}(),a=Cw(),l=Iw(),u=xw(),c=Pw(),d=Ow(),h=ww(),p=_w(),f=Rw(),g=Mw(),v=Tw(),m=vw();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new i(e)}return y.plugin=function(e,t){let r,n=!1;function o(...r){console&&console.warn&&!n&&(n=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226"));let o=t(...r);return o.postcssPlugin=e,o.postcssVersion=(new i).version,o}return Object.defineProperty(o,"postcss",{get:()=>(r||(r=o()),r)}),o.process=function(e,t,r){return y([o(r)]).process(e,t)},o},y.stringify=o,y.parse=p,y.fromJSON=s,y.list=f,y.comment=e=>new u(e),y.atRule=e=>new c(e),y.decl=e=>new t(e),y.rule=e=>new g(e),y.root=e=>new v(e),y.document=e=>new a(e),y.CssSyntaxError=e,y.Declaration=t,y.Container=n,y.Processor=i,y.Document=a,y.Comment=u,y.Warning=l,y.AtRule=c,y.Result=d,y.Input=h,y.Rule=g,y.Root=v,y.Node=m,r.registerPostcss(y),cw=y,y.default=y,cw}();const Fw=ib(Lw);Fw.stringify,Fw.fromJSON,Fw.plugin,Fw.parse,Fw.list,Fw.document,Fw.comment,Fw.atRule,Fw.rule,Fw.decl,Fw.root,Fw.CssSyntaxError,Fw.Declaration,Fw.Container,Fw.Processor,Fw.Document,Fw.Comment,Fw.Warning,Fw.AtRule,Fw.Result,Fw.Input,Fw.Rule,Fw.Root,Fw.Node;var Uw=Object.defineProperty,jw=(e,t,r)=>((e,t,r)=>t in e?Uw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);function Bw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function qw(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var zw,Ww={exports:{}};function Vw(){if(zw)return Ww.exports;zw=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return Ww.exports=t(),Ww.exports.createColors=t,Ww.exports}const $w=qw(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Hw,Kw;function Gw(){if(Kw)return Hw;Kw=1;let e=Vw(),t=$w;class r extends Error{constructor(e,t,n,i,o,s){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),void 0!==t&&void 0!==n&&("number"==typeof t?(this.line=t,this.column=n):(this.line=t.line,this.column=t.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,r)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(r){if(!this.source)return"";let n=this.source;null==r&&(r=e.isColorSupported),t&&r&&(n=t(n));let i,o,s=n.split(/\r?\n/),a=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;if(r){let{bold:t,gray:r,red:n}=e.createColors(!0);i=e=>t(n(e)),o=e=>r(e)}else i=o=e=>e;return s.slice(a,l).map((e,t)=>{let r=a+1+t,n=" "+(" "+r).slice(-u)+" | ";if(r===this.line){let t=o(n.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+o(n)+e+"\n "+t+i("^")}return" "+o(n)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return Hw=r,r.default=r,Hw}var Jw,Xw,Yw,Qw,Zw,eS,tS,rS,nS,iS,oS,sS,aS,lS,uS,cS,dS,hS,pS,fS,gS,vS,mS,yS,bS,wS,SS,xS,kS,CS,ES,IS,OS,PS,TS,RS,MS,AS,_S,NS,DS,LS,FS,US,jS,BS,qS,zS,WS,VS,$S,HS,KS,GS={};function JS(){return Jw||(Jw=1,GS.isClean=Symbol("isClean"),GS.my=Symbol("my")),GS}function XS(){if(Yw)return Xw;Yw=1;const e={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};class t{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let i=(e.raws.between||"")+(t?";":"");this.builder(r+n+i,e)}}beforeAfter(e,t){let r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let n=e.parent,i=0;for(;n&&"root"!==n.type;)i+=1,n=n.parent;if(r.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)r+=t}return r}block(e,t){let r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let i=e.nodes[n],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==n||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],void 0!==i))return i;let o=t.parent;if("before"===n){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[n];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[n])return s.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(t,n);{let e="raw"+((a=n)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[r],void 0!==i)return!1})}var a;return void 0===i&&(i=e[n]),s.rawCache[n]=i,i}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return t=r.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){let e=r.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}}return Xw=t,t.default=t,Xw}function YS(){if(Zw)return Qw;Zw=1;let e=XS();function t(t,r){new e(r).stringify(t)}return Qw=t,t.default=t,Qw}function QS(){if(tS)return eS;tS=1;let{isClean:e,my:t}=JS(),r=Gw(),n=XS(),i=YS();function o(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if("proxyCache"===n)continue;let i=e[n],s=typeof i;"parent"===n&&"object"===s?t&&(r[n]=t):"source"===n?r[n]=i:Array.isArray(i)?r[n]=i.map(e=>o(e,r)):("object"===s&&null!==i&&(i=o(i)),r[n]=i)}return r}class s{constructor(r={}){this.raws={},this[e]=!1,this[t]=!0;for(let e in r)if("nodes"===e){this.nodes=[];for(let t of r[e])"function"==typeof t.clone?this.append(t.clone()):this.append(t)}else this[e]=r[e]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=o(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new r(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[e]){this[e]=!1;let t=this;for(;t=t.parent;)t[e]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let n=(t=this.toString()).indexOf(e.word);-1!==n&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===r[t]?(n=1,i+=1):n+=1;return{column:n,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let n=this.toString(),i=n.indexOf(e.word);-1!==i&&(t=this.positionInside(i,n),r=this.positionInside(i+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return(new n).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let r={},n=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let n=this[e];if(Array.isArray(n))r[e]=n.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof n&&n.toJSON)r[e]=n.toJSON(null,t);else if("source"===e){let o=t.get(n.input);null==o&&(o=i,t.set(n.input,i),i++),r[e]={end:n.end,inputId:o,start:n.start}}else r[e]=n}return n&&(r.inputs=[...t.keys()].map(e=>e.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=i){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,r){let n={node:this};for(let e in r)n[e]=r[e];return e.warn(t,n)}get proxyOf(){return this}}return eS=s,s.default=s,eS}function ZS(){if(nS)return rS;nS=1;let e=QS();class t extends e{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}}return rS=t,t.default=t,rS}function ex(){if(oS)return iS;oS=1;return iS={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n}},iS}function tx(){if(aS)return sS;aS=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=$w,{existsSync:r,readFileSync:n}=$w,{dirname:i,join:o}=$w;class s{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=i(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new e(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}loadFile(e){if(this.root=i(e),r(e))return this.mapFile=e,n(e,"utf-8").toString().trim()}loadMap(r,n){if(!1===n)return!1;if(n){if("string"==typeof n)return n;if("function"!=typeof n){if(n instanceof e)return t.fromSourceMap(n).toString();if(n instanceof t)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}{let e=n(r);if(e){let t=this.loadFile(e);if(!t)throw new Error("Unable to load previous source map: "+e.toString());return t}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let e=this.annotation;return r&&(e=o(i(r),e)),this.loadFile(e)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return sS=s,s.default=s,sS}function rx(){if(uS)return lS;uS=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=$w,{fileURLToPath:r,pathToFileURL:n}=$w,{isAbsolute:i,resolve:o}=$w,{nanoid:s}=ex(),a=$w,l=Gw(),u=tx(),c=Symbol("fromOffsetCache"),d=Boolean(e&&t),h=Boolean(o&&i);class p{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!h||/^\w+:\/\//.test(t.from)||i(t.from)?this.file=t.from:this.file=o(t.from)),h&&d){let e=new u(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+s(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let o,s,a;if(t&&"object"==typeof t){let e=t,n=r;if("number"==typeof e.offset){let n=this.fromOffset(e.offset);t=n.line,r=n.col}else t=e.line,r=e.column;if("number"==typeof n.offset){let e=this.fromOffset(n.offset);s=e.line,a=e.col}else s=n.line,a=n.column}else if(!r){let e=this.fromOffset(t);t=e.line,r=e.col}let u=this.origin(t,r,s,a);return o=u?new l(e,void 0===u.endLine?u.line:{column:u.column,line:u.line},void 0===u.endLine?u.column:{column:u.endColumn,line:u.endLine},u.source,u.file,i.plugin):new l(e,void 0===s?t:{column:r,line:t},void 0===s?r:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:r,endColumn:a,endLine:s,line:t,source:this.css},this.file&&(n&&(o.input.url=n(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[c])r=this[c];else{let e=this.css.split("\n");r=new Array(e.length);let t=0;for(let n=0,i=e.length;n<i;n++)r[n]=t,t+=e[n].length+1;this[c]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let t,i=r.length-2;for(;n<i;)if(t=n+(i-n>>1),e<r[t])i=t-1;else{if(!(e>=r[t+1])){n=t;break}n=t+1}}return{col:e-r[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:o(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,o,s){if(!this.map)return!1;let a,l,u=this.map.consumer(),c=u.originalPositionFor({column:t,line:e});if(!c.source)return!1;"number"==typeof o&&(a=u.originalPositionFor({column:s,line:o})),l=i(c.source)?n(c.source):new URL(c.source,this.map.consumer().sourceRoot||n(this.map.mapFile));let d={column:c.column,endColumn:a&&a.column,endLine:a&&a.line,line:c.line,url:l.toString()};if("file:"===l.protocol){if(!r)throw new Error("file: protocol is not available in this PostCSS build");d.file=r(l)}let h=u.sourceContentFor(c.source);return h&&(d.source=h),d}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}}return lS=p,p.default=p,a&&a.registerInput&&a.registerInput(p),lS}function nx(){if(dS)return cS;dS=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=$w,{dirname:r,relative:n,resolve:i,sep:o}=$w,{pathToFileURL:s}=$w,a=rx(),l=Boolean(e&&t),u=Boolean(r&&i&&n&&o);return cS=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let t of this.previous()){let n,i=this.toUrl(this.path(t.file)),o=t.root||r(t.file);!1===this.mapOpts.sourcesContent?(n=new e(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,i,this.toUrl(this.path(o)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),u&&l&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=t.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0});let e,r,n=1,i=1,o="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(t,a,l)=>{if(this.css+=t,a&&"end"!==l&&(s.generated.line=n,s.generated.column=i-1,a.source&&a.source.start?(s.source=this.sourcePath(a),s.original.line=a.source.start.line,s.original.column=a.source.start.column-1,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,this.map.addMapping(s))),e=t.match(/\n/g),e?(n+=e.length,r=t.lastIndexOf("\n"),i=t.length-r):i+=t.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===e.last&&!e.raws.semicolon||(a.source&&a.source.end?(s.source=this.sourcePath(a),s.original.line=a.source.end.line,s.original.column=a.source.end.column-1,s.generated.line=n,s.generated.column=i-2,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=i-1,this.map.addMapping(s)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let o=this.opts.to?r(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=r(i(o,this.mapOpts.annotation)));let s=n(o,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new a(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(s){let t=s(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===o&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},cS}function ix(){if(pS)return hS;pS=1;let e=QS();class t extends e{constructor(e){super(e),this.type="comment"}}return hS=t,t.default=t,hS}function ox(){if(gS)return fS;gS=1;let e,t,r,n,{isClean:i,my:o}=JS(),s=ZS(),a=ix(),l=QS();function u(e){return e.map(e=>(e.nodes&&(e.nodes=u(e.nodes)),delete e.source,e))}function c(e){if(e[i]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class d extends l{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,r,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],r=e(this.proxyOf.nodes[t],t),!1!==r);)this.indexes[n]+=1;return delete this.indexes[n],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...r)=>e[t](...r.map(e=>"function"==typeof e?(t,r)=>e(t.toProxy(),r):e)):"every"===t||"some"===t?r=>e[t]((e,...t)=>r(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r,n=this.index(e),i=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(let e of i)this.proxyOf.nodes.splice(n+1,0,e);for(let e in this.indexes)r=this.indexes[e],n<r&&(this.indexes[e]=r+i.length);return this.markDirty(),this}insertBefore(e,t){let r,n=this.index(e),i=0===n&&"prepend",o=this.normalize(t,this.proxyOf.nodes[n],i).reverse();n=this.index(e);for(let e of o)this.proxyOf.nodes.splice(n,0,e);for(let e in this.indexes)r=this.indexes[e],n<=r&&(this.indexes[e]=r+o.length);return this.markDirty(),this}normalize(n,l){if("string"==typeof n)n=u(e(n).nodes);else if(void 0===n)n=[];else if(Array.isArray(n)){n=n.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===n.type&&"document"!==this.type){n=n.nodes.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if(n.type)n=[n];else if(n.prop){if(void 0===n.value)throw new Error("Value field is missed in node creation");"string"!=typeof n.value&&(n.value=String(n.value)),n=[new s(n)]}else if(n.selector)n=[new t(n)];else if(n.name)n=[new r(n)];else{if(!n.text)throw new Error("Unknown node type in node creation");n=[new a(n)]}return n.map(e=>(e[o]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[i]&&c(e),void 0===e.raws.before&&l&&void 0!==l.raws.before&&(e.raws.before=l.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let n;try{n=e(t,r)}catch(e){throw t.addToError(e)}return!1!==n&&t.walk&&(n=t.walk(e)),n})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("atrule"===r.type&&e.test(r.name))return t(r,n)}):this.walk((r,n)=>{if("atrule"===r.type&&r.name===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("atrule"===e.type)return t(e,r)}))}walkComments(e){return this.walk((t,r)=>{if("comment"===t.type)return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("decl"===r.type&&e.test(r.prop))return t(r,n)}):this.walk((r,n)=>{if("decl"===r.type&&r.prop===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("decl"===e.type)return t(e,r)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("rule"===r.type&&e.test(r.selector))return t(r,n)}):this.walk((r,n)=>{if("rule"===r.type&&r.selector===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("rule"===e.type)return t(e,r)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return d.registerParse=t=>{e=t},d.registerRule=e=>{t=e},d.registerAtRule=e=>{r=e},d.registerRoot=e=>{n=e},fS=d,d.default=d,d.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,r.prototype):"rule"===e.type?Object.setPrototypeOf(e,t.prototype):"decl"===e.type?Object.setPrototypeOf(e,s.prototype):"comment"===e.type?Object.setPrototypeOf(e,a.prototype):"root"===e.type&&Object.setPrototypeOf(e,n.prototype),e[o]=!0,e.nodes&&e.nodes.forEach(e=>{d.rebuild(e)})},fS}function sx(){if(mS)return vS;mS=1;let e,t,r=ox();class n extends r{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},vS=n,n.default=n,vS}function ax(){if(bS)return yS;bS=1;let e={};return yS=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function lx(){if(SS)return wS;SS=1;class e{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return wS=e,e.default=e,wS}function ux(){if(kS)return xS;kS=1;let e=lx();class t{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new e(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}}return xS=t,t.default=t,xS}function cx(){if(OS)return IS;OS=1;let e=ox();class t extends e{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}return IS=t,t.default=t,e.registerAtRule(t),IS}function dx(){if(TS)return PS;TS=1;let e,t,r=ox();class n extends r{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let n=super.normalize(e);if(t)if("prepend"===r)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of n)e.raws.before=t.raws.before;return n}removeChild(e,t){let r=this.index(e);return!t&&0===r&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},PS=n,n.default=n,r.registerRoot(n),PS}function hx(){if(MS)return RS;MS=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,r){let n=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let r of e)u?u=!1:"\\"===r?u=!0:a?r===l&&(a=!1):'"'===r||"'"===r?(a=!0,l=r):"("===r?s+=1:")"===r?s>0&&(s-=1):0===s&&t.includes(r)&&(o=!0),o?(""!==i&&n.push(i.trim()),i="",o=!1):i+=r;return(r||""!==i)&&n.push(i.trim()),n}};return RS=e,e.default=e,RS}function px(){if(_S)return AS;_S=1;let e=ox(),t=hx();class r extends e{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return t.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}}return AS=r,r.default=r,e.registerRule(r),AS}function fx(){if(DS)return NS;DS=1;let e=ZS(),t=function(){if(ES)return CS;ES=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),r="\\".charCodeAt(0),n="/".charCodeAt(0),i="\n".charCodeAt(0),o=" ".charCodeAt(0),s="\f".charCodeAt(0),a="\t".charCodeAt(0),l="\r".charCodeAt(0),u="[".charCodeAt(0),c="]".charCodeAt(0),d="(".charCodeAt(0),h=")".charCodeAt(0),p="{".charCodeAt(0),f="}".charCodeAt(0),g=";".charCodeAt(0),v="*".charCodeAt(0),m=":".charCodeAt(0),y="@".charCodeAt(0),b=/[\t\n\f\r "#'()/;[\\\]{}]/g,w=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,S=/.[\r\n"'(/\\]/,x=/[\da-f]/i;return CS=function(k,C={}){let E,I,O,P,T,R,M,A,_,N,D=k.css.valueOf(),L=C.ignoreErrors,F=D.length,U=0,j=[],B=[];function q(e){throw k.error("Unclosed "+e,U)}return{back:function(e){B.push(e)},endOfFile:function(){return 0===B.length&&U>=F},nextToken:function(k){if(B.length)return B.pop();if(U>=F)return;let C=!!k&&k.ignoreUnclosed;switch(E=D.charCodeAt(U),E){case i:case o:case a:case l:case s:I=U;do{I+=1,E=D.charCodeAt(I)}while(E===o||E===i||E===a||E===l||E===s);N=["space",D.slice(U,I)],U=I-1;break;case u:case c:case p:case f:case m:case g:case h:{let e=String.fromCharCode(E);N=[e,e,U];break}case d:if(A=j.length?j.pop()[1]:"",_=D.charCodeAt(U+1),"url"===A&&_!==e&&_!==t&&_!==o&&_!==i&&_!==a&&_!==s&&_!==l){I=U;do{if(R=!1,I=D.indexOf(")",I+1),-1===I){if(L||C){I=U;break}q("bracket")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["brackets",D.slice(U,I+1),U,I],U=I}else I=D.indexOf(")",U+1),P=D.slice(U,I+1),-1===I||S.test(P)?N=["(","(",U]:(N=["brackets",P,U,I],U=I);break;case e:case t:O=E===e?"'":'"',I=U;do{if(R=!1,I=D.indexOf(O,I+1),-1===I){if(L||C){I=U+1;break}q("string")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["string",D.slice(U,I+1),U,I],U=I;break;case y:b.lastIndex=U+1,b.test(D),I=0===b.lastIndex?D.length-1:b.lastIndex-2,N=["at-word",D.slice(U,I+1),U,I],U=I;break;case r:for(I=U,T=!0;D.charCodeAt(I+1)===r;)I+=1,T=!T;if(E=D.charCodeAt(I+1),T&&E!==n&&E!==o&&E!==i&&E!==a&&E!==l&&E!==s&&(I+=1,x.test(D.charAt(I)))){for(;x.test(D.charAt(I+1));)I+=1;D.charCodeAt(I+1)===o&&(I+=1)}N=["word",D.slice(U,I+1),U,I],U=I;break;default:E===n&&D.charCodeAt(U+1)===v?(I=D.indexOf("*/",U+2)+1,0===I&&(L||C?I=D.length:q("comment")),N=["comment",D.slice(U,I+1),U,I],U=I):(w.lastIndex=U+1,w.test(D),I=0===w.lastIndex?D.length-1:w.lastIndex-2,N=["word",D.slice(U,I+1),U,I],j.push(N),U=I)}return U++,N},position:function(){return U}}}}(),r=ix(),n=cx(),i=dx(),o=px();const s={empty:!0,space:!0};return NS=class{constructor(e){this.input=e,this.root=new i,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,r,i,o=new n;o.name=e[1].slice(1),""===o.name&&this.unnamedAtrule(o,e),this.init(o,e[2]);let s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?u.push("("===t?")":"]"):"{"===t&&u.length>0?u.push("}"):t===u[u.length-1]&&u.pop(),0===u.length){if(";"===t){o.source.end=this.getPosition(e[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===t){a=!0;break}if("}"===t){if(l.length>0){for(i=l.length-1,r=l[i];r&&"space"===r[0];)r=l[--i];r&&(o.source.end=this.getPosition(r[3]||r[2]),o.source.end.offset++)}this.end(e);break}l.push(e)}else l.push(e);if(this.tokenizer.endOfFile()){s=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(o.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(o,"params",l),s&&(e=l[l.length-1],o.source.end=this.getPosition(e[3]||e[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),a&&(o.nodes=[],this.current=o)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let r,n=0;for(let i=t-1;i>=0&&(r=e[i],"space"===r[0]||(n+=1,2!==n));i--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}colon(e){let t,r,n,i=0;for(let[o,s]of e.entries()){if(t=s,r=t[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return o}this.doubleColon(t)}n=t}return!1}comment(e){let t=new r;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=t(this.input)}decl(t,r){let n=new e;this.init(n,t[0][2]);let i,o=t[t.length-1];for(";"===o[0]&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}(t)),n.source.end.offset++;"word"!==t[0][0];)1===t.length&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let e=t[0][0];if(":"===e||"space"===e||"comment"===e)break;n.prop+=t.shift()[1]}for(n.raws.between="";t.length;){if(i=t.shift(),":"===i[0]){n.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s,a=[];for(;t.length&&(s=t[0][0],"space"===s||"comment"===s);)a.push(t.shift());this.precheckMissedSemicolon(t);for(let e=t.length-1;e>=0;e--){if(i=t[e],"!important"===i[1].toLowerCase()){n.important=!0;let r=this.stringFrom(t,e);r=this.spacesFromEnd(t)+r," !important"!==r&&(n.raws.important=r);break}if("important"===i[1].toLowerCase()){let r=t.slice(0),i="";for(let t=e;t>0;t--){let e=r[t][0];if(0===i.trim().indexOf("!")&&"space"!==e)break;i=r.pop()[1]+i}0===i.trim().indexOf("!")&&(n.important=!0,n.raws.important=i,t=r)}if("space"!==i[0]&&"comment"!==i[0])break}t.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(n.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(n,"value",a.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new o;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,r=null,n=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(r=l[0],a.push(l),"("===r||"["===r)i||(i=l),o.push("("===r?")":"]");else if(s&&n&&"{"===r)i||(i=l),o.push("}");else if(0===o.length){if(";"===r){if(n)return void this.decl(a,s);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),t&&n){if(!s)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,n){let i,o,a,l,u=r.length,c="",d=!0;for(let e=0;e<u;e+=1)i=r[e],o=i[0],"space"!==o||e!==u-1||n?"comment"===o?(l=r[e-1]?r[e-1][0]:"empty",a=r[e+1]?r[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let n=r.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:n,value:c}}e[t]=c}rule(e){e.pop();let t=new o;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},NS}function gx(){if(FS)return LS;FS=1;let e=ox(),t=fx(),r=rx();function n(e,n){let i=new r(e,n),o=new t(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&n&&n.from&&(/\.scss$/i.test(n.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(n.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(n.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return o.root}return LS=n,n.default=n,e.registerParse(n),LS}function vx(){if(jS)return US;jS=1;let{isClean:e,my:t}=JS(),r=nx(),n=YS(),i=ox(),o=sx(),s=ax(),a=ux(),l=gx(),u=dx();const c={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},d={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},h={Once:!0,postcssPlugin:!0,prepare:!0};function p(e){return"object"==typeof e&&"function"==typeof e.then}function f(e){let t=!1,r=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function g(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:f(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function v(t){return t[e]=!1,t.nodes&&t.nodes.forEach(e=>v(e)),t}let m={};class y{constructor(e,r,n){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof r||null===r||"root"!==r.type&&"document"!==r.type)if(r instanceof y||r instanceof a)o=v(r.root),r.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let e=l;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{o=e(r,n)}catch(e){this.processed=!0,this.error=e}o&&!o[t]&&i.rebuild(o)}else o=v(r);this.result=new a(e,o,n),this.helpers={...m,postcss:m,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(r.postcssVersion&&"production"!==process.env.NODE_ENV){let e=r.postcssPlugin,t=r.postcssVersion,n=this.result.processor.version,i=t.split("."),o=n.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+n+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=r.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,r)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,r])};for(let t of this.plugins)if("object"==typeof t)for(let r in t){if(!d[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[r])if("object"==typeof t[r])for(let n in t[r])e(t,"*"===n?r:r+"-"+n.toLowerCase(),t[r][n]);else"function"==typeof t[r]&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(p(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];){t[e]=!0;let r=[g(t)];for(;r.length>0;){let e=this.visitTick(r);if(p(e))try{await e}catch(e){let t=r[r.length-1].node;throw this.handleError(e,t)}}}if(this.listeners.OnceExit)for(let[e,r]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map(e=>r(e,this.helpers));await Promise.all(e)}else await r(t,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return p(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=n;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new r(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(p(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];)t[e]=!0,this.walkSync(t);if(this.listeners.OnceExit)if("document"===t.type)for(let e of t.nodes)this.visitSync(this.listeners.OnceExit,e);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||s("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,n]of e){let e;this.result.lastPlugin=r;try{e=n(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(p(e))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void t.pop();if(i.length>0&&r.visitorIndex<i.length){let[e,t]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=e;try{return t(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==r.iterator){let i,o=r.iterator;for(;i=n.nodes[n.indexes[o]];)if(n.indexes[o]+=1,!i[e])return i[e]=!0,void t.push(g(i));r.iterator=0,delete n.indexes[o]}let o=r.events;for(;r.eventIndex<o.length;){let t=o[r.eventIndex];if(r.eventIndex+=1,0===t)return void(n.nodes&&n.nodes.length&&(n[e]=!0,r.iterator=n.getIterator()));if(this.listeners[t])return void(r.visitors=this.listeners[t])}t.pop()}walkSync(t){t[e]=!0;let r=f(t);for(let n of r)if(0===n)t.nodes&&t.each(t=>{t[e]||this.walkSync(t)});else{let e=this.listeners[n];if(e&&this.visitSync(e,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return y.registerPostcss=e=>{m=e},US=y,y.default=y,u.registerLazyResult(y),o.registerLazyResult(y),US}function mx(){if(WS)return zS;WS=1;let e=function(){if(qS)return BS;qS=1;let e=nx(),t=YS(),r=ax(),n=gx();const i=ux();class o{constructor(r,n,o){let s;n=n.toString(),this.stringified=!1,this._processor=r,this._css=n,this._opts=o,this._map=void 0;let a=t;this.result=new i(this._processor,s,this._opts),this.result.css=n;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,n);if(u.isMap()){let[e,t]=u.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else u.clearAnnotation(),this.result.css=u.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||r("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=n;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}}return BS=o,o.default=o,BS}(),t=vx(),r=sx(),n=dx();class i{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(!0===r.postcss?r=r():r.postcss&&(r=r.postcss),"object"==typeof r&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if("object"==typeof r&&r.postcssPlugin)t.push(r);else if("function"==typeof r)t.push(r);else{if("object"!=typeof r||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(r,n={}){return this.plugins.length||n.parser||n.stringifier||n.syntax?new t(this,r,n):new e(this,r,n)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return zS=i,i.default=i,n.registerProcessor(i),r.registerProcessor(i),zS}var yx=function(){if(KS)return HS;KS=1;let e=Gw(),t=ZS(),r=vx(),n=ox(),i=mx(),o=YS(),s=function(){if($S)return VS;$S=1;let e=ZS(),t=tx(),r=ix(),n=cx(),i=rx(),o=dx(),s=px();function a(l,u){if(Array.isArray(l))return l.map(e=>a(e));let{inputs:c,...d}=l;if(c){u=[];for(let e of c){let r={...e,__proto__:i.prototype};r.map&&(r.map={...r.map,__proto__:t.prototype}),u.push(r)}}if(d.nodes&&(d.nodes=l.nodes.map(e=>a(e,u))),d.source){let{inputId:e,...t}=d.source;d.source=t,null!=e&&(d.source.input=u[e])}if("root"===d.type)return new o(d);if("decl"===d.type)return new e(d);if("rule"===d.type)return new s(d);if("comment"===d.type)return new r(d);if("atrule"===d.type)return new n(d);throw new Error("Unknown node type: "+l.type)}return VS=a,a.default=a,VS}(),a=sx(),l=lx(),u=ix(),c=cx(),d=ux(),h=rx(),p=gx(),f=hx(),g=px(),v=dx(),m=QS();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new i(e)}return y.plugin=function(e,t){let r,n=!1;function o(...r){console&&console.warn&&!n&&(n=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226"));let o=t(...r);return o.postcssPlugin=e,o.postcssVersion=(new i).version,o}return Object.defineProperty(o,"postcss",{get:()=>(r||(r=o()),r)}),o.process=function(e,t,r){return y([o(r)]).process(e,t)},o},y.stringify=o,y.parse=p,y.fromJSON=s,y.list=f,y.comment=e=>new u(e),y.atRule=e=>new c(e),y.decl=e=>new t(e),y.rule=e=>new g(e),y.root=e=>new v(e),y.document=e=>new a(e),y.CssSyntaxError=e,y.Declaration=t,y.Container=n,y.Processor=i,y.Document=a,y.Comment=u,y.Warning=l,y.AtRule=c,y.Result=d,y.Input=h,y.Rule=g,y.Root=v,y.Node=m,r.registerPostcss(y),HS=y,y.default=y,HS}();const bx=Bw(yx);bx.stringify,bx.fromJSON,bx.plugin,bx.parse,bx.list,bx.document,bx.comment,bx.atRule,bx.rule,bx.decl,bx.root,bx.CssSyntaxError,bx.Declaration,bx.Container,bx.Processor,bx.Document,bx.Comment,bx.Warning,bx.AtRule,bx.Result,bx.Input,bx.Rule,bx.Root,bx.Node;class wx{constructor(...e){jw(this,"parentElement",null),jw(this,"parentNode",null),jw(this,"ownerDocument"),jw(this,"firstChild",null),jw(this,"lastChild",null),jw(this,"previousSibling",null),jw(this,"nextSibling",null),jw(this,"ELEMENT_NODE",1),jw(this,"TEXT_NODE",3),jw(this,"nodeType"),jw(this,"nodeName"),jw(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof wx))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}const Sx={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},xx={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},kx={};function Cx(e){if(kx[e])return kx[e];const t=function(e){var t,r;const n=null==(r=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:r.call(t,e);return n&&globalThis[n]?globalThis[n]:void 0}(e)||globalThis[e],r=t.prototype,n=e in Sx?Sx[e]:void 0,i=Boolean(n&&n.every(e=>{var t,n;return Boolean(null==(n=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),o=e in xx?xx[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return kx[e]=t.prototype,t.prototype;try{const n=document.createElement("iframe");document.body.appendChild(n);const i=n.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(n),o?kx[e]=o:r}catch{return r}}const Ex={};function Ix(e,t,r){var n;const i=`${e}.${String(r)}`;if(Ex[i])return Ex[i].call(t);const o=Cx(e),s=null==(n=Object.getOwnPropertyDescriptor(o,r))?void 0:n.get;return s?(Ex[i]=s,s.call(t)):t[r]}const Ox={};function Px(e,t,r){const n=`${e}.${String(r)}`;if(Ox[n])return Ox[n].bind(t);const i=Cx(e)[r];return"function"!=typeof i?t[r]:(Ox[n]=i,i.bind(t))}function Tx(){return Cx("MutationObserver").constructor}const Rx={childNodes:function(e){return Ix("Node",e,"childNodes")},parentNode:function(e){return Ix("Node",e,"parentNode")},parentElement:function(e){return Ix("Node",e,"parentElement")},textContent:function(e){return Ix("Node",e,"textContent")},contains:function(e,t){return Px("Node",e,"contains")(t)},getRootNode:function(e){return Px("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Ix("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Ix("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Ix("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Ix("Element",e,"querySelectorAll")(t)},mutationObserver:Tx};function Mx(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}const Ax="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.";let _x={map:{},getId:()=>(console.error(Ax),-1),getNode:()=>(console.error(Ax),null),removeNodeFromMap(){console.error(Ax)},has:()=>(console.error(Ax),!1),reset(){console.error(Ax)}};function Nx(e,t,r={}){let n=null,i=0;return function(...o){const s=Date.now();i||!1!==r.leading||(i=s);const a=t-(s-i),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),i=s,e.apply(l,o)):n||!1===r.trailing||(n=setTimeout(()=>{i=!1===r.leading?0:Date.now(),n=null,e.apply(l,o)},a))}}function Dx(e,t,r,n,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(e){setTimeout(()=>{r.set.call(this,e)},0),o&&o.set&&o.set.call(this,e)}}),()=>Dx(e,t,o||{},!0)}function Lx(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],i=r(n);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(_x=new Proxy(_x,{get:(e,t,r)=>("map"===t&&console.error(Ax),Reflect.get(e,t,r))}));let Fx=Date.now;function Ux(e){var t,r,n,i;const o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:o.documentElement.scrollLeft||(null==o?void 0:o.body)&&(null==(t=Rx.parentElement(o.body))?void 0:t.scrollLeft)||(null==(r=null==o?void 0:o.body)?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==o?void 0:o.documentElement.scrollTop)||(null==o?void 0:o.body)&&(null==(n=Rx.parentElement(o.body))?void 0:n.scrollTop)||(null==(i=null==o?void 0:o.body)?void 0:i.scrollTop)||0}}function jx(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Bx(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function qx(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:Rx.parentElement(e)}function zx(e,t,r,n){if(!e)return!1;const i=qx(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(n&&null!==i.closest("."+t))return!0}else if(Qy(i,t,n))return!0}catch(e){}if(r){if(i.matches(r))return!0;if(n&&null!==i.closest(r))return!0}return!1}function Wx(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||-2===t.getId(e)}function Vx(e,t){if(Sy(e))return!1;const r=t.getId(e);if(!t.has(r))return!0;const n=Rx.parentNode(e);return(!n||n.nodeType!==e.DOCUMENT_NODE)&&(!n||Vx(n,t))}function $x(e){return Boolean(e.changedTouches)}function Hx(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Kx(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Gx(e){return!!e&&(e instanceof wx&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Rx.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Fx=()=>(new Date).getTime());class Jx{constructor(){ay(this,"id",1),ay(this,"styleIDMap",new WeakMap),ay(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}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 Xx(e){var t;let r=null;return"getRootNode"in e&&(null==(t=Rx.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Rx.host(Rx.getRootNode(e))&&(r=Rx.host(Rx.getRootNode(e))),r}function Yx(e){const t=e.ownerDocument;if(!t)return!1;const r=function(e){let t,r=e;for(;t=Xx(r);)r=t;return r}(e);return Rx.contains(t,r)}function Qx(e){const t=e.ownerDocument;return!!t&&(Rx.contains(t,e)||Yx(e))}var Zx=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Zx||{}),ek=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(ek||{}),tk=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(tk||{}),rk=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(rk||{}),nk=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(nk||{}),ik=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(ik||{}),ok=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(ok||{});function sk(e){return"__ln"in e}class ak{constructor(){ay(this,"length",0),ay(this,"head",null),ay(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&sk(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&sk(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const lk=(e,t)=>`${e}@${t}`;class uk{constructor(){ay(this,"frozen",!1),ay(this,"locked",!1),ay(this,"texts",[]),ay(this,"attributes",[]),ay(this,"attributeMap",new WeakMap),ay(this,"removes",[]),ay(this,"mapRemoves",[]),ay(this,"movedMap",{}),ay(this,"addedSet",new Set),ay(this,"movedSet",new Set),ay(this,"droppedSet",new Set),ay(this,"removesSubTreeCache",new Set),ay(this,"mutationCb"),ay(this,"blockClass"),ay(this,"blockSelector"),ay(this,"maskTextClass"),ay(this,"maskTextSelector"),ay(this,"inlineStylesheet"),ay(this,"maskInputOptions"),ay(this,"maskTextFn"),ay(this,"maskInputFn"),ay(this,"maskAttributeFn"),ay(this,"keepIframeSrcFn"),ay(this,"recordCanvas"),ay(this,"inlineImages"),ay(this,"slimDOMOptions"),ay(this,"dataURLOptions"),ay(this,"doc"),ay(this,"mirror"),ay(this,"iframeManager"),ay(this,"stylesheetManager"),ay(this,"shadowDomManager"),ay(this,"canvasManager"),ay(this,"processedNodeManager"),ay(this,"unattachedDoc"),ay(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),ay(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,r=new ak,n=e=>{let t=e,r=-2;for(;-2===r;)t=t&&t.nextSibling,r=t&&this.mirror.getId(t);return r},i=i=>{const o=Rx.parentNode(i);if(!o||!Qx(i))return;let s=!1;if(i.nodeType===Node.TEXT_NODE){const e=o.tagName;if("TEXTAREA"===e)return;"STYLE"===e&&this.addedSet.has(o)&&(s=!0)}const a=Sy(o)?this.mirror.getId(Xx(i)):this.mirror.getId(o),l=n(i);if(-1===a||-1===l)return r.addNode(i);const u=nb(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=>{Hx(e,this.mirror)&&this.iframeManager.addIframe(e),Kx(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Gx(i)&&this.shadowDomManager.addShadowRoot(Rx.shadowRoot(i),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)},cssCaptured:s});u&&(e.push({parentId:a,nextId:l,node:u}),t.add(u.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)dk(this.removesSubTreeCache,e,this.mirror)&&!this.movedSet.has(Rx.parentNode(e))||i(e);for(const e of this.addedSet)hk(this.droppedSet,e)||dk(this.removesSubTreeCache,e,this.mirror)?hk(this.movedSet,e)?i(e):this.droppedSet.add(e):i(e);let o=null;for(;r.length;){let e=null;if(o){const t=this.mirror.getId(Rx.parentNode(o.value)),r=n(o.value);-1!==t&&-1!==r&&(e=o)}if(!e){let t=r.tail;for(;t;){const r=t;if(t=t.previous,r){const t=this.mirror.getId(Rx.parentNode(r.value));if(-1===n(r.value))continue;if(-1!==t){e=r;break}{const t=r.value,n=Rx.parentNode(t);if(n&&n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=Rx.host(n);if(-1!==this.mirror.getId(t)){e=r;break}}}}}}if(!e){for(;r.head;)r.removeNode(r.head.value);break}o=e.previous,r.removeNode(e.value),i(e.value)}const s={texts:this.texts.map(e=>{const t=e.node,r=Rx.parentNode(t);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{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=>{const{attributes:t}=e;if("string"==typeof t.style){const r=JSON.stringify(e.styleDiff),n=JSON.stringify(e._unchangedStyles);r.length<t.style.length&&(r+n).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!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.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(s))}),ay(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));const r=Array.from(Rx.childNodes(e),e=>Rx.textContent(e)||"").join("");t.attributes.value=Iy({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Ty(e),value:r,maskInputFn:this.maskInputFn})}),ay(this,"processMutation",e=>{if(!Wx(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=Rx.textContent(e.target);zx(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:Zy(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,qx(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let r=e.attributeName,n=e.target.getAttribute(r);if("value"===r){const e=Ty(t);n=Iy({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:n,maskInputFn:this.maskInputFn})}if(zx(e.target,this.blockClass,this.blockSelector,!1)||n===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===r&&!this.keepIframeSrcFn(n)){if(t.contentDocument)return;r="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===r&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!Yy(t.tagName,r)){if(i.attributes[r]=Xy(this.doc,Oy(t.tagName),Oy(r),n),this.maskAttributeFn&&"string"==typeof i.attributes[r]){const e=this.maskAttributeFn(r,i.attributes[r],t);null!==e?i.attributes[r]=e:delete i.attributes[r]}if("style"===r){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const r=this.unattachedDoc.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const n=t.style.getPropertyValue(e),o=t.style.getPropertyPriority(e);n!==r.style.getPropertyValue(e)||o!==r.style.getPropertyPriority(e)?i.styleDiff[e]=""===o?n:[n,o]:i._unchangedStyles[e]=[n,o]}for(const e of Array.from(r.style))""===t.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}else"open"===r&&"DIALOG"===t.tagName&&(t.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal")}break}case"childList":if(zx(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const r=this.mirror.getId(t),n=Sy(e.target)?this.mirror.getId(Rx.host(e.target)):this.mirror.getId(e.target);zx(e.target,this.blockClass,this.blockSelector,!1)||Wx(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(ck(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||Vx(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[lk(r,n)]?ck(this.movedSet,t):(this.removes.push({parentId:n,id:r,isShadow:!(!Sy(e.target)||!xy(e.target))||void 0}),function(e,t){const r=[e];for(;r.length;){const e=r.pop();t.has(e)||(t.add(e),Rx.childNodes(e).forEach(e=>r.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),ay(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Wx(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[lk(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);zx(e,this.blockClass,this.blockSelector,!1)||(Rx.childNodes(e).forEach(e=>this.genAdds(e)),Gx(e)&&Rx.childNodes(Rx.shadowRoot(e)).forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAttributeFn","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 ck(e,t){e.delete(t),Rx.childNodes(t).forEach(t=>ck(e,t))}function dk(e,t,r){return 0!==e.size&&function(e,t){const r=Rx.parentNode(t);return!!r&&e.has(r)}(e,t)}function hk(e,t){return 0!==e.size&&pk(e,t)}function pk(e,t){const r=Rx.parentNode(t);return!!r&&(!!e.has(r)||pk(e,r))}let fk;const gk=e=>{if(!fk)return e;return(...t)=>{try{return e(...t)}catch(e){if(fk&&!0===fk(e))return;throw e}}};function vk(e){return(...t)=>{try{return e(...t)}catch(e){try{e._external_=!0}catch{}throw e}}}const mk=[];function yk(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function bk(e,t){const r=new uk;mk.push(r),r.init(e);const n=new(Tx())(gk(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function wk({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(!1===o.mouseInteraction)return()=>{};const s=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,a=[];let l=null;return Object.keys(tk).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(o=>{let s=Oy(o);const u=(t=>o=>{const s=yk(o);if(zx(s,n,i,!0))return;let a=null,u=t;if("pointerType"in o){switch(o.pointerType){case"mouse":a=rk.Mouse;break;case"touch":a=rk.Touch;break;case"pen":a=rk.Pen}a===rk.Touch?tk[t]===tk.MouseDown?u="TouchStart":tk[t]===tk.MouseUp&&(u="TouchEnd"):rk.Pen}else $x(o)&&(a=rk.Touch);null!==a?(l=a,(u.startsWith("Touch")&&a===rk.Touch||u.startsWith("Mouse")&&a===rk.Mouse)&&(a=null)):tk[t]===tk.Click&&(a=l,l=null);const c=$x(o)?o.changedTouches[0]:o;if(!c)return;const d=r.getId(s),{clientX:h,clientY:p}=c;gk(e)({type:tk[u],id:d,x:h,y:p,...null!==a&&{pointerType:a}})})(o);if(window.PointerEvent)switch(tk[o]){case tk.MouseDown:case tk.MouseUp:s=s.replace("mouse","pointer");break;case tk.TouchStart:case tk.TouchEnd:return}a.push(Mx(s,u,t))}),gk(()=>{a.forEach(e=>e())})}function Sk({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){const s=gk(Nx(gk(o=>{const s=yk(o);if(!s||zx(s,n,i,!0))return;const a=r.getId(s);if(s===t&&t.defaultView){const r=Ux(t.defaultView);e({id:a,x:r.left,y:r.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})}),o.scroll||100));return Mx("scroll",s,t)}const xk=["INPUT","TEXTAREA","SELECT"],kk=new WeakMap;function Ck(e){return function(e,t){if(Pk("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Pk("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Pk("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Pk("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const r=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(r)}else if(e.parentStyleSheet){const r=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(r)}return t}(e,[])}function Ek(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function Ik({mirror:e,stylesheetManager:t},r){var n,i,o;let s=null;s="#document"===r.nodeName?e.getId(r):e.getId(Rx.host(r));const a="#document"===r.nodeName?null==(n=r.defaultView)?void 0:n.Document:null==(o=null==(i=r.ownerDocument)?void 0:i.defaultView)?void 0:o.ShadowRoot,l=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&l?(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var r;const n=null==(r=l.set)?void 0:r.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(e){}return n}}),gk(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function Ok(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};let n;!function(e,t){const{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:f}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),r(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),n(...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),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),u(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),c(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),f(...e)}}(e,t),e.recordDOM&&(n=bk(e,e.doc));const i=function({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(!1===t.mousemove)return()=>{};const i="number"==typeof t.mousemove?t.mousemove:50,o="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s,a=[];const l=Nx(gk(t=>{const r=Date.now()-s;e(a.map(e=>(e.timeOffset-=r,e)),t),a=[],s=null}),o),u=gk(Nx(gk(e=>{const t=yk(e),{clientX:r,clientY:i}=$x(e)?e.changedTouches[0]:e;s||(s=Fx()),a.push({x:r,y:i,id:n.getId(t),timeOffset:Fx()-s}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?ek.Drag:e instanceof MouseEvent?ek.MouseMove:ek.TouchMove)}),i,{trailing:!1})),c=[Mx("mousemove",u,r),Mx("touchmove",u,r),Mx("drag",u,r)];return gk(()=>{c.forEach(e=>e())})}(e),o=wk(e),s=Sk(e),a=function({viewportResizeCb:e},{win:t}){let r=-1,n=-1;return Mx("resize",gk(Nx(gk(()=>{const t=jx(),i=Bx();r===t&&n===i||(e({width:Number(i),height:Number(t)}),r=t,n=i)}),200)),t)}(e,{win:r}),l=function({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:u,userTriggeredOnInput:c}){function d(e){let r=yk(e);const u=e.isTrusted,d=r&&r.tagName;if(r&&"OPTION"===d&&(r=Rx.parentElement(r)),!r||!d||xk.indexOf(d)<0||zx(r,n,i,!0))return;if(r.classList.contains(o)||s&&r.matches(s))return;let p=r.value,f=!1;const g=Ty(r)||"";"radio"===g||"checkbox"===g?f=r.checked:(a[d.toLowerCase()]||a[g])&&(p=Iy({element:r,maskInputOptions:a,tagName:d,type:g,value:p,maskInputFn:l})),h(r,c?{text:p,isChecked:f,userTriggered:u}:{text:p,isChecked:f});const v=r.name;"radio"===g&&v&&f&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach(e=>{if(e!==r){const t=e.value;h(e,c?{text:t,isChecked:!f,userTriggered:!1}:{text:t,isChecked:!f})}})}function h(t,n){const i=kk.get(t);if(!i||i.text!==n.text||i.isChecked!==n.isChecked){kk.set(t,n);const i=r.getId(t);gk(e)({...n,id:i})}}const p=("last"===u.input?["change"]:["input","change"]).map(e=>Mx(e,gk(d),t)),f=t.defaultView;if(!f)return()=>{p.forEach(e=>e())};const g=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),v=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&p.push(...v.map(e=>Dx(e[0],e[1],{set(){gk(d)({target:this,isTrusted:!1})}},!1,f))),gk(()=>{p.forEach(e=>e())})}(e),u=function({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:o}){const s=gk(o=>Nx(gk(i=>{const s=yk(i);if(!s||zx(s,t,r,!0))return;const{currentTime:a,volume:l,muted:u,playbackRate:c,loop:d}=s;e({type:o,id:n.getId(s),currentTime:a,volume:l,muted:u,playbackRate:c,loop:d})}),i.media||500)),a=[Mx("play",s(ik.Play),o),Mx("pause",s(ik.Pause),o),Mx("seeked",s(ik.Seeked),o),Mx("volumechange",s(ik.VolumeChange),o),Mx("ratechange",s(ik.RateChange),o)];return gk(()=>{a.forEach(e=>e())})}(e);let c=()=>{},d=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(c=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:gk((n,i,o)=>{const[s,a]=o,{id:l,styleId:u}=Ek(i,t,r.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,adds:[{rule:s,index:a}]}),vk(()=>n.apply(i,o))()})}),n.CSSStyleSheet.prototype.addRule=function(e,t,r=this.cssRules.length){const i=`${e} { ${t} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[i,r])};const o=n.CSSStyleSheet.prototype.deleteRule;let s,a;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:gk((n,i,o)=>{const[s]=o,{id:a,styleId:l}=Ek(i,t,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:s}]}),vk(()=>n.apply(i,o))()})}),n.CSSStyleSheet.prototype.removeRule=function(e){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:gk((n,i,o)=>{const[s]=o,{id:a,styleId:l}=Ek(i,t,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replace:s}),n.apply(i,o)})})),n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:gk((n,i,o)=>{const[s]=o,{id:a,styleId:l}=Ek(i,t,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replaceSync:s}),n.apply(i,o)})}));const l={};Tk("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(Tk("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),Tk("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),Tk("CSSSupportsRule")&&(l.CSSSupportsRule=n.CSSSupportsRule));const u={};return Object.entries(l).forEach(([n,i])=>{u[n]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(u[n].insertRule,{apply:gk((n,i,o)=>{const[s,a]=o,{id:l,styleId:u}=Ek(i.parentStyleSheet,t,r.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,adds:[{rule:s,index:[...Ck(i),a||0]}]}),n.apply(i,o)})}),i.prototype.deleteRule=new Proxy(u[n].deleteRule,{apply:gk((n,i,o)=>{const[s]=o,{id:a,styleId:l}=Ek(i.parentStyleSheet,t,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:[...Ck(i),s]}]}),n.apply(i,o)})})}),gk(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,s&&(n.CSSStyleSheet.prototype.replace=s),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})})}(e,{win:r}),d=Ik(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:gk((i,s,a)=>{var l;const[u,c,d]=a;if(r.has(u))return o.apply(s,[u,c,d]);const{id:h,styleId:p}=Ek(null==(l=s.parentRule)?void 0:l.parentStyleSheet,t,n.styleMirror);return(h&&-1!==h||p&&-1!==p)&&e({id:h,styleId:p,set:{property:u,value:c,priority:d},index:Ck(s.parentRule)}),i.apply(s,a)})});const s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:gk((i,o,a)=>{var l;const[u]=a;if(r.has(u))return s.apply(o,[u]);const{id:c,styleId:d}=Ek(null==(l=o.parentRule)?void 0:l.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||d&&-1!==d)&&e({id:c,styleId:d,remove:{property:u},index:Ck(o.parentRule)}),i.apply(o,a)})}),gk(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}(e,{win:r}),e.collectFonts&&(p=function({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const n=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(e,t,r){const n=new o(e,t,r);return i.set(n,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),n};const s=Lx(t.fonts,"add",function(t){return function(r){return setTimeout(gk(()=>{const t=i.get(r);t&&(e(t),i.delete(r))}),0),t.apply(this,[r])}});return n.push(()=>{r.FontFace=o}),n.push(s),gk(()=>{n.forEach(e=>e())})}(e)));const f=function(e){const{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=e;let s=!0;const a=gk(()=>{const e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;t<l;t++){const o=e.getRangeAt(t),{startContainer:s,startOffset:l,endContainer:u,endOffset:c}=o;zx(s,n,i,!0)||zx(u,n,i,!0)||a.push({start:r.getId(s),startOffset:l,end:r.getId(u),endOffset:c})}o({ranges:a})});return a(),Mx("selectionchange",a)}(e),g=function({doc:e,customElementCb:t}){const r=e.defaultView;return r&&r.customElements?Lx(r.customElements,"define",function(e){return function(r,n,i){try{t({define:{name:r}})}catch(e){console.warn(`Custom element callback failed for ${r}`)}return e.apply(this,[r,n,i])}}):()=>{}}(e),v=[];for(const t of e.plugins)v.push(t.observer(t.callback,r,t.options));return gk(()=>{mk.forEach(e=>e.reset()),null==n||n.disconnect(),i(),o(),s(),a(),l(),u(),c(),d(),h(),p(),f(),g(),v.forEach(e=>e())})}function Pk(e){return void 0!==window[e]}function Tk(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Rk{constructor(e){ay(this,"iframeIdToRemoteIdMap",new WeakMap),ay(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,n){const i=r||this.getIdToRemoteIdMap(e),o=n||this.getRemoteIdToIdMap(e);let s=i.get(t);return s||(s=this.generateIdFn(),i.set(t,s),o.set(s,t)),s}getIds(e,t){const r=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,r,n))}getRemoteId(e,t,r){const n=r||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const i=n.get(t);return i||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,r))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);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 Mk{constructor(e){ay(this,"iframes",new WeakMap),ay(this,"crossOriginIframeMap",new WeakMap),ay(this,"crossOriginIframeMirror",new Rk(qy)),ay(this,"crossOriginIframeStyleMirror"),ay(this,"crossOriginIframeRootIdMap",new WeakMap),ay(this,"mirror"),ay(this,"mutationCb"),ay(this,"wrappedEmit"),ay(this,"loadListener"),ay(this,"stylesheetManager"),ay(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Rk(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 r,n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(r=e.contentWindow)||r.addEventListener("message",this.handleMessage.bind(this))),null==(n=this.loadListener)||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){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const r=this.crossOriginIframeMap.get(e.source);if(!r)return;const n=this.transformCrossOriginEvent(r,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case Zx.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const r=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,r),this.patchRootIdOnNode(t.data.node,r),{timestamp:t.timestamp,type:Zx.IncrementalSnapshot,data:{source:ek.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Zx.Meta:case Zx.Load:case Zx.DomContentLoaded:return!1;case Zx.Plugin:return t;case Zx.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Zx.IncrementalSnapshot:switch(t.data.source){case ek.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const r=this.crossOriginIframeRootIdMap.get(e);r&&this.patchRootIdOnNode(t.node,r)}),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 ek.Drag:case ek.TouchMove:case ek.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case ek.ViewportResize:return!1;case ek.MediaInteraction:case ek.MouseInteraction:case ek.Scroll:case ek.CanvasMutation:case ek.Input:return this.replaceIds(t.data,e,["id"]),t;case ek.StyleSheetRule:case ek.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case ek.Font:return t;case ek.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case ek.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(r=t.data.styles)||r.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,r,n){for(const i of n)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(r,t[i]):t[i]=e.getId(r,t[i]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}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===ok.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}}class Ak{constructor(e){ay(this,"shadowDoms",new WeakSet),ay(this,"mutationCb"),ay(this,"scrollCb"),ay(this,"bypassOptions"),ay(this,"mirror"),ay(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(!xy(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const r=bk({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(Sk({...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(Rx.host(e))),this.restoreHandlers.push(Ik({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){const r=this;this.restoreHandlers.push(Lx(e.prototype,"attachShadow",function(e){return function(n){const i=e.call(this,n),o=Rx.shadowRoot(this);return o&&Qx(this)&&r.addShadowRoot(o,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var _k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Nk="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Dk=0;Dk<64;Dk++)Nk[_k.charCodeAt(Dk)]=Dk;const Lk=new Map;const Fk=(e,t,r)=>{if(!e||!Bk(e,t)&&"object"!=typeof e)return;const n=function(e,t){let r=Lk.get(e);return r||(r=new Map,Lk.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name);let i=n.indexOf(e);return-1===i&&(i=n.length,n.push(e)),i};function Uk(e,t,r){if(e instanceof Array)return e.map(e=>Uk(e,t,r));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){return{rr_type:e.constructor.name,base64:function(e){var t,r=new Uint8Array(e),n=r.length,i="";for(t=0;t<n;t+=3)i+=_k[r[t]>>2],i+=_k[(3&r[t])<<4|r[t+1]>>4],i+=_k[(15&r[t+1])<<2|r[t+2]>>6],i+=_k[63&r[t+2]];return n%3==2?i=i.substring(0,i.length-1)+"=":n%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Uk(e.buffer,t,r),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:r}=e;return{rr_type:t,src:r}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[Uk(e.data,t,r),e.width,e.height]}}if(Bk(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:Fk(e,t,r)}}return e}const jk=(e,t,r)=>e.map(e=>Uk(e,t,r)),Bk=(e,t)=>{const r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(r.find(r=>e instanceof t[r]))};function qk(e,t,r,n){const i=[];try{const o=Lx(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(i,...o){if(!zx(this,t,r,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=e),n&&["webgl","webgl2"].includes(e))if(o[0]&&"object"==typeof o[0]){const 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{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(e=>e())}}function zk(e,t,r,n,i,o){const s=[],a=Object.getOwnPropertyNames(e);for(const l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if("function"!=typeof e[l])continue;const a=Lx(e,l,function(e){return function(...s){const a=e.apply(this,s);if(Fk(a,o,this),"tagName"in this.canvas&&!zx(this.canvas,n,i,!0)){const e=jk(s,o,this),n={type:t,property:l,args:e};r(this.canvas,n)}return a}});s.push(a)}catch{const n=Dx(e,l,{set(e){r(this.canvas,{type:t,property:l,args:[e],setter:!0})}});s.push(n)}return s}const Wk='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext("2d");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map\n',Vk="undefined"!=typeof self&&self.Blob&&new Blob([Wk],{type:"text/javascript;charset=utf-8"});function $k(e){let t;try{if(t=Vk&&(self.URL||self.webkitURL).createObjectURL(Vk),!t)throw"";const r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Wk),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class Hk{constructor(e){ay(this,"pendingCanvasMutations",new Map),ay(this,"rafStamps",{latestId:0,invokeId:null}),ay(this,"mirror"),ay(this,"mutationCb"),ay(this,"resetObservers"),ay(this,"frozen",!1),ay(this,"locked",!1),ay(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)});const{sampling:t="all",win:r,blockClass:n,blockSelector:i,recordCanvas:o,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(r,n,i),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,r,n,i,{dataURLOptions:s})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,n,i){const o=qk(t,r,n,!0),s=new Map,a=new $k;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:r,type:n,width:i,height:o}=e.data;this.mutationCb({id:t,type:nk["2D"],commands:[{property:"clearRect",args:[0,0,i,o]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r}],type:n}]},0,0]}]})};const l=1e3/e;let u,c=0;const d=e=>{c&&e-c<l||(c=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{zx(t,r,n,!0)||e.push(t)}),e})().forEach(async e=>{var t;const r=this.mirror.getId(e);if(s.get(r))return;if(0===e.width||0===e.height)return;if(s.set(r,!0),["webgl","webgl2"].includes(e.__context)){const r=e.getContext(e.__context);!1===(null==(t=null==r?void 0:r.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&r.clear(r.COLOR_BUFFER_BIT)}const n=await createImageBitmap(e);a.postMessage({id:r,bitmap:n,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[n])})),u=requestAnimationFrame(d)};u=requestAnimationFrame(d),this.resetObservers=()=>{o(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const n=qk(e,t,r,!1),i=function(e,t,r,n){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const o=Lx(t.CanvasRenderingContext2D.prototype,s,function(i){return function(...o){return zx(this.canvas,r,n,!0)||setTimeout(()=>{const r=jk(o,t,this);e(this.canvas,{type:nk["2D"],property:s,args:r})},0),i.apply(this,o)}});i.push(o)}catch{const r=Dx(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:nk["2D"],property:s,args:[t],setter:!0})}});i.push(r)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r),o=function(e,t,r,n){const i=[];return i.push(...zk(t.WebGLRenderingContext.prototype,nk.WebGL,e,r,n,t)),void 0!==t.WebGL2RenderingContext&&i.push(...zk(t.WebGL2RenderingContext.prototype,nk.WebGL2,e,r,n,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{n(),i(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||-1===t)return;const n=r.map(e=>{const{type:t,...r}=e;return r}),{type:i}=r[0];this.mutationCb({id:t,type:i,commands:n}),this.pendingCanvasMutations.delete(e)}}class Kk{constructor(e){ay(this,"trackedLinkElements",new WeakSet),ay(this,"mutationCb"),ay(this,"adoptedStyleSheetCb"),ay(this,"styleMirror",new Jx),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;const r={id:t,styleIds:[]},n=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);let r=[];try{r=Array.from(t.cssRules,(e,r)=>({rule:Cy(e,t.href),index:r}))}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}n.push({styleId:e,rules:r})}r.styleIds.push(e)}n.length>0&&(r.styles=n),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Gk{constructor(){ay(this,"nodeMap",new WeakMap),ay(this,"active",!1)}inOtherBuffer(e,t){const r=this.nodeMap.get(e);return r&&Array.from(r).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let Jk,Xk,Yk,Qk=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(iy=e.contentWindow)?void 0:iy.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const Zk=new Ey;function eC(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:d,maskInputOptions:h,slimDOMOptions:p,maskInputFn:f,maskTextFn:g,maskAttributeFn:v,hooks:m,packFn:y,sampling:b={},dataURLOptions:w={},mousemoveWait:S,recordDOM:x=!0,recordCanvas:k=!1,recordCrossOriginIframes:C=!1,recordAfter:E=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:I=!1,collectFonts:O=!1,inlineImages:P=!1,captureAdoptedStyleSheets:T=!0,plugins:R,keepIframeSrcFn:M=()=>!1,ignoreCSSAttributes:A=new Set([]),errorHandler:_,applyBackgroundColorToBlockedElements:N=!1}=e;fk=_;const D=!C||window.parent===window;let L=!1;if(!D)try{window.parent.document&&(L=!1)}catch(e){L=!0}if(D&&!t)throw new Error("emit function is required");if(!D&&!L)return()=>{};void 0!==S&&void 0===b.mousemove&&(b.mousemove=S),Zk.reset();const F=!0===d?{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!==h?h:{password:!0},U=!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===p,headMetaDescKeywords:"all"===p,headTitleMutations:"all"===p}:p||{};let j;!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)}();let B=0;const q=e=>{for(const t of R||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!L&&(e=y(e)),e};Jk=(e,i)=>{var o;const s=e;if(s.timestamp=Fx(),!(null==(o=mk[0])?void 0:o.isFrozen())||s.type===Zx.FullSnapshot||s.type===Zx.IncrementalSnapshot&&s.data.source===ek.Mutation||mk.forEach(e=>e.unfreeze()),D)null==t||t(q(s),i);else if(L){const e={type:"rrweb",event:q(s),origin:window.location.origin,isCheckout:i};window.parent.postMessage(e,"*")}if(s.type===Zx.FullSnapshot)j=s,B=0;else if(s.type===Zx.IncrementalSnapshot){if(s.data.source===ek.Mutation&&s.data.isAttachIframe)return;B++;const e=n&&B>=n,t=r&&s.timestamp-j.timestamp>r;(e||t)&&Xk(!0)}};const z=e=>{Jk({type:Zx.IncrementalSnapshot,data:{source:ek.Mutation,...e}})},W=e=>Jk({type:Zx.IncrementalSnapshot,data:{source:ek.Scroll,...e}}),V=e=>Jk({type:Zx.IncrementalSnapshot,data:{source:ek.CanvasMutation,...e}}),$=new Kk({mutationCb:z,adoptedStyleSheetCb:e=>Jk({type:Zx.IncrementalSnapshot,data:{source:ek.AdoptedStyleSheet,...e}})}),H=new Mk({mirror:Zk,mutationCb:z,stylesheetManager:$,recordCrossOriginIframes:C,wrappedEmit:Jk});for(const e of R||[])e.getMirror&&e.getMirror({nodeMirror:Zk,crossOriginIframeMirror:H.crossOriginIframeMirror,crossOriginIframeStyleMirror:H.crossOriginIframeStyleMirror});const K=new Gk;Yk=new Hk({recordCanvas:k,mutationCb:V,win:window,blockClass:i,blockSelector:o,mirror:Zk,sampling:b.canvas,dataURLOptions:w});const G=new Ak({mutationCb:z,scrollCb:W,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:F,dataURLOptions:w,maskTextFn:g,maskInputFn:f,maskAttributeFn:v,recordCanvas:k,inlineImages:P,sampling:b,slimDOMOptions:U,iframeManager:H,stylesheetManager:$,canvasManager:Yk,keepIframeSrcFn:M,processedNodeManager:K},mirror:Zk});Xk=(e=!1)=>{if(!x)return;Jk({type:Zx.Meta,data:{href:window.location.href,width:Bx(),height:jx()}},e),$.reset(),G.init(),mk.forEach(e=>e.lock());const t=function(e,t){const{mirror:r=new Ey,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:h,maskAttributeFn:p,slimDOM:f=!1,dataURLOptions:g,preserveWhiteSpace:v,onSerialize:m,onAdoptedStyleSheet:y,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:k=()=>!1,applyBackgroundColorToBlockedElements:C=!1}=t||{};return nb(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:!0===c?{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===c?{password:!0}:c,maskTextFn:d,maskInputFn:h,maskAttributeFn:p,slimDOMOptions:!0===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===f,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===f?{}:f,dataURLOptions:g,inlineImages:l,recordCanvas:u,preserveWhiteSpace:v,onSerialize:m,onAdoptedStyleSheet:y,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:k,newlyAddedElement:!1,applyBackgroundColorToBlockedElements:C})}(document,{mirror:Zk,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:F,maskTextFn:g,maskInputFn:f,maskAttributeFn:v,slimDOM:U,dataURLOptions:w,recordCanvas:k,inlineImages:P,applyBackgroundColorToBlockedElements:N,onSerialize:e=>{Hx(e,Zk)&&H.addIframe(e),Kx(e,Zk)&&$.trackLinkElement(e),Gx(e)&&G.addShadowRoot(Rx.shadowRoot(e),document)},onAdoptedStyleSheet:T?e=>$.styleMirror.add(e):void 0,onIframeLoad:(e,t)=>{H.attachIframe(e,t),G.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{$.attachLinkElement(e,t)},keepIframeSrcFn:M});if(!t)return console.warn("Failed to snapshot the document");Jk({type:Zx.FullSnapshot,data:{node:t,initialOffset:Ux(window)}},e),mk.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,Zk.getId(document))};try{const e=[],t=e=>{var t;return gk(Ok)({mutationCb:z,mousemoveCb:(e,t)=>Jk({type:Zx.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Jk({type:Zx.IncrementalSnapshot,data:{source:ek.MouseInteraction,...e}}),scrollCb:W,viewportResizeCb:e=>Jk({type:Zx.IncrementalSnapshot,data:{source:ek.ViewportResize,...e}}),inputCb:e=>Jk({type:Zx.IncrementalSnapshot,data:{source:ek.Input,...e}}),mediaInteractionCb:e=>Jk({type:Zx.IncrementalSnapshot,data:{source:ek.MediaInteraction,...e}}),styleSheetRuleCb:e=>Jk({type:Zx.IncrementalSnapshot,data:{source:ek.StyleSheetRule,...e}}),styleDeclarationCb:e=>Jk({type:Zx.IncrementalSnapshot,data:{source:ek.StyleDeclaration,...e}}),canvasMutationCb:V,fontCb:e=>Jk({type:Zx.IncrementalSnapshot,data:{source:ek.Font,...e}}),selectionCb:e=>{Jk({type:Zx.IncrementalSnapshot,data:{source:ek.Selection,...e}})},customElementCb:e=>{Jk({type:Zx.IncrementalSnapshot,data:{source:ek.CustomElement,...e}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:u,maskInputOptions:F,inlineStylesheet:c,sampling:b,recordDOM:x,recordCanvas:k,inlineImages:P,userTriggeredOnInput:I,collectFonts:O,doc:e,maskInputFn:f,maskTextFn:g,maskAttributeFn:v,keepIframeSrcFn:M,blockSelector:o,slimDOMOptions:U,dataURLOptions:w,mirror:Zk,iframeManager:H,stylesheetManager:$,shadowDomManager:G,processedNodeManager:K,canvasManager:Yk,ignoreCSSAttributes:A,plugins:(null==(t=null==R?void 0:R.filter(e=>e.observer))?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>Jk({type:Zx.Plugin,data:{plugin:e.name,payload:t}})})))||[]},m)};H.addLoadListener(r=>{try{e.push(t(r.contentDocument))}catch(e){console.warn(e)}});const r=()=>{Xk(),e.push(t(document)),Qk=!0};return"interactive"===document.readyState||"complete"===document.readyState?r():(e.push(Mx("DOMContentLoaded",()=>{Jk({type:Zx.DomContentLoaded,data:{}}),"DOMContentLoaded"===E&&r()})),e.push(Mx("load",()=>{Jk({type:Zx.Load,data:{}}),"load"===E&&r()},window))),()=>{e.forEach(e=>e()),K.destroy(),Qk=!1,fk=void 0}}catch(e){console.warn(e)}}var tC;eC.addCustomEvent=(e,t)=>{if(!Qk)throw new Error("please add custom event after start recording");Jk({type:Zx.Custom,data:{tag:e,payload:t}})},eC.freezePage=()=>{mk.forEach(e=>e.freeze())},eC.takeFullSnapshot=e=>{if(!Qk)throw new Error("please take full snapshot after start recording");Xk(e)},eC.mirror=Zk,function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(tC||(tC={}));var rC=Object.freeze({__proto__:null,record:eC}),nC=function(e){return void 0!==e&&("boolean"==typeof e?e:!1!==e.enabled)},iC=function(e,t,r,n){var i=function(e){var t;return"object"==typeof e&&null!==e?{allowlist:null!==(t=e.allowlist)&&void 0!==t?t:[],excludelist:e.excludelist||e.blocklist||[]}:{allowlist:[],excludelist:[]}}(t),o=function(e,t,r){if(0===t.length&&0===r.length)return e;var n=t.length>0?t:["/**"];try{var i=JSON.parse(e);return Nt(i,n,r),JSON.stringify(i)}catch(t){return e}}(e,i.allowlist,i.excludelist);return n(o,r)},oC=["image/","audio/","video/","application/octet-stream","font/"];function sC(e,t){if(new Blob([e]).size<=t)return{value:e,truncated:!1};for(var r=0,n=Math.min(e.length,t);r<n;){var i=Math.ceil((r+n)/2);new Blob([e.slice(0,i)]).size<=t?r=i:n=i-1}return r>0&&e.charCodeAt(r-1)>=55296&&e.charCodeAt(r-1)<=56319&&(r-=1),{value:e.slice(0,r),truncated:!0}}var aC=function(){function e(){this.fetchObserver=null}return e.prototype.start=function(e,t){this.eventCallback=e,this.networkConfig=t,this.observeFetch()},e.prototype.stop=function(){var e;null===(e=this.fetchObserver)||void 0===e||e.call(this),this.fetchObserver=null,this.eventCallback=void 0,this.networkConfig=void 0},e.prototype.notifyEvent=function(e){var t;null===(t=this.eventCallback)||void 0===t||t.call(this,e)},e.prototype.observeFetch=function(){var e=this,t=z();if(t){var r=t.fetch;r&&(t.fetch=function(t,n){return l(e,void 0,void 0,function(){var e,i,o,s,a,l,c,d,h,p,f,g,v=this;return u(this,function(u){switch(u.label){case 0:e=Date.now(),i={timestamp:e,type:"fetch",method:(null==n?void 0:n.method)||"GET",url:t.toString(),requestHeaders:null==n?void 0:n.headers},(o=null===(f=this.networkConfig)||void 0===f?void 0:f.body)&&nC(o.request)&&void 0!==(s=function(e){if(null!=e){if("string"==typeof e)return e;if(e instanceof URLSearchParams)return e.toString();if(e instanceof FormData){var t=[];return e.forEach(function(e,r){t.push("".concat(r,"=").concat("string"==typeof e?e:"[File]"))}),t.join("&")}}}(null==n?void 0:n.body))&&(a=null!==(g=o.maxBodySizeBytes)&&void 0!==g?g:10240,i.requestBody=iC(s,o.request,a,sC).value),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,r(t,n)];case 2:return l=u.sent(),h=Date.now(),i.status=l.status,i.duration=h-e,c={},l.headers.forEach(function(e,t){c[t]=e}),i.responseHeaders=c,o&&nC(o.response)?!function(e){return!!e&&oC.some(function(t){return e.toLowerCase().startsWith(t)})}(c["content-type"]||null)?l.clone().text().then(function(e){var t,r=null!==(t=o.maxBodySizeBytes)&&void 0!==t?t:10240,n=iC(e,o.response,r,sC),s=n.value,a=n.truncated;i.responseBody=s,i.responseBodyStatus=a?"truncated":"captured",v.notifyEvent(i)},function(){i.responseBodyStatus="error",v.notifyEvent(i)}):(i.responseBodyStatus="skipped_binary",this.notifyEvent(i)):this.notifyEvent(i),[2,l];case 3:throw d=u.sent(),h=Date.now(),i.duration=h-e,p=d,i.error={name:p.name||"UnknownError",message:p.message||"An unknown error occurred"},this.notifyEvent(i),d;case 4:return[2]}})})},this.fetchObserver=function(){t.fetch=r})}},e}(),lC=Object.freeze({__proto__:null,NetworkObservers:aC});e.Identify=F,e.Revenue=ie,e.Types=Pn,e._setDiagnosticsSampleRate=Mh,e.add=Dh,e.createInstance=Th,e.experiment=_h,e.extendSession=Lh,e.flush=Fh,e.getDeviceId=Uh,e.getIdentity=jh,e.getOptOut=Bh,e.getSessionId=qh,e.getUserId=zh,e.groupIdentify=Wh,e.identify=Vh,e.initAll=Ah,e.logEvent=$h,e.remove=Hh,e.reset=Kh,e.revenue=Gh,e.sessionReplay=Nh,e.setDeviceId=Jh,e.setGroup=Xh,e.setIdentity=Yh,e.setOptOut=Qh,e.setSessionId=Zh,e.setTransport=ep,e.setUserId=tp,e.track=rp,Object.defineProperty(e,"__esModule",{value:!0})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,function(e){"use strict";function t(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new 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 i,o,s=function(){return s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)};function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function l(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})}function u(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function c(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function h(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(i||(i={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(o||(o={}));var p,f="AMP",g="".concat(f,"_unsent"),v="$default_instance",m="https://api2.amplitude.com/2/httpapi",y="https://api.eu.amplitude.com/2/httpapi",b="https://api2.amplitude.com/batch",w="https://api.eu.amplitude.com/batch",S="dclid",k="fbclid",x="gbraid",C="gclid",E="ko_click_id",I="li_fat_id",O="msclkid",P="rdt_cid",T="ttclid",R="twclid",M="wbraid",A={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},_=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],N=["authorization","cookie","set-cookie"],D=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var r=e[t];if(!L(t,r))return!1}return!0},L=function(e,t){var r,n;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=c(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&&D(a);else if(!["number","string"].includes(typeof a))return!1;if(!i)return!1}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}else{if(null==t)return!1;if("object"==typeof t)return D(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},F=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return s({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(p.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(p.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(p.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(p.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(p.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(p.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(p.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(p.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(p.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[p.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,r){if(this._validate(e,t,r)){var n=this._properties[e];return void 0===n&&(n={},this._properties[e]=n),n[t]=r,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,r){return void 0===this._properties[p.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===p.ADD?"number"==typeof r:e===p.UNSET||e===p.REMOVE||L(t,r)))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(p||(p={}));var U,j=[p.CLEAR_ALL,p.UNSET,p.SET,p.SET_ONCE,p.ADD,p.APPEND,p.PREPEND,p.PREINSERT,p.POSTINSERT,p.REMOVE],B="Event skipped due to empty event type";!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(U||(U={}));var q=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=U.Unknown),{event:e,code:t,message:r}},z=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},W=h([],d(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),V=function(e){var t,r=z();if(!(null===(t=null==r?void 0:r.crypto)||void 0===t?void 0:t.getRandomValues))return 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,V)}(e);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,h([],d(n.entries()),!1).map(function(e){var t=d(e,2),r=t[0],n=t[1];return[4,6,8,10].includes(r)?"-".concat(W[n]):W[n]}).join("")},$="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},H={},K={get exports(){return H},set exports(e){H=e}},G=Object.prototype.hasOwnProperty;function J(e){return"[Throws: "+(e?e.message:"?")+"]"}function X(e){var t=[];return function e(r){if(null===r||"object"!=typeof r)return r;if(-1!==t.indexOf(r))return"[Circular]";if(t.push(r),"function"==typeof r.toJSON)try{var n=e(r.toJSON());return t.pop(),n}catch(e){return J(e)}if(Array.isArray(r)){var i=r.map(e);return t.pop(),i}var o=Object.keys(r).reduce(function(t,n){return t[n]=e(function(e,t){if(G.call(e,t))try{return e[t]}catch(e){return J(e)}return e[t]}(r,n)),t},{});return t.pop(),o}(e)}K.exports=function(e,t,r){return JSON.stringify(X(e),t,r)};var Y,Q=H.ensureProperties=X,Z=H||t({__proto__:null,ensureProperties:Q,get default(){return H}},[H]),ee=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){var r,n;return l(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return void 0===e.name&&(e.name=V(),this.loggerProvider.warn("Plugin name is undefined.\n Generating a random UUID for plugin name: ".concat(e.name,".\n Set a name for the plugin to prevent it from being added multiple times."))),i=e.name,this.pluginStatus.has(i)?(this.loggerProvider.warn("Plugin with name ".concat(i," already exists, skipping registration")),[2]):(e.type=null!==(r=e.type)&&void 0!==r?r:"enrichment",this.pluginStatus.set(i,"locked"),[4,null===(n=e.setup)||void 0===n?void 0:n.call(e,t,this.client)]);case 1:return o.sent(),"locked"!==this.pluginStatus.get(i)?[2]:(this.plugins.push(e),this.pluginStatus.set(i,"installed"),[2])}})})},e.prototype.deregister=function(e,t){var r;return l(this,void 0,void 0,function(){var n,i;return u(this,function(o){switch(o.label){case 0:return this.pluginStatus.delete(e),n=this.plugins.findIndex(function(t){return t.name===e}),-1===n?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(i=this.plugins[n],this.plugins.splice(n,1),[4,null===(r=i.teardown)||void 0===r?void 0:r.call(i)]);case 1:return o.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)}),this.plugins=[],this.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(r){t.queue.push([e,r]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o,a,l,h,p,f,g,v,m,y,b,w,S,k,x,C;return u(this,function(u){switch(u.label){case 0:if(!e)return[2];t=d(e,1),r=t[0],n=d(e,2),i=n[1],this.loggerProvider.log("Timeline.apply: Initial event",r),o=this.plugins.filter(function(e){return"before"===e.type}),u.label=1;case 1:u.trys.push([1,6,7,8]),a=c(o),l=a.next(),u.label=2;case 2:return l.done?[3,5]:(v=l.value).execute?[4,v.execute(s({},r))]:[3,4];case 3:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(v.name),"', event: ").concat(Z(r))),i({event:r,code:0,message:""}),[2];r=m,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(v.name),"', event: ").concat(Z(r))),u.label=4;case 4:return l=a.next(),[3,2];case 5:return[3,8];case 6:return h=u.sent(),S={error:h},[3,8];case 7:try{l&&!l.done&&(k=a.return)&&k.call(a)}finally{if(S)throw S.error}return[7];case 8:p=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),u.label=9;case 9:u.trys.push([9,14,15,16]),f=c(p),g=f.next(),u.label=10;case 10:return g.done?[3,13]:(v=g.value).execute?[4,v.execute(s({},r))]:[3,12];case 11:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(v.name),"', event: ").concat(Z(r))),i({event:r,code:0,message:""}),[2];r=m,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(v.name),"', event: ").concat(Z(r))),u.label=12;case 12:return g=f.next(),[3,10];case 13:return[3,16];case 14:return y=u.sent(),x={error:y},[3,16];case 15:try{g&&!g.done&&(C=f.return)&&C.call(f)}finally{if(x)throw x.error}return[7];case 16:return b=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(Z(r))),w=b.map(function(e){var t=s({},r);return e.execute(t).catch(function(e){return q(t,0,String(e))})}),Promise.all(w).then(function(e){var t=d(e,1)[0]||q(r,100,"Event not tracked, no destination plugins on the instance");i(t)}),[2]}})})},e.prototype.flush=function(){return l(this,void 0,void 0,function(){var e,t,r,n=this;return u(this,function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return n.apply(e)}))];case 1:return i.sent(),t=this.plugins.filter(function(e){return"destination"===e.type}),r=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(r)];case 2:return i.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var r;null===(r=t.onIdentityChanged)||void 0===r||r.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var r;null===(r=t.onSessionIdChanged)||void 0===r||r.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var r;null===(r=t.onOptOutChanged)||void 0===r||r.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o,s,a;return u(this,function(l){switch(l.label){case 0:l.trys.push([0,7,8,9]),t=c(this._optOutListeners),r=t.next(),l.label=1;case 1:if(r.done)return[3,6];n=r.value,l.label=2;case 2:return l.trys.push([2,4,,5]),[4,n(e)];case 3:return l.sent(),[3,5];case 4:return i=l.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return r=t.next(),[3,1];case 6:return[3,9];case 7:return o=l.sent(),s={error:o},[3,9];case 8:try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(s)throw s.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null===(t=e.onReset)||void 0===t||t.call(e)})},e}(),te=function(e,t){return s(s({},t),{event_type:o.IDENTIFY,user_properties:e.getUserProperties()})},re=function(e){return{promise:e||Promise.resolve()}},ne=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 ee(this),this.name=e}return e.prototype._init=function(e){return l(this,void 0,void 0,function(){var t=this;return u(this,function(r){switch(r.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return t.isReady=!0})];case 1:return r.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return l(this,void 0,void 0,function(){var r,n,i,o,s,a,l,d;return u(this,function(u){switch(u.label){case 0:r=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),n=c(r),i=n.next(),u.label=2;case 2:return i.done?[3,7]:(o=i.value,(s=o())&&"promise"in s?[4,s.promise]:[3,4]);case 3:return u.sent(),[3,6];case 4:return[4,s];case 5:u.sent(),u.label=6;case 6:return i=n.next(),[3,2];case 7:return[3,10];case 8:return a=u.sent(),l={error:a},[3,10];case 9:try{i&&!i.done&&(d=n.return)&&d.call(n)}finally{if(l)throw l.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e,t)]:[3,12];case 11:return u.sent(),[3,13];case 12:null==t||t(),u.label=13;case 13:return[2]}})})},e.prototype.track=function(e,t,r){var n=function(e,t,r){return s(s(s({},"string"==typeof e?{event_type:e}:e),r),t&&{event_properties:t})}(e,t,r);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),re(this.dispatch(n))},e.prototype.identify=function(e,t){var r=te(e,t);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),re(this.dispatch(r))},e.prototype.groupIdentify=function(e,t,r,n){var i=function(e,t,r,n){var i;return s(s({},n),{event_type:o.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,r,n);return re(this.dispatch(i))},e.prototype.setGroup=function(e,t,r){var n=function(e,t,r){var n,i=new F;return i.set(e,t),s(s({},r),{event_type:o.IDENTIFY,user_properties:i.getUserProperties(),groups:(n={},n[e]=t,n)})}(e,t,r);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),re(this.dispatch(n))},e.prototype.revenue=function(e,t){var r=function(e,t){return s(s({},t),{event_type:o.REVENUE,event_properties:e.getEventProperties()})}(e,t);return re(this.dispatch(r))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),re())},e.prototype._addPlugin=function(e){return re(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)),re())},e.prototype._removePlugin=function(e){return re(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(q(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return l(this,void 0,void 0,function(){var t=this;return u(this,function(r){return this.isReady?[2,this.process(e)]:[2,new Promise(function(r){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,r))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,r=null!==(t=this.userProperties)&&void 0!==t?t:{},n=s({},r);if(void 0===e)return n;var o={};return Object.keys(e).forEach(function(t){Object.values(i).includes(t)||(o[t]=e[t])}),j.forEach(function(t){if(Object.keys(e).includes(t)){var r=e[t];switch(t){case i.CLEAR_ALL:Object.keys(n).forEach(function(e){delete n[e]});break;case i.UNSET:Object.keys(r).forEach(function(e){delete n[e]});break;case i.SET:Object.assign(n,r)}}}),Object.assign(n,o),n},e.prototype.process=function(e){return l(this,void 0,void 0,function(){var t,r,n,i;return u(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),this.config.optOut?[2,q(e,0,"Event skipped due to optOut config")]:"string"!=typeof(t=e.event_type)||0===t.trim().length?(this.config.loggerProvider.error(B),[2,q(e,0,B)]):(e.event_type===o.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)]);case 1:return 200===(i=s.sent()).code?this.config.loggerProvider.log(i.message):100===i.code?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return r=s.sent(),n=String(r),this.config.loggerProvider.error(n),[2,i=q(e,0,n)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=Boolean(e),this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return re(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});if(void 0!==t)return t;this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e))},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),ie=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){try{var t=JSON.parse(JSON.stringify(e));D(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?s({},this.properties):{};return e[Y.REVENUE_PRODUCT_ID]=this.productId,e[Y.REVENUE_QUANTITY]=this.quantity,e[Y.REVENUE_PRICE]=this.price,e[Y.REVENUE_TYPE]=this.revenueType,e[Y.REVENUE_CURRENCY]=this.currency,e[Y.REVENUE]=this.revenue,e[Y.RECEIPT]=this.receipt,e[Y.RECEIPT_SIG]=this.receiptSig,e},e}();!function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"}(Y||(Y={}));var oe;!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(oe||(oe={}));var se="Amplitude Logger ",ae=function(){function e(){this.logLevel=oe.None}return e.prototype.disable=function(){this.logLevel=oe.None},e.prototype.enable=function(e){void 0===e&&(e=oe.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<oe.Verbose||console.log("".concat(se,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<oe.Warn||console.warn("".concat(se,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<oe.Error||console.error("".concat(se,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<oe.Debug||console.log("".concat(se,"[Debug]: ").concat(e.join(" ")))},e}(),le=function(e){return void 0===e||""===e?v:e},ue=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:v,logLevel:oe.Warn,loggerProvider:new ae,offline:!1,optOut:!1,serverUrl:m,serverZone:"US",useBatch:!1}},ce=function(){function e(e){var t,r,n,i;this._optOut=!1;var o=ue();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=le(e.instanceName),this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(r=e.logLevel)&&void 0!==r?r:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(n=e.optOut)&&void 0!==n?n:o.optOut,this.serverUrl=e.serverUrl,this.delayedEventsServerUrl=e.delayedEventsServerUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=he(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),de=function(e,t){return"EU"===e?t?w:y:t?b:m},he=function(e,t,r){if(void 0===e&&(e=""),void 0===t&&(t=ue().serverZone),void 0===r&&(r=ue().useBatch),e)return{serverUrl:e,serverZone:void 0};var n=["US","EU"].includes(t)?t:ue().serverZone;return{serverZone:n,serverUrl:de(n,r)}},pe=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function fe(e){return e>=200&&e<300}var ge=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},ve=function(e){return function(){var t=s({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},me=function(e,t){var r,n;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=c(t.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e},ye=function(e,t){return function(){var r,n,i={};try{for(var o=c(t),s=o.next();!s.done;s=o.next()){var a=s.value;i[a]=me(e,a)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}},be=function(e,t,r,n,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=r(),l=a.logger,u=a.logLevel;if(u&&u<oe.Debug||!u||!l)return e.apply(i,o);var c={type:"invoke public method",name:t,args:o,stacktrace:ge(1),time:{start:(new Date).toISOString()},states:{}};n&&c.states&&(c.states.before=n());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=(new Date).toISOString()),l.debug(JSON.stringify(c,null,2))}):(n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=(new Date).toISOString()),l.debug(JSON.stringify(c,null,2))),d}},we=new Set([m,y,b,w]);function Se(e){return void 0!==e.delay&&null!==e.delay}function ke(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var xe=function(){function e(e){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.inFlightDelayedEvents={},this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return l(this,void 0,void 0,function(){var r,n=this;return u(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(g,"_").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(r=i.sent())&&r.length>0&&Promise.all(r.map(function(e){return n.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=V()),new Promise(function(r){var n={event:e,attempts:0,callback:function(e){return r(e)},timeout:0};Se(e)&&t.removeStaleDelayedEvents(e),t.queue.push(n),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeStaleDelayedEvents=function(e){var t=this;try{this.queue=this.queue.filter(function(r){var n,i=r.event;if(!Se(i))return!0;if(!(i.delay.id===e.delay.id&&i.insert_id===e.insert_id))return!0;var o=t.inFlightDelayedEvents[e.delay.id];return o&&(e.delay=s(s({},e.delay),{skipRemoval:!0})),!(!o||(null===(n=i.delay)||void 0===n?void 0:n.skipRemoval))||(r.callback(q(i,0,"Stale event overwritten")),!1)})}catch(e){}},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),l(this,void 0,void 0,function(){var t,r,n,i,o,s,a=this;return u(this,function(c){switch(c.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),t=[],r={},n=[],this.queue.forEach(function(e){var i;if(0!==e.timeout)n.push(e);else if(null===(i=e.event.delay)||void 0===i?void 0:i.id){var o=e.event.delay;r[o.id]=r[o.id]||[],r[o.id].push(e)}else t.push(e)}),d=t,h=this.config.flushQueueSize,p=Math.max(h,1),i=d.reduce(function(e,t,r){var n=Math.floor(r/p);return e[n]||(e[n]=[]),e[n].push(t),e},[]),o=i.reduce(function(t,r){return l(a,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return[4,t];case 1:return n.sent(),[4,this.send(r,e)];case 2:return[2,n.sent()]}})})},Promise.resolve()),s=[o],Object.keys(r).length>0&&s.push(this.sendDelayedEvents(r,e)),[4,Promise.all(s)]);case 1:return c.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var d,h,p})})},e.prototype.sendDelayedEvents=function(e,t){var r,n,i=this,o=[];try{var s=function(e,r){a.inFlightDelayedEvents[e]=!0;var n=a.send(r,t,!0);o.push(n),n.finally(function(){delete i.inFlightDelayedEvents[e]})},a=this;try{for(var h=c(Object.entries(e)),p=h.next();!p.done;p=h.next()){var f=d(p.value,2);s(f[0],f[1])}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}catch(e){}return o.reduce(function(e,t){return l(i,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return[4,e];case 1:return r.sent(),[4,t];case 2:return[2,r.sent()]}})})},Promise.resolve())},e.prototype.translatePayloadToDelayedPayload=function(e,t){var r,n,i=[],o=[],s=[],a=[];t.forEach(function(t,r){t.event.delay.timeout?(i.push(e.events[r]),s.push(t)):(o.push(e.events[r]),a.push(t))}),t.splice.apply(t,h(h([0,t.length],d(s),!1),d(a),!1)),e.timeout=null!==(n=null===(r=s[0])||void 0===r?void 0:r.event.delay.timeout)&&void 0!==n?n:0,e.id=t[0].event.delay.id,e.events=i,e.instant_events=o},e.prototype.send=function(e,t,r){var n;return void 0===t&&(t=!0),l(this,void 0,void 0,function(){var i,o,s,l,c,d;return u(this,function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];i={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,t.delay,a(t,["extra","delay"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:r?void 0:this.config.requestMetadata},r||(this.config.requestMetadata=new pe),u.label=1;case 1:return u.trys.push([1,3,,4]),o=he(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,s=function(e,t){return void 0===t&&(t=!1),!!we.has(e)||t}(o,this.config.enableRequestBodyCompression),r&&(o=this.config.delayedEventsServerUrl||"".concat(o,"/delayed"),this.translatePayloadToDelayedPayload(i,e),s=!1),[4,this.config.transportProvider.send(o,i,s)];case 2:return null===(l=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(l,e),[3,4]):("body"in l?this.fulfillRequest(e,l.statusCode,"".concat(l.status,": ").concat(ke(l))):this.fulfillRequest(e,l.statusCode,l.status),[2]);case 3:return c=u.sent(),d=(h=c)instanceof Error?h.message:String(h),this.config.loggerProvider.error(d),null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:d,stack_trace:ge()}),this.handleResponse({status:U.Failed,statusCode:0},e),[3,4];case 4:return[2]}var h})})},e.prototype.handleResponse=function(e,t){var r;fe(e.statusCode)||null===(r=this.diagnosticsClient)||void 0===r||r.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:ke(e),stack_trace:ge()});var n=e.status;switch(n){case U.Success:this.handleSuccessResponse(e,t);break;case U.Invalid:this.handleInvalidResponse(e,t);break;case U.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case U.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var r=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var n=h(h(h(h([],d(Object.values(e.body.eventsWithInvalidFields)),!1),d(Object.values(e.body.eventsWithMissingFields)),!1),d(Object.values(e.body.eventsWithInvalidIdLengths)),!1),d(e.body.silencedEvents),!1).flat(),i=new Set(n),o=t.filter(function(t,n){if(!i.has(n))return!0;r.fulfillRequest([t],e.statusCode,e.body.error)});o.length>0&&this.config.loggerProvider.warn(ke(e));var s=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(ke(e)),this.config.flushQueueSize/=2;var r=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(r)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var r=this,n=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(n),a=new Set(i),l=new Set(o),u=t.filter(function(t,n){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)))return l.has(n)&&(t.timeout=r.throttleTimeout),!0;r.fulfillRequest([t],e.statusCode,e.body.error)});u.length>0&&this.config.loggerProvider.warn(ke(e));var c=this.removeEventsExceedFlushMaxRetries(u);this.scheduleEvents(c)},e.prototype.handleOtherResponse=function(e){var t=this,r=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),n=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(n)},e.prototype.fulfillRequest=function(e,t,r){var n,i,o;fe(t)?null===(o=this.diagnosticsClient)||void 0===o||o.increment("analytics.events.sent",e.length):(null===(n=this.diagnosticsClient)||void 0===n||n.increment("analytics.events.dropped",e.length),null===(i=this.diagnosticsClient)||void 0===i||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:r,stack_trace:ge()})),this.removeEvents(e),e.forEach(function(e){return e.callback(q(e.event,t,r))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(e){return e.event});this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){var t=new Set(e.map(function(e){return e.event.insert_id}));this.queue=this.queue.filter(function(t){return!e.some(function(e){var r;return e.event.insert_id===t.event.insert_id&&!(null===(r=t.event.delay)||void 0===r?void 0:r.skipRemoval)})}),this.queue.forEach(function(e){var r;(null===(r=e.event.delay)||void 0===r?void 0:r.skipRemoval)&&t.has(e.event.insert_id)&&delete e.event.delay.skipRemoval}),this.saveEvents()},e}(),Ce=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Ee(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),Ee=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},Ie=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(t){e(t)}),this.queue=[])},e}(),Oe=function(){return Oe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Oe.apply(this,arguments)};function Pe(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Te(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var Re=function(e,t){var r,n,i=typeof e;if(i!==typeof t)return!1;try{for(var o=Pe(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next()){if(s.value===i)return e===t}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var a=Array.isArray(e),l=Array.isArray(t);if(a!==l)return!1;if(!a||!l){var u=Object.keys(e).sort(),c=Object.keys(t).sort();if(!Re(u,c))return!1;var d=!0;return Object.keys(e).forEach(function(r){Re(e[r],t[r])||(d=!1)}),d}for(var h=0;h<e.length;h++)if(!Re(e[h],t[h]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=new Array(r);r--;)n[r]=[t[r],e[t[r]]];return n});var Me=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=Oe({},this.identity.userProperties),r=Oe(Oe({},this.identity),{userProperties:t});return{setUserId:function(e){return r.userId=e,this},setDeviceId:function(e){return r.deviceId=e,this},setUserProperties:function(e){return r.userProperties=e,this},setOptOut:function(e){return r.optOut=e,this},updateUserProperties:function(e){var t,n,i,o,s,a,l=r.userProperties||{};try{for(var u=Pe(Object.entries(e)),c=u.next();!c.done;c=u.next()){var d=Te(c.value,2),h=d[0],p=d[1];switch(h){case"$set":try{for(var f=(i=void 0,Pe(Object.entries(p))),g=f.next();!g.done;g=f.next()){var v=Te(g.value,2),m=v[0],y=v[1];l[m]=y}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,Pe(Object.keys(p))),w=b.next();!w.done;w=b.next()){delete l[m=w.value]}}catch(e){s={error:e}}finally{try{w&&!w.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":l={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return r.userProperties=l,this},commit:function(){return e.setIdentity(r),this}}},e.prototype.getIdentity=function(){return Oe({},this.identity)},e.prototype.setIdentity=function(e){var t=Oe({},this.identity);this.identity=Oe({},e),Re(t,this.identity)||this.listeners.forEach(function(t){t(e)})},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),Ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,_e=function(){function e(){this.identityStore=new Me,this.eventBridge=new Ie,this.applicationContextProvider=new Ce}return e.getInstance=function(t){return Ae.analyticsConnectorInstances||(Ae.analyticsConnectorInstances={}),Ae.analyticsConnectorInstances[t]||(Ae.analyticsConnectorInstances[t]=new e),Ae.analyticsConnectorInstances[t]},e}(),Ne=function(e){return _e.getInstance(le(e))},De=function(){function e(){this.name="identity",this.type="before",this.identityStore=Ne().identityStore}return e.prototype.execute=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return l(this,void 0,void 0,function(){return u(this,function(t){return e.instanceName&&(this.identityStore=Ne(e.instanceName).identityStore),[2]})})},e}(),Le=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},Fe=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),[f,t,e.substring(0,r)].filter(Boolean).join("_")},Ue=function(){var e,t,r,n;if("undefined"==typeof navigator)return"";var i=navigator.userLanguage;return null!==(n=null!==(r=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==r?r:i)&&void 0!==n?n:""},je=function(){var e,t=z();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 r=t.split("=",2),n=Be(r[0]),i=Be(r[1]);return i?(e[n]=i,e):e},{}):{}},Be=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},qe=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},ze=function(e,t){var r=e;try{r=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return r},We=function(e){var t=0;if(0===e.length)return t;for(var r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r),t|=0}return t},Ve=function(e,t){var r=We(e.toString());return 31*Math.abs(r)%1e5/1e5<t},$e=function(e){var t={};for(var r in e){var n=e[r];n&&(t[r]=n)}return t},He=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,function(){return u(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return l(this,void 0,void 0,function(){return u(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return[4,this.get(e)];case 1:return[2,(t=r.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return l(this,void 0,void 0,function(){return u(this,function(r){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return l(this,void 0,void 0,function(){return u(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return l(this,void 0,void 0,function(){return u(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),Ke=function(){function e(e,t){void 0===t&&(t={}),this.options=s({},e),this.config=t}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,function(){var t,r,n,i,o=this;return u(this,function(a){switch(a.label){case 0:return t="AMP_TEST",r=s({},this.options),n=new e(r),i=String(Date.now()),[4,n.transaction(t,function(e){var r,n;try{e.set(i);var s=e.get()===i;return!s&&o.config.diagnosticsClient&&(null===(r=o.config.diagnosticsClient)||void 0===r||r.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:i,sync:!0})),s}catch(e){if(o.config.diagnosticsClient){var a=e instanceof Error?e.message:String(e);null===(n=o.config.diagnosticsClient)||void 0===n||n.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:i,error:a,sync:!0})}return!1}finally{e.set(null)}})];case 1:return[2,a.sent()]}})})},e.prototype.get=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return[4,this.getRaw(e)];case 1:return t=r.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var r=Ge(t);return void 0===r?void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t)):JSON.parse(r)}catch(r){return void console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t))}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,r;return l(this,void 0,void 0,function(){var n,i,o,s,a,l,d,h,p;return u(this,function(u){switch(u.label){case 0:n=z(),i=n,u.label=1;case 1:return u.trys.push([1,4,,5]),(o=null==i?void 0:i.cookieStore)?[4,o.getAll(e)]:[3,3];case 2:if(s=u.sent()){s.length>1&&(null===(t=this.config.diagnosticsClient)||void 0===t||t.recordEvent("cookies.duplicate",{cookies:s.map(function(e){return e.domain})}),null===(r=this.config.diagnosticsClient)||void 0===r||r.increment("cookies.duplicate.occurrence.cookieStore"));try{for(a=c(s),l=a.next();!l.done;l=a.next())if(d=l.value,Je(d.domain,this.options.domain))return[2,d.value]}catch(e){h={error:e}}finally{try{l&&!l.done&&(p=a.return)&&p.call(a)}finally{if(h)throw h.error}}}u.label=3;case 3:return[3,5];case 4:return u.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,r,n=this,i=z(),o=(null!==(r=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==r?r:[]).filter(function(t){return 0===t.indexOf(e+"=")}),s=void 0,a=this.config.duplicateResolverFn;if("function"==typeof a&&o.length>1&&(s=o.find(function(t){var r;try{var i=a(t.substring(e.length+1));return i||null===(r=n.config.diagnosticsClient)||void 0===r||r.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),s||(s=o[0]),s)return s.substring(e.length+1)},e.prototype.set=function(e,t){return l(this,void 0,void 0,function(){return u(this,function(r){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var r;try{var n=z();if(!n||!n.document||"function"!=typeof n.btoa||"function"!=typeof n.encodeURIComponent)return;var i=null!==(r=this.options.expirationDays)&&void 0!==r?r:0,o=null!==t?i:-1,s=void 0;if(o){var a=new Date;a.setTime(a.getTime()+24*o*60*60*1e3),s=a}var l="".concat(e,"=").concat(n.btoa(n.encodeURIComponent(JSON.stringify(t))));s&&(l+="; expires=".concat(s.toUTCString())),l+="; path=/",this.options.domain&&(l+="; domain=".concat(this.options.domain)),this.options.secure&&(l+="; Secure"),this.options.sameSite&&(l+="; SameSite=".concat(this.options.sameSite)),n.document.cookie=l}catch(t){var u=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(u))}},e.prototype.remove=function(e){return l(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}})})},e.prototype.reset=function(){return l(this,void 0,void 0,function(){return u(this,function(e){return[2]})})},e.isDomainWritable=function(t){return l(this,void 0,void 0,function(){var r,n;return u(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];r="AMP_TLDTEST",n=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n.transaction(r,function(r){if(e.cachedTlds[t])return!0;try{r.set(1);var n=!!r.get();return n&&(e.cachedTlds[t]=!0),n}finally{r.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return l(this,void 0,void 0,function(){var r,n,i=this;return u(this,function(o){switch(o.label){case 0:if(r=function(){var e,t=z();return null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.locks}(),n=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!r)return[2,n()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.request("com.amplitude:cookie-lock:".concat(e),n)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,n()];case 4:return[2]}})})},e.cachedTlds={},e}(),Ge=function(e){var t;return null!==(t=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}}(e))&&void 0!==t?t:function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}}(e)},Je=function(e,t){if(""===e&&""===t)return!0;if(!e||!t)return!1;var r=e.startsWith(".")?e.substring(1):e,n=t.startsWith(".")?t.substring(1):t;return r.toLowerCase()===n.toLowerCase()},Xe=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),[f,t,e.substring(0,r)].filter(Boolean).join("_")},Ye=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,function(){var t,r,n;return u(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),r=new e(this.storage),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,r.set(n,t)];case 2:return i.sent(),[4,r.get(n)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,r.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=r.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return r.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(r){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var r;return l(this,void 0,void 0,function(){return u(this,function(n){try{null===(r=this.storage)||void 0===r||r.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(r){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return l(this,void 0,void 0,function(){return u(this,function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]})})},e}(),Qe="tags",Ze="counters",et="histograms",tt="events",rt="internal",nt="last_flush_timestamp",it=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return void 0!==(null===(e=z())||void 0===e?void 0:e.indexedDB)},e.prototype.getDB=function(){return l(this,void 0,void 0,function(){return u(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,r){var n=indexedDB.open(e.dbName,1);n.onerror=function(){e.dbPromise=null,r(new Error("Failed to open IndexedDB"))},n.onsuccess=function(){var r=n.result;r.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},r.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),r.close()},t(r)},n.onupgradeneeded=function(){var t=n.result;t?e.createTables(t):e.logger.debug("DiagnosticsStorage: Missing DB during upgrade.")}})},e.prototype.createTables=function(e){(e.objectStoreNames.contains(Qe)||e.createObjectStore(Qe,{keyPath:"key"}),e.objectStoreNames.contains(Ze)||e.createObjectStore(Ze,{keyPath:"key"}),e.objectStoreNames.contains(et)||e.createObjectStore(et,{keyPath:"key"}),e.objectStoreNames.contains(tt))||e.createObjectStore(tt,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(rt)||e.createObjectStore(rt,{keyPath:"key"})},e.prototype.setTags=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o=this;return u(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=s.sent(),r=t.transaction([Qe],"readwrite"),n=r.objectStore(Qe),[2,new Promise(function(t){var i=Object.entries(e);r.oncomplete=function(){t()},r.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tags",e),t()},i.forEach(function(e){var t=d(e,2),r=t[0],i=t[1];n.put({key:r,value:i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tag",r,i,e)}})})];case 2:return i=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",i),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o=this;return u(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=s.sent(),r=t.transaction([Ze],"readwrite"),n=r.objectStore(Ze),[2,new Promise(function(t){var i=Object.entries(e);r.oncomplete=function(){t()},r.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to increment counters",e),t()},i.forEach(function(e){var t=d(e,2),r=t[0],i=t[1],s=n.get(r);s.onsuccess=function(){var e=s.result,t=e?e.value:0;n.put({key:r,value:t+i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to update counter",r,e)}},s.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing counter",r,e)}})})];case 2:return i=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",i),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o=this;return u(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=s.sent(),r=t.transaction([et],"readwrite"),n=r.objectStore(et),[2,new Promise(function(t){var i=Object.entries(e);r.oncomplete=function(){t()},r.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),t()},i.forEach(function(e){var t=d(e,2),r=t[0],i=t[1],s=n.get(r);s.onsuccess=function(){var e,t=s.result;e=t?{key:r,count:t.count+i.count,min:Math.min(t.min,i.min),max:Math.max(t.max,i.max),sum:t.sum+i.sum}:{key:r,count:i.count,min:i.min,max:i.max,sum:i.sum},n.put(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",r,e)}},s.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",r,e)}})})];case 2:return i=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",i),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o=this;return u(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),0===e.length?[2]:[4,this.getDB()];case 1:return t=s.sent(),r=t.transaction([tt],"readwrite"),n=r.objectStore(tt),[2,new Promise(function(t){r.oncomplete=function(){t()},r.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event records",e),t()};var i=n.count();i.onsuccess=function(){var t=i.result,r=Math.max(0,10-t);r<e.length&&o.logger.debug("DiagnosticsStorage: Only added ".concat(r," of ").concat(e.length," events due to storage limit")),e.slice(0,r).forEach(function(e){n.add(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},i.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return i=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",i),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return l(this,void 0,void 0,function(){var r,n,i,o;return u(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([rt],"readwrite"),i=n.objectStore(rt),[2,new Promise(function(r,o){n.onabort=function(){return o(new Error("Failed to set internal value"))};var s=i.put({key:e,value:t});s.onsuccess=function(){return r()},s.onerror=function(){return o(new Error("Failed to set internal value"))}})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",o),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return l(this,void 0,void 0,function(){var t,r,n,i;return u(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return t=o.sent(),r=t.transaction([rt],"readonly"),n=r.objectStore(rt),[2,new Promise(function(t,i){r.onabort=function(){return i(new Error("Failed to get internal value"))};var o=n.get(e);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(new Error("Failed to get internal value"))}})];case 2:return i=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",i),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return l(this,void 0,void 0,function(){var e,t;return u(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getInternal(nt)];case 1:return[2,(e=r.sent())?parseInt(e.value,10):void 0];case 2:return t=r.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.setInternal(nt,e.toString())];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(r,n){var i=e.objectStore(t).clear();i.onsuccess=function(){return r()},i.onerror=function(){return n(new Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return l(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a;return u(this,function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=l.sent(),t=e.transaction([Qe,Ze,et,tt],"readwrite"),[4,Promise.all([this.getAllFromStore(t,Qe),this.getAllFromStore(t,Ze),this.getAllFromStore(t,et),this.getAllFromStore(t,tt)])];case 2:return r=d.apply(void 0,[l.sent(),4]),n=r[0],i=r[1],o=r[2],s=r[3],[4,Promise.all([this.clearTable(t,Ze),this.clearTable(t,et),this.clearTable(t,tt)])];case 3:return l.sent(),[2,{tags:n,counters:i,histogramStats:o,events:s}];case 4:return a=l.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",a),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(r,n){var i=e.objectStore(t).getAll();i.onsuccess=function(){return r(i.result)},i.onerror=function(){return n(new Error("Failed to get all from ".concat(t)))}})},e}(),ot=function(e){var t,r,n=function(){var e=z();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]}();if(0!==n.length)try{for(var i=c(n),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.filename&&e.filename.includes(s))return"filename";if(e.stack&&e.stack.includes(s))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},st=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},at=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},lt=3e5,ut=1e4,ct=function(){function e(e,t,r,n,i){void 0===r&&(r="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===r?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(n,null,2)),this.config=s({enabled:!0,sampleRate:0},n),this.startTimestamp=Date.now(),this.shouldTrack=Ve(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:it.isSupported()?this.storage=new it(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),function(e){var t=z();if(t&&"function"==typeof t.addEventListener){var r=function(t){e.recordEvent("sdk.error.uncaught",s({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,n=null==t?void 0:t.stack,i=ot({filename:e.filename,stack:n});i&&r({type:"error",message:e.message,stack:n,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,n=e.reason instanceof Error?e.reason:void 0,i=null==n?void 0:n.stack,o=st(i),s=ot({filename:o,stack:i});s&&r({type:"unhandledrejection",message:null!==(t=null==n?void 0:n.message)&&void 0!==t?t:at(e.reason),stack:i,filename:o,errorName:null==n?void 0:n.name,metadata:{isTrusted:e.isTrusted,matchReason:s}})},!0)}}(this))}return e.prototype.isStorageAndTrackEnabled=function(){return Boolean(this.storage)&&Boolean(this.shouldTrack)},e.prototype.setTag=function(e,t){this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryTags).length>=ut?this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit"):(this.inMemoryTags[e]=t,this.startTimersIfNeeded()))},e.prototype.increment=function(e,t){void 0===t&&(t=1),this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryCounters).length>=ut?this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit"):(this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()))},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled())if(Object.keys(this.inMemoryHistograms).length>=ut)this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");else{var r=this.inMemoryHistograms[e];r?(r.count+=1,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){this.isStorageAndTrackEnabled()&&(this.inMemoryEvents.length>=10?this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit"):(this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()))},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},lt))},e.prototype.saveAllDataToStorage=function(){return l(this,void 0,void 0,function(){var e,t,r,n;return u(this,function(i){switch(i.label){case 0:return this.storage?(e=s({},this.inMemoryTags),t=s({},this.inMemoryCounters),r=s({},this.inMemoryHistograms),n=h([],d(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(r),this.storage.addEventRecords(n)])]):[2];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return l(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a,l,c;return u(this,function(u){switch(u.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return u.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=u.sent(),t=e.tags,r=e.counters,n=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),s={},r.forEach(function(e){s[e.key]=e.value}),a={},n.forEach(function(e){a[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),l=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(s).length&&0===Object.keys(a).length&&0===l.length?[2]:(c={tags:o,histogram:a,counters:s,events:l},this.fetch(c),[2])}})})},e.prototype.fetch=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!z())throw new Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return r.sent().ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return t=r.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return l(this,void 0,void 0,function(){var e,t,r;return u(this,function(n){switch(n.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return-1===(t=n.sent()||-1)?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(lt),[2]):(r=e-t)>=lt?(this._flush(),[2]):(this._setFlushTimer(lt-r),[2])}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=Ve(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),dt=function(){function e(){}return e.prototype.send=function(e,t,r){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,r,n,i,o,s,a,l,u,c,d,h,p,f,g,v,m,y,b,w,S,k;if("object"!=typeof e)return null;var x=e.code||0,C=this.buildStatus(x);switch(C){case U.Success:return{status:C,statusCode:x,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(r=e.payload_size_bytes)&&void 0!==r?r:0,serverUploadTime:null!==(n=e.server_upload_time)&&void 0!==n?n:0}};case U.Invalid:return{status:C,statusCode:x,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(a=e.events_with_missing_fields)&&void 0!==a?a:{},eventsWithInvalidIdLengths:null!==(l=e.events_with_invalid_id_lengths)&&void 0!==l?l:{},epsThreshold:null!==(u=e.eps_threshold)&&void 0!==u?u:0,exceededDailyQuotaDevices:null!==(c=e.exceeded_daily_quota_devices)&&void 0!==c?c:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(h=e.silenced_events)&&void 0!==h?h:[],throttledDevices:null!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(f=e.throttled_events)&&void 0!==f?f:[]}};case U.PayloadTooLarge:return{status:C,statusCode:x,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case U.RateLimit:return{status:C,statusCode:x,body:{error:null!==(v=e.error)&&void 0!==v?v:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(S=e.exceeded_daily_quota_users)&&void 0!==S?S:{},throttledEvents:null!==(k=e.throttled_events)&&void 0!==k?k:[]}};case U.Timeout:default:return{status:C,statusCode:x}}},e.prototype.buildStatus=function(e){return fe(e)?U.Success:429===e?U.RateLimit:413===e?U.PayloadTooLarge:408===e?U.Timeout:e>=400&&e<500?U.Invalid:e>=500?U.Failed:U.Unknown},e}(),ht=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.customHeaders=t,r}return n(t,e),t.prototype.send=function(e,t){return l(this,void 0,void 0,function(){var r,n,i;return u(this,function(o){switch(o.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return r={headers:s({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(t),method:"POST"},[4,fetch(e,r)];case 1:return[4,(n=o.sent()).text()];case 2:i=o.sent();try{return[2,this.buildResponse(JSON.parse(i))]}catch(e){return[2,this.buildResponse({code:n.status})]}return[2]}})})},t}(dt);function pt(){return"undefined"!=typeof CompressionStream}function ft(e){return l(this,void 0,void 0,function(){var t,r;return u(this,function(n){switch(n.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];n.label=1;case 1:return n.trys.push([1,3,,4]),r=new Blob([e]).stream().pipeThrough(new t("gzip")),[4,new Response(r).arrayBuffer()];case 2:return[2,n.sent()];case 3:return n.sent(),[2,void 0];case 4:return[2]}})})}var gt=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t;try{this.isSupported="undefined"!=typeof localStorage}catch(e){this.logger.debug("Remote config localstorage failed to access: ",e),this.isSupported=!1}}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};if(!this.isSupported)return Promise.resolve(t);try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var r=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(Z(r))),Promise.resolve({remoteConfig:r.remoteConfig,lastFetch:new Date(r.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){if(!this.isSupported)return Promise.resolve(!1);try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}();var vt=401,mt=403,yt=429,bt=function(){function e(t,r,n,i,o,s,a){void 0===n&&(n="US"),void 0===s&&(s=e.DEFAULT_CONFIG_GROUP),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=t,this.configGroup=s,this.serverUrl=i||("US"===n?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=r,this.storage=a||new gt(t,r),this.customFetch=o}return e.prototype.subscribe=function(e,t,r){var n=V(),i={id:n,key:e,deliveryMode:t,callback:r};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),n},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return-1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return l(this,void 0,void 0,function(){var e,t=this;return u(this,function(r){switch(r.label){case 0:return this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return e=r.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(r){t.sendCallback(r,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(e){return l(this,void 0,void 0,function(){var t,r,n,i=this;return u(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),r=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,r])];case 1:return void 0!==(n=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(n))),null!==n.remoteConfig?this.sendCallback(e,n,"cache"):this.logger.debug("Remote config client skips sending callback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return l(this,void 0,void 0,function(){var r,n;return u(this,function(i){switch(i.label){case 0:r=new Promise(function(e,r){setTimeout(function(){r("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),r])];case 2:return n=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,n,"remote"),this.storage.setConfig(n),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(n=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,n,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,n,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,r){var n;e.lastCallback=new Date,n=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(n,r,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),l(this,void 0,void 0,function(){var r,n,i,o,s,a,l=this;return u(this,function(c){switch(c.label){case 0:r=t/e,n={remoteConfig:null,lastFetch:new Date},i=function(n){var i,s,a,c,d,h,p,f,g;return u(this,function(u){switch(u.label){case 0:i=!0,s=new AbortController,a=setTimeout(function(){return s.abort()},t),u.label=1;case 1:return u.trys.push([1,10,11,12]),c=o.getUrlParams(),d={Accept:"*/*"},o.customFetch?[4,(v=o.customFetch({url:c,method:"GET",headers:d,signal:s.signal}),m=s.signal,new Promise(function(e,t){var r=function(){var e=new Error("Remote config custom fetch aborted by timeout");e.name="AbortError",t(e)};m.addEventListener("abort",r,{once:!0}),v.then(function(t){m.removeEventListener("abort",r),e(t)},function(e){m.removeEventListener("abort",r),t(e)})}))]:[3,3];case 2:return p=u.sent(),[3,5];case 3:return[4,fetch(c,{method:"GET",headers:d,signal:s.signal})];case 4:p=u.sent(),u.label=5;case 5:return(h=p).ok||h.status>=200&&h.status<300?[3,7]:[4,h.text()];case 6:return f=u.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(h.status,": ").concat(f)),h.status===vt||h.status===mt?(o.logger.error("Remote config client fetch failed with ".concat(h.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):h.status>=400&&h.status<500&&h.status!==yt&&(i=!1),[3,9];case 7:return[4,h.json()];case 8:return[2,{value:{remoteConfig:u.sent(),lastFetch:new Date}}];case 9:return[3,12];case 10:return(g=u.sent())instanceof Error&&"AbortError"===g.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),g),[3,12];case 11:return clearTimeout(a),[7];case 12:return i?n<e-1?[4,new Promise(function(e){return setTimeout(e,l.getJitterDelay(r))})]:[3,14]:[2,"break"];case 13:u.sent(),u.label=14;case 14:return[2]}var v,m})},o=this,s=0,c.label=1;case 1:return s<e?[5,i(s)]:[3,4];case 2:if("object"==typeof(a=c.sent()))return[2,a.value];if("break"===a)return[3,4];c.label=3;case 3:return s++,[3,1];case 4:return[2,n]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var e=encodeURIComponent(this.apiKey),t=new URLSearchParams;return t.append("config_group",this.configGroup),"".concat(this.serverUrl,"/").concat(e,"?").concat(t.toString())},e.DEFAULT_CONFIG_GROUP="browser",e}(),wt=z(),St=null==wt?void 0:wt.console,kt={},xt={},Ct=!1;var Et,It={addListener:function(e,t){var r,n=(r=e,!!St&&"function"==typeof St[r]&&(xt[r]||(xt[r]=St[r],St[r]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(kt[r]&&!Ct){Ct=!0;var n=kt[r];n&&n.forEach(function(t){try{t(r,e)}catch(e){}})}}catch(e){}return Ct=!1,xt[r].apply(St,e)}),!0));if(!n)return new Error("Console override failed");kt[e]?kt[e].push(t):kt[e]=[t]},removeListener:function(e){var t,r;try{for(var n=c(Object.values(kt)),i=n.next();!i.done;i=n.next())for(var o=i.value,s=o.length-1;s>=0;s--)if(o[s]===e){o.splice(s,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var r=c(Object.entries(xt)),n=r.next();!n.done;n=r.next()){var i=d(n.value,2),o=i[0],s=i[1];s&&(St[o]=s)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}xt={},kt={}}};!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(Et||(Et={}));var Ot=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Pt="data-amp-track-",Tt=["div","span","h1","h2","h3","h4","h5","h6"],Rt=h(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],d(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),Mt=Rt,At=Rt,_t=["*"];function Nt(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function Dt(e,t,r){e&&Lt({json:e,allowlist:t.map(Ft),excludelist:r.map(Ft),ancestors:[]})}function Lt(e){var t,r,n=e.json,i=e.targetObject,o=e.allowlist,s=e.excludelist,a=e.ancestors,l=e.parentObject,u=e.targetKey;i||(i=n);var p=Object.keys(i);try{for(var f=c(p),g=f.next();!g.done;g=f.next()){var v=g.value,m=h(h([],d(a),!1),[v],!1);Nt(i[v])?jt(m,o)&&!jt(m,s)||delete i[v]:Lt({json:n,targetObject:i[v],allowlist:o,excludelist:s,ancestors:m,parentObject:i,targetKey:v})}}catch(e){t={error:e}}finally{try{g&&!g.done&&(r=f.return)&&r.call(f)}finally{if(t)throw t.error}}0===Object.keys(i).length&&l&&u&&delete l[u]}function Ft(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function Ut(e,t,r,n){if(void 0===r&&(r=0),void 0===n&&(n=0),n===t.length)return r===e.length;if(r===e.length){for(;n<t.length&&"**"===t[n];)n++;return n===t.length}var i=t[n];if("**"===i){if(n+1===t.length)return!0;for(var o=r;o<=e.length;o++)if(Ut(e,t,o,n+1))return!0;return!1}return("*"===i||i===e[r])&&Ut(e,t,r+1,n+1)}function jt(e,t){return t.some(function(t){return Ut(e,t)})}var Bt=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,r;void 0===e&&(e=[]);var n=this.request.headers,i={};if(Array.isArray(n))n.forEach(function(e){var t=d(e,2),r=t[0],n=t[1];i[r]=n});else if(n instanceof Headers)n.forEach(function(e,t){i[t]=e});else if("object"==typeof n&&null!==n)try{for(var o=c(Object.entries(n)),s=o.next();!s.done;s=o.next()){var a=d(s.value,2),l=a[0],u=a[1];i[l]=u}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return Gt(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=z();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=zt(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),l(this,void 0,void 0,function(){return u(this,function(r){return 0===e.length?[2,null]:[2,Ht(this.body,e,t)]})})},e}(),qt=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),Gt(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return zt(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),l(this,void 0,void 0,function(){return u(this,function(r){return 0===e.length?[2,null]:[2,Ht(this.body,e,t)]})})},e}();function zt(e,t){var r,n,i,o=z(),s=null==o?void 0:o.TextEncoder;if(s&&null!=e){var a;if("string"==typeof e)a=e,i=(new s).encode(a).length;else if("undefined"!=typeof Blob&&e instanceof Blob)i=(a=e).size;else if("undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams)a=e,i=(new s).encode(a.toString()).length;else if(ArrayBuffer.isView(e))i=(a=e).byteLength;else if(e instanceof ArrayBuffer)i=(a=e).byteLength;else if("undefined"!=typeof FormData&&e instanceof FormData){var l=e,u=0,h=0;try{for(var p=c(l.entries()),f=p.next();!f.done;f=p.next()){var g=d(f.value,2),v=g[0],m=g[1];if(u+=v.length,"string"==typeof m)u+=(new s).encode(m).length;else{if(!("undefined"!=typeof Blob&&m instanceof Blob))return;u+=m.size}if(++h>=t)return}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}i=u}else if("undefined"!=typeof ReadableStream&&e instanceof ReadableStream)return void(a=e);return i}}var Wt,Vt=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var r=this.response.headers,n={};return null===(t=null==r?void 0:r.forEach)||void 0===t||t.call(r,function(e,t){n[t]=e}),Gt(n,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var r=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),n=r?parseInt(r,10):void 0;return this._bodySize=n,n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return l(this,void 0,void 0,function(){var e,t;return u(this,function(r){switch(r.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),r.label=1;case 1:return r.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise(function(e){return setTimeout(function(){return e(null)},500)}),[4,Promise.race([e,t])];case 2:return[2,r.sent()];case 3:return r.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),l(this,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,Ht(r.sent(),e,t)]}})})},e}(),$t=function(){function e(e,t,r,n){this.statusCode=e,this.headersString=t,this.size=r,this.getJson=n}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,r;if(void 0===e&&(e=[]),!this.headersString)return{};var n={},i=this.headersString.split("\r\n");try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var a=d(s.value.split(": "),2),l=a[0],u=a[1];l&&u&&(n[l]=u)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return Gt(n,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),l(this,void 0,void 0,function(){var r;return u(this,function(n){return 0===e.length?[2,null]:(r=this.getJson())?(Dt(r,e,t),[2,r]):[2,null]})})},e}();function Ht(e,t,r){if(!e)return null;try{var n=JSON.parse(e);return Dt(n,t,r),n}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(Wt||(Wt={}));var Kt="[REDACTED]",Gt=function(e,t){var r,n,i=t.allow,o=void 0===i?[]:i,s=t.strategy,a=void 0===s?Wt.REMOVE:s,l=h([],d(N),!1),u={},p=function(t){var r=t.toLowerCase();l.find(function(e){return e.toLowerCase()===r})?a===Wt.REDACT&&(u[t]=Kt):o.find(function(e){return e.toLowerCase()===r})?u[t]=e[t]:a===Wt.REDACT&&(u[t]=Kt)};try{for(var f=c(Object.keys(e)),g=f.next();!g.done;g=f.next()){p(g.value)}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}return u},Jt=function(){function e(e,t,r,n,i,o,s,a,l,u,c){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=r,this.startTime=n,this.url=i,this.requestWrapper=o,this.status=s,this.duration=a,this.responseWrapper=l,this.error=u,this.endTime=c}return e.prototype.toSerializable=function(){var e,t,r,n,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(h([],d(_),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(r=this.responseWrapper)||void 0===r?void 0:r.headers(h([],d(_),!1)),responseBodySize:null===(n=this.responseWrapper)||void 0===n?void 0:n.bodySize};return Object.fromEntries(Object.entries(i).filter(function(e){var t=d(e,2);return t[0],void 0!==t[1]}))},e}();var Xt=function(e,t){void 0===t&&(t=V()),this.callback=e,this.id=t};function Yt(e){try{e()}catch(e){}}var Qt=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=z();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var e=z();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var r,n,i,o,s,a,l,u,c,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var h=null===(i=null===(n=null===(r=this.globalScope)||void 0===r?void 0:r.XMLHttpRequest)||void 0===n?void 0:n.prototype)||void 0===i?void 0:i.open,p=null===(a=null===(s=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===s?void 0:s.prototype)||void 0===a?void 0:a.send,f=null===(c=null===(u=null===(l=this.globalScope)||void 0===l?void 0:l.XMLHttpRequest)||void 0===u?void 0:u.prototype)||void 0===c?void 0:c.setRequestHeader;h&&p&&f&&this.observeXhr(h,p,f);var g=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;g&&this.observeFetch(g),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach(function(r){try{r.callback(e)}catch(e){Yt(function(){var r;null===(r=t.logger)||void 0===r||r.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,r,n,i,o,s){var a;if(void 0!==o&&void 0!==s){var l,u,c,d="GET";if(!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?l=null===(a=null==t?void 0:t.toString)||void 0===a?void 0:a.call(t):(l=t.url,d=t.method),l)try{var h=new URL(l);l="".concat(h.protocol,"//").concat(h.host).concat(h.pathname).concat(h.search).concat(h.hash)}catch(e){}d=(null==r?void 0:r.method)||d,n&&(u=n.status),i&&(c={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},u=0);var p=Math.floor(performance.now()-s),f=Math.floor(o+p),g=new Jt(e,d,o,o,l,r,u,p,n,c,f);this.triggerEventCallbacks(g)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(r,n){return l(t,void 0,void 0,function(){var t,i,o,s,a=this;return u(this,function(l){switch(l.label){case 0:try{t=this.getTimestamps()}catch(e){Yt(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}l.label=1;case 1:return l.trys.push([1,3,,4]),[4,e(r,n)];case 2:return i=l.sent(),[3,4];case 3:return s=l.sent(),o=s,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",r,n?new Bt(n):void 0,i?new Vt(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){Yt(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){var r;try{if("json"===e.responseType){if(null===(r=t.globalScope)||void 0===r?void 0:r.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(r){return r instanceof Error&&"InvalidStateError"===r.name&&Yt(function(){var r;return null===(r=t.logger)||void 0===r?void 0:r.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))}),null}return null}},e.prototype.observeXhr=function(t,r,n){if(this.globalScope&&t&&r){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=d(r,2),a=i[0],l=i[1];try{this.$$AmplitudeAnalyticsEvent=s({method:a,url:null===(e=null==l?void 0:l.toString)||void 0===e?void 0:e.call(l),headers:{}},o.getTimestamps())}catch(e){Yt(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,r)},i.send=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this,s=e.createXhrJsonParser(this,o),a=t[0],l=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),r=new $t(i.status,e,t?parseInt(t,10):void 0,s),n=i.$$AmplitudeAnalyticsEvent.headers,u=new qt(a,n);l.status=i.status,o.handleNetworkRequestEvent("xhr",{url:l.url,method:l.method},u,r,void 0,l.startTime,l.durationStart)}catch(e){Yt(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),r.apply(i,t)},i.setRequestHeader=function(e,t){try{var r=this.$$AmplitudeAnalyticsEvent;r&&(r.headers[e]=t)}catch(e){Yt(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}n.apply(this,[e,t])}}},e}(),Zt=new Qt,er=function(){function e(){}return e.prototype.parse=function(){return l(this,void 0,void 0,function(){return u(this,function(e){return[2,s(s(s(s({},A),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=je();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,r={referrer:void 0,referring_domain:void 0};try{r.referrer=document.referrer||void 0,r.referring_domain=null!==(t=null===(e=r.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return r},e.prototype.getClickIds=function(){var e,t=je();return(e={})[S]=t[S],e[k]=t[k],e[x]=t[x],e[C]=t[C],e[E]=t[E],e[I]=t[I],e[O]=t[O],e[P]=t[P],e[T]=t[T],e[R]=t[R],e[M]=t[M],e},e}(),tr="data-amp-mask",rr="*****",nr=/\b(?:\d[ -]*?){13,16}\b/,ir=/(\d{3}-?\d{2}-?\d{4})/g,or=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,sr=function(e,t){var r,n;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var i=e;i=(i=(i=i.replace(nr,rr)).replace(ir,rr)).replace(or,rr);try{for(var o=c(t),s=o.next();!s.done;s=o.next()){var a=s.value;try{i=i.replace(a,rr)}catch(e){}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},ar=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(tr)?rr:e?e(document.title):document.title},lr={};Object.defineProperty(lr,"__esModule",{value:!0}),lr.Observable=void 0;const ur=e=>Boolean(Symbol[e]),cr=e=>ur(e)?Symbol[e]:"@@"+e,dr=cr("iterator"),hr=cr("observable"),pr=cr("species");function fr(e,t){let r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function gr(e){let t=e.constructor;return void 0!==t&&(t=t[pr],null===t&&(t=void 0)),void 0!==t?t:xr}function vr(e){vr.log?vr.log(e):setTimeout(()=>{throw e})}function mr(e){Promise.resolve().then(()=>{try{e()}catch(e){vr(e)}})}function yr(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=fr(t,"unsubscribe");e&&e.call(t)}}catch(e){vr(e)}}function br(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function wr(e,t,r){e._state="running";let n=e._observer;try{let i=fr(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(br(e),!i)throw r;i.call(n,r);break;case"complete":br(e),i&&i.call(n)}}catch(e){vr(e)}"closed"===e._state?yr(e):"running"===e._state&&(e._state="ready")}function Sr(e,t,r){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void mr(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let r=0;r<t.length&&(wr(e,t[r].type,t[r].value),"closed"!==e._state);++r);}}(e))):void wr(e,t,r);e._queue.push({type:t,value:r})}}class kr{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let r=this,n={get closed(){return"closed"===r._state},next(e){Sr(r,"next",e)},error(e){Sr(r,"error",e)},complete(){Sr(r,"complete")}};try{this._cleanup=t.call(void 0,n)}catch(e){n.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(br(this),yr(this))}}class xr{constructor(e){if(!(this instanceof xr))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new kr(e,this._subscriber)}forEach(e){return new Promise((t,r)=>{if("function"!=typeof e)return void r(new TypeError(e+" is not a function"));function n(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,n)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(gr(this))(t=>this.subscribe({next(r){try{r=e(r)}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(gr(this))(t=>this.subscribe({next(r){try{if(!e(r))return}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=gr(this),r=arguments.length>1,n=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let s=!n;if(n=!0,!s||r)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!n&&!r)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=gr(this);return new t(r=>{let n,i=0;return function o(s){n=s.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){i===e.length?(n=void 0,r.complete()):o(t.from(e[i++]))}})}(this),()=>{n&&(n.unsubscribe(),n=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=gr(this);return new t(r=>{let n=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return r.error(e)}let s=t.from(i).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){let e=n.indexOf(s);e>=0&&n.splice(e,1),o()}});n.push(s)},error(e){r.error(e)},complete(){o()}});function o(){i.closed&&0===n.length&&r.complete()}return()=>{n.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[hr](){return this}static from(e){let t="function"==typeof this?this:xr;if(null==e)throw new TypeError(e+" is not an object");let r=fr(e,hr);if(r){let n=r.call(e);if(Object(n)!==n)throw new TypeError(n+" is not an object");return function(e){return e instanceof xr}(n)&&n.constructor===t?n:new t(e=>n.subscribe(e))}if(ur("iterator")&&(r=fr(e,dr),r))return new t(t=>{mr(()=>{if(!t.closed){for(let n of r.call(e))if(t.next(n),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{mr(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:xr)(t=>{mr(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})})}static get[pr](){return this}}lr.Observable=xr,Object.defineProperty(xr,Symbol("extensions"),{value:{symbol:hr,hostReportError:vr},configurable:!0});var Cr=lr.Observable;function Er(e,t){return new Cr(function(r){e.subscribe({next:function(e){t(e).then(function(e){return r.next(e)}).catch(function(e){return r.error(e)})},error:function(e){r.error(e)},complete:function(){r.complete()}})})}function Ir(e,t){return new Cr(function(r){var n=!1,i=new Set,o=function(){var e,t;n=!0;try{for(var r=c(i),o=r.next();!o.done;o=r.next()){var s=o.value;try{s.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}i.clear()},s=function(e){var t=e.subscribe({next:function(e){n||r.next(e)},error:function(e){n||(n=!0,r.error(e),o())},complete:function(){i.delete(t),n||0!==i.size||(r.complete(),o(),n=!0)}});i.add(t)};return s(e),s(t),o})}function Or(e){var t=new Set,r=null;function n(){null==r||r.unsubscribe(),r=null,t.clear()}return new Cr(function(i){return t.add(i),null===r&&(r=e.subscribe({next:function(e){var r,n,i;try{for(var o=c(t),s=o.next();!s.done;s=o.next()){var a=s.value;null===(i=a.next)||void 0===i||i.call(a,e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},error:function(e){var r,i,o;try{for(var s=c(t),a=s.next();!a.done;a=s.next()){var l=a.value;null===(o=l.error)||void 0===o||o.call(l,e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}n()},complete:function(){var e,r,i;try{for(var o=c(t),s=o.next();!s.done;s=o.next()){var a=s.value;null===(i=a.complete)||void 0===i||i.call(a)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}n()}})),function(){t.delete(i),0===t.size&&r&&(r.unsubscribe(),r=null)}})}var Pr,Tr="https://app.amplitude.com",Rr={US:Tr,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var Mr="__AMPLITUDE_MESSENGER_INSTANCE__",Ar="__AMPLITUDE_MESSENGER__",_r=function(){function e(e){var t=(void 0===e?{}:e).origin,r=void 0===t?Tr:t;this[Pr]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=r}return e.prototype.notify=function(e){var t,r,n,i;null===(r=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===r||r.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(n=window.opener)||void 0===n?void 0:n.postMessage)||void 0===i||i.call(n,e,this.endpoint)},e.prototype.sendRequest=function(e,t,r){var n=this;void 0===r&&(r={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,s){n.requestCallbacks[i]={resolve:t,reject:s},n.notify(o),r.timeout>0&&setTimeout(function(){s(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete n.requestCallbacks[i]},r.timeout)})},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.registerActionHandler=function(e,t){var r,n,i,o;this.actionHandlers.has(e)&&(null===(o=null===(i=this.logger)||void 0===i?void 0:i.warn)||void 0===o||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var s=this.pendingMessages.get(e);if(s){this.pendingMessages.delete(e);try{for(var a=c(s),l=a.next();!l.done;l=a.next()){t(l.value)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}},e.prototype.loadScriptOnce=function(e){return l(this,void 0,void 0,function(){var t,r,n;return u(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];r=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,r){var n;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){r({status:!1,message:"Failed to load the script ".concat(e)})}),null===(n=document.head)||void 0===n||n.appendChild(i)}catch(e){r(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,r),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r];case 2:return i.sent(),[3,4];case 3:throw n=i.sent(),this.scriptLoadPromises.delete(e),n;case 4:return[2]}})})},e.prototype.setup=function(e){var t,r,n=this,i=void 0===e?{}:e,o=i.logger,s=i.endpoint;o&&(this.logger=o),s&&this.endpoint===Tr&&(this.endpoint=s),this.isSetup||(this.isSetup=!0,null===(r=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===r||r.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,r,i,o,s;if(null===(r=null===(t=n.logger)||void 0===t?void 0:t.debug)||void 0===r||r.call(t,"Message received: ",JSON.stringify(e)),n.endpoint===e.origin){var a=e.data,l=null==a?void 0:a.action;if(l)if("id"in a&&a.id)null===(o=null===(i=n.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),n.handleResponse(a);else{if("ping"===l)return void n.notify({action:"pong"});var u=n.actionHandlers.get(l);if(u)u(a.data);else{var c=null!==(s=n.pendingMessages.get(l))&&void 0!==s?s:[];c.push(a.data),n.pendingMessages.set(l,c)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=z();(null==e?void 0:e[Ar])===this&&delete e[Ar]},e}();function Nr(e){var t,r=z(),n=null==r?void 0:r[Ar];if("object"==typeof(t=n)&&null!==t&&Mr in t&&!0===t[Mr])return n;var i=new _r(e);return r&&(r[Ar]=i),i}Pr=Mr;var Dr="__AMPLITUDE_BACKGROUND_CAPTURE__";function Lr(e,t){var r,n=e;if(!0!==n[Dr]){n[Dr]=!0;var i=null!==(r=null==t?void 0:t.scriptUrl)&&void 0!==r?r:"https://cdn.amplitude.com/libs/background-capture-1.0.3.js.gz",o=null,s=function(t,r){var n,i;"background-capture-complete"===t&&(null===(i=null===(n=e.logger)||void 0===n?void 0:n.debug)||void 0===i||i.call(n,"Background capture complete"),e.notify({action:"background-capture-complete",data:r}))};e.registerActionHandler("initialize-background-capture",function(){var t,r;null===(r=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===r||r.call(t,"Initializing background capture (external script)");var n=new URL(i,e.endpoint).toString();e.loadScriptOnce(n).then(function(){var t,r,n;null===(r=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===r||r.call(t,"Background capture script loaded (external)"),o=null===(n=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===n?void 0:n.call(window,{messenger:e,onBackgroundCapture:s}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==o?void 0:o.close)||void 0===e||e.call(o),o=null})}}var Fr={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function Ur(e,t,r){var n,i,o=[];try{for(var s=c(null!=t?t:[]),a=s.next();!a.done;a=s.next()){var l=a.value;try{o.push(new RegExp(l))}catch(e){r.warn("Invalid regex pattern: ".concat(l),e)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return e.concat(o)}function jr(e){var t,r,n,i,o,s,a,l,u,p,f,g,v;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var m=Object.keys(e);try{for(var y=c(m),b=y.next();!b.done;b=y.next()){var w=b.value;try{var S=e[w];"boolean"==typeof(null==S?void 0:S.enabled)&&(S.enabled?(delete S.enabled,0===Object.keys(S).length&&(e[w]=!0)):e[w]=!1),jr(S)}catch(e){}}}catch(e){t={error:e}}finally{try{b&&!b.done&&(r=y.return)&&r.call(y)}finally{if(t)throw t.error}}try{if(null===(u=null===(l=null===(a=e.autocapture)||void 0===a?void 0:a.networkTracking)||void 0===l?void 0:l.captureRules)||void 0===u?void 0:u.length)try{for(var k=c(e.autocapture.networkTracking.captureRules),x=k.next();!x.done;x=k.next()){var C=x.value;try{for(var E=(o=void 0,c(["responseHeaders","requestHeaders"])),I=E.next();!I.done;I=E.next()){var O=I.value,P=null!==(p=C[O])&&void 0!==p?p:{},T=P.captureSafeHeaders,R=P.allowlist;(T||R)&&(void 0===R||Array.isArray(R)?C[O]=h(h([],d(T?_:[]),!1),d(null!=R?R:[]),!1):delete C[O])}}catch(e){o={error:e}}finally{try{I&&!I.done&&(s=E.return)&&s.call(E)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{x&&!x.done&&(i=k.return)&&i.call(k)}finally{if(n)throw n.error}}}catch(e){}void 0!==(null===(f=e.autocapture)||void 0===f?void 0:f.pageViews)&&(e.autocapture.screenViews=e.autocapture.pageViews);var M=null===(g=e.autocapture)||void 0===g?void 0:g.frustrationInteractions;M&&(M.rageClick&&(M.rageClicks=M.rageClick,delete M.rageClick),M.deadClick&&(M.deadClicks=M.deadClick,delete M.deadClick));try{var A=null===(v=e.autocapture)||void 0===v?void 0:v.elementInteractions;if(A&&"object"==typeof A&&(!0===A.viewportContentUpdated&&(A.viewportContentUpdated={}),!1===A.viewportContentUpdated&&(A.viewportContentUpdated={enabled:!1}),void 0!==A.exposureDuration)){var N=A.viewportContentUpdated;void 0===N?A.viewportContentUpdated={exposureDuration:A.exposureDuration}:"object"==typeof N&&void 0===N.exposureDuration&&!1!==N.enabled&&(N.exposureDuration=A.exposureDuration),delete A.exposureDuration}}catch(e){}}}var Br=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])&&(!function(){var e,t,r=z();return"string"==typeof(null===(t=null===(e=null==r?void 0:r.chrome)||void 0===e?void 0:e.runtime)||void 0===t?void 0:t.id)}()||!!(null==e?void 0:e[t]))},qr=function(e){return Br(e,"attribution")},zr=function(e){return Br(e,"formInteractions")},Wr=function(e){return Br(e,"pageViews")},Vr=function(e){return Br(e,"sessions")},$r=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},Hr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},Kr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},Gr=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.performanceTracking;return!0===t?{mainThreadBlock:!0}:"object"==typeof t&&null!==t?t:void 0}},Jr=function(e){if(Hr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},Xr=function(e){if(Kr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},Yr=function(e){if($r(e.autocapture)){var t=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?t=e.autocapture.networkTracking:e.networkTrackingOptions&&(t=e.networkTrackingOptions),s(s({},t),{captureRules:(r=null==t?void 0:t.captureRules,n=e.loggerProvider,null==r?void 0:r.map(function(e){var t,r;if((null===(t=e.urls)||void 0===t?void 0:t.length)&&(null===(r=e.hosts)||void 0===r?void 0:r.length)){var i=JSON.stringify(e.hosts),o=JSON.stringify(e.urls);return null==n||n.warn("Found network capture rule with both urls='".concat(o,"' and hosts='").concat(i,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),s(s({},e),{hosts:void 0})}return e}))})}var r,n},Qr=function(e){var t,r=function(){return!1},n=void 0,i=e.pageCounter;return Wr(e.defaultTracking)&&(r=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:r,trackHistoryChanges:n,eventType:t,pageCounter:i}},Zr=function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.name,o=n.args,s=n.resolve,a=e&&e[i];if("function"==typeof a){var l=a.apply(e,o);"function"==typeof s&&s(null==l?void 0:l.promise)}}return e},en=function(e){return e&&void 0!==e._q};var tn="2.47.0-video-analytics-5.0",rn="amplitude-ts",nn=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(rn,"/").concat(tn),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,r;return l(this,void 0,void 0,function(){var n,i,o;return u(this,function(a){return n=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,o=null!==(r=e.event_id)&&void 0!==r?r:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=n),[2,s(s(s(s(s(s(s(s({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:n},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Ue()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:V(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:o,library:this.library,user_agent:this.userAgent})]})})},e}(),on=1e3,sn=function(e){function t(t){var r,n,i,o=this;try{i=null===(r=z())||void 0===r?void 0:r.localStorage}catch(e){null===(n=null==t?void 0:t.loggerProvider)||void 0===n||n.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return n(t,e),t.prototype.set=function(t,r){var n;return l(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return Array.isArray(r)&&r.length>on?(i=r.length-on,[4,e.prototype.set.call(this,t,r.slice(0,on))]):[3,2];case 1:return o.sent(),null===(n=this.loggerProvider)||void 0===n||n.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(on,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,r)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(Ye),an=function(e){function t(){var t;return e.call(this,null===(t=z())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(Ye),ln=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.state={done:4},r.customHeaders=t,r}return n(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),l(this,void 0,void 0,function(){var n=this;return u(this,function(i){return[2,new Promise(function(i,o){"undefined"==typeof XMLHttpRequest&&o(new Error("XHRTransport is not supported."));var a=new XMLHttpRequest;a.open("POST",e,!0),a.onreadystatechange=function(){if(a.readyState===n.state.done){var e=a.responseText;try{i(n.buildResponse(JSON.parse(e)))}catch(e){i(n.buildResponse({code:a.status}))}}};var h={"Content-Type":"application/json",Accept:"*/*"},p=JSON.stringify(t),f=r&&p.length>=2048&&pt(),g=function(e){var t,r;h=s(s({},n.customHeaders),h);try{for(var i=c(Object.entries(h)),o=i.next();!o.done;o=i.next()){var l=d(o.value,2),u=l[0],p=l[1];a.setRequestHeader(u,p)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}a.send(e)};l(n,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return f?[4,ft(p)]:[3,2];case 1:return(e=t.sent())?(h["Content-Encoding"]="gzip",g(e)):g(p),[3,3];case 2:g(p),t.label=3;case 3:return[2]}})}).catch(o)})]})})},t}(dt),un=function(e){function t(t,r,n){void 0===t&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=!1!==r,i.referrerPolicy=n,i}return n(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),l(this,void 0,void 0,function(){var n,i,o,a,l,c,d,h,p;return u(this,function(u){switch(u.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n=JSON.stringify(t),i=r&&n.length>=2048&&pt(),o=n,a={"Content-Type":"application/json",Accept:"*/*"},i?[4,ft(n)]:[3,2];case 1:(l=u.sent())&&(a["Content-Encoding"]="gzip",o=l),u.label=2;case 2:return a=s(s({},this.customHeaders),a),c="string"==typeof o?o.length:o.byteLength,d={headers:a,body:o,method:"POST",keepalive:this.enableKeepalive&&c<=16384},this.referrerPolicy&&(d.referrerPolicy=this.referrerPolicy),[4,fetch(e,d)];case 3:return[4,(h=u.sent()).text()];case 4:p=u.sent();try{return[2,this.buildResponse(JSON.parse(p))]}catch(e){return[2,this.buildResponse({code:h.status})]}return[2]}})})},t}(dt),cn=function(e){function t(){return e.call(this)||this}return n(t,e),t.prototype.send=function(e,t,r){return l(this,void 0,void 0,function(){var r=this;return u(this,function(n){return[2,new Promise(function(n,i){var o=z();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return n(o.navigator.sendBeacon(e,s)?r.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):r.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(dt),dn=function(e,t,r){return void 0===r&&(r=!0),l(void 0,void 0,void 0,function(){var n,i,o,s,a,l,c,h,p;return u(this,function(u){switch(u.label){case 0:return n=function(e){return"".concat(f.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(n)];case 1:return(i=u.sent())?r?[4,t.remove(n)]:[3,3]:[2,{optOut:!1}];case 2:u.sent(),u.label=3;case 3:return o=d(i.split("."),6),s=o[0],a=o[1],l=o[2],c=o[3],h=o[4],p=o[5],[2,{deviceId:s,userId:pn(a),sessionId:hn(c),lastEventId:hn(p),lastEventTime:hn(h),optOut:Boolean(l)}]}})})},hn=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},pn=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},fn="[Amplitude]",gn="".concat(fn," Form Started"),vn="".concat(fn," Form Submitted"),mn="".concat(fn," File Downloaded"),yn="session_start",bn="session_end",wn="".concat(fn," File Extension"),Sn="".concat(fn," File Name"),kn="".concat(fn," Link ID"),xn="".concat(fn," Link Text"),Cn="".concat(fn," Link URL"),En="".concat(fn," Form ID"),In="".concat(fn," Form Name"),On="".concat(fn," Form Destination"),Pn="cookie",Tn="US",Rn=Object.freeze({__proto__:null,get IdentifyOperation(){return i},get SpecialEventType(){return o},get RevenueProperty(){return Y},get LogLevel(){return oe},get ServerZone(){return Et},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:Ot,DEFAULT_DATA_ATTRIBUTE_PREFIX:Pt,DEFAULT_ACTION_CLICK_ALLOWLIST:Tt,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Fr}),Mn=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},An=function(e,t,r,n,i,o){void 0===i&&(i=!0),e.referrer;var l=e.referring_domain,u=a(e,["referrer","referring_domain"]),c=t||{};c.referrer;var d,h=c.referring_domain,p=a(c,["referrer","referring_domain"]),f=r.excludeInternalReferrers;if(f){var g=Nn(f,n);if(!(g instanceof TypeError)&&e.referring_domain&&Un(e.referring_domain,o)){if("always"===g)return Dn(g,e.referring_domain,n),!1;if("ifEmptyCampaign"===g&&(d=s(s({},e),{referring_domain:void 0,referrer:void 0}),Object.values(d).every(function(e){return!e})))return Dn(g,e.referring_domain,n),!1}}if(_n(r.excludeReferrers,e.referring_domain))return n.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&function(e){return Object.values(e).every(function(e){return!e})}(e)&&t)return n.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var v=JSON.stringify(u)!==JSON.stringify(p),m=Mn(l||"")!==Mn(h||""),y=!t||v||m;return y?n.debug("This is a new campaign. An $identify event will be sent."):n.debug("This is not a new campaign because it's the same as the previous one."),y},_n=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})},Nn=function(e,t){if(!0===e)return Fr.always;if("object"==typeof e){var r=e.condition;if("string"==typeof r&&Object.keys(Fr).includes(r))return r;if(void 0===r)return Fr.always}var n="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(n),new TypeError(n)};function Dn(e,t,r){var n="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?r.debug(n):"ifEmptyCampaign"===e&&r.debug("".concat(n," with empty campaign parameters"))}var Ln=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","cloudfront.net","myshopify.com","blogspot.com","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","netlify.app","workers.dev"],Fn=function(e){var t,r,n=e||(null===(r=null===(t=z())||void 0===t?void 0:t.location)||void 0===r?void 0:r.hostname);if(!n)return"";var i=n.split("."),o=i[i.length-1],s=i[i.length-2];return Ln.find(function(e){return n.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],s=i[i.length-3]),s?"".concat(s,".").concat(o):o},Un=function(e,t){var r=z();if(!r)return!1;var n,i,o,s=(t||"").trim()||Fn(r.location.hostname);return n=e,o=(i=s).startsWith(".")?i:".".concat(i),!!(n.startsWith(".")?n:".".concat(n)).endsWith(o)},jn=function(e){function t(t,r,n,i,o,s,a,l,u,c,d,h,p,f,g,v,m,y,b,w,S,k,x,C,E,I,O,P,T,R,M,A,_,N,D,L,F,U,j,B,q,z,W,V,$){void 0===n&&(n=new He),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===l&&(l=1e3),void 0===u&&(u=5),void 0===c&&(c=30),void 0===d&&(d=Pn),void 0===v&&(v=new ae),void 0===m&&(m=oe.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===x&&(x=""),void 0===C&&(C=Tn),void 0===O&&(O=18e5),void 0===P&&(P=new sn({loggerProvider:v})),void 0===T&&(T={ipAddress:!0,language:!0,platform:!0}),void 0===R&&(R="fetch"),void 0===M&&(M=!1),void 0===A&&(A=!0),void 0===U&&(U=!0),void 0===j&&(j=0),void 0===W&&(W=!1);var H,K=this;(K=e.call(this,{apiKey:t,instanceName:p,storageProvider:P,transportProvider:zn(R)})||this).apiKey=t,K.appVersion=r,K.cookieOptions=i,K.defaultTracking=o,K.autocapture=s,K.flushIntervalMillis=l,K.flushMaxRetries=u,K.flushQueueSize=c,K.identityStorage=d,K.ingestionMetadata=h,K.loggerProvider=v,K.logLevel=m,K.minIdLength=y,K.offline=b,K.partnerId=S,K.plan=k,K.serverUrl=x,K.serverZone=C,K.sessionTimeout=O,K.storageProvider=P,K.trackingOptions=T,K.transport=R,K.useBatch=M,K.fetchRemoteConfig=A,K.networkTrackingOptions=L,K.identify=F,K.enableDiagnostics=U,K.diagnosticsSampleRate=j,K.diagnosticsClient=B,K.remoteConfig=q,K.topLevelDomain=z,K.enableRequestBodyCompression=W,K.customEnrichment=V,K.delayedEventsServerUrl=$,K.version=tn,K._optOut=!1,K._cookieStorage=n,K.deviceId=a,K.lastEventId=f,K.lastEventTime=g,K.optOut=w,K.deferredSessionId=I,K.sessionId=E,K.pageCounter=N,K.userId=_,K.debugLogsEnabled=D,K.loggerProvider.enable(D?oe.Debug:K.logLevel),K.networkTrackingOptions=L,K.identify=F,K.enableDiagnostics=U,K.diagnosticsSampleRate=j,K.diagnosticsClient=B;var G=null!==(H=null==q?void 0:q.fetchRemoteConfig)&&void 0!==H?H:A;return K.remoteConfig=K.remoteConfig||{},K.remoteConfig.fetchRemoteConfig=G,K.fetchRemoteConfig=G,K.topLevelDomain=z||Fn(),K.delayedEventsServerUrl=function(e,t,r){return void 0===r&&(r=Tn),t||(e?"".concat(e,"/delayed"):"EU"===r?"https://delayed-events.prod.eu-central-1.amplitude.com/2/httpapi/delayed":"https://delayed-events.prod.us-west-2.amplitude.com/2/httpapi/delayed")}(x,$,C),K}return n(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,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof Ke&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Fe(this.apiKey),e)},t}(ce),Bn=function(e,t,r,n,i){return void 0===t&&(t={}),l(void 0,void 0,void 0,function(){var o,a,l,c,d,h,p,f,g,v,m,y,b,w,S,k,x,C,E,I,O,P,T,R,M,A,_,N,D,L,F,U,j,B,q,z,W,$,H,K,G,J,X,Y,Q,Z,ee,te,re,ne,ie;return u(this,function(u){switch(u.label){case 0:return o=t.identityStorage||Pn,a="",o!==Pn||(null===(P=t.cookieOptions)||void 0===P?void 0:P.domain)||""===(null===(T=t.cookieOptions)||void 0===T?void 0:T.domain)?[3,2]:[4,Wn(void 0,n)];case 1:a=u.sent(),u.label=2;case 2:return l=s({domain:null!==(M=null===(R=t.cookieOptions)||void 0===R?void 0:R.domain)&&void 0!==M?M:a,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},t.cookieOptions),c={duplicateResolverFn:function(e){var t=Ge(e);if(!t)return!1;var r=JSON.parse(t);return Je(r.cookieDomain,l.domain)},diagnosticsClient:n},d=qn(t.identityStorage,l,c),[4,dn(e,d,null===(_=null===(A=t.cookieOptions)||void 0===A?void 0:A.upgrade)||void 0===_||_)];case 3:return h=u.sent(),[4,d.get(Fe(e))];case 4:return p=u.sent(),f=je(),g=f.ampTimestamp?Number(f.ampTimestamp):void 0,v=!g||Date.now()<g,m=null!==(U=null!==(F=null!==(L=null!==(N=t.deviceId)&&void 0!==N?N:v?null!==(D=f.ampDeviceId)&&void 0!==D?D:f.deviceId:void 0)&&void 0!==L?L:null==p?void 0:p.deviceId)&&void 0!==F?F:h.deviceId)&&void 0!==U?U:V(),y=null!==(j=null==p?void 0:p.lastEventId)&&void 0!==j?j:h.lastEventId,b=null!==(B=null==p?void 0:p.lastEventTime)&&void 0!==B?B:h.lastEventTime,w=null!==(z=null!==(q=t.optOut)&&void 0!==q?q:null==p?void 0:p.optOut)&&void 0!==z?z:h.optOut,S=null!==(W=null==p?void 0:p.sessionId)&&void 0!==W?W:h.sessionId,k=null==p?void 0:p.deferredSessionId,x=null!==(H=null!==($=t.userId)&&void 0!==$?$:null==p?void 0:p.userId)&&void 0!==H?H:h.userId,r.previousSessionDeviceId=null!==(K=null==p?void 0:p.deviceId)&&void 0!==K?K:h.deviceId,r.previousSessionUserId=null!==(G=null==p?void 0:p.userId)&&void 0!==G?G:h.userId,C={ipAddress:null===(X=null===(J=t.trackingOptions)||void 0===J?void 0:J.ipAddress)||void 0===X||X,language:null===(Q=null===(Y=t.trackingOptions)||void 0===Y?void 0:Y.language)||void 0===Q||Q,platform:null===(ee=null===(Z=t.trackingOptions)||void 0===Z?void 0:Z.platform)||void 0===ee||ee},E=null==p?void 0:p.pageCounter,I=null==p?void 0:p.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(O=new jn(e,t.appVersion,d,l,t.defaultTracking,t.autocapture,m,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,o,t.ingestionMetadata,t.instanceName,y,b,null!==(te=null==i?void 0:i.loggerProvider)&&void 0!==te?te:t.loggerProvider,t.logLevel,t.minIdLength,t.offline,w,t.partnerId,t.plan,t.serverUrl,null!==(re=null==i?void 0:i.serverZone)&&void 0!==re?re:t.serverZone,S,k,t.sessionTimeout,t.storageProvider,C,t.transport,t.useBatch,t.fetchRemoteConfig,x,E,I,t.networkTrackingOptions,t.identify,null!==(ne=null==i?void 0:i.enableDiagnostics)&&void 0!==ne?ne:t.enableDiagnostics,null!==(ie=null==i?void 0:i.diagnosticsSampleRate)&&void 0!==ie?ie:r._diagnosticsSampleRate,n,t.remoteConfig,a,t.enableRequestBodyCompression,t.customEnrichment,t.delayedEventsServerUrl)).storageProvider.isEnabled()];case 5:return u.sent()||(O.loggerProvider.warn("Storage provider ".concat(O.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),O.storageProvider=new He),[2,O]}})})},qn=function(e,t,r){switch(void 0===e&&(e=Pn),void 0===t&&(t={}),e){case"localStorage":return new sn;case"sessionStorage":return new an;case"none":return new He;default:return new Ke(s(s({},t),{expirationDays:t.expiration}),r)}},zn=function(e){var t="object"==typeof e?e.type:e,r="object"==typeof e?e.headers:void 0,n="object"==typeof e?e.enableKeepalive:void 0,i="object"==typeof e?e.referrerPolicy:void 0;return"xhr"===t?new ln(r):"beacon"===t?new cn:new un(r,n,i)},Wn=function(e,t){return l(void 0,void 0,void 0,function(){var r,n,i,o,s,a,l;return u(this,function(u){switch(u.label){case 0:return[4,new Ke(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!u.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];if(r=null!=e?e:location.hostname,1===(n=r.split(".")).length)return[2,""];for(i=[],o=1,Ln.find(function(e){return r.endsWith(".".concat(e))})&&(o=2),s=n.length-o-1;s>=0;--s)i.push(n.slice(s).join("."));s=0,u.label=2;case 2:if(!(s<i.length))return[3,7];a=i[s],u.label=3;case 3:return u.trys.push([3,5,,6]),[4,Ke.isDomainWritable(a)];case 4:return u.sent()?[2,"."+a]:[3,6];case 5:return l=u.sent(),t&&t.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(a),error:l instanceof Error?l.message:String(l)}),[3,6];case 6:return s++,[3,2];case 7:return t&&t.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(r)}),[2,""]}})})},Vn="AMP_PAGE_VIEW",$n=function(e){var t;void 0===e&&(e={});var r,n,i=z(),o=void 0,a=!1,c=e.trackOn,h=e.trackHistoryChanges,p=e.eventType,f=void 0===p?"[Amplitude] Page Viewed":p,g=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==o||o.error("Malformed URI sequence: ",e)}return t},v=function(e){return l(void 0,void 0,void 0,function(){var t,r,n;return u(this,function(i){switch(i.label){case 0:return t=g("undefined"!=typeof location&&location.href||""),n={event_type:f},r=[{}],[4,Hn()];case 1:return[2,(n.event_properties=s.apply(void 0,[s.apply(void 0,r.concat([i.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":t,"[Amplitude] Page Path":"undefined"!=typeof location&&g(location.pathname)||"","[Amplitude] Page Title":ar(sr),"[Amplitude] Page URL":t.split("?")[0],"[Amplitude] Page View ID":e}]),n)]}})})},m=function(){return void 0===c||"function"==typeof c&&c()},y="undefined"!=typeof location?location.href:null,b=function(){l(void 0,void 0,void 0,function(){var e,r,i,s,a;return u(this,function(l){switch(l.label){case 0:return e=location.href,r=Gn(h,e,y||"")&&m(),y=e,r?(i=void 0,n&&(i=V(),n.set(Vn,{pageViewId:i})),null==o||o.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return a=(s=t).track,[4,v(i)];case 2:a.apply(s,[l.sent()]),l.label=3;case 3:l.label=4;case 4:return[2]}})})},w={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return l(void 0,void 0,void 0,function(){var l,c,h;return u(this,function(u){switch(u.label){case 0:if(t=s,r=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),a=!0,i){try{n=new Ye(i.sessionStorage)}catch(e){null==o||o.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",b),i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,r){var n=d(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),a&&b()}})}return m()?(o.log("Tracking page view event"),l=void 0,n&&(l=V(),n.set(Vn,{pageViewId:l})),h=(c=t).track,[4,v(l)]):[3,2];case 1:h.apply(c,[u.sent()]),u.label=2;case 2:return[2]}})})},execute:function(e){return l(void 0,void 0,void 0,function(){var t,i,a;return u(this,function(l){switch(l.label){case 0:return"attribution"===c&&Kn(e)?(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,n?[4,n.get(Vn)]:[3,2]):[3,4];case 1:i=l.sent(),t=null==i?void 0:i.pageViewId,l.label=2;case 2:return[4,v(t)];case 3:a=l.sent(),e.event_type=a.event_type,e.event_properties=s(s({},e.event_properties),a.event_properties),l.label=4;case 4:return r&&e.event_type===f&&(r.pageCounter=r.pageCounter?r.pageCounter+1:1,e.event_properties=s(s({},e.event_properties),{"[Amplitude] Page Counter":r.pageCounter})),[2,e]}})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(e){return i&&(i.removeEventListener("popstate",b),a=!1),[2]})})}};return w},Hn=function(){return l(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return e=$e,[4,(new er).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},Kn=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,r=t[i.SET]||{},n=t[i.UNSET]||{},o=h(h([],d(Object.keys(r)),!1),d(Object.keys(n)),!1);return Object.keys(A).every(function(e){return o.includes(e)})}return!1},Gn=function(e,t,r){if("pathOnly"===e){if(""==r)return!0;var n=new URL(t),i=new URL(r);return n.origin+n.pathname!==i.origin+i.pathname}return t!==r},Jn=function(){var e,t,r=[],n=function(e,t,n){e.addEventListener(t,n),r.push({element:e,type:t,handler:n})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(r,i){return l(void 0,void 0,void 0,function(){var o,s;return u(this,function(a){return t=function(e){if(zr(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions}(r),o=function(){if(i){if("undefined"!=typeof document){var o=new WeakSet,s=function(e){if(!o.has(e)){o.add(e);var s=!1;n(e,"change",function(){var t,r=Yn(e);s||i.track(gn,((t={})[En]=Xn(e.id),t[In]=Xn(e.name),t[On]=r,t)),s=!0}),n(e,"submit",function(n){var o,a,l=Yn(e);if(s||i.track(gn,((o={})[En]=Xn(e.id),o[In]=Xn(e.name),o[On]=l,o)),s=!0,void 0!==(null==t?void 0:t.shouldTrackSubmit))if("function"==typeof t.shouldTrackSubmit&&"undefined"!=typeof SubmitEvent&&n instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(n))return}catch(e){r.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else r.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(vn,((a={})[En]=Xn(e.id),a[In]=Xn(e.name),a[On]=l,a)),s=!1})}};Array.from(document.getElementsByTagName("form")).forEach(s),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("FORM"===e.nodeName&&s(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("form");null==t||t.forEach(s)}}catch(e){r.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(e)))}})})}),e.observe(document.body,{subtree:!0,childList:!0}))}}else r.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")},"complete"===document.readyState?o():(s=z())?s.addEventListener("load",o):r.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(t){return null==e||e.disconnect(),r.forEach(function(e){var t=e.element,r=e.type,n=e.handler;null==t||t.removeEventListener(r,n)}),r=[],[2]})})}}},Xn=function(e){if("string"==typeof e)return e},Yn=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},Qn=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(r,n){return l(void 0,void 0,void 0,function(){var i,o;return u(this,function(s){return i=function(){if(n){if("undefined"!=typeof document){var i=function(e){var r;try{r=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(r.href),s=null==i?void 0:i[1];s&&function(e,r,n){e.addEventListener(r,n),t.push({element:e,type:r,handler:n})}(e,"click",function(){var t;s&&n.track(mn,((t={})[wn]=s,t[Sn]=r.pathname,t[kn]=e.id,t[xn]=e.text,t[Cn]=e.href,t))})},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){try{if("A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("a");null==t||t.forEach(i)}}catch(e){r.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(e)))}})})}),e.observe(document.body,{subtree:!0,childList:!0}))}}else r.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")},"complete"===document.readyState?i():(o=z())?o.addEventListener("load",i):r.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(r){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,r=e.type,n=e.handler;null==t||t.removeEventListener(r,n)}),t=[],[2]})})}}},Zn=!1,ei=function(){var e=z(),t=[],r=function(r,n){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(r,n),t.push({type:r,handler:n}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return l(void 0,void 0,void 0,function(){return u(this,function(n){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,r("online",function(){!1!==e.offline&&(e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),r("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2])})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(r){return t.forEach(function(t){var r=t.type,n=t.handler;null==e||e.removeEventListener(r,n)}),t=[],[2]})})}}};function ti(e,t){var r,n;if(e){jr(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",Z(e));var i=e;if(i&&"autocapture"in i){if("boolean"==typeof i.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture&&null!==i.autocapture){var o=s({},i.autocapture);if(void 0===t.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture.elementInteractions&&null!==i.autocapture.elementInteractions&&(null===(r=i.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===r?void 0:r.length)){o.elementInteractions=s({},i.autocapture.elementInteractions);var a=o.elementInteractions,l=null!==(n=a.pageUrlAllowlist)&&void 0!==n?n:[],u=i.autocapture.elementInteractions.pageUrlAllowlistRegex;a.pageUrlAllowlist=Ur(l,u,t.loggerProvider),delete a.pageUrlAllowlistRegex}var d=function(e,t){var r,n,i,o,a;if("object"==typeof e&&null!==e&&(null===(i=e.captureRules)||void 0===i?void 0:i.length)){var l=s({},e),u=null!==(o=l.captureRules)&&void 0!==o?o:[];try{for(var d=c(u),h=d.next();!h.done;h=d.next()){var p=h.value;p.urls=Ur(null!==(a=p.urls)&&void 0!==a?a:[],p.urlsRegex,t),delete p.urlsRegex}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return l}}(i.autocapture.networkTracking,t.loggerProvider);d&&(o.networkTracking=d),"boolean"==typeof t.autocapture&&(t.autocapture=s({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},o)),"object"==typeof t.autocapture&&(t.autocapture=s(s({},t.autocapture),o))}t.defaultTracking=t.autocapture}"customEnrichment"in i&&null!==i.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=i.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",Z(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}var ri="1.29.3-video-analytics-5.0",ni="[Amplitude] Element Clicked",ii="[Amplitude] Element Tag",oi="[Amplitude] Element Text",si="[Amplitude] Page URL",ai="[Amplitude] Viewport Height",li="[Amplitude] Viewport Width",ui="[Amplitude] Page View ID",ci="data-amp-mask-attributes",di="data-amp-internal-shadow";function hi(e,t){var r=e.getAttribute(t.explicitTrackingAttribute);if(null!==r&&""===r)return null;var n=e.getAttribute("id");return null===n||""===n?null:function(e,t){var r,n;if(null==e||""===e)return!1;try{for(var i=c(t),o=i.next();!o.done;o=i.next())if(o.value.test(e))return!1}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0}(n,t.autogeneratedIdPatterns)?n:null}function pi(e,t){return t.map(fi).join(" > ")}function fi(e){var t=e.tagName.toLowerCase(),r=e.parentElement;if(null===r)return t;var n=function(e,t){for(var r=0,n=0;n<t.children.length;n++){var i=t.children[n];if(i.tagName===e.tagName&&(r+=1,i===e))return r}return 1}(e,r);return"".concat(t,":nth-of-type(").concat(n,")")}var gi=":scope > ";function vi(e){return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot}function mi(e){var t,r=e.getRootNode();return vi(r)?r:null!==(t=e.ownerDocument)&&void 0!==t?t:document}function yi(e,t){var r,n,i,o;return u(this,function(s){switch(s.label){case 0:r=e,n=0,i=0,s.label=1;case 1:return null!==r&&i<1024?(i+=1,[4,r]):[3,3];case 2:return s.sent(),r.parentElement?(r=r.parentElement,[3,1]):n<t&&"function"==typeof r.getRootNode&&(o=function(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return vi(t)?t.host:null}(r),o&&o!==r)?(n+=1,r=o,[3,1]):[3,3];case 3:return[2]}})}function bi(e,t){var r=[];if(t<=0)return r;for(var n=[[e,0]],i=0;n.length&&i<5e4;){i+=1;var o=d(n.pop(),2),s=o[0],a=o[1],l=s.shadowRoot;if(l&&a+1<=t){r.push({root:l,depth:a+1});for(var u=l.children,c=0;c<u.length;c++)n.push([u[c],a+1])}var h=s.children;for(c=0;c<h.length;c++)n.push([h[c],a])}return r}function wi(e,t){for(var r=[],n=e,i=0;null!==n&&i<1024;){i+=1;var o=mi(n);r.push({root:o,target:n});var s=n.getRootNode();if(!vi(s))break;n=s.host}var a=r.length-1,l=!1,u=r;return a>t&&(u=r.slice(a-t),l=!0),{segments:u.reverse(),truncated:l}}function Si(e,t){var r=e.tagName.toLowerCase(),n=e.parentElement;if(null===n){var i=e.getRootNode();return t&&vi(i)?"".concat(r,":nth-of-type(").concat(ki(e,i.children),")"):r}return"".concat(r,":nth-of-type(").concat(ki(e,n.children),")")}function ki(e,t){for(var r=0,n=0;n<t.length;n++){var i=t[n];if(i.tagName===e.tagName&&(r+=1,i===e))return r}return 1}var xi={name:"explicitTrackingAttribute",try:function(e,t){var r=t.config.explicitTrackingAttribute,n=e.getAttribute(r);return null===n||""===n?null:"[".concat(r,"=").concat(JSON.stringify(n),"]")}};function Ci(e){var t=globalThis.CSS;if(t&&"function"==typeof t.escape)return t.escape(e);for(var r=String(e),n=r.length,i="",o=0;o<n;o++){var s=r.charCodeAt(o);0!==s?s>=1&&s<=31||127===s||0===o&&s>=48&&s<=57||1===o&&s>=48&&s<=57&&45===r.charCodeAt(0)?i+="\\".concat(s.toString(16)," "):i+=0!==o||1!==n||45!==s?s>=128||45===s||95===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?r.charAt(o):"\\".concat(r.charAt(o)):"\\-":i+="�"}return i}function Ei(e){return Ci(e)}var Ii={name:"stableId",try:function(e,t){var r=hi(e,t.config);return null===r?null:"".concat(e.tagName.toLowerCase(),"#").concat(Ei(r))}},Oi=!1,Pi=Object.freeze({enabled:!1,explicitTrackingAttribute:"data-amp-track-id",autogeneratedIdPatterns:h([],d([/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/]),!1),unstableClassPatterns:h([],d([/^(p|m|px|py|mx|my|pt|pb|pl|pr|mt|mb|ml|mr)-\d+$/,/^(w|h|min-w|max-w|min-h|max-h)-/,/^(text|bg|border|ring|fill|stroke)-/,/^(hover|focus|active|disabled|group-hover):/,/^(sm|md|lg|xl|2xl):/,/^z-\d+$/,/^data-\[/,/^\[/,/^css-[a-z0-9]{6,}$/,/^[a-zA-Z]+_[a-zA-Z0-9]{3,}__[a-zA-Z0-9]{5,}$/,/^sc-[a-zA-Z0-9]{6,}$/,/^jsx-\d+$/,/^swiper-slide-(visible|fully-visible|active|prev|next|duplicate)$/,/^is-(active|open|selected|hovered|focused|expanded)$/,/^Mui[A-Z][a-zA-Z]+-(focused|selected|disabled|expanded|focusVisible|active|checked)$/,/^Mui-(selected|focused|disabled|expanded|focusVisible|active|checked)$/,/^data-state-/]),!1),maxAncestorWalkDepth:void 0,shadowDomEnabled:Oi,maxShadowDomDepth:1});function Ti(e){var t;return s(s({},e),{shadowDomEnabled:null!==(t=e.shadowDomEnabled)&&void 0!==t?t:Oi,maxShadowDomDepth:Mi(e.maxShadowDomDepth)})}function Ri(e,t){if(!e)return Ai();var r,n=Ai();return"boolean"==typeof e.enabled&&(n.enabled=e.enabled),"string"==typeof e.explicitTrackingAttribute&&""!==e.explicitTrackingAttribute&&(n.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(n.autogeneratedIdPatterns=function(e,t){var r,n,i=[];try{for(var o=c(e),s=o.next();!s.done;s=o.next()){var a=s.value;try{i.push(new RegExp(a))}catch(e){var l=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid autogenerated-id pattern "'.concat(a,'" (').concat(l,")"))}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(n.unstableClassPatterns=function(e,t){var r,n,i=[];try{for(var o=c(e),s=o.next();!s.done;s=o.next()){var a=s.value;try{i.push(new RegExp(a))}catch(e){var l=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid unstable-class pattern "'.concat(a,'" (').concat(l,")"))}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}(e.unstableClassPatterns,t)),n.maxAncestorWalkDepth="number"!=typeof(r=e.maxAncestorWalkDepth)?void 0:Number.isFinite(r)?r<=0?void 0:Math.floor(r):void 0,"boolean"==typeof e.shadowDomEnabled&&(n.shadowDomEnabled=e.shadowDomEnabled),n.maxShadowDomDepth=Mi(e.maxShadowDomDepth),Ti(n)}function Mi(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}function Ai(){return{enabled:Pi.enabled,explicitTrackingAttribute:Pi.explicitTrackingAttribute,autogeneratedIdPatterns:h([],d(Pi.autogeneratedIdPatterns),!1),unstableClassPatterns:h([],d(Pi.unstableClassPatterns),!1),maxAncestorWalkDepth:Pi.maxAncestorWalkDepth,shadowDomEnabled:Pi.shadowDomEnabled,maxShadowDomDepth:Pi.maxShadowDomDepth}}var _i=[xi,Ii];function Ni(e,t,r){var n,i,o,s,a;void 0===r&&(r={});var l=Ti(t),u=null!==(o=r.strategies)&&void 0!==o?o:_i,d=null!==(a=null!==(s=r.scope)&&void 0!==s?s:e.ownerDocument)&&void 0!==a?a:document,h={scope:d,config:l},p=function(e,t){var r=[],n=e;for(;null!==n&&(r.push(n),!(void 0!==t&&r.length>t));)n=n.parentElement;return r}(e,l.maxAncestorWalkDepth);try{for(var f=c(u),g=f.next();!g.done;g=f.next())for(var v=g.value,m=0;m<p.length;m++){var y=p[m],b=v.try(y,h);if(null!==b)if(0!==m){var w=pi(0,p.slice(0,m).reverse()),S="".concat(b," > ").concat(w);if(Di(d,S,e,v.name,r.logger))return S}else if(Di(d,b,e,v.name,r.logger))return b}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}return null}function Di(e,t,r,n,i){var o;try{o=e.querySelectorAll(t)}catch(e){var s=e instanceof Error?e.message:String(e);return null==i||i.debug('@amplitude/element-selector: strategy "'.concat(n,'" emitted a malformed selector "').concat(t,'" (').concat(s,")")),!1}return 1===o.length&&o[0]===r}function Li(e,t,r){var n;try{n=e.querySelectorAll(t)}catch(e){return!1}return 1===n.length&&n[0]===r}var Fi=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),Ui=function(e,t,r){var n,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute("id");if(t){if(o)return new Fi(Bi(o),!0);var s=e.tagName.toLowerCase();if("body"===s||"head"===s||"html"===s)return new Fi(s,!0)}var a=e.tagName.toLowerCase();if(o)return new Fi(a+Bi(o),!0);var l=e.parentNode;if(!l||l.nodeType===Node.DOCUMENT_NODE)return new Fi(a,!0);for(var u=ji(e),d=!1,h=!1,p=-1,f=-1,g=l.children,v=0;g&&(-1===p||!h)&&v<g.length;++v){var m=g[v];if(m.nodeType===Node.ELEMENT_NODE)if(f+=1,m!==e){if(!h&&m.tagName.toLowerCase()===a){d=!0;var y=new Set(u);if(y.size)for(var b=ji(m),w=0;w<b.length;++w){var S=b[w];if(y.has(S)&&(y.delete(S),!y.size)){h=!0;break}}else h=!0}}else p=f}var k=a;if(r&&"input"===a.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(k+="[type="+Ci(e.getAttribute("type")||"")+"]"),h)k+=":nth-child("+String(p+1)+")";else if(d)try{for(var x=c(u),C=x.next();!C.done;C=x.next()){k+="."+Ci(C.value.slice(1))}}catch(e){n={error:e}}finally{try{C&&!C.done&&(i=x.return)&&i.call(x)}finally{if(n)throw n.error}}return new Fi(k,!1)},ji=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},Bi=function(e){return"#"+Ci(e)};function qi(e,t){try{return function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var r=[],n=e;n;){var i=Ui(n,Boolean(t),n===e);if(!i)break;if(r.push(i),i.optimized)break;n=n.parentElement}return r.reverse(),r.join(" > ")}(e)}catch(e){var r=e instanceof Error?e.message:String(e);return null==t||t.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(r)),""}}function zi(e,t){void 0===t&&(t={});var r=Ti(e),n=new Set,i=t.logger,o=function(e){return qi(e,i)},s=function(e,n){var o;return null!==(o=Ni(e,r,{strategies:t.strategies,scope:n,logger:i}))&&void 0!==o?o:function(e,t,r){var n,i;void 0===r&&(r={});for(var o=Ti(t),s=null!==(i=null!==(n=r.scope)&&void 0!==n?n:e.ownerDocument)&&void 0!==i?i:document,a=vi(s),l=[],u=e,c=0,p=!(o.shadowDomEnabled&&a);null!==u&&!(p&&void 0!==o.maxAncestorWalkDepth&&c>o.maxAncestorWalkDepth);){var f=hi(u,o);if(null!==f){var g=h(["".concat(u.tagName.toLowerCase(),"#").concat(Ei(f))],d(l),!1).join(" > ");if(Li(s,g,e))return g}l.unshift(Si(u,o.shadowDomEnabled)),u=u.parentElement,c+=1}var v=l.join(" > ");return o.shadowDomEnabled&&a&&null===u?"".concat(gi).concat(v):v}(e,r,{scope:n})},a=function(e,t){return function(e,t,r){return e&&r&&vi(t)?"".concat(gi).concat(e):e}(o(e),t,function(e){for(var t=e;null!==t;t=t.parentElement)if(t.getAttribute("id"))return!1;return!0}(e))};return{generate:function(e){var n,l;try{return r.shadowDomEnabled?function(e,t){var n=wi(e,r.maxShadowDomDepth),o=n.segments;return n.truncated&&(null==i||i.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(r.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host"))),o.map(function(e){var r=e.target,n=e.root;return t(r,n)}).join(" >>> ")}(e,r.enabled?s:a):(r.enabled?s:o)(e,null!==(l=null!==(n=t.scope)&&void 0!==n?n:e.ownerDocument)&&void 0!==l?l:document)}catch(t){var u=t instanceof Error?t.message:String(t);return null==i||i.warn("@amplitude/element-selector: selector generation threw — falling back to legacy cssPath: ".concat(u)),qi(e,i)}},getConfig:function(){return r},updateConfig:function(e){var t,o;r=Ti(e);try{for(var s=c(n),a=s.next();!a.done;a=s.next()){var l=a.value;try{l(r)}catch(e){var u=e instanceof Error?e.message:String(e);null==i||i.warn("@amplitude/element-selector: onConfigChange subscriber threw — ".concat(u))}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(t)throw t.error}}},onConfigChange:function(e){return n.add(e),function(){n.delete(e)}}}}var Wi,Vi,$i=Object.freeze({enabled:!1,maxDepth:0}),Hi=function(){var e=$i,t=new Set;return{get:function(){return e},arm:function(r){return e.enabled||!r.enabled||(e=r,function(e){var r,n;try{for(var i=c(h([],d(t),!1)),o=i.next();!o.done;o=i.next()){var s=o.value;try{s(e)}catch(e){}}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.clear()}(r)),e},onArm:function(r){if(e.enabled){var n=e;try{r(n)}catch(e){}return function(){}}return t.add(r),function(){t.delete(r)}}}},Ki=["input","select","textarea"],Gi=function(e){var t=e.pageUrlAllowlist,r=e.pageUrlExcludelist;return!(r&&r.length>0&&qe(window.location.href,r))&&!!qe(window.location.href,t)},Ji=function(e,t){return function(r,n){var i,o,s=e.shouldTrackEventResolver,a=null===(o=null===(i=null==n?void 0:n.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!a)return!1;if(s)return s(r,n);if(!Gi(e))return!1;var l=String(null==n?void 0:n.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}if(t){var u=t.some(function(e){var t;return!!(null===(t=null==n?void 0:n.matches)||void 0===t?void 0:t.call(n,e))});if(!u)return!1}switch(a){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return"click"===r}}},Xi=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},Yi=function(e){return Object.keys(e).reduce(function(t,r){var n=e[r];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(n)||(t[r]=n),t},{})},Qi=function(){var e;try{var t=z(),r=null===(e=null==t?void 0:t.sessionStorage)||void 0===e?void 0:e.getItem("AMP_PAGE_VIEW");if(!r)return;var n=JSON.parse(r);if("string"==typeof n.pageViewId)return n.pageViewId}catch(e){}},Zi=function(e,t,r){return void 0===r&&(r=$i),r.enabled?to(e,t,r.maxDepth):eo(e,t)},eo=function(e,t){return e?t.some(function(t){var r;return null===(r=null==e?void 0:e.matches)||void 0===r?void 0:r.call(e,t)})?e:eo(null==e?void 0:e.parentElement,t):null},to=function(e,t,r){var n,i;if(!e)return null;var o=function(e){if(t.some(function(t){var r;return null===(r=null==e?void 0:e.matches)||void 0===r?void 0:r.call(e,t)}))return{value:e}};try{for(var s=c(yi(e,r)),a=s.next();!a.done;a=s.next()){var l=o(a.value);if("object"==typeof l)return l.value}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return null},ro=function(e,t,r){return void 0===r&&(r=$i),r.enabled?io(e,t,r.maxDepth):no(e,t)},no=function(e,t){var r=[];return t?(e.querySelectorAll(t).forEach(function(e){return r.push(e)}),r):r},io=function(e,t,r){var n=no(e,t),i=e instanceof Document?e.documentElement:e;return i?(bi(i,r).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return n.push(e)})}),n):n},oo=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};function so(e){if(!e)return"";try{var t=new URL(e);return t.search="",ze(t.href)}catch(t){return ze(e)}}function ao(e){var t,r;return void 0===e&&(e=z()),so(null!==(r=null===(t=null==e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==r?r:"")}!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(Vi||(Vi={}));var lo="__AMPLITUDE_VISUAL_TAGGING__";var uo=z(),co=function(e){return e.get()},ho={childList:!0,attributes:!0,characterData:!0,subtree:!0},po=function(e){return new Cr(e?function(t){var r,n=new WeakSet,i=new WeakMap,o=function(e,t){n.has(e)||(n.add(e),vi(e)&&i.set(e,t),a.observe(e,ho))},s=function(e,t,r){var n=r-t;n<=0||bi(e,n).forEach(function(e){var r=e.root,n=e.depth;return o(r,t+n)})},a=new MutationObserver(function(r){var n,o;t.next(r);try{var a=co(e);if(!a.enabled)return;var l=function(e){var t=function(e){var t=e.getRootNode();if(!vi(t))return 0;var r=i.get(t);return null!=r?r:0}(e.target);e.addedNodes.forEach(function(e){e instanceof Element&&s(e,t,a.maxDepth)})};try{for(var u=c(r),d=u.next();!d.done;d=u.next()){l(d.value)}}catch(e){n={error:e}}finally{try{d&&!d.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}}catch(e){}});if(document.body){var l=document.body;o(l,0),r=e.onArm(function(e){s(l,0,e.maxDepth)})}return function(){null==r||r(),a.disconnect()}}:function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},fo=function(e){return void 0===e&&(e="click"),new Cr(function(t){var r,n=function(e){t.next(e)};return null===(r=z())||void 0===r||r.document.addEventListener(e,n,{capture:!0}),function(){var t;null===(t=z())||void 0===t||t.document.removeEventListener(e,n,{capture:!0})}})},go=function(){var e=Ir(new Cr(function(e){var t=function(t){if(t instanceof ErrorEvent){var r={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?r=s(s({},r),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(r.message=t.error),e.next(r)}};return uo.addEventListener("error",t),function(){uo.removeEventListener("error",t)}}),new Cr(function(e){var t=function(t){var r={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(r.message=t.reason.message,r.stack=t.reason.stack):"string"==typeof t.reason&&(r.message=t.reason),e.next(r)};return uo.addEventListener("unhandledrejection",t),function(){uo.removeEventListener("unhandledrejection",t)}}));return Ir(e,new Cr(function(e){var t=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=void 0;Array.isArray(r[0])&&"string"==typeof r[0][0]&&(i=r[0][0]),e.next({kind:"console",message:i})};return It.addListener("error",t),function(){It.removeListener(t)}}))},vo=function(e,t,r){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var n=r.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=n}})},mo={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},yo=function(e){var t,r,n,i,o=Object.values(mo).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var s=c(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{try{for(var u=(n=void 0,c(l.definition)),d=u.next();!d.done;d=u.next()){var h=d.value,p=mo[h.event_type];p&&o[p].add(l.id)}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==l?void 0:l.id,e)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o},bo=function(e){var t,r,n,i,o=new Map;try{for(var s=c(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{for(var u=(n=void 0,c(l.conditions)),d=u.next();!d.done;d=u.next()){var h=d.value;if("LABELED_EVENT"===h.type){var p=h.match.eventId,f=o.get(p);f||(f=[],o.set(p,f)),f.push(l)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o},wo=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return mo[t.event_type]===e.type&&t.filters.every(function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)})})})},So=function(){function e(e,t,r,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=r,this.options=n}return e.prototype.evaluate=function(e){var t,r,n=this.options.pageActions;if(!n)return e;var i=wo(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return n.labeledEvents[e]})),o=function(e,t){var r,n,i,o,s=new Set;try{for(var a=c(e),l=a.next();!l.done;l=a.next()){var u=l.value,d=t.get(u.id);if(d)try{for(var h=(i=void 0,c(d)),p=h.next();!p.done;p=h.next()){var f=p.value;s.add(f)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return Array.from(s)}(i,this.labeledEventToTriggerMap);try{for(var s=c(o),a=s.next();!a.done;a=s.next()){var l=a.value;vo(l.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=r},e}(),ko=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",ci,tr,di]),xo=["type"],Co=["svg","path","g"],Eo=["password","hidden"];function Io(e,t,r){var n,i,o,a,l;if(void 0===r&&(r=$i),null===e)return null;var u=String(e.tagName).toLowerCase(),d={tag:u},h=Array.from(function(e,t){if(e.parentElement)return e.parentElement.children;var r=e.getRootNode();return t&&vi(r)?r.children:[]}(e,r.enabled));h.length&&(d.index=h.indexOf(e),d.indexOfType=h.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var p=null===(l=null===(a=e.previousElementSibling)||void 0===a?void 0:a.tagName)||void 0===l?void 0:l.toLowerCase();p&&(d.prevSib=String(p));var f=e.getAttribute("id");f&&(d.id=String(f));var g=Array.from(e.classList);g.length&&(d.classes=g);var v={},m=Array.from(e.attributes).filter(function(e){return!ko.has(e.name)}),y=!function(e){var t,r,n,i=null===(r=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===r?void 0:r.call(t),o=e instanceof HTMLElement&&"true"===(null===(n=e.getAttribute("contenteditable"))||void 0===n?void 0:n.toLowerCase());return!Ki.includes(i)&&!o}(e);if(!Eo.includes(String(e.getAttribute("type")))&&!Co.includes(u))try{for(var b=c(m),w=b.next();!w.done;w=b.next()){var S=w.value;y&&!xo.includes(S.name)||(t.has(S.name)?v[S.name]=rr:v[S.name]=String(S.value).substring(0,128))}}catch(e){n={error:e}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(n)throw n.error}}return Object.keys(v).length&&(d.attrs=v),e.shadowRoot&&(d.attrs=s(s({},d.attrs||{}),((o={})[di]="true",o)),d.shadow=!0),d}function Oo(e,t){return void 0===t&&(t=$i),e?t.enabled?function(e,t){var r,n,i=[];try{for(var o=c(yi(e,t)),s=o.next();!s.done;s=o.next()){var a=s.value;if("HTML"===a.tagName)break;i.push(a)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}(e,t.maxDepth):function(e){var t=[];t.push(e);var r=e.parentElement;for(;r&&"HTML"!==r.tagName;)t.push(r),r=r.parentElement;return t}(e):[]}var Po;var To=function(e,t){var r,n,i,o=this;this.replaceSensitiveString=function(e){return sr(e,o.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,r,n,i,s,a=performance.now();if(!e)return[];for(var l=o.getShadowMode(),u=Oo(e,l),p=new Map,f=u.length-1;f>=0;f--){var g=u[f];if(g){var v=Xi(g.getAttribute(ci)),m=f===u.length-1?[]:null!==(n=p.get(u[f+1]))&&void 0!==n?n:new Set,y=new Set(h(h([],d(m),!1),d(v),!1));p.set(g,y)}}s=u.map(function(e){var t;return Io(e,null!==(t=p.get(e))&&void 0!==t?t:new Set,l)});var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var r=d(t,2),n=r[0],i=r[1];e.attrs&&(e.attrs[n]=o.replaceSensitiveString(i))})};try{for(var w=c(s),S=w.next();!S.done;S=w.next())b(S.value)}catch(e){t={error:e}}finally{try{S&&!S.done&&(r=w.return)&&r.call(w)}finally{if(t)throw t.error}}var k=performance.now();return null===(i=o.diagnosticsClient)||void 0===i||i.recordHistogram("autocapturePlugin.getHierarchy",k-a),s},this.getNearestLabel=function(e){var t,r=e.parentElement;if(!r)return"";try{t=r.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?o.getText(t):o.getNearestLabel(r)},this.getElementPath=function(e){var t;if(!e)return"";var r=performance.now(),n=o.selectorEngine.generate(e),i=performance.now();return null===(t=o.diagnosticsClient)||void 0===t||t.recordHistogram("autocapturePlugin.getElementPath",i-r),n},this.updateSelectorConfig=function(e,t){var r;if(null!=e){var n="boolean"==typeof e.enabled,i="boolean"==typeof e.shadowDomEnabled;if(n||i){var a=Ri(e,t),l=o.selectorEngine.getConfig().enabled,u=o.shadowGate.get().enabled,c=o.shadowGate.arm(function(e){var t,r=null!==(t=e.maxShadowDomDepth)&&void 0!==t?t:1;return!e.shadowDomEnabled||r<=0?$i:Object.freeze({enabled:!0,maxDepth:r})}(a));o.selectorEngine.updateConfig(s(s(s({},n?a:o.selectorEngine.getConfig()),{shadowDomEnabled:c.enabled}),c.enabled&&{maxShadowDomDepth:c.maxDepth})),n&&l!==a.enabled&&(null==t||t.debug(a.enabled?"@amplitude/element-selector: engine enabled — now emitting new element-selector element paths for autocapture events.":"@amplitude/element-selector: engine disabled — reverting to legacy cssPath for element paths.")),!u&&c.enabled&&(null===(r=o.diagnosticsClient)||void 0===r||r.setTag("plugin.autocapture.shadowDom","enabled:".concat(c.maxDepth)))}else null==t||t.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` or `shadowDomEnabled` flag — keeping current engine state.")}},this.getShadowMode=function(){return o.shadowGate.get()},this.getEventProperties=function(e,t,r){var n,i,s,a,l,u,c=null===(s=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===s?void 0:s.call(i),h="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},p=o.getHierarchy(t),f=null===(a=p[0])||void 0===a?void 0:a.attrs,g=o.getNearestLabel(t),v=(l=null!=f?f:{},u=r,Object.entries(l).reduce(function(e,t){var r=d(t,2),n=r[0],i=r[1];if(n.startsWith(u)){var o=n.replace(u,"");o&&(e[o]=i||"")}return e},{})),m=((n={})["[Amplitude] Element Hierarchy"]=p,n[ii]=c,n[oi]=o.getText(t),n["[Amplitude] Element Position Left"]=null==h.left?null:Math.round(h.left),n["[Amplitude] Element Position Top"]=null==h.top?null:Math.round(h.top),n["[Amplitude] Element Attributes"]=v,n["[Amplitude] Element Path"]=o.getElementPath(t),n["[Amplitude] Element Parent Label"]=g,n[si]=ze(window.location.href.split("?")[0]),n["[Amplitude] Page Title"]=ar(o.replaceSensitiveString),n[ai]=window.innerHeight,n[li]=window.innerWidth,n),y=Qi();if(y&&(m[ui]=y),m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null==f?void 0:f["aria-label"],"a"===c&&"click"===e&&t instanceof HTMLAnchorElement){var b=t.href.substring(0,128);m["[Amplitude] Element Href"]=o.replaceSensitiveString(b)}return Yi(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,r,n,i){void 0===i&&(i=!1);var s=o.addTypeAndTimestamp(e,t);try{if(function(e){return"click"===e.type||"change"===e.type}(s)&&null!==s.event.target){var a=o.getShadowMode(),l=function(e,t){var r,n;if(void 0===t&&(t=$i),!t.enabled)return e.target;var i=null===(r=e.composedPath)||void 0===r?void 0:r.call(e),o=null!==(n=e.target)&&void 0!==n?n:null;if(!i||0===i.length)return o;var s=i[0];if(!(s instanceof Element))return null!=s?s:o;var a=wi(s,t.maxDepth),l=a.segments;return a.truncated&&l.length>0?l[l.length-1].target:s}(s.event,a);if(i){var u=function(e,t){var r,n=null===(r=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===r?void 0:r.call(window,e);return"pointer"===(null==n?void 0:n.getPropertyValue("cursor"))&&"click"===t}(l,s.type);if(u)return s.closestTrackedAncestor=l,s.targetElementProperties=o.getEventProperties(s.type,s.closestTrackedAncestor,n),s}var c=Zi(l,r,a);c&&(s.closestTrackedAncestor=c,s.targetElementProperties=o.getEventProperties(s.type,c,n))}}catch(e){}return s},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var r=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var r=document.documentElement;return e.scope&&t&&(r=t.closest(e.scope)),r&&e.selector?r.querySelector(e.selector):r}}catch(e){return}}(e,t);if(!r)return;return"TEXT"===e.elementExtractType?o.getText(r):"ATTRIBUTE"===e.elementExtractType&&e.attribute?r.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,r,n="[".concat(tr,"], [contenteditable]");if(!e.querySelector(n))return e.innerText;var i="",s=Array.from(e.childNodes);try{for(var a=c(s),l=a.next();!l.done;l=a.next()){var u=l.value;u.nodeType!==Node.TEXT_NODE?u instanceof Element&&(u.hasAttribute(tr)||u.hasAttribute("contenteditable")?i+=rr:i+=o.getTextWithMaskedDescendants(u)):i+=u.textContent||""}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return i},this.hasMaskedAncestor=function(e){var t=o.getShadowMode();return t.enabled?function(e,t){var r,n;return!!Oo(e,t).some(function(e){return e.hasAttribute(tr)})||null!==(n=null===(r=document.documentElement)||void 0===r?void 0:r.hasAttribute(tr))&&void 0!==n&&n}(e,t):function(e){return null!==e.closest("[".concat(tr,"]"))}(e)},this.getText=function(e){if(o.hasMaskedAncestor(e))return rr;var t="";return t=e.querySelector("[".concat(tr,"], [contenteditable]"))?o.getTextWithMaskedDescendants(e):e.innerText||"",o.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,r,n;if(!e)return{};var i=null===(n=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===n?void 0:n.call(r),s=((t={})[ii]=i,t[oi]=o.getText(e),t[si]=window.location.href.split("?")[0],t);return Yi(s)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(Po||(Po=zi(Ri())),Po),this.shadowGate=(Wi||(Wi=Hi()),Wi);var a=null!==(i=e.maskTextRegex)&&void 0!==i?i:[],l=[];try{for(var u=c(a),p=u.next();!p.done;p=u.next()){var f=p.value;if(l.length>=25)break;if(f instanceof RegExp)l.push(f);else if("pattern"in f&&"string"==typeof f.pattern)try{l.push(new RegExp(f.pattern,"i"))}catch(e){}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}this.additionalMaskTextPatterns=l};function Ro(e,t){var r=e.remoteConfigClient;if(e.fetchRemoteConfig&&r){var n=r.subscribe("configs.analyticsSDK.browserSDK.autocapture.elementSelector","all",function(r,n){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(n),") ").concat(JSON.stringify(r))),t.updateSelectorConfig(r,e.loggerProvider)});return function(){r.unsubscribe(n)}}}var Mo,Ao=function(e,t){return("fixed"===t||"absolute"===t)&&e instanceof HTMLElement?e.offsetParent:function(e){var t;return e.assignedSlot||e.parentElement||(null===(t=e.parentNode)||void 0===t?void 0:t.host)||null}(e)};function _o(e){var t=e.allObservables,r=e.onExposure,n=e.dataExtractor,i=e.exposureDuration,o=void 0===i?150:i,s=new Map,a=new Map,l=new Set,u=function(e){var t=a.get(e);t&&(clearTimeout(t),a.set(e,null))},c=function(e){if(function(e){var t=z(),r=t.document.documentElement.clientHeight||t.innerHeight,n=t.document.documentElement.clientWidth||t.innerWidth,i=e.getBoundingClientRect(),o=i.top+.5*i.height,s=Math.max(i.left,0),a=Math.min(i.right,n);if(o<-1||o>r+1||s>=a||i.width<=0)return!1;for(var l=Ao(e,t.getComputedStyle(e).position);l;){var u=t.getComputedStyle(l),c=u.overflowY&&"visible"!==u.overflowY,d=u.overflowX&&"visible"!==u.overflowX;if(c||d){var h=l.getBoundingClientRect();if(c&&(o<h.top-1||o>h.bottom+1))return!1;if(d&&(s=Math.max(s,h.left))>=(a=Math.min(a,h.right)))return!1}l=Ao(l,u.position)}return!0}(e)){if(!s.get(e)&&!a.get(e)){var t=setTimeout(function(){s.set(e,!0);var t=n.getElementPath(e);r(t),a.set(e,null)},o);a.set(e,t)}}else u(e)},d=t.exposureObservable,h=t.scrollObservable,p=d.subscribe(function(e){var t=e,r=t.target;t.isIntersecting?(l.add(r),c(r)):(l.delete(r),u(r))}),f=h.subscribe(function(){l.forEach(c)}),g=function(){a.forEach(function(e){e&&clearTimeout(e)}),a.clear(),s.clear()};return{unsubscribe:function(){p.unsubscribe(),f.unsubscribe(),g(),l.clear()},reset:function(){g(),l.forEach(c)}}}function No(e){var t,r,n,i,o,s=e.mutationObservable,a=e.onRescan,l=e.onFlush,u=e.exposureDuration,c=e.quietMs,d=void 0===c?150:c,h=e.maxWaitMs,p=void 0===h?4e3:h,f=!1,g=function(){t&&(clearTimeout(t),t=void 0),r&&(clearTimeout(r),r=void 0),n&&(clearTimeout(n),n=void 0)},v=function(){o&&(document.removeEventListener("DOMContentLoaded",o),o=void 0)},m=function(){f||("undefined"!=typeof document&&"loading"!==document.readyState?(f=!0,g(),v(),a(),n=setTimeout(function(){n=void 0,l()},u+50)):o||(o=function(){o=void 0,y()},document.addEventListener("DOMContentLoaded",o)))},y=function(){f||(t&&clearTimeout(t),t=setTimeout(m,d))},b=function(){g(),v(),f=!1,y(),r=setTimeout(m,p)};return{start:function(){i||(i=s.subscribe(function(){y()}),b())},reset:function(){b()},stop:function(){null==i||i.unsubscribe(),i=void 0,g(),v()}}}!function(e){e.ClickObservable="clickObservable",e.PointerDownObservable="pointerDownObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}(Mo||(Mo={}));var Do=function(e,t){var r,n,i,o,a,p,f,g,v,m,y,b;void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",ri);var w=e.dataAttributePrefix,S=void 0===w?Pt:w,k=e.visualTaggingOptions,x=void 0===k?{enabled:!0}:k;e.cssSelectorAllowlist=null!==(r=e.cssSelectorAllowlist)&&void 0!==r?r:Ot,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:Tt,e.debounceTime=null!==(i=e.debounceTime)&&void 0!==i?i:0;var C=!1!==(null===(o=e.viewportContentUpdated)||void 0===o?void 0:o.enabled),E=null!==(f=null!==(p=null===(a=e.viewportContentUpdated)||void 0===a?void 0:a.exposureDuration)&&void 0!==p?p:e.exposureDuration)&&void 0!==f?f:150;e.viewportContentUpdated=s(s({},e.viewportContentUpdated),{exposureDuration:E}),e.pageUrlExcludelist=null===(g=e.pageUrlExcludelist)||void 0===g?void 0:g.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(r){return console.warn("Invalid regex pattern: ".concat(t.pattern),r),e}return e},[]);var I,O,P="@amplitude/plugin-autocapture-browser",T=[],R=new To(e,t),M=new Set,A=new Set,_=new Set,N=function(){var t,r,n=Or(fo().map(function(t){return R.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,S)})),i=Or(new Cr(function(t){var r,n=function(r){var n=R.addAdditionalEventProperties(r,"change",e.cssSelectorAllowlist,S);t.next(n)};return null===(r=z())||void 0===r||r.document.addEventListener("change",n,{capture:!0}),function(){var e;return null===(e=z())||void 0===e?void 0:e.document.removeEventListener("change",n)}}));window.navigation&&(r=Or(new Cr(function(t){var r=function(r){var n=R.addAdditionalEventProperties(r,"navigate",e.cssSelectorAllowlist,S);t.next(n)};return window.navigation.addEventListener("navigate",r),function(){window.navigation.removeEventListener("navigate",r)}})));var o=R.shadowGate,s=Or(po(o).map(function(t){return R.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,S)})),a=new Cr(function(e){var t,r,n=function(t){e.next(t)};return null===(t=z())||void 0===t||t.addEventListener("scroll",n,{capture:!0,passive:!0}),null===(r=z())||void 0===r||r.addEventListener("resize",n,{passive:!0}),function(){var e,t;null===(e=z())||void 0===e||e.removeEventListener("scroll",n,{capture:!0}),null===(t=z())||void 0===t||t.removeEventListener("resize",n)}}),l=function(e,t,r,n){var i="function"==typeof r?r:void 0,o="function"==typeof r?n:r;return new Cr(function(r){var n=z();if(!(null==n?void 0:n.IntersectionObserver))return function(){};var s=new IntersectionObserver(function(e){e.forEach(function(e){r.next(e)})},{root:null,rootMargin:"0px",threshold:0}),a=t.join(","),l=function(e){e instanceof Element&&e.matches(a)&&s.observe(e),e.querySelectorAll(a).forEach(function(e){s.observe(e)})},u=function(e){if(o)try{ro(e,a,co(o)).forEach(function(e){s.observe(e)})}catch(e){}},c=function(){var e=null==n?void 0:n.document;if(e){var t=[];try{t=o&&co(o).enabled?ro(e,a,co(o)):e.querySelectorAll(a)}catch(e){return}Array.from(t).forEach(function(e){s.unobserve(e),s.observe(e)})}};null==i||i(c),c();var d=null==o?void 0:o.onArm(function(){(null==n?void 0:n.document)&&u(n.document)}),h=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){if(e instanceof DocumentFragment)l(e);else if(e instanceof Element)if(o&&co(o).enabled){try{e.matches(a)&&s.observe(e)}catch(e){}u(e)}else l(e)})})});return function(){null==i||i(void 0),null==d||d(),h.unsubscribe(),s.disconnect()}})}(s,e.cssSelectorAllowlist,function(e){O=e},o);return(t={})[Mo.ChangeObservable]=i,t[Mo.ClickObservable]=n,t[Mo.MutationObservable]=s,t[Mo.NavigateObservable]=r,t[Mo.ScrollObservable]=a,t[Mo.ExposureObservable]=l,t},D=yo(Object.values(null!==(m=null===(v=e.pageActions)||void 0===v?void 0:v.labeledEvents)&&void 0!==m?m:{})),L=bo(null!==(b=null===(y=e.pageActions)||void 0===y?void 0:y.triggers)&&void 0!==b?b:[]),F=function(e,t,r,n){return new So(e,t,r,n)}(D,L,R,e);return{name:P,type:"enrichment",setup:function(t,r){return l(void 0,void 0,void 0,function(){var n,i,o,a,l,c,p,f,g,v,m,y,b,w,k,U,j,B,q,W,V,$,H,K,G,J,X;return u(this,function(u){return"undefined"==typeof document||(n=!1,t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(t){!function(t){var r,n;t&&(e.pageActions=s(s({},e.pageActions),t),D=yo(Object.values(null!==(r=e.pageActions.labeledEvents)&&void 0!==r?r:{})),L=bo(null!==(n=e.pageActions.triggers)&&void 0!==n?n:[]),F.update(D,L,e))}(t)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),(i=Ro(t,R))&&T.push({unsubscribe:i}),o=Ji(e,e.cssSelectorAllowlist),a=Ji(e,e.actionClickAllowlist),l=N(),c=function(e){var t=e.amplitude,r=e.allObservables,n=e.shouldTrackEvent,i=e.evaluateTriggers;return r.clickObservable.filter(oo).filter(function(e){return n("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(ni,e.targetElementProperties)})}({allObservables:l,amplitude:r,shouldTrackEvent:o,evaluateTriggers:F.evaluate.bind(F)}),T.push(c),p=function(e){var t=e.amplitude,r=e.allObservables,n=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return r.changeObservable.filter(oo).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",n("change",e.closestTrackedAncestor))})}({allObservables:l,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return R.getEventProperties.apply(R,h(h([],d(e),!1),[S],!1))},amplitude:r,shouldTrackEvent:o,evaluateTriggers:F.evaluate.bind(F)}),T.push(p),f=function(e){var t=e.amplitude,r=e.allObservables,n=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,s=e.shouldTrackActionClick,a=r.clickObservable,l=r.mutationObservable,u=r.navigateObservable,c=a.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=Zi(e.event.target,n.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(oo).filter(function(e){return s("click",e.closestTrackedAncestor)}),d=u?Ir(l,u):l,h=Ir(c,d),p=null,f=null;return Er(h,function(e){if(p&&(clearTimeout(p),p=null),"click"===e.type)return f=e,p=setTimeout(function(){p=null,f=null},500),Promise.resolve(null);if(f){var t=f;return f=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==t||t.track(ni,i("click",e.closestTrackedAncestor)))})}({allObservables:l,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return R.getEventProperties.apply(R,h(h([],d(e),!1),[S],!1))},amplitude:r,shouldTrackEvent:o,shouldTrackActionClick:a}),f&&T.push(f),g=function(e){e.amplitude;var t=e.allObservables.scrollObservable,r={maxX:0,maxY:0},n=t.subscribe(function(){var e,t,n,i,o=z(),s=Math.floor(null!==(t=null!==(e=null==o?void 0:o.scrollX)&&void 0!==e?e:null==o?void 0:o.pageXOffset)&&void 0!==t?t:0),a=Math.floor(null!==(i=null!==(n=null==o?void 0:o.scrollY)&&void 0!==n?n:null==o?void 0:o.pageYOffset)&&void 0!==i?i:0);r.maxX=Math.max(r.maxX,s),r.maxY=Math.max(r.maxY,a)});return{unsubscribe:function(){n.unsubscribe()},getState:function(){return r},reset:function(){r.maxX=0,r.maxY=0}}}({allObservables:l,amplitude:r}),T.push(g),v=s({},g.getState()),m={},y=z(),w=function(e){e&&(null==b||b.reset()),e&&n||(e&&(n=!0,setTimeout(function(){n=!1},100)),function(e){var t,r,n,i=e.amplitude,o=e.scrollTracker,s=e.currentElementExposed,a=e.elementExposedForPage,l=e.elementExposedInSentEvents,u=e.exposureTracker,c=e.isPageEnd,d=e.lastScroll,h=o.getState(),p=z(),f=null!==(r=null==p?void 0:p.innerWidth)&&void 0!==r?r:0,g=null!==(n=null==p?void 0:p.innerHeight)&&void 0!==n?n:0,v=Array.from(s).filter(function(e){return!l.has(e)}),m=((t={})[si]=ao(p),t["[Amplitude] Max Page X"]=h.maxX+f,t["[Amplitude] Max Page Y"]=h.maxY+g,t[ai]=g,t[li]=f,t["[Amplitude] Element Exposed"]=v,t),y=Qi();y&&(m[ui]=y);var b=function(){o.reset();var e=o.getState();d.maxX=e.maxX,d.maxY=e.maxY,a.clear(),l.clear(),null==u||u.reset()};0!==v.length||h.maxX!==d.maxX||h.maxY!==d.maxY?(null==i||i.track("[Amplitude] Viewport Content Updated",m),d.maxX=h.maxX,d.maxY=h.maxY,v.forEach(function(e){l.add(e)}),s.clear(),c&&b()):c&&b()}({amplitude:r,scrollTracker:g,currentElementExposed:_,elementExposedForPage:M,elementExposedInSentEvents:A,exposureTracker:m.exposure,isPageEnd:e,lastScroll:v}))},k=ao(y),U=function(){var e=ao(y);e!==k&&(k=e,w(!0))},j=function(e,t){var r=ao(y),n=function(e,t){var r;if(void 0===t&&(t=z()),null==e||""===e)return ao(t);var n=(null===(r=null==t?void 0:t.location)||void 0===r?void 0:r.href)||"http://localhost/";try{return so(new URL(e,n).href)}catch(e){return ao(t)}}(t,y);r!==n?(k=n,w(!0),e()):e()},B=function(e){!function(e,t,r,n,i){if(!t.has(e)&&!r.has(e)){t.add(e),n.add(e);var o=Array.from(n);JSON.stringify(o).length>=18e3&&i(!1)}}(e,M,A,_,w)},C&&(m.exposure=_o({allObservables:l,onExposure:B,dataExtractor:R,exposureDuration:E}),m.exposure&&T.push(m.exposure),b=No({mutationObservable:l[Mo.MutationObservable],onRescan:function(){var e,r;null===(r=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===r||r.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),null==O||O()},onFlush:function(){var e,r;null===(r=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===r||r.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),w(!1)},exposureDuration:E}),b.start(),T.push({unsubscribe:function(){null==b||b.stop()}}),q=function(){w(!0)},null==y||y.addEventListener("beforeunload",q),I=function(){null==y||y.removeEventListener("beforeunload",q)},T.push({unsubscribe:function(){return I()}}),(W=l[Mo.NavigateObservable])?T.push(W.subscribe(function(e){var t,r,n=null===(r=null===(t=e.event)||void 0===t?void 0:t.destination)||void 0===r?void 0:r.url;if(n){var i=so(n);if(i===k)return;return k=i,void w(!0)}U()})):y&&(V=function(){U()},y.addEventListener("popstate",V),$=y.history.pushState,H=y.history.replaceState,y.history&&$&&(y.history.pushState=new Proxy($,{apply:function(e,t,r){j(function(){e.apply(t,r)},r[2])}})),y.history&&H&&(y.history.replaceState=new Proxy(H,{apply:function(e,t,r){j(function(){e.apply(t,r)},r[2])}})),T.push({unsubscribe:function(){y.removeEventListener("popstate",V),y.history&&$&&(y.history.pushState=$),y.history&&H&&(y.history.replaceState=H)}}))),null===(X=null==t?void 0:t.loggerProvider)||void 0===X||X.log("".concat(P," has been successfully added.")),window.opener&&x.enabled&&(K=e.cssSelectorAllowlist,G=e.actionClickAllowlist,function(e,t){var r=e;if(!0!==r[lo]){r[lo]=!0;var n=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,s=t.actionClickAllowlist,a=null,l=function(t){e.notify({action:"element-selected",data:t})},u=function(t,r){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:r}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:r})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var r;a=null===(r=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===r?void 0:r.call(window,{getEventTagProps:n.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:u,onSelect:l,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:s,extractDataFromDataSource:n.extractDataFromDataSource,dataExtractor:n,diagnostics:{autocapture:{version:ri}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==a?void 0:a.close)||void 0===e||e.call(a)})}}(J=Nr(),{dataExtractor:R,isElementSelectable:Ji(e,h(h([],d(K),!1),d(G),!1)),cssSelectorAllowlist:K,actionClickAllowlist:G}),Lr(J),J.setup(s({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:Rr[t.serverZone]})))),[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){var e,t,r,n;return u(this,function(i){try{for(e=c(T),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(n=e.return)&&n.call(e)}finally{if(r)throw r.error}}return[2]})})}}},Lo=["mutation","navigate"];function Fo(e,t){var r,n,i,o,s=t.event,a=s.pageX,l=s.pageY;e.yMin=Math.min(null!==(r=e.yMin)&&void 0!==r?r:l,l),e.yMax=Math.max(null!==(n=e.yMax)&&void 0!==n?n:l,l),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:a,a),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:a,a),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function Uo(e){if(0===e.length)return null;var t=e[0],r=e[e.length-1];return{rageClickEvent:s({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(r.timestamp).toISOString(),"[Amplitude] Duration":r.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function jo(e){var t=this,r=e.amplitude,n=e.allObservables,i=e.shouldTrackRageClick,o=n.pointerDownObservable,s=n.selectionObservable,a=[],c={},d=null;function h(e){a=[],c={},e&&(Fo(c,e),a.push(e))}var p=Er(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return l(t,void 0,void 0,function(){var t;return u(this,function(r){return Fo(c,e),t=null,0===a.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(a,e)||function(e,t){var r=e[Math.max(0,e.length-4+1)];return t.timestamp-r.timestamp>=1e3}(a,e)||c.isOutOfBounds?(d&&(t=Uo(a)),h(e)):a.push(e),d&&(clearTimeout(d.timerId),d.resolve(t),d=null),a.length>=4?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(Uo(a))},1e3)}})]:[2,null]})})}),f=null==s?void 0:s.subscribe(function(){h()}),g=p.subscribe(function(e){null!==e&&r.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){g.unsubscribe(),null==f||f.unsubscribe()}}}var Bo,qo;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(Bo||(Bo={})),function(e){e.X="x",e.Y="y"}(qo||(qo={}));function zo(e){var t=e.changes,r=e.changesThreshold,n=e.thresholdMs;return!(t.length<r)&&t[t.length-1]-t[0]<n}function Wo(e){e.changes=[],e.startTime=void 0}function Vo(e){for(var t=e.changes,r=e.thresholdMs,n=0,i=t[t.length-1];n<t.length;n++){if(i-t[n]<r)break}0!==n&&(e.startTime=t[n],e.changes.splice(0,n))}var $o=function(e){var t=e.mouseDirectionChangeObservable,r=e.directionChanges,n=void 0===r?20:r,i=e.thresholdMs,o=void 0===i?2e3:i;return new Cr(function(e){var r={changes:[],changesThreshold:n,thresholdMs:o},i={changes:[],changesThreshold:n,thresholdMs:o},s=void 0,a=null;function l(){void 0!==s&&(e.next(s),s=void 0,null!==a&&clearTimeout(a),Wo(r),Wo(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),function(e){var t=+Date.now();e.startTime=e.startTime||t;var r=e.changes,n=e.changesThreshold;r.push(t),r.length>n&&r.shift()}(e===qo.X?r:i);var t=function(e,t){var r=void 0;if(zo(e)&&(r=e.startTime),zo(t)){var n=t.startTime;n&&(!r||n<r)&&(r=n)}return r}(r,i);return t?(s=s||t,a=setTimeout(function(){l(),a=null},o)):l(),Vo(r),Vo(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},Ho=function(e){var t=e.amplitude,r=e.options,n=e.allObservables,i=e.directionChanges,o=void 0===i?20:i,s=e.thresholdMs,a=void 0===s?2e3:s,l=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new Cr(function(e){var r=null,n=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==r?(o.x>r.x?(n===Bo.DECREASING&&e.next(qo.X),n=Bo.INCREASING):o.x<r.x&&(n===Bo.INCREASING&&e.next(qo.X),n=Bo.DECREASING),o.y>r.y?(i===Bo.DECREASING&&e.next(qo.Y),i=Bo.INCREASING):o.y<r.y&&(i===Bo.INCREASING&&e.next(qo.Y),i=Bo.DECREASING),r=o):r=o})})}({allWindowObservables:n});return $o({mouseDirectionChangeObservable:l,directionChanges:o,thresholdMs:a}).subscribe(function(e){Gi(r)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function Ko(e,t,r,n){if(!n)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:r}var Go=4e3,Jo=function(e){var t;void 0===e&&(e={});var r="@amplitude/plugin-frustration-browser",n=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var o=!1!==e.deadClicks&&null!==e.deadClicks,a=!1!==e.rageClicks&&null!==e.rageClicks,p=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(p=!1);var f=Ko(e,"rageClicks",_t,a),g=Ko(e,"deadClicks",Mt,o),v=Ko(e,"errorClicks",At,i),m=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:Pt,y=new To(e),b=h([],d(new Set(h(h(h([],d(f),!1),d(g),!1),d(v),!1))),!1),w=function(){var e,t,r=function(e){return Or(fo(e).map(function(e){return y.addAdditionalEventProperties(e,"click",b,m,!0)}))},n=r("click"),i=r("pointerdown"),o=Or(go().map(function(e){return y.addTypeAndTimestamp(e,"error")})),a=Or(po(y.shadowGate).map(function(e){return y.addAdditionalEventProperties(e,"mutation",b,m)}));window.navigation&&(t=Or(new Cr(function(e){var t=function(t){e.next(s(s({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return y.addAdditionalEventProperties(e,"navigate",b,m)})));var l=Or(new Cr(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){try{if(t.selectionStart===t.selectionEnd)return}catch(e){return}return e.next()}var r=window.getSelection();if(r&&!r.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),u=Or(new Cr(function(e){var t=function(t){e.next(t)},r={capture:!0};return uo.document.addEventListener("mousemove",t,r),function(){uo.document.removeEventListener("mousemove",t,r)}}));return(e={})[Mo.ClickObservable]=n,e[Mo.PointerDownObservable]=i,e[Mo.MutationObservable]=a,e[Mo.NavigateObservable]=t,e[Mo.BrowserErrorObservable]=o,e[Mo.SelectionObservable]=l,e[Mo.MouseMoveObservable]=u,e};return{name:r,type:"enrichment",setup:function(t,c){return l(void 0,void 0,void 0,function(){var l,d,h,b,S,k,x,C,E,I,O,P;return u(this,function(u){return"undefined"==typeof document||(l=w(),(d=Ro(t,y))&&n.push({unsubscribe:d}),a&&(h=Ji(e,f),b=jo({allObservables:l,amplitude:c,shouldTrackRageClick:h}),n.push(b)),o&&(S=Ji(e,g),k=function(e){var t=e.amplitude,r=e.allObservables,n=e.getEventProperties,i=e.shouldTrackDeadClick,o=r.clickObservable,a=r.mutationObservable,l=r.navigateObservable,u=o.filter(function(e){return oo(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Vi.LEFT_OR_TOUCH_CONTACT}),c=l?Ir(a,l):a,d=Ir(u,c),h=null;return Er(d,function(e){return h&&Lo.includes(e.type)?(clearTimeout(h),h=null,Promise.resolve(null)):"click"===e.type?h?Promise.resolve(null):new Promise(function(t){h=setTimeout(function(){t(e),h=null},3e3)}):Promise.resolve(null)}).subscribe(function(e){if(e){var r={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",s(s({},n("click",e.closestTrackedAncestor)),r),{time:e.timestamp})}})}({amplitude:c,allObservables:l,getEventProperties:function(e,t){return y.getEventProperties(e,t,m)},shouldTrackDeadClick:S}),n.push(k)),i&&(x=Ji(e,v),C=function(e){var t=e.amplitude,r=e.allObservables,n=e.shouldTrackErrorClick,i=r.pointerDownObservable,o=r.browserErrorObservable,a=i.filter(function(e){return oo(e)&&n("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Vi.LEFT_OR_TOUCH_CONTACT}),l=null,u=null,c=function(){null!==l&&(clearTimeout(l),l=null),u=null};return Ir(a,o).subscribe(function(e){var r;if("click"===e.type)return c(),u=e,void(l=setTimeout(c,2e3));"error"===e.type&&u&&(t.track("[Amplitude] Error Click",s(((r={})["[Amplitude] Kind"]=e.event.kind,r["[Amplitude] Message"]=e.event.message,r["[Amplitude] Stack"]=e.event.stack,r["[Amplitude] Filename"]=e.event.filename,r["[Amplitude] Line Number"]=e.event.lineNumber,r["[Amplitude] Column Number"]=e.event.columnNumber,r),u.targetElementProperties)),c())})}({amplitude:c,allObservables:l,shouldTrackErrorClick:x}),n.push(C)),p&&(E=void 0,I=void 0,"object"==typeof e.thrashedCursor&&(E=e.thrashedCursor.directionChanges,I=e.thrashedCursor.threshold,E&&E<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(E," is below the minimum of ").concat(5,", setting to ").concat(5)),E=5),I&&I>Go&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(I," is above the maximum of ").concat(Go,", setting to ").concat(Go)),I=Go)),O=Ho({amplitude:c,options:e,allObservables:l,directionChanges:E,thresholdMs:I}),n.push(O)),null===(P=null==t?void 0:t.loggerProvider)||void 0===P||P.log("".concat(r," has been successfully added."))),[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){var e,t,r,i;return u(this,function(o){try{for(e=c(n),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}};function Xo(e,t){var r=e.startTime+e.duration;return t.filter(function(t){return t.startTime<r&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}function Yo(e,t){var r,n=Xo(e,t),i=null!==(r=e.scripts)&&void 0!==r?r:[],o=i.map(function(e){return e.sourceURL}).filter(Boolean),a=i.map(function(e){return e.sourceFunctionName}).filter(Boolean),l=i.map(function(e){return e.sourceCharPosition}).filter(function(e){return"number"==typeof e&&e>=0}),u=i.map(function(e){return e.invokerType}).filter(Boolean),c=i.map(function(e){return e.invoker}).filter(Boolean);return s(s(s(s(s(s(s({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},n.length>0&&{"[Amplitude] Main Thread Block Measures":n}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),o.length>0&&{"[Amplitude] Main Thread Block Script URLs":o}),a.length>0&&{"[Amplitude] Main Thread Block Script Functions":a}),l.length>0&&{"[Amplitude] Main Thread Block Script Positions":l}),u.length>0&&{"[Amplitude] Main Thread Block Invoker Types":u}),c.length>0&&{"[Amplitude] Main Thread Block Invokers":c})}function Qo(e,t){var r,n=Xo(e,t),i=null!==(r=e.attribution)&&void 0!==r?r:[];return s(s({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},n.length>0&&{"[Amplitude] Main Thread Block Measures":n}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}function Zo(e){var t=e.amplitude,r=e.options,n=e.durationThreshold,i=void 0===n?100:n,o=function(){if("undefined"==typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!o)return{unsubscribe:function(){}};var s=[],a=new PerformanceObserver(function(e){var t,r,n=performance.now();try{for(var i=c(e.getEntries()),o=i.next();!o.done;o=i.next()){var a=o.value;s.push(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}for(var l=n-1e4;s.length>0&&s[0].startTime<l;)s.shift()});try{a.observe({entryTypes:["measure"]})}catch(e){}var l=new PerformanceObserver(function(e){var n,a;try{for(var l=c(e.getEntries()),u=l.next();!u.done;u=l.next()){var d=u.value;if(!Gi(r))return;if(!(d.duration<i)){var h="long-animation-frame"===o?Yo(d,s):Qo(d,s);t.track("[Amplitude] Main Thread Block",h)}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(n)throw n.error}}});try{l.observe({entryTypes:[o]})}catch(e){return a.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){l.disconnect(),a.disconnect()}}}var es,ts,rs=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",r=[],n=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(i,o){return l(void 0,void 0,void 0,function(){var s,a,l;return u(this,function(u){return"undefined"==typeof document||(n&&(s=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(s=e.mainThreadBlock.durationThreshold),a=Zo({amplitude:o,options:e,durationThreshold:s}),r.push(a)),null===(l=null==i?void 0:i.loggerProvider)||void 0===l||l.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){var e,t,n,i;return u(this,function(o){try{for(e=c(r),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]})})}}},ns="[Amplitude] Network Request",is="500-599";function os(e,t){var r="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(r).test(e)}function ss(e,t){var r,n,i=t.split(",");try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var a=d(s.value.split("-").map(Number),2),l=a[0],u=a[1];if(e===l&&void 0===u)return!0;if(e>=l&&e<=u)return!0}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return!1}function as(e){var t;if(e)try{var r=null===(t=z())||void 0===t?void 0:t.location.href,n=new URL(e,r),i=n.searchParams.toString(),o=n.hash.replace("#",""),s=n.href,a=n.host;return n.hash="",n.search="",{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:n.href,host:a}}catch(t){try{return function(e){var t,r=e.indexOf("#"),n=r>=0?e.slice(r+1):"",i=r>=0?e.slice(0,r):e,o=i.indexOf("?"),s=o>=0?i.slice(o+1):"",a=o>=0?i.slice(0,o):i,l=a.match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i);return{query:s,fragment:n,href:e,hrefWithoutQueryOrHash:a,host:null!==(t=null==l?void 0:l[1])&&void 0!==t?t:""}}(e)}catch(e){return}}}function ls(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return h([],d(_),!1);if(void 0===e){return}}}function us(e){var t,r,n;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(r=null==e?void 0:e.blocklist)||void 0===r?void 0:r.length)&&!(null===(n=null==e?void 0:e.excludelist)||void 0===n?void 0:n.length)}function cs(e,t){var r;void 0===t&&(t={});var n=as(e.url);if(!n)return!1;var i,o=n.host;if(!1!==t.ignoreAmplitudeRequests&&(os(o,"*.amplitude.com")||os(o,"amplitude.com")))return!1;if(null===(r=t.ignoreHosts)||void 0===r?void 0:r.find(function(e){return os(o,e)}))return!1;if(!t.captureRules&&void 0!==e.status&&!ss(e.status,is))return!1;if(t.captureRules&&(h([],d(t.captureRules),!1).reverse().find(function(t){if(i=function(e,t,r,n,i){if((!e.hosts||e.hosts.find(function(e){return os(t,e)}))&&(!n||!e.urls||qe(n,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return!((r||0===r)&&!ss(r,e.statusCodeRange||is))}(t,o,e.status,e.url,e.method),i){var r=ls(t.responseHeaders);if(e.responseWrapper&&r){var n=e.responseWrapper.headers(r);n&&(e.responseHeaders=n)}var s=ls(t.requestHeaders);if(e.requestWrapper&&s){var a=e.requestWrapper.headers(s);a&&(e.requestHeaders=a)}if(e.responseWrapper&&t.responseBody&&!us(t.responseBody)){var l=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,l)}if(e.requestWrapper&&t.requestBody&&!us(t.requestBody)){l=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,l)}}return void 0!==i}),!i))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var r=t.body;if("string"!=typeof r)return!1;if(JSON.parse(r).events.find(function(e){return e.event_type===ns}))return!0}catch(e){}return!1}(o,e.requestWrapper)}function ds(e){var t=e.allObservables,r=e.networkTrackingOptions,n=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return cs(e.event,r)}).subscribe(function(e){var t,r,o,s=e.event,a=as(s.url);if(a){var c=null===(r=s.responseWrapper)||void 0===r?void 0:r.bodySize,h=null===(o=s.requestWrapper)||void 0===o?void 0:o.bodySize;!function(e,t,r,n){l(this,void 0,void 0,function(){var i,o,s;return u(this,function(a){switch(a.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(i=d.apply(void 0,[a.sent(),2]),o=i[0],s=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==n||n.debug("Failed to stringify request body",e)}if(s)try{e["[Amplitude] Response Body"]=JSON.stringify(s)}catch(e){null==n||n.debug("Failed to stringify response body")}a.label=2;case 2:return null==r||r.track(ns,e),[2]}})})}(((t={})["[Amplitude] URL"]=a.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=a.query,t["[Amplitude] URL Fragment"]=a.fragment,t["[Amplitude] Request Method"]=s.method,t["[Amplitude] Status Code"]=s.status,t["[Amplitude] Start Time"]=s.startTime,t["[Amplitude] Completion Time"]=s.endTime,t["[Amplitude] Duration"]=s.duration,t["[Amplitude] Request Body Size"]=h,t["[Amplitude] Response Body Size"]=c,t["[Amplitude] Request Type"]=s.type,t["[Amplitude] Request Headers"]=s.requestHeaders,t["[Amplitude] Response Headers"]=s.responseHeaders,t),s,n,i)}})}!function(e){e.NetworkObservable="networkObservable"}(es||(es={}));var hs=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-network-capture-browser",n=function(){var e,r=new Cr(function(e){var r=new Xt(function(t){var r=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(r)});return Zt.subscribe(r,t),function(){Zt.unsubscribe(r)}});return(e={})[es.NetworkObservable]=r,e};return{name:r,type:"enrichment",setup:function(i,o){return l(void 0,void 0,void 0,function(){var s;return u(this,function(a){return"undefined"!=typeof document||function(){var e,t=z();return"ReactNative"===(null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.product)}()?(s=n(),t=null==i?void 0:i.loggerProvider,ts=ds({allObservables:s,networkTrackingOptions:e,amplitude:o,loggerProvider:t}),null==t||t.log("".concat(r," has been successfully added.")),[2]):[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(e){return ts.unsubscribe(),[2]})})}}};let ps=-1;const fs=e=>{addEventListener("pageshow",t=>{t.persisted&&(ps=t.timeStamp,e(t))},!0)},gs=(e,t,r,n)=>{let i,o;return s=>{t.value>=0&&(s||n)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t)))}},vs=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},ms=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ys=()=>{const e=ms();return e?.activationStart??0},bs=(e,t=-1)=>{const r=ms();let n="navigate";return ps>=0?n="back-forward-cache":r&&(document.prerendering||ys()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},ws=new WeakMap;function Ss(e,t){return ws.get(e)||ws.set(e,new t),ws.get(e)}class ks{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const xs=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const n=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},Cs=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let Es=-1;const Is=new Set,Os=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Ps=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of Is)e();isFinite(Es)||(Es="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Ps,!0))}},Ts=()=>{if(Es<0){const e=ys(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime;Es=t??Os(),addEventListener("visibilitychange",Ps,!0),addEventListener("prerenderingchange",Ps,!0),fs(()=>{setTimeout(()=>{Es=Os()})})}return{get firstHiddenTime(){return Es},onHidden(e){Is.add(e)}}},Rs=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},Ms=[1800,3e3],As=(e,t={})=>{Rs(()=>{const r=Ts();let n,i=bs("FCP");const o=xs("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-ys(),0),i.entries.push(t),n(!0)))});o&&(n=gs(e,i,Ms,t.reportAllChanges),fs(r=>{i=bs("FCP"),n=gs(e,i,Ms,t.reportAllChanges),vs(()=>{i.value=performance.now()-r.timeStamp,n(!0)})}))})},_s=[.1,.25];let Ns=0,Ds=1/0,Ls=0;const Fs=e=>{for(const t of e)t.interactionId&&(Ds=Math.min(Ds,t.interactionId),Ls=Math.max(Ls,t.interactionId),Ns=Ls?(Ls-Ds)/7+1:0)};let Us;const js=()=>Us?Ns:performance.interactionCount??0;let Bs=0;class qs{u=[];l=new Map;m;p;v(){Bs=js(),this.u.length=0,this.l.clear()}L(){const e=Math.min(this.u.length-1,Math.floor((js()-Bs)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let r=this.l.get(e.interactionId);if(r||this.u.length<10||e.duration>t.P){if(r?e.duration>r.P?(r.entries=[e],r.P=e.duration):e.duration===r.P&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],P:e.duration},this.l.set(r.id,r),this.u.push(r)),this.u.sort((e,t)=>t.P-e.P),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.p?.(r)}}}const zs=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=Cs(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},Ws=[200,500],Vs=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const r=Ts();Rs(()=>{"interactionCount"in performance||Us||(Us=xs("event",Fs,{type:"event",buffered:!0,durationThreshold:0}));let n,i=bs("INP");const o=Ss(t,qs),s=e=>{zs(()=>{for(const t of e)o.h(t);const t=o.L();t&&t.P!==i.value&&(i.value=t.P,i.entries=t.entries,n())})},a=xs("event",s,{durationThreshold:t.durationThreshold??40});n=gs(e,i,Ws,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),r.onHidden(()=>{s(a.takeRecords()),n(!0)}),fs(()=>{o.v(),i=bs("INP"),n=gs(e,i,Ws,t.reportAllChanges)}))})};class $s{m;h(e){this.m?.(e)}}const Hs=[2500,4e3],Ks=[800,1800],Gs=e=>{document.prerendering?Rs(()=>Gs(e)):"complete"!==document.readyState?addEventListener("load",()=>Gs(e),!0):setTimeout(e)};function Js(e){var t,r=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+r}function Xs(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(Js(e)),navigationStart:Math.floor(performance.timeOrigin)}}var Ys,Qs=function(){var e=null,t=z(),r=null==t?void 0:t.document,n=null==t?void 0:t.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(t,i){return l(void 0,void 0,void 0,function(){var o,s;return u(this,function(a){return void 0===r||(o=ze((null==n?void 0:n.href)||"",t.loggerProvider),s={"[Amplitude] Page Domain":(null==n?void 0:n.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":ze((null==n?void 0:n.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":ze(o.split("?")[0],t.loggerProvider)},((e,t={})=>{Rs(()=>{const r=Ts();let n,i=bs("LCP");const o=Ss(t,$s),s=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)o.h(t),t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-ys(),0),i.entries=[t],n())},a=xs("largest-contentful-paint",s);if(a){n=gs(e,i,Hs,t.reportAllChanges);const r=Cs(()=>{s(a.takeRecords()),a.disconnect(),n(!0)}),o=e=>{e.isTrusted&&(zs(r),removeEventListener(e.type,o,{capture:!0}))};for(const e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});fs(r=>{i=bs("LCP"),n=gs(e,i,Hs,t.reportAllChanges),vs(()=>{i.value=performance.now()-r.timeStamp,n(!0)})})}})})(function(e){s["[Amplitude] LCP"]=Xs(e)}),As(function(e){s["[Amplitude] FCP"]=Xs(e)}),Vs(function(e){s["[Amplitude] INP"]=Xs(e)}),((e,t={})=>{const r=Ts();As(Cs(()=>{let n,i=bs("CLS",0);const o=Ss(t,ks),s=e=>{for(const t of e)o.h(t);o.i>i.value&&(i.value=o.i,i.entries=o.o,n())},a=xs("layout-shift",s);a&&(n=gs(e,i,_s,t.reportAllChanges),r.onHidden(()=>{s(a.takeRecords()),n(!0)}),fs(()=>{o.i=0,i=bs("CLS",0),n=gs(e,i,_s,t.reportAllChanges),vs(()=>n())}),setTimeout(n))}))})(function(e){s["[Amplitude] CLS"]=Xs(e)}),((e,t={})=>{let r=bs("TTFB"),n=gs(e,r,Ks,t.reportAllChanges);Gs(()=>{const i=ms();i&&(r.value=Math.max(i.responseStart-ys(),0),r.entries=[i],n(!0),fs(()=>{r=bs("TTFB",0),n=gs(e,r,Ks,t.reportAllChanges),n(!0)}))})})(function(e){s["[Amplitude] TTFB"]=Xs(e)}),e=function(){"hidden"===r.visibilityState&&e&&(i.track("[Amplitude] Web Vitals",s),r.removeEventListener("visibilitychange",e),e=null)},r.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(t){return e&&(null==r||r.removeEventListener("visibilitychange",e)),[2]})})}}},Zs=function(){function e(e,t){var r,n,i;this.shouldTrackNewCampaign=!1,this.options=s({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(n=(null===(r=t.cookieOptions)||void 0===r?void 0:r.domain)||t.topLevelDomain,i=n,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[]),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=Xe(t.apiKey,"MKTG"),this.webExpStorageKey=Xe(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=A,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return l(this,void 0,void 0,function(){var e,t;return u(this,function(r){switch(r.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return t=d.apply(void 0,[r.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||Le(this.sessionTimeout,this.lastEventTime),An(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return l(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return(e=t.sent())?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||(new er).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,r,n,i,o=(t=this.currentCampaign,r=this.options,n=s(s({},A),t),i=Object.entries(n).reduce(function(e,t){var n,i=d(t,2),o=i[0],s=i[1];return e.setOnce("initial_".concat(o),null!==(n=null!=s?s:r.initialEmptyValue)&&void 0!==n?n:"EMPTY"),s?e.set(o,s):e.unset(o)},new F),te(i));return e&&(o.event_id=e),o},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),ea=new Set([o.IDENTIFY,o.GROUP_IDENTIFY]),ta=function(e){var t;void 0===e&&(e={});var r,n,i,o,a,c,d=null!==(t=e.fallbackAttributionEvent)&&void 0!==t&&t,h=z(),p={},f=!1,g=!1,v=function(){return l(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,(new er).parse()];case 1:return e=t.sent(),p=$e(e),d&&(null==n||n.log("Tracking attribution fallback event."),null==r||r.track("[Amplitude] Attribution",p)),[2]}})})},m=function(){v()},y=function(e){return new Proxy(e,{apply:function(e,t,r){Reflect.apply(e,t,r),f&&m()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return l(void 0,void 0,void 0,function(){return u(this,function(s){switch(s.label){case 0:return r=t,n=e.loggerProvider,f=!0,n.log("Installing event property attribution tracking."),[4,v()];case 1:if(s.sent(),!h)return[2];if(h.addEventListener("popstate",m),!g){if(i=Reflect.get(h.history,"pushState"),o=Reflect.get(h.history,"replaceState"),!i||!o)return[2];a=y(i),h.history.pushState=a,c=y(o),h.history.replaceState=c,g=!0}return[2]}})})},execute:function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){return ea.has(e.event_type)||(e.event_properties=s(s({},p),e.event_properties)),[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){var e,t;return u(this,function(r){return h&&(h.removeEventListener("popstate",m),e=Reflect.get(h.history,"pushState"),t=Reflect.get(h.history,"replaceState"),g&&e===a&&i&&(h.history.pushState=i),g&&t===c&&o&&(h.history.replaceState=o)),f=!1,g=!1,i=void 0,o=void 0,a=void 0,c=void 0,p={},[2]})})}}},ra="AMP_CURRENT_PAGE",na="AMP_PREVIOUS_PAGE",ia="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(Ys||(Ys={}));var oa=new Set([o.IDENTIFY,o.GROUP_IDENTIFY,o.REVENUE]),sa=function(e){var t=(void 0===e?{}:e).internalDomains,r=void 0===t?[]:t,n=z(),i=void 0,o=!1,a=void 0,c=!1,h=!1,p=function(e){var t;try{var r=ze(e,a);t=new URL(r).hostname}catch(e){null==a||a.error("Could not parse URL: ",e)}return t},f=function(e){var t="undefined"!=typeof location&&location.hostname||"",n=e?p(e):void 0;if(!n)return Ys.Direct;var i=r.some(function(e){return-1!==t.indexOf(e)}),o=r.some(function(e){return-1!==n.indexOf(e)});return t===n||o&&i?Ys.Internal:Ys.External},g=function(){return l(void 0,void 0,void 0,function(){var e,t,r,n,s;return u(this,function(a){switch(a.label){case 0:return i&&o?[4,i.get(ia)]:[3,3];case 1:return e=a.sent(),t=ze("undefined"!=typeof location&&location.href||""),r=(null==e?void 0:e[ra])||"",n=void 0,n=t===r?(null==e?void 0:e[na])||"":r||(document.referrer||""),[4,i.set(ia,(s={},s[ra]=t,s[na]=n,s))];case 2:a.sent(),a.label=3;case 3:return[2]}})})},v=function(){g()},m={name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return l(void 0,void 0,void 0,function(){var t,r,s,l,f,m,y,b;return u(this,function(u){switch(u.label){case 0:if((a=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),h=!0,!n)return[3,7];try{i=new Ye(n.sessionStorage)}catch(e){null==a||a.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:return o=null!==(b=u.sent())&&void 0!==b&&b,i&&o?(t="undefined"!=typeof document&&document.referrer||"",r=t?p(t):void 0,s="undefined"!=typeof location&&location.hostname||"",l=ze("undefined"!=typeof location&&location.href||""),[4,i.get(ia)]):[3,6];case 2:return f=u.sent(),m=(null==f?void 0:f[ra])||"",!!r&&r!==s&&m!==l?[4,i.set(ia,(y={},y[ra]=l,y[na]=t,y))]:[3,4];case 3:return u.sent(),[3,6];case 4:return[4,g()];case 5:u.sent(),u.label=6;case 6:n.addEventListener("popstate",v),c||(n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,r){var n=d(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),h&&v()}}),n.history.replaceState=new Proxy(n.history.replaceState,{apply:function(e,t,r){var n=d(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),h&&v()}}),c=!0),u.label=7;case 7:return[2]}})})},execute:function(e){return l(void 0,void 0,void 0,function(){var t,r,n;return u(this,function(a){switch(a.label){case 0:return t=ze("undefined"!=typeof location&&location.href||""),i&&o?[4,i.get(ia)]:[3,2];case 1:if(r=a.sent(),n=(null==r?void 0:r[na])||"",oa.has(e.event_type))return[2,e];e.event_properties=s(s({},e.event_properties||{}),{"[Amplitude] Page Domain":aa(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":aa(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":aa(e,"[Amplitude] Page Path","undefined"!=typeof location&&ze(location.pathname)||""),"[Amplitude] Page Title":aa(e,"[Amplitude] Page Title",ar(sr)),"[Amplitude] Page URL":aa(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":n,"[Amplitude] Previous Page Type":f(n)}),a.label=2;case 2:return[2,e]}})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return n&&(n.removeEventListener("popstate",v),h=!1),i&&o?[4,i.set(ia,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}};return m};function aa(e,t,r){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?r:e.event_properties[t]}var la,ua=function(){var e,t,r;function n(t){if(t)try{var r=new Function("return "+t)();if("function"==typeof r)return r;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}var i={name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(i,o){return l(void 0,void 0,void 0,function(){var o,s;return u(this,function(a){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null===(s=i.remoteConfig)||void 0===s?void 0:s.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){r=e&&function(e){return"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body}(e)?n(e.body||""):n("")}),t=function(){var e;return null===(e=i.remoteConfigClient)||void 0===e?void 0:e.unsubscribe(o)}):null==e||e.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(t){return l(void 0,void 0,void 0,function(){var n;return u(this,function(i){if(r)try{return[2,null!==(n=r(t))&&void 0!==n?n:null]}catch(r){return null==e||e.error("Could not execute custom enrichment function",r),[2,t]}return[2,t]})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(e){return t&&t(),[2]})})}};return i},ca="userProperty",da="eventProperty",ha=function(e){return e===ca||e===da},pa=[ca,da],fa=function(e,t){return function(e){var t=h([],d(new Set((Array.isArray(e)?e:[e]).filter(ha))),!1);return t.length>0?t:h([],d(pa),!1)}(e.trackingMethod).includes(t)},ga=function(e){return fa(e,ca)},va=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return n(t,e),t.prototype.init=function(e,t,r){var n,i;return void 0===e&&(e=""),arguments.length>2?(n=t,i=r):"string"==typeof t?(n=t,i=void 0):(n=null==t?void 0:t.userId,i=t),re(this._init(s(s({},i),{userId:n,apiKey:e})))},t.prototype._init=function(t){var r,n,i,o,c,d,h,p;return l(this,void 0,void 0,function(){var f,g,v,m,y,b,w,S,k,x,C,E,I,O,P,T=this;return u(this,function(R){switch(R.label){case 0:return this.initializing?[2]:(this.initializing=!0,f=function(e){var t,r;return void 0===e&&(e={}),!0===(null===(t=e.remoteConfig)||void 0===t?void 0:t.fetchRemoteConfig)||!1!==(null===(r=e.remoteConfig)||void 0===r?void 0:r.fetchRemoteConfig)&&!1!==e.fetchRemoteConfig}(t),g=null!==(r=t.loggerProvider)&&void 0!==r?r:new ae,t.loggerProvider||g.enable(null!==(n=t.logLevel)&&void 0!==n?n:oe.Warn),v=null!==(i=t.serverZone)&&void 0!==i?i:Tn,y=this._diagnosticsSampleRate,b=null===(o=t.enableDiagnostics)||void 0===o||o,f?(m=new bt(t.apiKey,g,v,null===(c=t.remoteConfig)||void 0===c?void 0:c.serverUrl),[4,new Promise(function(e){null==m||m.subscribe("configs.diagnostics.browserSDK","all",function(t,r,n){if(g.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:r,lastFetch:n},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(y=i);var o=t.enabled;"boolean"==typeof o&&(b=o)}e()})})]):[3,2]);case 1:R.sent(),R.label=2;case 2:return(w=new ct(t.apiKey,g,v,{enabled:b,sampleRate:y})).setTag("library","".concat(rn,"/").concat(tn)),w.setTag("platform","Web"),w.setTag("web_environment",function(){var e=z();if(!e)return"unknown";var t=function(e){var t,r;return"string"==typeof(null===(r=null===(t=e.chrome)||void 0===t?void 0:t.runtime)||void 0===r?void 0:r.id)}(e);return function(e){var t=e.ServiceWorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?t?"chrome_extension_service_worker":"service_worker":function(e){var t=e.WorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?"web_worker":function(e){return void 0!==e.document}(e)?t?"chrome_extension":"browser":function(e){var t,r;return"string"==typeof(null===(r=null===(t=e.process)||void 0===t?void 0:t.versions)||void 0===r?void 0:r.node)}(e)?"node":"unknown"}()),"undefined"!=typeof navigator&&w.setTag("user_agent",navigator.userAgent),[4,Bn(t.apiKey,t,this,w,{loggerProvider:g,serverZone:v,enableDiagnostics:b,diagnosticsSampleRate:y})];case 3:return S=R.sent(),f&&m?[4,new Promise(function(e){null==m||m.subscribe("configs.analyticsSDK.browserSDK","all",function(t,r,n){S.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:r,lastFetch:n},null,2)),t&&ti(t,S),e()})})]:[3,5];case 4:R.sent(),R.label=5;case 5:return[4,e.prototype._init.call(this,S)];case 6:return R.sent(),this.logBrowserOptions(S),this.config.remoteConfigClient=m,k=function(e){return qr(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?s({},e.defaultTracking.attribution):{}}(this.config),qr(this.config.defaultTracking)&&ga(k)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return l(T,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[3,2]:(this.webAttribution=new Zs(k,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new Zs(k,this.config),[4,this.webAttribution.init()]):[3,8];case 7:R.sent(),R.label=8;case 8:return x=je(),C=x.ampTimestamp?Number(x.ampTimestamp):void 0,E=!C||Date.now()<C,I=E&&!Number.isNaN(Number(x.ampSessionId))?Number(x.ampSessionId):void 0,-1!==(O=this.config.deferredSessionId)||this.config.optOut||(O=Date.now()),this.setSessionId(null!==(p=null!==(h=null!==(d=t.sessionId)&&void 0!==d?d:I)&&void 0!==h?h:O)&&void 0!==p?p:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return l(T,void 0,void 0,function(){return u(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(P=Ne(this.config.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,10]:[4,this.add(ei()).promise];case 9:R.sent(),R.label=10;case 10:return[4,this.add(new xe({diagnosticsClient:w})).promise];case 11:return R.sent(),[4,this.add(new nn).promise];case 12:return R.sent(),[4,this.add(new De).promise];case 13:return R.sent(),function(e){Zn||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),Zn=!0)}(this.config),A=this.config.defaultTracking,Br(A,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(Qn()).promise]):[3,15];case 14:R.sent(),R.label=15;case 15:return zr(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Jn()).promise]):[3,17];case 16:R.sent(),R.label=17;case 17:return Wr(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add($n(Qr(this.config))).promise]):[3,20];case 18:return R.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return l(T,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[2]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add($n(Qr(this.config))).promise]);case 1:return t.sent(),[2]}})})}),R.label=20;case 20:return qr(this.config.defaultTracking)&&function(e){return fa(e,da)}(k)?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(ta(k)).promise]):[3,22];case 21:R.sent(),R.label=22;case 22:return Hr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Do(Jr(this.config),{diagnosticsClient:w})).promise]):[3,24];case 23:R.sent(),R.label=24;case 24:return Kr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Jo(Xr(this.config))).promise]):[3,26];case 25:R.sent(),R.label=26;case 26:return $r(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(hs(Yr(this.config))).promise]):[3,28];case 27:R.sent(),R.label=28;case 28:return function(e){return"boolean"==typeof e?e:"object"==typeof e&&!0===e.webVitals}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(Qs()).promise]):[3,30];case 29:R.sent(),R.label=30;case 30:return function(e){return"object"==typeof e&&(!0===e.performanceTracking||"object"==typeof e.performanceTracking)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(rs(Gr(this.config))).promise]):[3,32];case 31:R.sent(),R.label=32;case 32:return function(e){return Br(e,"pageUrlEnrichment")}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(sa()).promise]):[3,34];case 33:R.sent(),R.label=34;case 34:return("boolean"==typeof(M=this.config.customEnrichment)?M:"object"==typeof M&&null!==M&&!1!==M.enabled)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(ua()).promise]):[3,36];case 35:R.sent(),R.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return R.sent(),P.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},r=t.time,n=a(t,["time"]),i="number"==typeof r?{time:r}:void 0;T.track(e.eventType,n,i)}),[2]}var M,A})})},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){Ne(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){Ne(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(V()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){var t,r,n;if("userId"in e&&this.setUserId(e.userId),"deviceId"in e&&e.deviceId&&this.setDeviceId(e.deviceId),"userProperties"in e){this.userProperties=e.userProperties;var i=new F,o=null!==(n=e.userProperties)&&void 0!==n?n:{};try{for(var s=c(Object.entries(o)),a=s.next();!a.done;a=s.next()){var l=d(a.value,2),u=l[0],h=l[1];i.set(u,h)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}this.identify(i)}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,r=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),re(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,re(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return re(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var n=this.getSessionId();n!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,Vr(this.config.defaultTracking)&&(n&&i&&r.push(this.track(bn,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:n,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,r);return this.config.identify&&r.push(this.track(te(this.config.identify)).promise),Vr(this.config.defaultTracking)&&r.push(this.track(yn,void 0,{event_id:s?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,re(Promise.all(r))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=zn(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,r){if(en(t)){var n=t._q;t._q=[],t=Zr(new F,n)}return(null==r?void 0:r.user_id)&&this.setUserId(r.user_id),(null==r?void 0:r.device_id)&&this.setDeviceId(r.device_id),e.prototype.identify.call(this,t,r)},t.prototype.groupIdentify=function(t,r,n,i){if(en(n)){var o=n._q;n._q=[],n=Zr(new F,o)}return e.prototype.groupIdentify.call(this,t,r,n,i)},t.prototype.revenue=function(t,r){if(en(t)){var n=t._q;t._q=[],t=Zr(new ie,n)}return e.prototype.revenue.call(this,t,r)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!ga(this.webAttribution.options))return!1;var r=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(r).promise):this.track(r),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return l(this,void 0,void 0,function(){var r,n,i;return u(this,function(o){return r=Date.now(),n=Le(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===yn||t.event_type===bn||t.session_id&&t.session_id!==this.getSessionId()||(n||i?(this.setSessionId(r),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):n||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=s(s({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",Z(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){e>1||e<0||this.config||(this._diagnosticsSampleRate=e)},t}(ne),ma="[Amplitude]",ya="".concat(ma," Session Replay ID"),ba=Et.US,wa={enabled:!0},Sa=1e3,ka="".concat(ma," Session Replay Debug"),xa="amp-mask",Ca="amp-unmask",Ea="https://api-sr.amplitude.com/sessions/v2/track",Ia="https://api-sr.eu.amplitude.com/sessions/v2/track",Oa="https://api-sr.stag2.amplitude.com/sessions/v2/track",Pa=9e6,Ta=/payload.*exceed/i,Ra=500,Ma=1e4,Aa=1024,_a="X-Session-Replay-Event-Skipped",Na="amplitude-sr-iframe";!function(e){e.GET_SR_PROPS="get-sr-props",e.DEBUG_INFO="debug-info",e.FETCH_REQUEST="fetch-request",e.METADATA="metadata",e.TARGETING_DECISION="targeting-decision",e.REPLAY_GATE_DECISION="replay-gate-decision"}(la||(la={}));var Da=function(){function e(e){this.logger=e,this.log=this.getSafeMethod("log"),this.warn=this.getSafeMethod("warn"),this.error=this.getSafeMethod("error"),this.debug=this.getSafeMethod("debug")}return e.prototype.getSafeMethod=function(e){var t;if(!this.logger)return function(){};var r=this.logger[e];return"function"==typeof r?(null!==(t=r.__rrweb_original__)&&void 0!==t?t:r).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),La="medium";function Fa(e,t){return t||("STAGING"===e?Oa:"EU"===e?Ia:Ea)}var Ua=function(e,t,r){switch(t){case"light":if("input"!==e)return!1;var n=r?function(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?t.toLowerCase():null}(r):"";return!!n&&(!!["password","hidden","email","tel"].includes(n)||!!r.autocomplete.startsWith("cc-"));case"medium":return"input"===e;case"conservative":return!0;default:return Ua(e,La,r)}},ja=function(e,t){var r,n,i;if(e&&t.urlMaskLevels)try{for(var o=c(t.urlMaskLevels),s=o.next();!s.done;s=o.next()){var a=s.value;if($a(a.match).test(e))return a.maskLevel}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null!==(i=t.defaultMaskLevel)&&void 0!==i?i:La},Ba=function(e,t,r,n){var i,o;if(void 0===t&&(t={defaultMaskLevel:La}),r){if(r.closest("."+xa))return!0;var s=(null!==(i=t.maskSelector)&&void 0!==i?i:[]).some(function(e){return r.closest(e)});if(s)return!0;if(r.closest("."+Ca))return!1;var a=(null!==(o=t.unmaskSelector)&&void 0!==o?o:[]).some(function(e){return r.closest(e)});if(a)return!1}return Ua(e,ja(n,t),r)},qa=function(e,t,r){return function(n,i){return Ba(e,t,i,null==r?void 0:r())?n.replace(/[^\s]/g,"*"):n}},za=function(e,t){return function(r,n,i){var o;if("style"===r)return n;if(!(null!==(o=null==e?void 0:e.maskAttributes)&&void 0!==o?o:[]).includes(r))return n;var s=["INPUT","SELECT","TEXTAREA"].includes(i.tagName)?"input":"text";return Ba(s,e,i,null==t?void 0:t())?n.replace(/[^\s]/g,"*"):n}},Wa=function(){var e=z();return(null==e?void 0:e.location)?e.location.href:""},Va=new Map,$a=function(e){var t=Va.get(e);if(t)return t;var r="\0TRAIL\0",n="\0MID\0",i="\0DS\0",o="\0ST\0",s="\0QU\0",a=e;a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=a.replace(/\/\*\*$/,r)).replace(/\/\*\*\//g,n)).replace(/\*\*/g,i)).replace(/\*/g,o)).replace(/\?/g,s)).replace(/[.+^${}()|[\]\\]/g,"\\$&")).split(r).join("(/.*)?")).split(n).join("/(.*\\/)?")).split(i).join(".*")).split(o).join(".*")).split(s).join(".");var l=new RegExp("^".concat(a,"$"));return Va.set(e,l),l},Ha=function(e,t){var r,n;try{for(var i=c(t),o=i.next();!o.done;o=i.next()){var s=o.value,a=$a(s.selector);if(a.test(e))return e.replace(a,s.replacement)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e},Ka=function(){return l(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),(e=z())?[4,e.navigator.storage.estimate()]:[3,2];case 1:return t=a.sent(),r=t.usage,n=t.quota,i=t.usageDetails,o=r?Math.round(r/Aa):0,s=r&&n?Math.round(1e3*(r/n+Number.EPSILON))/1e3:0,[2,{totalStorageSize:o,percentOfQuota:s,usageDetails:JSON.stringify(i)}];case 2:return[3,4];case 3:return a.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:""}]}})})},Ga=function(e){var t=s({},e),r=t.apiKey;return t.apiKey="****".concat(r.substring(r.length-4)),t},Ja=function(){return{flushMaxRetries:2,logLevel:oe.Warn,loggerProvider:new ae,transportProvider:new ht}},Xa=function(e){function t(t,r){var n,i,o,a,l,u,c,p,f,g,v,m,y,b,w=this,S=Ja();(w=e.call(this,s(s({transportProvider:S.transportProvider,loggerProvider:new Da(r.loggerProvider||S.loggerProvider)},r),{apiKey:t}))||this).flushMaxRetries=void 0!==r.flushMaxRetries&&r.flushMaxRetries<=S.flushMaxRetries?r.flushMaxRetries:S.flushMaxRetries,w.apiKey=t,w.sampleRate=r.sampleRate||0,w.serverZone=r.serverZone||ba,w.configServerUrl=r.configServerUrl,w.trackServerUrl=r.trackServerUrl,w.shouldInlineStylesheet=r.shouldInlineStylesheet,w.inlineImages=r.inlineImages,w.version=r.version,w.performanceConfig=r.performanceConfig||wa,w.storeType=null!==(n=r.storeType)&&void 0!==n?n:"memory",w.applyBackgroundColorToBlockedElements=null!==(i=r.applyBackgroundColorToBlockedElements)&&void 0!==i&&i,w.enableUrlChangePolling=null!==(o=r.enableUrlChangePolling)&&void 0!==o&&o,w.urlChangePollingInterval=null!==(a=r.urlChangePollingInterval)&&void 0!==a?a:Sa,w.captureDocumentTitle=null!==(l=r.captureDocumentTitle)&&void 0!==l&&l,void 0!==r.fullSnapshotIntervalMs&&(w.fullSnapshotIntervalMs=r.fullSnapshotIntervalMs),void 0!==r.eagerFullSnapshotSend&&(w.eagerFullSnapshotSend=r.eagerFullSnapshotSend),w.captureFullSnapshotOnFocus=null!==(u=r.captureFullSnapshotOnFocus)&&void 0!==u&&u,void 0!==r.maxPersistedEventsSizeBytes&&(w.maxPersistedEventsSizeBytes=tl(r.maxPersistedEventsSizeBytes,Qa,Za,"maxPersistedEventsSizeBytes",w.loggerProvider)),void 0!==r.maxSingleEventSizeBytes&&(w.maxSingleEventSizeBytes=tl(r.maxSingleEventSizeBytes,Qa,el,"maxSingleEventSizeBytes",w.loggerProvider)),w.privacyConfig=s(s({},null!==(c=r.privacyConfig)&&void 0!==c?c:{}),{unmaskSelector:Array.from(new Set(h([".".concat(Ca)],d(null!==(f=null===(p=r.privacyConfig)||void 0===p?void 0:p.unmaskSelector)&&void 0!==f?f:[]),!1)))}),r.interactionConfig&&(w.interactionConfig=r.interactionConfig,w.interactionConfig.ugcFilterRules&&function(e){if(!e.every(function(e){return"string"==typeof e.selector&&"string"==typeof e.replacement}))throw new Error("ugcFilterRules must be an array of objects with selector and replacement properties");if(!e.every(function(e){return"string"==typeof(t=e.selector)&&""!==t.trim()&&!!/^\/|^https?:\/\/[^\s]+$/.test(t);var t}))throw new Error("ugcFilterRules must be an array of objects with valid globs")}(w.interactionConfig.ugcFilterRules)),r.debugMode&&(w.debugMode=r.debugMode);var k=r;return w.useWebWorker=null===(m=null!==(g=r.useWebWorker)&&void 0!==g?g:null===(v=k.experimental)||void 0===v?void 0:v.useWebWorker)||void 0===m||m,w.enableTransportCompression=null===(y=r.enableTransportCompression)||void 0===y||y,w.sendTimeoutMs=r.sendTimeoutMs,w.captureAdoptedStyleSheets=null===(b=r.captureAdoptedStyleSheets)||void 0===b||b,r.crossOriginIframes&&(w.crossOriginIframes=r.crossOriginIframes),r.flushIntervalConfig?w.flushIntervalConfig=function(e,t){var r,n,i={};void 0!==e.minIntervalMs&&(!Number.isFinite(e.minIntervalMs)||e.minIntervalMs<Ya?(t.warn("flushIntervalConfig.minIntervalMs ".concat(e.minIntervalMs," is below floor ").concat(Ya,"ms; clamping.")),i.minIntervalMs=Ya):i.minIntervalMs=e.minIntervalMs);void 0!==e.maxIntervalMs&&(Number.isNaN(e.maxIntervalMs)||e.maxIntervalMs<Ya?(t.warn("flushIntervalConfig.maxIntervalMs ".concat(e.maxIntervalMs," is below floor ").concat(Ya,"ms; clamping.")),i.maxIntervalMs=Ya):i.maxIntervalMs=e.maxIntervalMs);if(void 0!==i.minIntervalMs||void 0!==i.maxIntervalMs){var o=null!==(r=i.minIntervalMs)&&void 0!==r?r:Ra,s=null!==(n=i.maxIntervalMs)&&void 0!==n?n:Ma;s<o&&(void 0===i.maxIntervalMs?(t.warn("flushIntervalConfig.minIntervalMs (".concat(o,") exceeds the default maxIntervalMs (").concat(Ma,"); raising max to match min.")),i.maxIntervalMs=o):void 0===i.minIntervalMs?(t.warn("flushIntervalConfig.maxIntervalMs (".concat(s,") is below the default minIntervalMs (").concat(Ra,"); lowering min to match max.")),i.minIntervalMs=s):(t.warn("flushIntervalConfig.maxIntervalMs (".concat(i.maxIntervalMs,") is less than minIntervalMs (").concat(i.minIntervalMs,"); raising max to match min.")),i.maxIntervalMs=i.minIntervalMs))}return i}(r.flushIntervalConfig,w.loggerProvider):w.flushIntervalConfig={minIntervalMs:1e3,maxIntervalMs:1e4},w.handleSendEvents=r.handleSendEvents,w.handleFetchConfig=r.handleFetchConfig,w}return n(t,e),t}(ce),Ya=100,Qa=1e3,Za=8e6,el=1e7;function tl(e,t,r,n,i){if(Number.isFinite(e))return e<t?(i.warn("".concat(n," ").concat(e," is below floor ").concat(t,"; clamping.")),t):e>r?(i.warn("".concat(n," ").concat(e," exceeds ceiling ").concat(r,"; clamping.")),r):e;i.warn("".concat(n," value is not a finite number (got ").concat(String(e),"); ignoring."))}var rl=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(rl||{}),nl=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(nl||{}),il=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(il||{}),ol=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){var e,t,r,n,i,o,a;return l(this,void 0,void 0,function(){var l,p,f,g,v,m,y,b,w,S,k,x,C,E,I,O,P,T=this;return u(this,function(u){switch(u.label){case 0:(l=s({},this.localConfig)).optOut=this.localConfig.optOut,l.captureEnabled=!0,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,new Promise(function(e,t){T.remoteConfigClient.subscribe("configs.sessionReplay",{timeout:1500},function(r,n){var i;if(T.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(n,":"),JSON.stringify(r,null,2)),r){var o=r,s=o.sr_sampling_config,a=o.sr_privacy_config,u=o.sr_targeting_config,c=null===(i=l.interactionConfig)||void 0===i?void 0:i.ugcFilterRules;l.interactionConfig=o.sr_interaction_config,l.interactionConfig&&c&&(l.interactionConfig.ugcFilterRules=c),l.loggingConfig=o.sr_logging_config,(s||a||u)&&(p={},s&&(p.sr_sampling_config=s),a&&(p.sr_privacy_config=a),u&&(p.sr_targeting_config=u)),e()}else t(new Error("No remote config received"))})})];case 2:return u.sent(),[3,4];case 3:return f=u.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",f),l.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:l,remoteConfig:void 0}];case 4:if(!p)return[2,{localConfig:this.localConfig,joinedConfig:l,remoteConfig:p}];if(g=p.sr_sampling_config,v=p.sr_privacy_config,m=p.sr_targeting_config,g&&Object.keys(g).length>0?(Object.prototype.hasOwnProperty.call(g,"capture_enabled")?l.captureEnabled=g.capture_enabled:l.captureEnabled=!1,Object.prototype.hasOwnProperty.call(g,"sample_rate")&&(l.sampleRate=g.sample_rate),Object.prototype.hasOwnProperty.call(g,"min_session_duration_ms")&&(l.minSessionDurationMs=this.sanitizeMinSessionDurationMs(g.min_session_duration_ms))):(l.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),v){y=null!==(e=l.privacyConfig)&&void 0!==e?e:{},b={defaultMaskLevel:null!==(r=null!==(t=v.defaultMaskLevel)&&void 0!==t?t:y.defaultMaskLevel)&&void 0!==r?r:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:h([],d(new Set(h(h([],d(null!==(n=y.maskAttributes)&&void 0!==n?n:[]),!1),d(null!==(i=v.maskAttributes)&&void 0!==i?i:[]),!1))),!1),urlMaskLevels:h(h([],d(null!==(o=v.urlMaskLevels)&&void 0!==o?o:[]),!1),d(null!==(a=y.urlMaskLevels)&&void 0!==a?a:[]),!1)},w=function(e){var t,r,n,i,o,s,a,l,u,d={};"string"==typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var h=c(null!==(a=e.blockSelector)&&void 0!==a?a:[]),p=h.next();!p.done;p=h.next()){d[p.value]="block"}}catch(e){t={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}try{for(var f=c(null!==(l=e.maskSelector)&&void 0!==l?l:[]),g=f.next();!g.done;g=f.next()){d[g.value]="mask"}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}try{for(var v=c(null!==(u=e.unmaskSelector)&&void 0!==u?u:[]),m=v.next();!m.done;m=v.next()){d[m.value]="unmask"}}catch(e){o={error:e}}finally{try{m&&!m.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}return d},S=s(s({},w(y)),w(v));try{for(k=c(Object.entries(S)),x=k.next();!x.done;x=k.next())C=d(x.value,2),E=C[0],"mask"===(I=C[1])?b.maskSelector.push(E):"block"===I?b.blockSelector.push(E):"unmask"===I&&b.unmaskSelector.push(E)}catch(e){O={error:e}}finally{try{x&&!x.done&&(P=k.return)&&P.call(k)}finally{if(O)throw O.error}}l.privacyConfig=(R=b,M=this.localConfig.loggerProvider,A=document.createDocumentFragment(),_=function(e){if(void 0===e&&(e=[]),"string"==typeof e&&(e=[e]),e=e.filter(function(e){try{A.querySelector(e)}catch(t){return M.warn('[session-replay-browser] omitting selector "'.concat(e,'" because it is invalid')),!1}return!0}),0!==e.length)return e},R.blockSelector=_(R.blockSelector),R.maskSelector=_(R.maskSelector),R.unmaskSelector=_(R.unmaskSelector),R)}return m&&Object.keys(m).length>0&&(l.targetingConfig=m),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:Ga(l)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:l,remoteConfig:p}]}var R,M,A,_})})},e.prototype.sanitizeMinSessionDurationMs=function(e){if("number"==typeof e&&Number.isFinite(e)){if(!(e<0))return e>sl?(this.localConfig.loggerProvider.warn("min_session_duration_ms remote value ".concat(e," exceeds ").concat(sl,"ms ceiling; clamping.")),sl):e;this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is negative (".concat(e,"); ignoring."))}else this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is not a finite number (got ".concat(String(e),"); ignoring."))},e}(),sl=6e4,al=function(e,t){return l(void 0,void 0,void 0,function(){var r,n;return u(this,function(i){return r=new Xa(e,t),n=new bt(e,r.loggerProvider,r.serverZone,t.configServerUrl,t.handleFetchConfig),[2,new ol(n,r)]})})};function ll(e){if(e.type!==rl.IncrementalSnapshot)return!1;var t=e.data;return t.source===nl.Mutation&&!t.isAttachIframe}function ul(e){var t,r,n=new Map;if(e.forEach(function(e,t){if(e.attributes&&"style"in e.attributes){var r=n.get(e.id);r?r.push(t):n.set(e.id,[t])}}),0===n.size)return e;var i=function(t){return e[t].attributes.style},o=new Set,a=new Map,l=function(e){if(1===e.length)return"continue";var t=-1;e.forEach(function(e,r){var n;("object"!=typeof(n=i(e))||null===n)&&(t=r)});var r=[];if(e.forEach(function(e,n){n!==t&&(o.add(e),n>t&&r.push(e))}),r.length>0){var n=r[r.length-1],s=function(e){var t,r,n,i,o={};try{for(var s=c(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{for(var u=(n=void 0,c(Object.keys(l))),d=u.next();!d.done;d=u.next()){var h=d.value;o[h]=l[h]}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o}(r.map(function(e){return i(e)}));o.delete(n),a.set(n,s)}};try{for(var u=c(n.values()),d=u.next();!d.done;d=u.next()){l(d.value)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}if(0===o.size&&0===a.size)return e;var h=[];return e.forEach(function(e,t){var r=a.get(t);if(void 0===r)if(o.has(t)){var n=s({},e.attributes);delete n.style,Object.keys(n).length>0&&h.push(s(s({},e),{attributes:n}))}else h.push(e);else h.push(s(s({},e),{attributes:s(s({},e.attributes),{style:r})}))}),h}function cl(e){var t,r,n,i,o=e[0],a=new Map,l=new Map,u=new Map,h=new Map,p=new Map;e.forEach(function(e,t){var r,n,i,o,s=e.data;try{for(var d=c(s.adds),f=d.next();!f.done;f=d.next()){var g=f.value;a.has(g.node.id)||a.set(g.node.id,t),l.set(g.node.id,t),p.set(g.node.id,g.parentId)}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}try{for(var v=c(s.removes),m=v.next();!m.done;m=v.next()){var y=m.value;u.has(y.id)||u.set(y.id,t),h.set(y.id,t)}}catch(e){i={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}});var f=new Set,g=new Set;try{for(var v=c(a),m=v.next();!m.done;m=v.next()){var y=d(m.value,2),b=y[0],w=y[1],S=u.get(b);if(void 0!==S)l.get(b)>=h.get(b)||(w<S?f.add(b):S<w&&g.add(b))}}catch(e){t={error:e}}finally{try{m&&!m.done&&(r=v.return)&&r.call(v)}finally{if(t)throw t.error}}var k=new Set;if(f.size>0||g.size>0)for(var x=!0;x;){x=!1;try{for(var C=(n=void 0,c(p)),E=C.next();!E.done;E=C.next()){var I=d(E.value,2),O=I[0],P=I[1];if(!f.has(O)&&!g.has(O)&&!k.has(O)&&(f.has(P)||g.has(P)||k.has(P))){var T=u.get(O),R=a.get(O);void 0!==T&&void 0!==R&&T<R?g.add(O):void 0!==T&&void 0!==R&&T===R?k.add(O):f.add(O),x=!0}}}catch(e){n={error:e}}finally{try{E&&!E.done&&(i=C.return)&&i.call(C)}finally{if(n)throw n.error}}}var M=f.size>0||g.size>0||k.size>0,A=[];e.forEach(function(e,t){var r,n;try{for(var i=c(e.data.removes),o=i.next();!o.done;o=i.next()){var s=o.value;f.has(s.id)||(g.has(s.id)&&t>=a.get(s.id)||k.has(s.id)&&(f.has(s.parentId)||g.has(s.parentId)||k.has(s.parentId))||A.push(s))}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}});var _=e.flatMap(function(e){return e.data.adds}),N=e.flatMap(function(e){return e.data.texts}),D=e.flatMap(function(e){return e.data.attributes}),L=M?D.filter(function(e){return!f.has(e.id)&&!g.has(e.id)&&!k.has(e.id)}):D,F={source:nl.Mutation,removes:A,adds:M?_.filter(function(e){return!f.has(e.node.id)&&!g.has(e.node.id)&&!k.has(e.node.id)}):_,texts:M?N.filter(function(e){return!f.has(e.id)&&!g.has(e.id)&&!k.has(e.id)}):N,attributes:ul(L)};return s(s({},o),{data:F})}function dl(e){if(e.length<=1)return e;for(var t=[],r=0;r<e.length;)if(ll(e[r])){for(var n=r+1;n<e.length&&ll(e[n]);)n++;t.push(n>r+1?cl(e.slice(r,n)):e[r]),r=n}else t.push(e[r]),r++;return t}var hl=function(){function e(e,t,r,n,i){var o,s=this;this.taskQueue=[],this.pendingQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t=e,r=t.type,n=t.timestamp,i=t.delay,o=t.data;return null!=i?JSON.stringify({type:r,timestamp:n,delay:i,data:o}):JSON.stringify({type:r,timestamp:n,data:o})},this.addCompressedEventToManager=function(e,t){var r,n=new Blob([e]).size;n>(null!==(r=s.config.maxSingleEventSizeBytes)&&void 0!==r?r:Pa)?s.config.loggerProvider.warn("Session replay event dropped: serialized size ".concat(Math.round(n/1024)," KB exceeds maximum allowed event size. If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support.")):s.eventsManager&&s.deviceId&&s.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:s.deviceId})},this.addCompressedEvent=function(e,t){if(s.worker)try{s.worker.postMessage({event:e,sessionId:t})}catch(r){"DataCloneError"===r.name?s.worker.postMessage(JSON.stringify({event:e,sessionId:t})):s.config.loggerProvider.warn("Unexpected error while posting message to worker:",r)}else{var r=s.compressEvent(e);s.addCompressedEventToManager(r,t)}},this.flushQueue=function(){var e;for(s.pendingQueue.length>0&&(e=s.taskQueue).push.apply(e,h([],d(s.mergeMutationTasks(s.pendingQueue.splice(0))),!1));s.taskQueue.length>0;){var t=s.taskQueue.shift();if(t){var r=t.event,n=t.sessionId,i=s.compressEvent(r);s.addCompressedEventToManager(i,n)}}s.isProcessing=!1},this.terminate=function(){var e;null===(e=s.worker)||void 0===e||e.terminate()};var a=z();if(this.canUseIdleCallback=a&&"requestIdleCallback"in a,this.eventsManager=e,this.config=t,this.deviceId=r,this.timeout=(null===(o=t.performanceConfig)||void 0===o?void 0:o.timeout)||2e3,this.onFullSnapshotProcessed=i,n){t.loggerProvider.log("Enabling web worker for compression");try{var l=new Blob([n],{type:"application/javascript"}),u=URL.createObjectURL(l),c=new Worker(u);c.onerror=function(e){e.preventDefault(),t.loggerProvider.error("Worker failed, falling back to non-worker compression: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),c.terminate(),s.worker=void 0},c.onmessage=function(e){var t=e.data,r=t.compressedEvent,n=t.sessionId;s.addCompressedEventToManager(r,n)},this.worker=c}catch(e){t.loggerProvider.error("Failed to create worker, falling back to non-worker compression:",e)}}}return e.prototype.scheduleIdleProcessing=function(){var e=this;this.isProcessing||(this.isProcessing=!0,requestIdleCallback(function(t){e.processQueue(t)},{timeout:this.timeout}))},e.prototype.enqueueEvent=function(e,t){var r,n,i,o;if(e.type===rl.FullSnapshot){if(this.config.loggerProvider.debug("Processing full snapshot immediately."),this.taskQueue.length>0||this.pendingQueue.length>0){var s=h(h([],d(this.taskQueue.splice(0)),!1),d(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1);try{for(var a=c(s),l=a.next();!l.done;l=a.next()){var u=l.value,p=this.compressEvent(u.event);this.addCompressedEventToManager(p,u.sessionId)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}this.isProcessing=!1}var f=this.compressEvent(e);return this.addCompressedEventToManager(f,t),void(null===(i=this.onFullSnapshotProcessed)||void 0===i||i.call(this))}this.canUseIdleCallback&&(null===(o=this.config.performanceConfig)||void 0===o?void 0:o.enabled)?(this.config.loggerProvider.debug("Enqueuing event for processing during idle time."),this.pendingQueue.push({event:e,sessionId:t}),this.scheduleIdleProcessing()):(this.config.loggerProvider.debug("Processing event without idle callback."),this.addCompressedEvent(e,t))},e.prototype.processQueue=function(e){var t,r=this;for(this.pendingQueue.length>0&&(t=this.taskQueue).push.apply(t,h([],d(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1));this.taskQueue.length>0&&(e.timeRemaining()>0||e.didTimeout);){var n=this.taskQueue.shift();if(n){var i=n.event,o=n.sessionId;this.addCompressedEvent(i,o)}}this.taskQueue.length>0||this.pendingQueue.length>0?requestIdleCallback(function(e){r.processQueue(e)},{timeout:this.timeout}):this.isProcessing=!1},e.prototype.mergeMutationTasks=function(e){var t,r,n;if(!1===(null===(n=this.config.performanceConfig)||void 0===n?void 0:n.mergeMutations))return e;if(e.length<=1)return e;for(var i=[],o=0;o<e.length;){for(var s=e[o].sessionId,a=o+1;a<e.length&&e[a].sessionId===s;)a++;var l=dl(e.slice(o,a).map(function(e){return e.event}));try{for(var u=(t=void 0,c(l)),d=u.next();!d.done;d=u.next()){var h=d.value;i.push({event:h,sessionId:s})}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}o=a}return i},e}(),pl="Session replay event batch rejected due to exceeded retry count",fl="Failed to store session replay events in IndexedDB",gl="Session replay event batch dropped: server signalled capture disabled or session out of valid range for this session",vl="1.50.3-video-analytics-5.0";function ml(e,t){return l(this,void 0,void 0,function(){var r,n,i,o,s,a,d,h,p,f,g,v,m,y,b=this;return u(this,function(w){switch(w.label){case 0:return w.trys.push([0,4,,5]),r=t.CompressionStream,n=new r("gzip"),i=n.writable.getWriter(),o=n.readable.getReader(),s=[],a=l(b,void 0,void 0,function(){var e,t,r;return u(this,function(n){switch(n.label){case 0:return[4,o.read()];case 1:if(e=n.sent(),t=e.done,r=e.value,t)return[3,3];s.push(r),n.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,i.write((new TextEncoder).encode(e))];case 1:return w.sent(),[4,i.close()];case 2:return w.sent(),[4,a];case 3:w.sent(),d=s.reduce(function(e,t){return e+t.length},0),h=new Uint8Array(d),p=0;try{for(f=c(s),g=f.next();!g.done;g=f.next())v=g.value,h.set(v,p),p+=v.length}catch(e){m={error:e}}finally{try{g&&!g.done&&(y=f.return)&&y.call(f)}finally{if(m)throw m.error}}return[2,h];case 4:return w.sent(),[2,null];case 5:return[2]}})})}var yl=function(){function e(e){var t=e.trackServerUrl,r=e.loggerProvider,n=e.payloadBatcher,i=e.workerScript,o=e.enableTransportCompression,s=e.sendTimeoutMs,a=e.handleSendEvents,l=this;if(this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.sendIdCounter=0,this.pendingWorkerRequests=new Map,this.timedOutWorkerRequests=new Map,this.flushPauseUntilMs=0,this.mergeOnNextFlush=!1,this.coalesceNextFlush=!1,this.mergeLogFiredThisPause=!1,this.killedSessions=new Set,this.loggerProvider=r,this.payloadBatcher=n||function(e){return e},this.trackServerUrl=t,this.enableTransportCompression=null==o||o,this.sendTimeoutMs=null!=s?s:1e4,this.handleSendEvents=a,i)try{var u=new Blob([i],{type:"application/javascript"}),h=URL.createObjectURL(u),p=new Worker(h);p.onerror=function(e){var t,n;e.preventDefault(),r.error("Track destination worker failed, falling back to main-thread sending: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),p.terminate(),l.worker=void 0;try{for(var i=c(l.pendingWorkerRequests),o=i.next();!o.done;o=i.next()){var s=d(o.value,2)[1];s.timeout&&clearTimeout(s.timeout),r.warn("Session replay event send failed due to worker crash: ".concat(e.message)),s.resolve()}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}l.pendingWorkerRequests.clear(),l.timedOutWorkerRequests.clear()},p.onmessage=function(e){var t=e.data;if("log"===t.type)r.log(t.message);else if("warn"===t.type)r.warn(t.message);else if("payload_too_large"===t.type){var n=l.pendingWorkerRequests.get(t.id);if(n)n.timeout&&clearTimeout(n.timeout),l.handlePayloadTooLargeResponse(n.context,t.isWaf),n.resolve(),l.pendingWorkerRequests.delete(t.id);else(i=l.timedOutWorkerRequests.get(t.id))&&(l.timedOutWorkerRequests.delete(t.id),l.handlePayloadTooLargeResponse(i,t.isWaf))}else if("complete"===t.type){var i,o=l.pendingWorkerRequests.get(t.id);if(o)o.timeout&&clearTimeout(o.timeout),void 0!==t.skipCode&&l.applyServerDirective(o.context.sessionId,t.skipCode),l.completeRequest({context:o.context}),o.resolve(),l.pendingWorkerRequests.delete(t.id);else(i=l.timedOutWorkerRequests.get(t.id))&&(l.timedOutWorkerRequests.delete(t.id),void 0!==t.skipCode&&l.applyServerDirective(i.sessionId,t.skipCode),l.completeRequest({context:i}))}else"fetch-request"===t.type&&l.handleDelegatedFetch(p,t).catch(function(e){r.warn("Failed to handle delegated session replay fetch:",e)})},this.worker=p}catch(e){r.error("Failed to create track destination worker, falling back to main-thread sending:",e)}}return e.prototype.sendEventsList=function(e){this.addToQueue(s(s({},e),{attempts:0,timeout:0}))},e.prototype.markCoalesceNextFlush=function(){this.coalesceNextFlush=!0,this.schedule(0)},e.prototype.sendBeacon=function(e){var t,r,n=this,i=e.events,o=e.sessionId,s=e.deviceId,a=e.apiKey,l=e.serverZone,u=function(e){return new Blob([e]).size},c=i,d=JSON.stringify({version:2,events:c});if(u(d)>65536){for(var h=0,p=c.length;h<p;){var f=Math.floor((h+p+1)/2);u(JSON.stringify({version:2,events:c.slice(0,f)}))<=65536?h=f:p=f-1}c=c.slice(0,h),d=JSON.stringify({version:2,events:c}),this.loggerProvider.warn("sendBeacon payload exceeded 64 KB limit, trimmed from ".concat(i.length," to ").concat(c.length," events"))}if(0!==c.length)if(this.handleSendEvents){var g=new URLSearchParams({device_id:s,session_id:String(o),type:"replay"}),v="".concat(Fa(l,this.trackServerUrl),"?").concat(g.toString()),m={"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(a)};this.loggerProvider.debug("Routing session replay exit batch (".concat(c.length," events) through custom transport for session id ").concat(o,"."));try{this.handleSendEvents({url:v,method:"POST",headers:m,body:d,keepalive:!0}).catch(function(e){n.loggerProvider.warn("Custom transport failed to send session replay exit batch:",e)})}catch(e){this.loggerProvider.warn("Custom transport threw while sending session replay exit batch:",e)}}else{var y=new URLSearchParams({device_id:s,session_id:String(o),type:"replay",api_key:a}),b="".concat(Fa(l,this.trackServerUrl),"?").concat(y.toString()),w=z();try{var S=new Blob([d],{type:"application/json"});!1===(null===(r=null===(t=null==w?void 0:w.navigator)||void 0===t?void 0:t.sendBeacon)||void 0===r?void 0:r.call(t,b,S))&&this.loggerProvider.warn("sendBeacon failed to queue session replay payload")}catch(e){}}},e.prototype.addToQueue=function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];t.filter(function(t){return e.killedSessions.has(t.sessionId)?(e.completeRequest({context:t,err:gl}),!1):t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:pl}),!1)}).forEach(function(t){e.queue=e.queue.concat(t),e.schedule(0)})},e.prototype.schedule=function(e){var t=this;if(!this.scheduled){var r=this.flushPauseUntilMs-Date.now(),n=r>e?r:e;r>0&&(this.mergeOnNextFlush=!0),this.scheduled=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},n)}},e.prototype.flush=function(e){return void 0===e&&(e=!1),l(this,void 0,void 0,function(){var t,r,n,i,o,s,a;return u(this,function(l){switch(l.label){case 0:t=this.queue,this.queue=[],this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),this.mergeOnNextFlush?(this.mergeOnNextFlush=!1,this.coalesceNextFlush=!1,t=this.mergeQueueAfterThrottle(t)):this.coalesceNextFlush&&(this.coalesceNextFlush=!1,t=this.mergeDrainBacklog(t)),l.label=1;case 1:l.trys.push([1,6,7,8]),r=c(t),n=r.next(),l.label=2;case 2:return n.done?[3,5]:(i=n.value,[4,this.send(i,e)]);case 3:l.sent(),l.label=4;case 4:return n=r.next(),[3,2];case 5:return[3,8];case 6:return o=l.sent(),s={error:o},[3,8];case 7:try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}return[7];case 8:return[2]}})})},e.prototype.mergeQueueAfterThrottle=function(e){var t=this.coalesceByIdentity(e);return t.length<e.length&&!this.mergeLogFiredThisPause&&(this.mergeLogFiredThisPause=!0,this.loggerProvider.log("Session replay throttle pause ended; merged ".concat(e.length," queued batches into ").concat(t.length," request(s)"))),t},e.prototype.mergeDrainBacklog=function(e){var t=this.coalesceByIdentity(e);return t.length<e.length&&this.loggerProvider.log("Session replay coalesced ".concat(e.length," persisted page-load backlog batches into ").concat(t.length," request(s)")),t},e.prototype.coalesceByIdentity=function(e){var t,r,n,i,o,a,p,f,g,v,m,y=this;if(e.length<=1)return e;var b=new Map;try{for(var w=c(e),S=w.next();!S.done;S=w.next()){var k=S.value,x=[k.sessionId,null!==(o=k.deviceId)&&void 0!==o?o:"",null!==(a=k.apiKey)&&void 0!==a?a:"",k.type,null!==(p=k.serverZone)&&void 0!==p?p:"",k.sampleRate,null!==(g=null===(f=k.version)||void 0===f?void 0:f.type)&&void 0!==g?g:"",null!==(m=null===(v=k.version)||void 0===v?void 0:v.version)&&void 0!==m?m:""].join("|"),C=b.get(x);C?C.push(k):b.set(x,[k])}}catch(e){t={error:e}}finally{try{S&&!S.done&&(r=w.return)&&r.call(w)}finally{if(t)throw t.error}}var E=[],I=function(e){var t,r;if(1===e.length)return E.push(e[0]),"continue";var n=null,i=0,o=function(){n&&E.push(n),n=null,i=0},a=function(e){var t=e.events.reduce(function(e,t){return e+new Blob([t]).size},0);if(null===n)return n=s(s({},e),{events:h([],d(e.events),!1),attempts:0}),i=t,"continue";if(i+t>4e6)return o(),n=s(s({},e),{events:h([],d(e.events),!1),attempts:0}),i=t,"continue";var r=n.onComplete,a=e.onComplete;n.events=n.events.concat(e.events),i+=t,n.onComplete=function(){return l(y,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,Promise.allSettled([r(),a()])];case 1:return e.sent(),[2]}})})}};try{for(var p=(t=void 0,c(e)),f=p.next();!f.done;f=p.next()){a(f.value)}}catch(e){t={error:e}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}o()};try{for(var O=c(b.values()),P=O.next();!P.done;P=O.next()){I(P.value)}}catch(e){n={error:e}}finally{try{P&&!P.done&&(i=O.return)&&i.call(O)}finally{if(n)throw n.error}}return E},e.prototype.send=function(e,t){return void 0===t&&(t=!0),l(this,void 0,void 0,function(){var r,n,i,o;return u(this,function(s){return this.killedSessions.has(e.sessionId)?[2,this.completeRequest({context:e,err:gl})]:(r=e.apiKey)?(n=e.deviceId)?0===(i=this.payloadBatcher({version:1,events:e.events})).events.length?(this.completeRequest({context:e}),[2]):(o=this.worker)?[2,this.sendViaWorker(o,e,i,t)]:[2,this.sendOnMainThread(r,n,e,i,t)]:[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})]:[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})]})})},e.prototype.sendViaWorker=function(e,t,r,n){return l(this,void 0,void 0,function(){var i,o=this;return u(this,function(s){return i="".concat(++this.sendIdCounter),[2,new Promise(function(s){var a,l=o.sendTimeoutMs>0?setTimeout(function(){var e=o.pendingWorkerRequests.get(i);e&&(o.pendingWorkerRequests.delete(i),o.rememberTimedOutRequest(i,e.context),o.loggerProvider.warn("Session replay worker send timed out after ".concat(o.sendTimeoutMs,"ms; leaving events for retry")),e.resolve())},o.sendTimeoutMs):void 0;o.pendingWorkerRequests.set(i,{context:t,resolve:s,timeout:l}),e.postMessage({type:"send",id:i,payload:r,useRetry:n,useCustomTransport:!!o.handleSendEvents,context:{apiKey:t.apiKey,deviceId:t.deviceId,sessionId:t.sessionId,events:t.events,eventType:t.type,flushMaxRetries:null!==(a=t.flushMaxRetries)&&void 0!==a?a:0,sampleRate:t.sampleRate,serverZone:t.serverZone,trackServerUrl:o.trackServerUrl,version:t.version,currentUrl:Wa(),sdkVersion:vl,enableTransportCompression:o.enableTransportCompression,sendTimeoutMs:o.sendTimeoutMs}})})]})})},e.prototype.rememberTimedOutRequest=function(e,t){var r,n;if(this.timedOutWorkerRequests.set(e,t),this.timedOutWorkerRequests.size>256)try{for(var i=c(this.timedOutWorkerRequests.keys()),o=i.next();!o.done;o=i.next()){var s=o.value;this.timedOutWorkerRequests.delete(s);break}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},e.prototype.handleDelegatedFetch=function(e,t){var r,n,i;return l(this,void 0,void 0,function(){var o,s,a,l,c,d,h,p,f,g,v;return u(this,function(u){switch(u.label){case 0:o=t.requestId,s=t.url,a=t.method,l=t.headers,c=t.body,d=t.keepalive,u.label=1;case 1:return u.trys.push([1,10,,11]),h=void 0,this.handleSendEvents?[4,this.handleSendEvents({url:s,method:a,headers:l,body:c,keepalive:d})]:[3,3];case 2:return h=u.sent(),[3,5];case 3:return this.loggerProvider.warn("Delegated session replay fetch received without a custom transport configured; falling back to built-in fetch."),[4,fetch(s,{method:a,headers:l,body:c,keepalive:d})];case 4:h=u.sent(),u.label=5;case 5:if(p=h.status,f=null,g="",p>=200&&p<300&&(f=null!==(i=null===(n=null===(r=h.headers)||void 0===r?void 0:r.get)||void 0===n?void 0:n.call(r,_a))&&void 0!==i?i:null),413!==p)return[3,9];u.label=6;case 6:return u.trys.push([6,8,,9]),[4,h.text()];case 7:return g=u.sent(),[3,9];case 8:return u.sent(),[3,9];case 9:return this.loggerProvider.debug("Delegated session replay fetch (request ".concat(o,") returned status ").concat(p,".")),e.postMessage({type:"fetch-response",requestId:o,status:p,skipHeader:f,body:g}),[3,11];case 10:return v=u.sent(),this.loggerProvider.debug("Delegated session replay fetch (request ".concat(o,") failed:"),v),e.postMessage({type:"fetch-response",requestId:o,status:0,skipHeader:null,body:String(v),error:!0}),[3,11];case 11:return[2]}})})},e.prototype.sendOnMainThread=function(e,t,r,n,i){var o,a,c,d,h,p,f;return l(this,void 0,void 0,function(){var l,g,v,m,y,b,w,S,k,x,C,E,I,O,P,T,R,M,A,_,N,D;return u(this,function(u){switch(u.label){case 0:l=Wa(),g=vl,v=r.sampleRate,m=new URLSearchParams({device_id:t,session_id:"".concat(r.sessionId),type:"".concat(r.type)}),y="".concat(null!==(a=null===(o=r.version)||void 0===o?void 0:o.type)&&void 0!==a?a:"standalone","/").concat(null!==(d=null===(c=r.version)||void 0===c?void 0:c.version)&&void 0!==d?d:g),u.label=1;case 1:return u.trys.push([1,19,,23]),b=JSON.stringify(n),w=z(),this.enableTransportCompression&&w&&"CompressionStream"in w?[4,ml(b,w)]:[3,3];case 2:return k=u.sent(),[3,4];case 3:k=null,u.label=4;case 4:if(x=(S=k)?S.byteLength:new Blob([b]).size,C=new AbortController,E=s({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(e),"X-Client-Version":g,"X-Client-Library":y,"X-Client-Url":l.substring(0,1e3),"X-Client-Sample-Rate":"".concat(v),"X-Sampling-Hash-Alg":"xxhash32"},S?{"Content-Encoding":"gzip"}:{}),P={headers:E,body:I=null!=S?S:b,method:"POST",keepalive:O=x<=65536,signal:C.signal},T="".concat(Fa(r.serverZone,this.trackServerUrl),"?").concat(m.toString()),0===n.events.length)return this.completeRequest({context:r}),[2];R=this.sendTimeoutMs>0?setTimeout(function(){C.abort()},this.sendTimeoutMs):void 0,M=void 0,u.label=5;case 5:return u.trys.push([5,,10,11]),this.handleSendEvents?[4,(L=this.handleSendEvents({url:T,method:"POST",headers:E,body:I,keepalive:O}),F=C.signal,new Promise(function(e,t){var r=function(){var e=new Error("Custom session replay transport aborted by send timeout");e.name="AbortError",t(e)};F.addEventListener("abort",r,{once:!0}),L.then(function(t){F.removeEventListener("abort",r),e(t)},function(e){F.removeEventListener("abort",r),t(e)})}))]:[3,7];case 6:return A=u.sent(),[3,9];case 7:return[4,fetch(T,P)];case 8:A=u.sent(),u.label=9;case 9:return M=A,[3,11];case 10:return R&&clearTimeout(R),[7];case 11:if(null===M)return this.completeRequest({context:r,err:"Unexpected error occurred"}),[2];if(M.status>=200&&M.status<300&&(_=null!==(f=null===(p=null===(h=M.headers)||void 0===h?void 0:h.get)||void 0===p?void 0:p.call(h,_a))&&void 0!==f?f:null,this.applyServerDirective(r.sessionId,_)),i)return[3,12];N="";try{N=JSON.stringify(M.body,null,2)}catch(e){}return this.completeRequest({context:r,success:"".concat(M.status,": ").concat(N)}),[3,18];case 12:if(N="",413!==M.status)return[3,16];u.label=13;case 13:return u.trys.push([13,15,,16]),[4,M.text()];case 14:return N=u.sent(),[3,16];case 15:return u.sent(),[3,16];case 16:return[4,this.handleReponse(M.status,r,N)];case 17:u.sent(),u.label=18;case 18:return[3,23];case 19:return D=u.sent(),!!D&&"object"==typeof D&&"AbortError"===D.name&&i?[4,this.handleOtherResponse(r)]:[3,21];case 20:return u.sent(),[3,22];case 21:this.completeRequest({context:r,err:D}),u.label=22;case 22:return[3,23];case 23:return[2]}var L,F})})},e.prototype.handleReponse=function(e,t,r){return void 0===r&&(r=""),l(this,void 0,void 0,function(){var n;return u(this,function(i){switch(i.label){case 0:switch(n=(new dt).buildStatus(e),n){case U.Success:return[3,1];case U.Failed:case U.Timeout:case U.RateLimit:return[3,2];case U.PayloadTooLarge:return[3,4]}return[3,5];case 1:return this.handleSuccessResponse(t),[3,8];case 2:return[4,this.handleOtherResponse(t)];case 3:return i.sent(),[3,8];case 4:return this.handlePayloadTooLargeResponse(t,Ta.test(r)),[3,8];case 5:return 499!==e?[3,7]:[4,this.handleOtherResponse(t)];case 6:return i.sent(),[3,8];case 7:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"}),i.label=8;case 8:return[2]}})})},e.prototype.handlePayloadTooLargeResponse=function(e,t){var r=t?"WAF (compressed payload too large)":"server (event too large)",n=Math.round(e.events.reduce(function(e,t){return e+t.length},0)/Aa);if(t)if(1!==e.events.length){this.loggerProvider.warn("Session replay event batch rejected by ".concat(r," (").concat(e.events.length," events, ").concat(n," KB total) — splitting and retrying")),e.onComplete();var i=function(){return Promise.resolve()},o=Math.floor(e.events.length/2);this.sendEventsList(s(s({},e),{events:e.events.slice(0,o),onComplete:i})),this.sendEventsList(s(s({},e),{events:e.events.slice(o),onComplete:i}))}else this.completeRequest({context:e,err:"Session replay event dropped: single event (".concat(n," KB, 1 event) rejected by ").concat(r," — cannot split further")});else this.completeRequest({context:e,err:"Session replay event batch dropped: ".concat(r," rejected payload (").concat(e.events.length," events, ").concat(n," KB) — not retrying non-WAF 413")})},e.prototype.handleSuccessResponse=function(e){var t=Math.round(new Blob(e.events).size/Aa);this.completeRequest({context:e,success:"Session replay event batch tracked successfully for session id ".concat(e.sessionId,", size of events: ").concat(t," KB")})},e.prototype.handleOtherResponse=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return t=Math.random()*e.attempts*this.retryTimeout,e.attempts++,e.attempts>(e.flushMaxRetries||0)?(this.completeRequest({context:e,err:pl}),[2]):[4,new Promise(function(e){return setTimeout(e,t)})];case 1:return r.sent(),[4,this.send(e,!0)];case 2:return r.sent(),[2]}})})},e.prototype.completeRequest=function(e){var t=e.context,r=e.err,n=e.success;t.onComplete(),r?this.loggerProvider.warn(r):n&&this.loggerProvider.log(n)},e.prototype.applyServerDirective=function(e,t){if(null===t)return this.flushPauseUntilMs=0,void(this.mergeLogFiredThisPause=!1);if("429"===t){var r=this.flushPauseUntilMs>Date.now();return this.flushPauseUntilMs=Date.now()+6e4,void(r||this.loggerProvider.log("Session replay throttled by server; pausing flush schedule for ".concat(60,"s")))}"4005"!==t&&"4004"!==t||this.killSession(e,t)},e.prototype.killSession=function(e,t){var r,n,i,o;if(!this.killedSessions.has(e)){if(this.killedSessions.add(e),this.killedSessions.size>256)try{for(var s=c(this.killedSessions),a=s.next();!a.done;a=s.next()){var l=a.value;this.killedSessions.delete(l);break}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}this.loggerProvider.log("Session replay capture stopped for session ".concat(e," by server directive ").concat(t,"; remaining events will be dropped"));var u=[];try{for(var d=c(this.queue),h=d.next();!h.done;h=d.next()){var p=h.value;p.sessionId===e?this.completeRequest({context:p,err:gl}):u.push(p)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}this.queue=u}},e}();const bl=(e,t)=>t.some(t=>e instanceof t);let wl,Sl;const kl=new WeakMap,xl=new WeakMap,Cl=new WeakMap;let El={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return kl.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Tl(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Il(e){El=e(El)}function Ol(e){return(Sl||(Sl=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Rl(this),t),Tl(this.request)}:function(...t){return Tl(e.apply(Rl(this),t))}}function Pl(e){return"function"==typeof e?Ol(e):(e instanceof IDBTransaction&&function(e){if(kl.has(e))return;const t=new Promise((t,r)=>{const n=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),n()},o=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});kl.set(e,t)}(e),bl(e,wl||(wl=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,El):e)}function Tl(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,r)=>{const n=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(Tl(e.result)),n()},o=()=>{r(e.error),n()};e.addEventListener("success",i),e.addEventListener("error",o)});return Cl.set(t,e),t}(e);if(xl.has(e))return xl.get(e);const t=Pl(e);return t!==e&&(xl.set(e,t),Cl.set(t,e)),t}const Rl=e=>Cl.get(e);function Ml(e,t,{blocked:r,upgrade:n,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=Tl(s);return n&&s.addEventListener("upgradeneeded",e=>{n(Tl(s.result),e.oldVersion,e.newVersion,Tl(s.transaction),e)}),r&&s.addEventListener("blocked",e=>r(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}const Al=["get","getKey","getAll","getAllKeys","count"],_l=["put","add","delete","clear"],Nl=new Map;function Dl(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Nl.get(t))return Nl.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,i=_l.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!i&&!Al.includes(r))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;return n&&(s=s.index(t.shift())),(await Promise.all([s[r](...t),i&&o.done]))[0]};return Nl.set(t,o),o}Il(e=>({...e,get:(t,r,n)=>Dl(t,r)||e.get(t,r,n),has:(t,r)=>!!Dl(t,r)||e.has(t,r)}));const Ll=["continue","continuePrimaryKey","advance"],Fl={},Ul=new WeakMap,jl=new WeakMap,Bl={get(e,t){if(!Ll.includes(t))return e[t];let r=Fl[t];return r||(r=Fl[t]=function(...e){Ul.set(this,jl.get(this)[t](...e))}),r}};async function*ql(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const r=new Proxy(t,Bl);for(jl.set(r,t),Cl.set(r,Rl(t));t;)yield r,t=await(Ul.get(r)||t.continue()),Ul.delete(r)}function zl(e,t){return t===Symbol.asyncIterator&&bl(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&bl(e,[IDBIndex,IDBObjectStore])}Il(e=>({...e,get:(t,r,n)=>zl(t,r)?ql:e.get(t,r,n),has:(t,r)=>zl(t,r)||e.has(t,r)}));var Wl=function(){function e(e){var t,r,n,i=this;this.minInterval=Ra,this.maxInterval=Ma,this.maxPersistedEventsSize=6e6,this._timeAtLastSplit=Date.now(),this.shouldSplitEventsList=function(e,t){var r=i.getStringSize(t);return i.getEventsArraySize(e)+r>=i.maxPersistedEventsSize||!!(Date.now()-i.timeAtLastSplit>i.interval&&e.length)&&(i.interval=Math.min(i.maxInterval,i.interval+i.minInterval),i._timeAtLastSplit=Date.now(),!0)},this.loggerProvider=e.loggerProvider,this.minInterval=null!==(t=e.minInterval)&&void 0!==t?t:this.minInterval,this.maxInterval=null!==(r=e.maxInterval)&&void 0!==r?r:this.maxInterval,this.maxPersistedEventsSize=null!==(n=e.maxPersistedEventsSize)&&void 0!==n?n:this.maxPersistedEventsSize,this.interval=this.minInterval}return Object.defineProperty(e.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),e.prototype.getStringSize=function(e){for(var t=0,r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n<=127)t++;else if(n<=2047)t+=2;else if(n>=55296&&n<=56319){var i=r+1<e.length?e.charCodeAt(r+1):NaN;i>=56320&&i<=57343?(t+=4,r++):t+=3}else t+=3}return t},e.prototype.getEventsArraySize=function(e){var t,r,n=0;try{for(var i=c(e),o=i.next();!o.done;o=i.next()){var s=o.value;n+=this.getStringSize(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n+(2+Math.max(0,e.length-1)+2*e.length)},e}(),Vl=function(e,t,r){!function(e){return"object"==typeof e&&null!==e&&"AbortError"===e.name}(r)?e.warn(t):e.debug(t)};var $l="sessionCurrentSequence",Hl="sequencesToSend",Kl=5e3;function Gl(e,t,r){var n=setTimeout(r,t);return e.then(function(){return clearTimeout(n)},function(){return clearTimeout(n)}),function(){return clearTimeout(n)}}var Jl,Xl,Yl,Ql=function(e){var t,r;return e.objectStoreNames.contains($l)||(r=e.createObjectStore($l,{keyPath:"sessionId"})),e.objectStoreNames.contains(Hl)||(t=e.createObjectStore(Hl,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:r}},Zl=function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,(r=Ml(e,1,{upgrade:Ql}),n=2e3,i="IDB openDB timed out",void 0===i&&(i="IDB operation timed out"),new Promise(function(e,t){var o=setTimeout(function(){return t(new Error("".concat(i," after ").concat(n,"ms")))},n);r.then(function(t){clearTimeout(o),e(t)},function(e){clearTimeout(o),t(e)})}))];case 1:return[2,t.sent()]}var r,n,i})})},eu=function(e){function t(t){var r,n=this;return(n=e.call(this,t)||this).consecutiveFailures=0,n.hasTriggeredFallback=!1,n.emptyFilteredCount=0,n.getSequencesToSend=function(){return l(n,void 0,void 0,function(){var e,t,r,n,i,o,s,a,l,c,d=this;return u(this,function(u){switch(u.label){case 0:e=!1,t=!1,u.label=1;case 1:return u.trys.push([1,9,,10]),r=[],(n=this.db.transaction("sequencesToSend","readwrite")).done.catch(function(r){e||t||(Vl(d.loggerProvider,"".concat(fl,": ").concat(r),r),d.recordFailure())}),i=Gl(n.done,Kl,function(){e||t||(t=!0,Vl(d.loggerProvider,"".concat(fl,": transaction timed out")),d.recordFailure())}),[4,n.store.openCursor()];case 2:o=u.sent(),u.label=3;case 3:return o?(s=o.value,a=s.sessionId,0!==(l=s.events).length?[3,5]:(this.maybeLogEmptyFiltered("getSequencesToSend"),[4,o.delete()])):[3,8];case 4:return u.sent(),[3,6];case 5:r.push({events:l,sequenceId:o.key,sessionId:a}),u.label=6;case 6:return[4,o.continue()];case 7:return o=u.sent(),[3,3];case 8:return this.recordSuccess(),i(),[2,r];case 9:return c=u.sent(),t||(e=!0,Vl(this.loggerProvider,"".concat(fl,": ").concat(c),c),this.recordFailure()),[3,10];case 10:return[2,void 0]}})})},n.storeCurrentSequence=function(e){return l(n,void 0,void 0,function(){var t,r,n,i,o,l,c,d,h=this;return u(this,function(u){switch(u.label){case 0:t=!1,r=!1,u.label=1;case 1:return u.trys.push([1,5,,6]),(n=this.db.transaction([$l,Hl],"readwrite")).done.catch(function(e){t||r||(Vl(h.loggerProvider,"".concat(fl,": ").concat(e),e),h.recordFailure())}),i=Gl(n.done,Kl,function(){t||r||(r=!0,Vl(h.loggerProvider,"".concat(fl,": transaction timed out")),h.recordFailure())}),[4,n.objectStore($l).get(e)];case 2:return!(o=u.sent())||o.tabId&&o.tabId!==this.tabId?(i(),[2,void 0]):0===o.events.length?(this.maybeLogEmptyFiltered("storeCurrentSequence"),i(),[2,void 0]):[4,n.objectStore(Hl).put({sessionId:e,events:o.events,tabId:this.tabId})];case 3:return l=u.sent(),[4,n.objectStore($l).put({sessionId:e,events:[],tabId:this.tabId})];case 4:return u.sent(),this.recordSuccess(),i(),o.tabId,c=a(o,["tabId"]),[2,s(s({},c),{sessionId:e,sequenceId:l})];case 5:return d=u.sent(),r||(t=!0,Vl(this.loggerProvider,"".concat(fl,": ").concat(d),d),this.recordFailure()),[3,6];case 6:return[2,void 0]}})})},n.addEventToCurrentSequence=function(e,t){return l(n,void 0,void 0,function(){var r,n,i,o,s,a,l,c,d,h=this;return u(this,function(u){switch(u.label){case 0:r=!1,n=!1,u.label=1;case 1:return u.trys.push([1,15,,16]),(i=this.db.transaction([$l,Hl],"readwrite")).done.catch(function(e){r||n||(Vl(h.loggerProvider,"".concat(fl,": ").concat(e),e),h.recordFailure())}),o=Gl(i.done,Kl,function(){r||n||(n=!0,Vl(h.loggerProvider,"".concat(fl,": transaction timed out")),h.recordFailure())}),[4,i.objectStore($l).get(e)];case 2:return(null==(s=u.sent())?void 0:s.tabId)&&s.tabId!==this.tabId?s.events.length>0?[4,i.objectStore(Hl).put({sessionId:e,events:s.events,tabId:s.tabId})]:[3,4]:[3,6];case 3:u.sent(),u.label=4;case 4:return[4,i.objectStore($l).put({sessionId:e,events:[t],tabId:this.tabId})];case 5:return u.sent(),this.recordSuccess(),o(),[2,void 0];case 6:return(a=s)?[3,8]:[4,i.objectStore($l).put({sessionId:e,events:[t],tabId:this.tabId})];case 7:return u.sent(),this.recordSuccess(),o(),[2,void 0];case 8:return this.shouldSplitEventsList(a.events,t)?[3,10]:[4,i.objectStore($l).put({sessionId:e,events:a.events.concat(t),tabId:this.tabId})];case 9:return u.sent(),this.recordSuccess(),o(),[2,void 0];case 10:return 0!==(l=a.events).length?[3,12]:(this.maybeLogEmptyFiltered("addEventToCurrentSequence"),[4,i.objectStore($l).put({sessionId:e,events:[t],tabId:this.tabId})]);case 11:return u.sent(),this.recordSuccess(),o(),[2,void 0];case 12:return[4,i.objectStore($l).put({sessionId:e,events:[t],tabId:this.tabId})];case 13:return u.sent(),[4,i.objectStore(Hl).put({sessionId:e,events:l,tabId:this.tabId})];case 14:return c=u.sent(),this.recordSuccess(),o(),[2,{events:l,sessionId:e,sequenceId:c}];case 15:return d=u.sent(),n||(r=!0,Vl(this.loggerProvider,"".concat(fl,": ").concat(d),d),this.recordFailure()),[3,16];case 16:return[2,void 0]}})})},n.storeSendingEvents=function(e,t){return l(n,void 0,void 0,function(){var r,n;return u(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.db.put(Hl,{sessionId:e,events:t,tabId:this.tabId})];case 1:return r=i.sent(),this.recordSuccess(),[2,r];case 2:return n=i.sent(),Vl(this.loggerProvider,"".concat(fl,": ").concat(n),n),this.recordFailure(),[3,3];case 3:return[2,void 0]}})})},n.cleanUpSessionEventsStore=function(e,t){return l(n,void 0,void 0,function(){var e;return u(this,function(r){switch(r.label){case 0:if(!t)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.db.delete(Hl,t)];case 2:return r.sent(),this.recordSuccess(),[3,4];case 3:return e=r.sent(),Vl(this.loggerProvider,"".concat(fl,": ").concat(e),e),this.recordFailure(),[3,4];case 4:return[2]}})})},n.db=t.db,n.tabId=t.tabId,n.onPersistentFailure=t.onPersistentFailure,n.consecutiveFailureThreshold=null!==(r=t.consecutiveFailureThreshold)&&void 0!==r?r:1,n}return n(t,e),t.prototype.maybeLogEmptyFiltered=function(e){this.emptyFilteredCount++%100==0&&this.loggerProvider.debug("Filtered empty session replay sequence at ".concat(e," (idb store)"))},t.prototype.recordFailure=function(){var e;this.consecutiveFailures++,!this.hasTriggeredFallback&&this.consecutiveFailures>=this.consecutiveFailureThreshold&&(this.hasTriggeredFallback=!0,null===(e=this.onPersistentFailure)||void 0===e||e.call(this))},t.prototype.recordSuccess=function(){this.consecutiveFailures=0},t.new=function(e,r){var n;return l(this,void 0,void 0,function(){var i,o,a,l,c;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),i="replay"===e?"":"_".concat(e),o="".concat(r.apiKey.substring(0,10),"_amp_session_replay_events").concat(i),[4,Zl(o)];case 1:return a=u.sent(),l=null!==(n=r.tabId)&&void 0!==n?n:function(){try{return crypto.randomUUID()}catch(e){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}}(),[2,new t(s(s({},r),{db:a,tabId:l}))];case 2:return c=u.sent(),Vl(r.loggerProvider,"".concat(fl,": ").concat(c),c),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return l(this,void 0,void 0,function(){var t,r,n,i,o,s,l,d;return u(this,function(u){switch(u.label){case 0:return e?[4,this.db.get("sessionCurrentSequence",e)]:[3,2];case 1:return(i=u.sent())?i.tabId&&i.tabId!==this.tabId?[2,void 0]:(i.tabId,[2,[o=a(i,["tabId"])]]):[2,void 0];case 2:t=[],u.label=3;case 3:return u.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:r=c.apply(void 0,[u.sent()]),n=r.next(),u.label=5;case 5:if(n.done)return[3,7];if((i=n.value).tabId&&i.tabId!==this.tabId)return[3,6];i.tabId,o=a(i,["tabId"]),t.push(o),u.label=6;case 6:return n=r.next(),[3,5];case 7:return[3,10];case 8:return s=u.sent(),l={error:s},[3,10];case 9:try{n&&!n.done&&(d=r.return)&&d.call(r)}finally{if(l)throw l.error}return[7];case 10:return[2,t]}})})},t}(Wl),tu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.finalizedSequences={},t.sequences={},t.sequenceId=0,t.emptyFilteredCount=0,t}return n(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,r=h([],d(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:r},this.resetCurrentSequence(e),{sequenceId:t,events:r,sessionId:e}},t.prototype.maybeLogEmptyFiltered=function(e){this.emptyFilteredCount++%100==0&&this.loggerProvider.debug("Filtered empty session replay sequence at ".concat(e," (in-memory store)"))},t.prototype.getSequencesToSend=function(){return l(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a,l,h;return u(this,function(u){e=[];try{for(t=c(Object.entries(this.finalizedSequences)),r=t.next();!r.done;r=t.next())n=d(r.value,2),i=n[0],o=n[1],s=o.sessionId,0!==(a=o.events).length?e.push({sequenceId:Number(i),sessionId:s,events:a}):(this.maybeLogEmptyFiltered("getSequencesToSend"),delete this.finalizedSequences[Number(i)])}catch(e){l={error:e}}finally{try{r&&!r.done&&(h=t.return)&&h.call(t)}finally{if(l)throw l.error}}return[2,e]})})},t.prototype.storeCurrentSequence=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){return(t=this.sequences[e])?0===t.length?(this.maybeLogEmptyFiltered("storeCurrentSequence"),[2,void 0]):[2,this.addSequence(e)]:[2,void 0]})})},t.prototype.addEventToCurrentSequence=function(e,t){return l(this,void 0,void 0,function(){var r;return u(this,function(n){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(0===this.sequences[e].length?this.maybeLogEmptyFiltered("addEventToCurrentSequence"):r=this.addSequence(e)),this.sequences[e].push(t),[2,r]})})},t.prototype.storeSendingEvents=function(e,t){return l(this,void 0,void 0,function(){return u(this,function(r){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(e,t){return l(this,void 0,void 0,function(){return u(this,function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]})})},t}(Wl),ru=function(e){var t=e.config,r=e.minInterval,n=e.maxInterval,i=e.maxPersistedEventsSize,o=e.type,a=e.payloadBatcher,c=e.storeType,p=e.trackDestinationWorkerScript,f=e.shouldSend;return l(void 0,void 0,void 0,function(){function e(e){return void 0===e&&(e=!1),l(this,void 0,void 0,function(){return u(this,function(t){return[2,v.flush(e)]})})}var g,v,m,y,b,w,S,k,x,C,E,I,O,P,T,R,M;return u(this,function(A){switch(A.label){case 0:return g=null!==(M=t.maxSingleEventSizeBytes)&&void 0!==M?M:Pa,v=new yl(s(s({},t),{loggerProvider:t.loggerProvider,payloadBatcher:a,workerScript:p})),m=function(){return new tu({loggerProvider:t.loggerProvider,maxInterval:n,minInterval:r,maxPersistedEventsSize:i})},b=!1,S=function(){return l(void 0,void 0,void 0,function(){var e,r,n;return u(this,function(i){switch(i.label){case 0:return b?(b=!1,t.loggerProvider.warn("IDB store is experiencing repeated failures; falling back to in-memory event store."),y?[4,w.getSequencesToSend()]:[3,2]):[2];case 1:return r=i.sent(),[3,3];case 2:r=void 0,i.label=3;case 3:return e=r,w=m(),e&&y&&(n=y,e.forEach(function(e){O({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:n})})),[2]}})})},k=function(){return l(void 0,void 0,void 0,function(){var e;return u(this,function(s){switch(s.label){case 0:return[4,eu.new(o,{loggerProvider:t.loggerProvider,minInterval:r,maxInterval:n,maxPersistedEventsSize:i,apiKey:t.apiKey,onPersistentFailure:function(){S()}})];case 1:return(e=s.sent())?(b=!0,[2,e]):(t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,m()])}})})},"idb"!==c?[3,2]:[4,k()];case 1:return x=A.sent(),[3,3];case 2:x=m(),A.label=3;case 3:return w=x,C=[],E=0,I=function(e){if(!(e<=E)){var t=Math.min(e-E,C.length);t>0&&(C.splice(0,t),E=e)}},O=function(e){var r=e.events,n=e.sessionId,i=e.deviceId,s=e.sequenceId,a=r.map(function(e){return{event:e,bytes:new Blob([e]).size}}),c=a.filter(function(e){return e.bytes>g});c.length>0&&t.loggerProvider.warn("Dropping ".concat(c.length," oversized event(s) from session replay sequence before send. Sizes: ").concat(c.map(function(e){return"".concat(Math.round(e.bytes/1024)," KB")}).join(", "),". If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support."));var d=c.length>0?a.filter(function(e){return e.bytes<=g}).map(function(e){return e.event}):r;0!==d.length?(t.debugMode&&Ka().then(function(e){var r=e.totalStorageSize,n=e.percentOfQuota,i=e.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(r," KB, percentage of quota: ").concat(n,"%, usage details: ").concat(i))}).catch(function(){}),v.sendEventsList({events:d,sessionId:n,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:i,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:o,onComplete:function(){return l(void 0,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,w.cleanUpSessionEventsStore(n,s)];case 1:return e.sent(),[2]}})})}})):w.cleanUpSessionEventsStore(n,s).catch(function(e){t.loggerProvider.warn("Failed to clean up session replay events store:",e)})},P=function(e){var r=e.sessionId,n=e.deviceId;if(y=n,!f||f()){var i=E+C.length;w.storeCurrentSequence(r).then(function(e){e&&(I(i),O({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:n}))}).catch(function(e){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",e)})}},T=function(e){var r=e.deviceId;return l(void 0,void 0,void 0,function(){var e;return u(this,function(n){switch(n.label){case 0:return y=r,[4,w.getSequencesToSend()];case 1:return(null==(e=n.sent())?void 0:e.length)?(t.loggerProvider.log("Draining ".concat(e.length," stored sequence(s) from previous session.")),e.length>1&&v.markCoalesceNextFlush(),e.forEach(function(e){O({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r})}),[2]):[2]}})})},R=function(e){var r=e.event,n=e.sessionId,i=e.deviceId;y=i;var o=!f||f(),s=E+C.length;C.push(r.data),w.addEventToCurrentSequence(n,r.data).then(function(e){if(e){if(!o)return w.cleanUpSessionEventsStore(e.sessionId,e.sequenceId).catch(function(e){t.loggerProvider.warn("Failed to clean up dropped session replay sequence:",e)}),void I(s);I(s),O({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)})},[2,{sendCurrentSequenceEvents:P,addEvent:R,sendStoredEvents:T,flush:e,getBeaconEvents:function(){return h([],d(C),!1)},dropPendingBeaconEvents:function(){I(E+C.length)},trackDestination:v}]}})})},nu=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=new Map;e.forEach(function(e){r.set(e.name,e.manager)}),this.managers=r}return e.prototype.sendStoredEvents=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return t=[],this.managers.forEach(function(r){t.push(r.sendStoredEvents(e))}),[4,Promise.all(t)];case 1:return r.sent(),[2]}})})},e.prototype.addEvent=function(e){var t,r=e.sessionId,n=e.event,i=e.deviceId;null===(t=this.managers.get(n.type))||void 0===t||t.addEvent({sessionId:r,event:n,deviceId:i})},e.prototype.sendCurrentSequenceEvents=function(e){var t=e.sessionId,r=e.deviceId;this.managers.forEach(function(e){e.sendCurrentSequenceEvents({sessionId:t,deviceId:r})})},e.prototype.flush=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:return t=[],this.managers.forEach(function(r){t.push(r.flush(e))}),[4,Promise.all(t)];case 1:return r.sent(),[2]}})})},e}();function iu(e,t){if(Yl=new Date,e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var 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};Jl=s(s({},r),t),Xl=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(Jl.root,r);var n=ou(e,"all",function(){return ou(e,"two",function(){return ou(e,"one",function(){return ou(e,"none")})})});if(n){var i=gu(vu(n,e));return i.length>0&&(n=i[0]),au(n)}throw new Error("Selector was not found.")}function ou(e,t,r){for(var n=null,i=[],o=e,s=0,a=function(){var e,a,l=(new Date).getTime()-Yl.getTime();if(void 0!==Jl.timeoutMs&&l>Jl.timeoutMs)throw new Error("Timeout: Can't find a unique selector after ".concat(l,"ms"));var u=hu(function(e){var t=e.getAttribute("id");if(t&&Jl.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(o))||hu.apply(void 0,h([],d(function(e){var t=Array.from(e.attributes).filter(function(e){return Jl.attr(e.name,e.value)});return t.map(function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}})}(o)),!1))||hu.apply(void 0,h([],d(function(e){var t=Array.from(e.classList).filter(Jl.className);return t.map(function(e){return{name:"."+CSS.escape(e),penalty:1}})}(o)),!1))||hu(function(e){var t=e.tagName.toLowerCase();if(Jl.tagName(t))return{name:t,penalty:2};return null}(o))||[{name:"*",penalty:3}],p=function(e){var t=e.parentNode;if(!t)return null;var r=t.firstChild;if(!r)return null;var n=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&n++,r!==e);)r=r.nextSibling;return n}(o);if("all"==t)p&&(u=u.concat(u.filter(du).map(function(e){return cu(e,p)})));else if("two"==t)u=u.slice(0,1),p&&(u=u.concat(u.filter(du).map(function(e){return cu(e,p)})));else if("one"==t){var f=d(u=u.slice(0,1),1)[0];p&&du(f)&&(u=[cu(f,p)])}else"none"==t&&(u=[{name:"*",penalty:3}],p&&(u=[cu(u[0],p)]));try{for(var g=(e=void 0,c(u)),v=g.next();!v.done;v=g.next()){(f=v.value).level=s}}catch(t){e={error:t}}finally{try{v&&!v.done&&(a=g.return)&&a.call(g)}finally{if(e)throw e.error}}if(i.push(u),i.length>=Jl.seedMinLength&&(n=su(i,r)))return"break";o=o.parentElement,s++};o;){if("break"===a())break}return n||(n=su(i,r)),!n&&r?r():n}function su(e,t){var r,n,i=gu(fu(e));if(i.length>Jl.threshold)return t?t():null;try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(uu(a))return a}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null}function au(e){for(var t=e[0],r=t.name,n=1;n<e.length;n++){var i=e[n].level||0;r=t.level===i-1?"".concat(e[n].name," > ").concat(r):"".concat(e[n].name," ").concat(r),t=e[n]}return r}function lu(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function uu(e){var t=au(e);switch(Xl.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function cu(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function du(e){return"html"!==e.name&&!e.name.startsWith("#")}function hu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.filter(pu);return r.length>0?r:null}function pu(e){return null!=e}function fu(e,t){var r,n,i,o,s,a;return void 0===t&&(t=[]),u(this,function(l){switch(l.label){case 0:if(!(e.length>0))return[3,9];l.label=1;case 1:l.trys.push([1,6,7,8]),r=c(e[0]),n=r.next(),l.label=2;case 2:return n.done?[3,5]:(i=n.value,[5,c(fu(e.slice(1,e.length),t.concat(i)))]);case 3:l.sent(),l.label=4;case 4:return n=r.next(),[3,2];case 5:return[3,8];case 6:return o=l.sent(),s={error:o},[3,8];case 7:try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:l.sent(),l.label=11;case 11:return[2]}})}function gu(e){return h([],d(e),!1).sort(function(e,t){return lu(e)-lu(t)})}function vu(e,t,r){var n,i,o;return void 0===r&&(r={counter:0,visited:new Map}),u(this,function(s){switch(s.label){case 0:if(!(e.length>2&&e.length>Jl.optimizedMinLength))return[3,5];n=1,s.label=1;case 1:return n<e.length-1?r.counter>Jl.maxNumberOfTries?[2]:(r.counter+=1,(i=h([],d(e),!1)).splice(n,1),o=au(i),r.visited.has(o)?[2]:uu(i)&&function(e,t){return Xl.querySelector(au(e))===t}(i,t)?[4,i]:[3,4]):[3,5];case 2:return s.sent(),r.visited.set(o,!0),[5,c(vu(i,t,r))];case 3:s.sent(),s.label=4;case 4:return n++,[3,1];case 5:return[2]}})}var mu=function(e){var t=e.version,r=e.events,n=[];return r.forEach(function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&n.push(t)}),{version:t,events:n}},yu=function(e){var t=e.version,r=e.events,n=[];r.forEach(function(e){var t=JSON.parse(e);"click"===t.type&&n.push(t)});var i=n.reduce(function(e,t){var r=t.x,n=t.y,i=t.selector,o=t.timestamp,a=o-o%36e5,l="".concat(r,":").concat(n,":").concat(null!=i?i:"",":").concat(a);return e[l]?e[l].count+=1:e[l]=s(s({},t),{timestamp:a,count:1}),e},{});return{version:t,events:Object.values(i)}},bu=function(e,t){var r=this;this.createHook=function(e){var t=e.eventsManager,n=e.sessionId,i=e.deviceIdFn,o=e.mirror,s=e.ugcFilterRules,a=e.performanceOptions;return function(e){if(e.type===il.Click){var l=z();if(l){var u=l.location,c=l.innerHeight,d=l.innerWidth;if(u){var h=e.x,p=e.y;if(void 0!==h&&void 0!==p){var f,g=o.getNode(e.id);if(g)try{f=iu(g,a)}catch(e){r.logger.debug("error resolving selector from finder")}var v=Ha(u.href,s),m={x:h+r.scrollWatcher.currentScrollX,y:p+r.scrollWatcher.currentScrollY,selector:f,viewportHeight:c,viewportWidth:d,pageUrl:v,timestamp:Date.now(),type:"click"},y=i();y&&t.addEvent({sessionId:n,event:{type:"interaction",data:JSON.stringify(m)},deviceId:y})}}}}}},this.logger=e,this.scrollWatcher=t};function wu(){var e=z();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||0}function Su(){var e=z();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||0}var ku=function(){function e(e,t){var r=z();r&&r.navigator&&"function"==typeof r.navigator.sendBeacon?this.sendBeacon=function(e,t){try{if(r.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch(e){}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(e,t){var r=new XMLHttpRequest;return r.open("POST",e,!0),r.setRequestHeader("Accept","*/*"),r.send(JSON.stringify(t)),!0},this.basePageUrl=Fa(t.serverZone,t.trackServerUrl),this.apiKey=t.apiKey,this.context=e,this.handleSendEvents=t.handleSendEvents,this.loggerProvider=t.loggerProvider}return e.prototype.send=function(e,t){var r,n=this,i=this.context,o=i.sessionId,s=i.type;if(this.handleSendEvents){var a=new URLSearchParams({device_id:e,session_id:String(o),type:String(s)}),l="".concat(this.basePageUrl,"?").concat(a.toString()),u={"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(this.apiKey)};try{this.handleSendEvents({url:l,method:"POST",headers:u,body:JSON.stringify(t),keepalive:!0}).catch(function(e){var t;null===(t=n.loggerProvider)||void 0===t||t.warn("Custom transport failed to send session replay interaction beacon:",e)})}catch(e){null===(r=this.loggerProvider)||void 0===r||r.warn("Custom transport threw while sending session replay interaction beacon:",e)}}else{var c=new URLSearchParams({device_id:e,session_id:String(o),type:String(s),api_key:this.apiKey}),d="".concat(this.basePageUrl,"?").concat(c.toString());this.sendBeacon(d,t)||this.sendXhr(d,t)}},e}(),xu=function(){function e(e,t){var r=this;this.timestamp=Date.now(),this.hook=function(e){r.update(e)},this.send=function(e){return function(t){var n,i,o,s,a=e(),l=z();if(l&&a){var u=null!==(n=l.scrollX)&&void 0!==n?n:0,c=null!==(i=l.scrollY)&&void 0!==i?i:0;(u>0||c>0)&&r.update({id:1,x:u,y:c}),r.transport.send(a,{version:1,events:[{maxScrollX:r._maxScrollX,maxScrollY:r._maxScrollY,maxScrollWidth:r._maxScrollWidth,maxScrollHeight:r._maxScrollHeight,viewportHeight:wu(),viewportWidth:Su(),pageUrl:Ha(l.location.href,null!==(s=null===(o=r.config.interactionConfig)||void 0===o?void 0:o.ugcFilterRules)&&void 0!==s?s:[]),timestamp:r.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=Su(),this._maxScrollHeight=wu(),this.config=t,this.transport=e}return e.default=function(t,r){return new e(new ku(t,r),r)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollX",{get:function(){return this._currentScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollY",{get:function(){return this._currentScrollY},enumerable:!1,configurable:!0}),e.prototype.update=function(e){var t=Date.now();if(this._currentScrollX=e.x,this._currentScrollY=e.y,e.x>this._maxScrollX){var r=Su();this._maxScrollX=e.x;var n=e.x+r;n>this._maxScrollWidth&&(this._maxScrollWidth=n),this.timestamp=t}if(e.y>this._maxScrollY){var i=wu();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),Cu=function(e){var t=e.sessionId,r=e.deviceId;this.deviceId=r,this.sessionId=t,t&&r&&(this.sessionReplayId=function(e,t){return"".concat(t,"/").concat(e)}(t,r))},Eu=864e5,Iu=function(e){return"".concat("AMP_SR_START_").concat(e.substring(0,10),"_")},Ou=function(e,t){return"".concat(Iu(e)).concat(t)},Pu=function(){try{var e=z();return null==e?void 0:e.localStorage}catch(e){return}},Tu=function(){var e=this;this.dbs={},this.createStore=function(t){return l(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,Ml(t,1,{upgrade:function(e){e.objectStoreNames.contains("sessionTargetingMatch")||e.createObjectStore("sessionTargetingMatch",{keyPath:"sessionId"})}})];case 1:return[2,e.sent()]}})})},this.openOrCreateDB=function(t){return l(e,void 0,void 0,function(){var e,r;return u(this,function(n){switch(n.label){case 0:return this.dbs&&this.dbs[t]?[2,this.dbs[t]]:(e="".concat(t.substring(0,10),"_amp_session_replay_targeting"),[4,this.createStore(e)]);case 1:return r=n.sent(),this.dbs[t]=r,[2,r]}})})},this.getTargetingMatchForSession=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.sessionId;return l(e,void 0,void 0,function(){var e,t,o,s;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(n)];case 1:return e=a.sent(),t=String(i),[4,e.get("sessionTargetingMatch",t)];case 2:return[2,null==(o=a.sent())?void 0:o.targetingMatch];case 3:return s=a.sent(),Vl(r,"Failed to get targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.storeTargetingMatchForSession=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.sessionId,o=t.targetingMatch;return l(e,void 0,void 0,function(){var e,t,s;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(n)];case 1:return e=a.sent(),t=String(i),[4,e.put("sessionTargetingMatch",{targetingMatch:o,sessionId:t,lastUpdated:Date.now()})];case 2:return[2,a.sent()];case 3:return s=a.sent(),Vl(r,"Failed to store targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.clearStoreOfOldSessions=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.currentSessionId;return l(e,void 0,void 0,function(){var e,t,o,s,a,l,c,d;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,8,,9]),[4,this.openOrCreateDB(n)];case 1:return e=u.sent(),t=String(i),[4,(o=e.transaction("sessionTargetingMatch","readwrite")).store.getAll()];case 2:s=u.sent(),a=0,u.label=3;case 3:return a<s.length?(l=s[a],c=Date.now()-l.lastUpdated,l.sessionId!==t&&c>1728e5?[4,o.store.delete(l.sessionId)]:[3,5]):[3,6];case 4:u.sent(),u.label=5;case 5:return a++,[3,3];case 6:return[4,o.done];case 7:return u.sent(),[3,9];case 8:return d=u.sent(),Vl(r,"Failed to clear old targeting matches for sessions: ".concat(d),d),[3,9];case 9:return[2]}})})}},Ru=new Tu,Mu=function(e){var t=e.sessionId,r=e.targetingConfig,n=e.loggerProvider,i=e.apiKey,o=e.targetingParams,a=e.urlChange,c=void 0!==a&&a;return l(void 0,void 0,void 0,function(){var e,a,l,d,h,p;return u(this,function(u){switch(u.label){case 0:return[4,Ru.clearStoreOfOldSessions({loggerProvider:n,apiKey:i,currentSessionId:t})];case 1:return u.sent(),[4,Ru.getTargetingMatchForSession({loggerProvider:n,apiKey:i,sessionId:t})];case 2:if(!0===u.sent()&&!c)return[2,!0];e=!0,u.label=3;case 3:return u.trys.push([3,6,,7]),[4,Promise.resolve().then(function(){return $p})];case 4:return a=u.sent().evaluateTargeting,l=s(s({},o),{flag:r,sessionId:"string"==typeof t?parseInt(t,10):t,apiKey:i,loggerProvider:n}),[4,a(l)];case 5:return(d=u.sent())&&d.sr_targeting_config&&(e="on"===d.sr_targeting_config.key),Ru.storeTargetingMatchForSession({loggerProvider:n,apiKey:i,sessionId:t,targetingMatch:e}),[3,7];case 6:return h=u.sent(),p=h,n.warn(p.message),[3,7];case 7:return[2,e]}})})},Au=2654435761,_u=2246822519,Nu=3266489917,Du=374761393;function Lu(e,t){return(e<<t|e>>>32-t)>>>0}function Fu(e,t){return e=Lu(e=e+Math.imul(t,_u)>>>0,13),e=Math.imul(e,Au)>>>0}function Uu(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function ju(e,t){void 0===t&&(t=0);var r,n=function(e){for(var t=[],r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<e.length){var i=e.charCodeAt(r+1);i>=56320&&i<=57343&&(n=i-56320+(n-55296<<10)+65536,r++)}n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<65536?t.push(224|n>>12,128|n>>6&63,128|63&n):t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n)}return new Uint8Array(t)}(e),i=n.length,o=0;if(i>=16){for(var s=t+Au+_u>>>0,a=t+_u>>>0,l=t>>>0,u=t-Au>>>0;o<=i-16;)s=Fu(s,Uu(n,o)),a=Fu(a,Uu(n,o+=4)),l=Fu(l,Uu(n,o+=4)),u=Fu(u,Uu(n,o+=4)),o+=4;r=Lu(s,1)+Lu(a,7)+Lu(l,12)+Lu(u,18)>>>0}else r=t+Du>>>0;for(r=r+i>>>0;o<=i-4;)r=r+Math.imul(Uu(n,o),Nu)>>>0,r=Math.imul(Lu(r,17),668265263)>>>0,o+=4;for(;o<i;)r=r+Math.imul(n[o],Du)>>>0,r=Math.imul(Lu(r,11),Au)>>>0,o++;return r^=r>>>15,r=Math.imul(r,_u)>>>0,r^=r>>>13,r=Math.imul(r,Nu)>>>0,(r^=r>>>16)>>>0}var Bu="__amplitude_url_tracking_patched__",qu=new WeakMap;function zu(e,t,r){if(void 0===r&&(r={}),!(null==e?void 0:e.location))return function(){};var n=r.enablePolling,i=void 0!==n&&n,o=r.pollingInterval,s=void 0===o?Sa:o;if(i){var a=function(){var t;return null!==(t=e.location.href)&&void 0!==t?t:""},l=a(),u=e.setInterval(function(){var e=a();e!==l&&(l=e,t(e))},s);return function(){null!=u&&e.clearInterval(u)}}var c=qu.get(e);if(!c){var d=void 0,h=new Set,p=function(){var t=function(){var t;return null!==(t=e.location.href)&&void 0!==t?t:""}();void 0!==d&&t===d||(d=t,h.forEach(function(e){return e(t)}))},f=function(e){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=e.apply(this,t);return p(),n};return t[Bu]=!0,t},g=e.history;if(null==g?void 0:g.pushState){var v=Reflect.get(g,"pushState");v[Bu]||(g.pushState=f(v))}if(null==g?void 0:g.replaceState){var m=Reflect.get(g,"replaceState");m[Bu]||(g.replaceState=f(m))}c={callbacks:h,notify:p,onPopStateOrHashChange:function(){return p()},listenersAttached:!1},qu.set(e,c)}var y=c;return y.listenersAttached||(e.addEventListener("popstate",y.onPopStateOrHashChange),e.addEventListener("hashchange",y.onPopStateOrHashChange),y.listenersAttached=!0),y.callbacks.add(t),function(){y.callbacks.delete(t),0===y.callbacks.size&&y.listenersAttached&&(e.removeEventListener("popstate",y.onPopStateOrHashChange),e.removeEventListener("hashchange",y.onPopStateOrHashChange),y.listenersAttached=!1)}}function Wu(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,r,n){var i,o,a,l=s(s({},e),n),u=l.ugcFilterRules||[],c=null!==(i=l.enablePolling)&&void 0!==i&&i,d=null!==(o=l.pollingInterval)&&void 0!==o?o:Sa,h=null!==(a=l.captureDocumentTitle)&&void 0!==a&&a;if(!r)return function(){};var p=void 0,f=function(){return r.location&&r.location.href||""},g=function(){var e=f();if(void 0===p||e!==p){p=e;var n=function(){var e=r.innerHeight,t=r.innerWidth,n=r.document,i=f(),o="";return h&&(o=(null==n?void 0:n.title)||""),{href:u.length>0?Ha(i,u):i,title:o,viewportHeight:e,viewportWidth:t,type:"url-change-event"}}();t(n)}},v=zu(r,function(){return g()},c?{enablePolling:!0,pollingInterval:d}:{});return g(),function(){return v()}},options:e}}Wu();var Vu=function(){function e(){this.pendingLoadListeners=new Map}return e.prototype.start=function(){var e,t=this;null===(e=this.mutationObserver)||void 0===e||e.disconnect(),z()&&(this.sendToAllIframes({type:Na,action:"start"}),this.mutationObserver=new MutationObserver(function(e){var r,n,i,o,s,a;try{for(var l=c(e),u=l.next();!u.done;u=l.next()){var d=u.value;try{for(var h=(i=void 0,c(Array.from(d.addedNodes))),p=h.next();!p.done;p=h.next()){(v=p.value)instanceof HTMLIFrameElement?t.sendToIframeAfterLoad(v):v instanceof Element&&v.querySelectorAll("iframe").forEach(function(e){t.sendToIframeAfterLoad(e)})}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}try{for(var f=(s=void 0,c(Array.from(d.removedNodes))),g=f.next();!g.done;g=f.next()){var v;if((v=g.value)instanceof HTMLIFrameElement){var m=t.pendingLoadListeners.get(v);m&&(v.removeEventListener("load",m),t.pendingLoadListeners.delete(v))}}}catch(e){s={error:e}}finally{try{g&&!g.done&&(a=f.return)&&a.call(f)}finally{if(s)throw s.error}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}),this.mutationObserver.observe(document.documentElement,{childList:!0,subtree:!0}))},e.prototype.stop=function(){var e;null===(e=this.mutationObserver)||void 0===e||e.disconnect(),this.mutationObserver=void 0,this.pendingLoadListeners.forEach(function(e,t){t.removeEventListener("load",e)}),this.pendingLoadListeners.clear(),this.sendToAllIframes({type:Na,action:"stop"})},e.prototype.sendToIframeAfterLoad=function(e){var t=this,r=function(){t.pendingLoadListeners.delete(e),t.sendToIframe(e,{type:Na,action:"start"})};this.pendingLoadListeners.set(e,r),e.addEventListener("load",r,{once:!0})},e.prototype.sendToAllIframes=function(e){var t=this;document.querySelectorAll("iframe").forEach(function(r){return t.sendToIframe(r,e)})},e.prototype.sendToIframe=function(e,t){var r;try{null===(r=e.contentWindow)||void 0===r||r.postMessage(t,"*")}catch(e){}},e}();var $u,Hu,Ku,Gu=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.sessionTargetingMatch=!1,this.pageLeaveFns=[],this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,this.recordFunction=null,this.recordEventsInFlight=!1,this.recordingEnabled=!0,this.recordingGeneration=0,this.startChildRecordingOnSetup=!1,this.pendingEmitEvents=[],this.currentPageUrl="",this.recordEventsPendingShouldLogMetadata=null,this.urlChangeCleanup=null,this.crossOriginIframeCoordinator=null,this.crossOriginParentSignalCleanup=null,this.latestUrlChangeTargetingEvaluationId=0,this.teardownEventListeners=function(t){var r=z();r&&(r.removeEventListener("blur",e.blurListener),r.removeEventListener("focus",e.focusListener),!t&&r.addEventListener("blur",e.blurListener),!t&&r.addEventListener("focus",e.focusListener),r.self&&"onpagehide"in r.self?(r.removeEventListener("pagehide",e.pageLeaveListener),!t&&r.addEventListener("pagehide",e.pageLeaveListener)):(r.removeEventListener("beforeunload",e.pageLeaveListener),!t&&r.addEventListener("beforeunload",e.pageLeaveListener)))},this.blurListener=function(){e.sendEvents()},this.focusListener=function(){var t;if(e.recordingEnabled)if(e.recordCancelCallback&&e.recordFunction){if(!1===(null===(t=e.config)||void 0===t?void 0:t.captureFullSnapshotOnFocus))return;try{e.recordFunction.takeFullSnapshot(!0)}catch(t){e.loggerProvider.warn("Failed to take full snapshot on focus:",t)}}else e.recordEventsInFlight||e.recordEvents(!1)},this.pageLeaveListener=function(t){var r;null===(r=e.eventCompressor)||void 0===r||r.flushQueue(),e.sendEvents(),e.pageLeaveFns.forEach(function(e){e(t)})},this.evaluateTargetingAndCapture=function(t,r,n,i){return void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===i&&(i=!1),l(e,void 0,void 0,function(){var e,s,a,l,c,d,h,p,f,g,v,m;return u(this,function(u){switch(u.label){case 0:if(!this.identifiers||!this.identifiers.sessionId||!this.config)return this.identifiers&&!this.identifiers.sessionId?this.loggerProvider.log("Session ID has not been set yet, cannot evaluate targeting for Session Replay."):this.loggerProvider.warn("Session replay init has not been called, cannot evaluate targeting."),[2];if(!this.config.targetingConfig){if(!r)return this.loggerProvider.log("No targeting config set, skipping initialization/recording for event."),[2];this.loggerProvider.log("Targeting config has not been set yet, cannot evaluate targeting.")}return this.lastTargetingParams=t,e=this.config.targetingConfig,e&&!this.sessionTargetingMatch?(s=i?this.latestUrlChangeTargetingEvaluationId:void 0,(a=t.event)&&Object.values(o).includes(a.event_type)&&(a=void 0),l=null!==(v=null!==(p=null===(h=t.page)||void 0===h?void 0:h.url)&&void 0!==p?p:null===(g=null===(f=z())||void 0===f?void 0:f.location)||void 0===g?void 0:g.href)&&void 0!==v?v:"",c=null!==(m=t.page)&&void 0!==m?m:""!==l?{url:l}:void 0,[4,Mu({sessionId:this.identifiers.sessionId,targetingConfig:e,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:a,page:c},urlChange:i})]):[3,2];case 1:if(d=u.sent(),i&&void 0!==s&&s!==this.latestUrlChangeTargetingEvaluationId)return this.loggerProvider.debug("Ignoring stale URL-change targeting result #".concat(s,"; latest is #").concat(this.latestUrlChangeTargetingEvaluationId,".")),[2];this.sessionTargetingMatch=this.sessionTargetingMatch||d,this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:a,targetingParams:t},null,2)),u.label=2;case 2:return r?(this.initialize(!0),[3,5]):[3,3];case 3:return!n&&this.recordCancelCallback?[3,5]:(this.loggerProvider.log("Recording events for session due to forceRestart or no ongoing recording."),[4,this.recordEvents()]);case 4:u.sent(),u.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n=!0),l(e,void 0,void 0,function(){var e,i,o,a;return u(this,function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),e=void 0,(i=this.config)&&t!==la.METADATA?(e={config:Ga(i),version:vl},n?[4,Ka()]:[3,2]):[3,2];case 1:o=l.sent(),e=s(s({},o),e),l.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,s(s({},r),e)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(t," due to no ongoing recording.")),[3,4];case 3:return a=l.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",a),[3,4];case 4:return[2]}})})},this.stopRecordingEvents=function(){var t,r,n;try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,null===(t=e.networkObservers)||void 0===t||t.stop(),null===(r=e.crossOriginIframeCoordinator)||void 0===r||r.stop(),e.crossOriginIframeCoordinator=null,null===(n=e.crossOriginParentSignalCleanup)||void 0===n||n.call(e),e.crossOriginParentSignalCleanup=null}catch(t){var i=t;e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(i.toString()))}},this.loggerProvider=new Da(new ae)}return e.prototype.init=function(e,t){return re(this._init(e,t))},e.prototype.setupUrlChangeListener=function(){var e,t,r=this;null===(e=this.urlChangeCleanup)||void 0===e||e.call(this);var n=z();if(null==n?void 0:n.location){var i=!!(null===(t=this.config)||void 0===t?void 0:t.targetingConfig),o=zu(n,function(e){if(r.currentPageUrl=e,i){var t=++r.latestUrlChangeTargetingEvaluationId;r.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:e}},!1,!1,!0),r.loggerProvider.debug("Queued URL-change targeting re-evaluation #".concat(t," for ").concat(e,"."))}});this.urlChangeCleanup=function(){o(),r.urlChangeCleanup=null}}},e.prototype.isBelowMinSessionDuration=function(){var e,t=null===(e=this.config)||void 0===e?void 0:e.minSessionDurationMs;return void 0!==t&&void 0!==this.sessionStartTime&&Date.now()-this.sessionStartTime<t},e.prototype.getCurrentPageForTargeting=function(){var e,t,r=null===(t=null===(e=z())||void 0===e?void 0:e.location)||void 0===t?void 0:t.href;return null!=r?{url:r}:void 0},e.prototype._init=function(e,t){var r,n,i,o,a,p,f,g,v,m,y,b,w,S;return l(this,void 0,void 0,function(){var l,k,x,C,E,I,O,P,T,R,M,A,_,N,D,L,F,U,j,B,q,W,V,$,H,K,G,J,X,Y,Q,Z=this;return u(this,function(u){switch(u.label){case 0:return null===(r=this.urlChangeCleanup)||void 0===r||r.call(this),this.recordingEnabled=!0,this.startChildRecordingOnSetup=!1,this.loggerProvider=new Da(t.loggerProvider||new ae),Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.currentPageUrl=Wa(),this.identifiers=new Cu({sessionId:t.sessionId,deviceId:t.deviceId}),l=Date.now(),function(e,t,r){var n,i,o=Pu();if(o){var s=Iu(e);try{for(var a=[],l=0;l<o.length;l++)if((f=o.key(l))&&f.startsWith(s)){var u=o.getItem(f);if(null!==u){var d=Number(u);(!Number.isFinite(d)||d<=0||t-d>=Eu)&&a.push(f)}}try{for(var h=c(a),p=h.next();!p.done;p=h.next()){var f=p.value;o.removeItem(f)}}catch(e){n={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}}catch(e){null==r||r.debug("Failed to prune stale replay start times: ".concat(String(e)))}}}(e,l,this.loggerProvider),this.sessionStartTime=void 0!==t.sessionId&&null!==(n=function(e,t,r,n){var i=Pu();if(i){var o=Ou(e,t);try{var s=i.getItem(o);if(null!==s){var a=Number(s);if(Number.isFinite(a)&&a>0&&a<=r&&r-a<Eu)return a}return i.setItem(o,String(r)),r}catch(e){return void(null==n||n.debug("Failed to read/write replay start time from storage: ".concat(String(e))))}}}(e,t.sessionId,l,this.loggerProvider))&&void 0!==n?n:l,k=this,[4,al(e,t)];case 1:return k.joinedConfigGenerator=u.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:return x=u.sent(),C=x.joinedConfig,E=x.localConfig,I=x.remoteConfig,this.config=C,this.setMetadata(t.sessionId,C,E,I,null===(i=t.version)||void 0===i?void 0:i.version,vl,null===(o=t.version)||void 0===o?void 0:o.type),this.pageLeaveFns=[],t.sessionId&&(null===(a=this.config.interactionConfig)||void 0===a?void 0:a.enabled)&&(O=xu.default({sessionId:t.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[O.send(this.getDeviceId.bind(this)).bind(O)],this.scrollHook=O.hook.bind(O),this.clickHandler=new bu(this.loggerProvider,O)),P=[],"idb"!==(T=this.config.storeType)||(null===(p=z())||void 0===p?void 0:p.indexedDB)||(T="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(T," for event storage.")),A=z(),this.config.useWebWorker&&A&&A.Worker?[4,Promise.resolve().then(function(){return Hp})]:[3,4];case 3:_=u.sent(),N=_.compressionScript,D=_.trackDestinationScript,R=N,M=D,u.label=4;case 4:return u.trys.push([4,6,,7]),[4,ru({config:this.config,type:"replay",minInterval:null===(f=this.config.flushIntervalConfig)||void 0===f?void 0:f.minIntervalMs,maxInterval:null===(g=this.config.flushIntervalConfig)||void 0===g?void 0:g.maxIntervalMs,maxPersistedEventsSize:this.config.maxPersistedEventsSizeBytes,storeType:T,trackDestinationWorkerScript:M,shouldSend:function(){return!Z.isBelowMinSessionDuration()}})];case 5:return L=u.sent(),this.rrwebEventManager=L,P.push({name:"replay",manager:L}),[3,7];case 6:return F=u.sent(),q=F,this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(q.toString())),[3,7];case 7:if(!(null===(v=this.config.interactionConfig)||void 0===v?void 0:v.enabled))return[3,11];U=this.config.interactionConfig.batch?yu:mu,u.label=8;case 8:return u.trys.push([8,10,,11]),[4,ru({config:this.config,type:"interaction",minInterval:null!==(m=this.config.interactionConfig.trackEveryNms)&&void 0!==m?m:3e4,maxInterval:6e4,maxPersistedEventsSize:this.config.maxPersistedEventsSizeBytes,payloadBatcher:U,storeType:T,trackDestinationWorkerScript:M})];case 9:return j=u.sent(),P.push({name:"interaction",manager:j}),[3,11];case 10:return B=u.sent(),q=B,this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(q.toString())),[3,11];case 11:if(this.eventsManager=new(nu.bind.apply(nu,h([void 0],d(P),!1))),this.eventCompressor&&this.eventCompressor.terminate(),W=!0===this.config.eagerFullSnapshotSend?function(){return Z.sendEvents()}:void 0,this.eventCompressor=new hl(this.eventsManager,this.config,this.getDeviceId(),R,W),this.pendingEmitEvents.length>0){V=this.pendingEmitEvents.splice(0);try{for($=c(V),H=$.next();!H.done;H=$.next())K=H.value,G=K.event,J=K.sessionId,this.eventCompressor.enqueueEvent(G,J)}catch(e){Y={error:e}}finally{try{H&&!H.done&&(Q=$.return)&&Q.call($)}finally{if(Y)throw Y.error}}}return this.pageLeaveFns=h(h([],d(this.pageLeaveFns),!1),[function(){var e;if(Z.config&&(null===(e=Z.identifiers)||void 0===e?void 0:e.sessionId)&&L){var t=L.getBeaconEvents();if(t.length){var r=Z.getDeviceId();r&&(Z.isBelowMinSessionDuration()||L.trackDestination.sendBeacon({events:t,sessionId:Z.identifiers.sessionId,deviceId:r,apiKey:Z.config.apiKey,serverZone:Z.config.serverZone}))}}}],!1),[4,this.initializeNetworkObservers()];case 12:return u.sent(),(null===(y=z())||void 0===y?void 0:y.opener)&&(Lr(X=Nr()),X.setup(s({logger:this.loggerProvider},this.config.serverZone&&{endpoint:Rr[this.config.serverZone]}))),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.teardownEventListeners(!1),[4,this.evaluateTargetingAndCapture({userProperties:t.userProperties,page:this.getCurrentPageForTargeting()},!0)];case 13:return u.sent(),(this.config.targetingConfig||(null!==(S=null===(w=null===(b=this.config.privacyConfig)||void 0===b?void 0:b.urlMaskLevels)||void 0===w?void 0:w.length)&&void 0!==S?S:0)>0)&&this.setupUrlChangeListener(),[2]}})})},e.prototype.setSessionId=function(e,t){return re(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t,r){var n,i,o,s;return l(this,void 0,void 0,function(){var a,l,c,d,h;return u(this,function(u){switch(u.label){case 0:return a=null===(n=this.identifiers)||void 0===n?void 0:n.sessionId,l=this.getDeviceId(),void 0===a||a!==e||void 0!==t&&t!==l||void 0!==(null==r?void 0:r.userProperties)&&0!==Object.keys(r.userProperties).length?(this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,a&&this.sendEvents(a),(c=a!==e)&&(null===(i=this.rrwebEventManager)||void 0===i||i.dropPendingBeaconEvents()),d=t||this.getDeviceId(),this.identifiers=new Cu({sessionId:e,deviceId:d}),c&&(this.sessionStartTime=Date.now(),this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,(null===(o=this.config)||void 0===o?void 0:o.apiKey)&&(function(e,t,r,n){var i=Pu();if(i)try{i.setItem(Ou(e,t),String(r))}catch(e){null==n||n.debug("Failed to write replay start time to storage: ".concat(String(e)))}}(this.config.apiKey,e,this.sessionStartTime,this.loggerProvider),void 0!==a&&function(e,t,r){var n=Pu();if(n)try{n.removeItem(Ou(e,t))}catch(e){null==r||r.debug("Failed to remove replay start time from storage: ".concat(String(e)))}}(this.config.apiKey,a,this.loggerProvider))),this.joinedConfigGenerator&&a?[4,this.joinedConfigGenerator.generateJoinedConfig()]:[3,2]):[2];case 1:h=u.sent().joinedConfig,this.config=h,u.label=2;case 2:return(null===(s=this.config)||void 0===s?void 0:s.targetingConfig)?[4,this.evaluateTargetingAndCapture({userProperties:null==r?void 0:r.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)]:[3,4];case 3:return u.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:u.sent(),u.label=6;case 6:return[2]}})})},e.prototype.getSessionReplayProperties=function(){var e,t=this.config,r=this.identifiers;if(!t||!r)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var n=this.getShouldRecord(),i={};return n&&((e={})[ya]=r.sessionReplayId?r.sessionReplayId:null,i=e,t.debugMode&&(i[ka]=JSON.stringify({appHash:We(t.apiKey).toString()}))),this.addCustomRRWebEvent(la.GET_SR_PROPS,{shouldRecord:n,eventProperties:i},10===this.eventCount),10===this.eventCount&&(this.eventCount=0),this.eventCount++,i},e.prototype.sendEvents=function(e){var t,r,n=e||(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId),i=this.getDeviceId();if(this.eventsManager&&n&&i){if(this.isBelowMinSessionDuration()){var o=this.sessionStartTime,s=this.config.minSessionDurationMs;return this.loggerProvider.log("Session ".concat(n," not sent: duration ").concat(Date.now()-o,"ms is below minimum ").concat(s,"ms.")),void this.suppressedSendCount++}if(!this.hasEmittedGateDecision&&void 0!==(null===(r=this.config)||void 0===r?void 0:r.minSessionDurationMs)&&this.recordCancelCallback&&this.recordFunction){this.hasEmittedGateDecision=!0;var a=void 0!==this.sessionStartTime?Date.now()-this.sessionStartTime:void 0;this.addCustomRRWebEvent(la.REPLAY_GATE_DECISION,{sessionId:n,suppressedSendCount:this.suppressedSendCount,elapsedMs:a,minSessionDurationMs:this.config.minSessionDurationMs},!1)}this.eventsManager.sendCurrentSequenceEvents({sessionId:n,deviceId:i})}},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),l(this,void 0,void 0,function(){var r;return u(this,function(n){return(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId)?(r=this.getDeviceId())?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:r}),[2,this.recordEvents()]):(this.loggerProvider.log("Session is not being recorded due to lack of device id."),[2,Promise.resolve()]):(this.loggerProvider.log("Session is not being recorded due to lack of session id."),[2,Promise.resolve()])})})},e.prototype.shouldOptOut=function(){var e,t,r;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(r=Ne(this.config.instanceName).identityStore.getIdentity().optOut);return void 0!==r?r: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.recordingEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured because recording was stopped.")),!1;if(!this.config.captureEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured due to capture being disabled for project or because the remote config could not be fetched.")),!1;if(this.shouldOptOut())return this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;var e,t,r=!1,n="",i=!1;this.config.targetingConfig?this.sessionTargetingMatch?(n="Capturing replays for session ".concat(this.identifiers.sessionId," due to matching targeting conditions."),this.loggerProvider.log(n),r=!0,i=!0):(n="Not capturing replays for session ".concat(this.identifiers.sessionId," due to not matching targeting conditions."),this.loggerProvider.log(n),r=!1,i=!1):(e=this.identifiers.sessionId,t=this.config.sampleRate,ju(e.toString())%1e6/1e6<t)?(r=!0,i=!0):(n="Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate."),this.loggerProvider.log(n),r=!1,i=!1);return this.lastShouldRecordDecision!==r&&this.config.targetingConfig&&(this.addCustomRRWebEvent(la.TARGETING_DECISION,{message:n,sessionId:this.identifiers.sessionId,matched:i,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=r),r},e.prototype.getBlockSelectors=function(){var e,t,r,n=null!==(r=null===(t=null===(e=this.config)||void 0===e?void 0:e.privacyConfig)||void 0===t?void 0:t.blockSelector)&&void 0!==r?r:[];if(0!==n.length)return n},e.prototype.getMaskTextSelectors=function(){var e,t,r=null===(e=this.config)||void 0===e?void 0:e.privacyConfig;if("conservative"===(r?ja(this.currentPageUrl,r):void 0))return"*";if(null===(t=null==r?void 0:r.urlMaskLevels)||void 0===t?void 0:t.some(function(e){return"conservative"===e.maskLevel}))return"*";var n=null==r?void 0:r.urlMaskLevels;if("conservative"===(null==r?void 0:r.defaultMaskLevel)&&n&&n.length>0)return"*";var i=null==r?void 0:r.maskSelector;return i||void 0},e.prototype.getRecordingPlugins=function(e){var t,r,n,i,o,s;return l(this,void 0,void 0,function(){var a,l,c,d;return u(this,function(u){switch(u.label){case 0:a=[];try{l=Wu({ugcFilterRules:(null===(r=null===(t=this.config)||void 0===t?void 0:t.interactionConfig)||void 0===r?void 0:r.ugcFilterRules)||[],enablePolling:(null===(n=this.config)||void 0===n?void 0:n.enableUrlChangePolling)||!1,pollingInterval:null===(i=this.config)||void 0===i?void 0:i.urlChangePollingInterval,captureDocumentTitle:null===(o=this.config)||void 0===o?void 0:o.captureDocumentTitle}),a.push(l)}catch(e){this.loggerProvider.warn("Failed to create URL tracking plugin:",e)}if(!(null===(s=null==e?void 0:e.console)||void 0===s?void 0:s.enabled))return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return ay})];case 2:return c=u.sent().getRecordConsolePlugin,a.push(c({level:e.console.levels})),[3,4];case 3:return d=u.sent(),this.loggerProvider.warn("Failed to load console plugin:",d),[3,4];case 4:return[2,a.length>0?a:void 0]}})})},e.prototype.getRecordFunction=function(){return l(this,void 0,void 0,function(){var e,t;return u(this,function(r){switch(r.label){case 0:if(this.recordFunction)return[2,this.recordFunction];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return iC})];case 2:return e=r.sent().record,this.recordFunction=e,[2,e];case 3:return t=r.sent(),this.loggerProvider.warn("Failed to load rrweb-record module:",t),[2,null];case 4:return[2]}})})},e.prototype.recordEvents=function(e){return void 0===e&&(e=!0),l(this,void 0,void 0,function(){var t;return u(this,function(r){switch(r.label){case 0:if(this.recordEventsInFlight)return this.recordEventsPendingShouldLogMetadata=e,[2];this.recordEventsInFlight=!0,r.label=1;case 1:return r.trys.push([1,,6,7]),[4,this._recordEvents(e)];case 2:r.sent(),r.label=3;case 3:return null===this.recordEventsPendingShouldLogMetadata?[3,5]:(t=this.recordEventsPendingShouldLogMetadata,this.recordEventsPendingShouldLogMetadata=null,[4,this._recordEvents(t)]);case 4:return r.sent(),[3,3];case 5:return[3,7];case 6:return this.recordEventsInFlight=!1,this.recordEventsPendingShouldLogMetadata=null,[7];case 7:return[2]}})})},e.prototype.shouldAbandonRecordStart=function(e){return!this.recordingEnabled||e!==this.recordingGeneration},e.prototype._recordEvents=function(e){var t,r,n,i,o,a,c,d;return void 0===e&&(e=!0),l(this,void 0,void 0,function(){var l,h,p,f,g,v,m,y,b,w,S,k,x,C,E,I,O,P=this;return u(this,function(u){switch(u.label){case 0:return l=this.config,h=this.getShouldRecord(),p=null===(t=this.identifiers)||void 0===t?void 0:t.sessionId,h&&p&&l?(this.stopRecordingEvents(),f=this.recordingGeneration,[4,this.getRecordFunction()]):[2];case 1:return!(g=u.sent())||this.shouldAbandonRecordStart(f)?[2]:[4,this.initializeNetworkObservers()];case 2:if(u.sent(),this.shouldAbandonRecordStart(f))return[2];v=null===(r=l.loggingConfig)||void 0===r?void 0:r.network,m=Fa(l.serverZone,l.trackServerUrl),y=[Ea,Ia,Oa,m],null===(n=this.networkObservers)||void 0===n||n.start(function(e){y.some(function(t){return e.url.startsWith(t)})||P.addCustomRRWebEvent(la.FETCH_REQUEST,e)},v),b=l.interactionConfig,w=l.loggingConfig,S=(null==b?void 0:b.enabled)?{mouseInteraction:this.eventsManager&&(null===(i=this.clickHandler)||void 0===i?void 0:i.createHook({eventsManager:this.eventsManager,sessionId:p,deviceIdFn:this.getDeviceId.bind(this),mirror:g.mirror,ugcFilterRules:null!==(o=b.ugcFilterRules)&&void 0!==o?o:[],performanceOptions:null===(a=l.performanceConfig)||void 0===a?void 0:a.interaction})),scroll:this.scrollHook}:{},k=(null==b?void 0:b.enabled)&&b.ugcFilterRules?b.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(p,".")),u.label=3;case 3:return u.trys.push([3,5,,6]),x=!!(null===(c=l.crossOriginIframes)||void 0===c?void 0:c.enabled),C=!1!==(null===(d=l.crossOriginIframes)||void 0===d?void 0:d.coordinateChildren),E=x&&function(){try{var e=z();return!!e&&e.parent!==e}catch(e){return!0}}(),E&&C?(this.crossOriginParentSignalCleanup=function(e){var t=z();if(!t)return function(){};var r=t.parent;function n(t){if(t.source===r){var n=t.data;(null==n?void 0:n.type)===Na&&("start"===n.action?e.onStart():"stop"===n.action&&e.onStop())}}return t.addEventListener("message",n),function(){return t.removeEventListener("message",n)}}({onStart:function(){P.recordingEnabled&&P._recordEventsInChildMode(g,p,l,S)},onStop:function(){try{P.recordCancelCallback&&P.recordCancelCallback(),P.recordCancelCallback=null}catch(t){var e=t;P.loggerProvider.warn("Error occurred while stopping child iframe replay capture: ".concat(e.toString()))}}}),this.startChildRecordingOnSetup&&(this.startChildRecordingOnSetup=!1,this._recordEventsInChildMode(g,p,l,S)),[2]):(this.startChildRecordingOnSetup=!1,[4,this.getRecordingPlugins(w)]);case 4:return I=u.sent(),this.shouldAbandonRecordStart(f)?[2]:(this.recordCancelCallback=g(s(s({},this.buildRRWebRecordOptions(l,S,function(e){if(P.shouldOptOut()||!P.recordingEnabled)return P.loggerProvider.log(P.shouldOptOut()?"Opting session ".concat(p," out of recording due to optOut config."):"Session Replay capture stopping for ".concat(p,".")),P.stopRecordingEvents(),void P.sendEvents();e.type===rl.Meta&&(e.data.href=Ha(e.data.href,k)),P.eventCompressor?P.eventCompressor.enqueueEvent(e,p):P.pendingEmitEvents.push({event:e,sessionId:p})},"Error while capturing replay: ")),{plugins:I,recordCrossOriginIframes:x})),x&&!E&&C&&(this.crossOriginIframeCoordinator||(this.crossOriginIframeCoordinator=new Vu),this.crossOriginIframeCoordinator.start()),this.addCustomRRWebEvent(la.DEBUG_INFO),e&&this.addCustomRRWebEvent(la.METADATA,this.metadata),[3,6]);case 5:return O=u.sent(),this.loggerProvider.warn("Failed to initialize session replay:",O),[3,6];case 6:return[2]}})})},e.prototype.buildRRWebRecordOptions=function(e,t,r,n){var i=this,o=e.privacyConfig;return s(s({emit:r,inlineStylesheet:e.shouldInlineStylesheet,inlineImages:e.inlineImages,hooks:t,maskAllInputs:!0,maskTextClass:xa,blockClass:"amp-block",blockSelector:this.getBlockSelectors(),applyBackgroundColorToBlockedElements:e.applyBackgroundColorToBlockedElements,maskInputFn:qa("input",o,function(){return i.currentPageUrl}),maskTextFn:qa("text",o,function(){return i.currentPageUrl}),maskAttributeFn:za(o,function(){return i.currentPageUrl}),maskTextSelector:this.getMaskTextSelectors()},void 0!==e.fullSnapshotIntervalMs&&{checkoutEveryNms:e.fullSnapshotIntervalMs}),{recordCanvas:!1,captureAdoptedStyleSheets:e.captureAdoptedStyleSheets,slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0},errorHandler:function(e){var t=e;if(t.message.includes("insertRule")&&t.message.includes("CSSStyleSheet"))throw t;if(t._external_)throw t;return i.loggerProvider.warn(n,t.toString()),!0}})},e.prototype._recordEventsInChildMode=function(e,t,r,n){try{this.recordCancelCallback&&this.recordCancelCallback(),this.recordCancelCallback=null,this.recordCancelCallback=e(s(s({},this.buildRRWebRecordOptions(r,n,function(){},"Error while capturing replay (child iframe): ")),{recordCrossOriginIframes:!0})),this.loggerProvider.log("Session Replay child iframe capture beginning for session ".concat(t,"."))}catch(e){this.loggerProvider.warn("Failed to initialize session replay in child iframe mode:",e)}},e.prototype.getDeviceId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.deviceId},e.prototype.getSessionId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.sessionId},e.prototype.start=function(){return re(this._start())},e.prototype._start=function(){return l(this,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return this.recordingEnabled=!0,this.startChildRecordingOnSetup=!0,[4,this.recordEvents()];case 1:return e.sent(),[2]}})})},e.prototype.stop=function(){this.recordingEnabled=!1,this.startChildRecordingOnSetup=!1,this.recordingGeneration++,this.stopRecordingEvents(),this.sendEvents()},e.prototype.flush=function(e){var t;return void 0===e&&(e=!1),l(this,void 0,void 0,function(){return u(this,function(r){return[2,null===(t=this.eventsManager)||void 0===t?void 0:t.flush(e)]})})},e.prototype.shutdown=function(){var e,t;this.recordingEnabled=!1,this.startChildRecordingOnSetup=!1,this.recordingGeneration++,null===(e=this.urlChangeCleanup)||void 0===e||e.call(this),null===(t=this.crossOriginParentSignalCleanup)||void 0===t||t.call(this),this.crossOriginParentSignalCleanup=null,this.teardownEventListeners(!0),this.stopRecordingEvents(),this.sendEvents()},e.prototype.mapSDKType=function(e){return"plugin"===e?"@amplitude/plugin-session-replay-browser":"segment"===e?"@amplitude/segment-session-replay-plugin":null},e.prototype.setMetadata=function(e,t,r,n,i,o,s){var a=(null==e?void 0:e.toString())?We(e.toString()):void 0;this.metadata={joinedConfig:t,localConfig:r,remoteConfig:n,sessionId:e,hashValue:a,sampleRate:t.sampleRate,replaySDKType:this.mapSDKType(s),replaySDKVersion:i,standaloneSDKType:"@amplitude/session-replay-browser",standaloneSDKVersion:o}},e.prototype.initializeNetworkObservers=function(){var e,t,r;return l(this,void 0,void 0,function(){var n,i;return u(this,function(o){switch(o.label){case 0:if(!(null===(r=null===(t=null===(e=this.config)||void 0===e?void 0:e.loggingConfig)||void 0===t?void 0:t.network)||void 0===r?void 0:r.enabled)||this.networkObservers)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return cC})];case 2:return n=o.sent().NetworkObservers,this.networkObservers=new n,[3,4];case 3:return i=o.sent(),this.loggerProvider.warn("Failed to import or instantiate NetworkObservers:",i),[3,4];case 4:return[2]}})})},e}(),Ju=function(e){return function(){var t=e.config||Ja();return{logger:t.loggerProvider,logLevel:t.logLevel}}},Xu=function(){var e=new Gu;return{init:be(e.init.bind(e),"init",Ju(e)),evaluateTargetingAndCapture:be(e.evaluateTargetingAndCapture.bind(e),"evaluateTargetingAndRecord",Ju(e)),setSessionId:be(e.setSessionId.bind(e),"setSessionId",Ju(e)),getSessionId:be(e.getSessionId.bind(e),"getSessionId",Ju(e)),getSessionReplayProperties:be(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",Ju(e)),flush:be(e.flush.bind(e),"flush",Ju(e)),start:be(e.start.bind(e),"start",Ju(e)),stop:be(e.stop.bind(e),"stop",Ju(e)),shutdown:be(e.shutdown.bind(e),"shutdown",Ju(e))}}(),Yu=Xu.init,Qu=Xu.setSessionId,Zu=Xu.getSessionId,ec=Xu.getSessionReplayProperties,tc=Xu.flush,rc=Xu.start,nc=Xu.stop,ic=Xu.shutdown,oc=Xu.evaluateTargetingAndCapture;!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}($u||($u={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue"}(Hu||(Hu={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(Ku||(Ku={}));var sc=[$u.SET,$u.SET_ONCE,$u.ADD,$u.APPEND,$u.PREPEND,$u.POSTINSERT],ac="1.35.3-video-analytics-5.0",lc="".concat("[Amplitude]"," Session Replay ID"),uc=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:tc,getSessionId:Zu,getSessionReplayProperties:ec,init:Yu,setSessionId:Qu,start:rc,stop:nc,shutdown:ic,evaluateTargetingAndCapture:oc},this.options=s({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var r,n,i,o,a,c,d,h;return l(this,void 0,void 0,function(){var t,l,p;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),null==e||e.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(ac,".")),this.config=e,this.options.forceSessionTracking&&("boolean"==typeof e.defaultTracking?!1===e.defaultTracking&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=s(s({},e.defaultTracking),{sessions:!0})),t=Ne(this.config.instanceName).identityStore,l=t.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:null!==(r=this.options.deviceId)&&void 0!==r?r:this.config.deviceId,optOut:this.config.optOut,sessionId:this.options.customSessionId?void 0:this.config.sessionId,loggerProvider:this.config.loggerProvider,logLevel:this.config.logLevel,flushMaxRetries:this.config.flushMaxRetries,serverZone:this.config.serverZone,configServerUrl:this.options.configServerUrl||(null===(n=this.config.remoteConfig)||void 0===n?void 0:n.serverUrl),trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null===(i=this.options.privacyConfig)||void 0===i?void 0:i.blockSelector,maskSelector:null===(o=this.options.privacyConfig)||void 0===o?void 0:o.maskSelector,unmaskSelector:null===(a=this.options.privacyConfig)||void 0===a?void 0:a.unmaskSelector,defaultMaskLevel:null===(c=this.options.privacyConfig)||void 0===c?void 0:c.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,inlineImages:this.options.inlineImages,version:{type:"plugin",version:ac},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:null!==(d=this.options.useWebWorker)&&void 0!==d?d:null===(h=this.options.experimental)||void 0===h?void 0:h.useWebWorker,userProperties:l,applyBackgroundColorToBlockedElements:this.options.applyBackgroundColorToBlockedElements,interactionConfig:this.options.interactionConfig,captureDocumentTitle:this.options.captureDocumentTitle,enableUrlChangePolling:this.options.enableUrlChangePolling,urlChangePollingInterval:this.options.urlChangePollingInterval,captureAdoptedStyleSheets:this.options.captureAdoptedStyleSheets,crossOriginIframes:this.options.crossOriginIframes,flushIntervalConfig:this.options.flushIntervalConfig,eagerFullSnapshotSend:this.options.eagerFullSnapshotSend,captureFullSnapshotOnFocus:this.options.captureFullSnapshotOnFocus,maxPersistedEventsSizeBytes:this.options.maxPersistedEventsSizeBytes,maxSingleEventSizeBytes:this.options.maxSingleEventSizeBytes,sendTimeoutMs:this.options.sendTimeoutMs,handleSendEvents:this.options.handleSendEvents,handleFetchConfig:this.options.handleFetchConfig},[4,this.sessionReplay.init(e.apiKey,this.srInitOptions).promise];case 1:return u.sent(),[3,3];case 2:return p=u.sent(),null==e||e.loggerProvider.error("Session Replay: Failed to initialize due to ".concat(p.message)),[3,3];case 3:return[2]}})})},e.prototype.onSessionIdChanged=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return null===(t=this.config)||void 0===t||t.loggerProvider.debug("Analytics session id is changed to ".concat(e,", SR session id is ").concat(String(this.sessionReplay.getSessionId()),".")),[4,this.sessionReplay.setSessionId(e).promise];case 1:return r.sent(),[2]}})})},e.prototype.onOptOutChanged=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return null===(t=this.config)||void 0===t||t.loggerProvider.debug("optOut is changed to ".concat(String(e),", calling ").concat(e?"sessionReplay.shutdown()":"sessionReplay.init()",".")),e?(this.sessionReplay.shutdown(),[3,4]):[3,1];case 1:return null!=this.config?[4,this.sessionReplay.init(this.config.apiKey,this.srInitOptions).promise]:[3,3];case 2:r.sent(),r.label=3;case 3:r.label=4;case 4:return[2]}})})},e.prototype.execute=function(e){var t,r,n;return l(this,void 0,void 0,function(){var i,a,l,c,d;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,9,,10]),this.options.customSessionId?(i=this.options.customSessionId(e))?i===this.sessionReplay.getSessionId()?[3,2]:[4,this.sessionReplay.setSessionId(i).promise]:[3,3]:[3,4];case 1:u.sent(),u.label=2;case 2:c=this.sessionReplay.getSessionReplayProperties(),e.event_properties=s(s({},e.event_properties),c),u.label=3;case 3:return[3,8];case 4:return(i=null===(t=this.config)||void 0===t?void 0:t.sessionId)&&i!==this.sessionReplay.getSessionId()?[4,this.sessionReplay.setSessionId(i).promise]:[3,6];case 5:u.sent(),u.label=6;case 6:return i&&i===e.session_id?(a=void 0,e.event_type===o.IDENTIFY&&(a=function(e){if(e.user_properties){var t={};return Object.keys(e.user_properties).forEach(function(r){if(sc.includes(r)){var n=e.user_properties&&e.user_properties[r];t=s(s({},t),n)}}),t}}(e)),l=z(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:a,page:null!=(null===(r=null==l?void 0:l.location)||void 0===r?void 0:r.href)?{url:l.location.href}:void 0})]):[3,8];case 7:u.sent(),c=this.sessionReplay.getSessionReplayProperties(),e.event_properties=s(s({},e.event_properties),c),u.label=8;case 8:return e.event_type===o.IDENTIFY&&e.event_properties&&delete e.event_properties[lc],[2,Promise.resolve(e)];case 9:return d=u.sent(),null===(n=this.config)||void 0===n||n.loggerProvider.error("Session Replay: Failed to enrich event due to ".concat(d.message)),[2,Promise.resolve(e)];case 10:return[2]}})})},e.prototype.teardown=function(){var e;return l(this,void 0,void 0,function(){return u(this,function(t){try{this.sessionReplay.shutdown(),this.config=null}catch(t){null===(e=this.config)||void 0===e||e.loggerProvider.error("Session Replay: teardown failed due to ".concat(t.message))}return[2]})})},e.prototype.getSessionReplayProperties=function(){return this.sessionReplay.getSessionReplayProperties()},e.prototype.start=function(){return l(this,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,this.sessionReplay.start().promise];case 1:return e.sent(),[2]}})})},e.prototype.stop=function(){this.sessionReplay.stop()},e.pluginName="@amplitude/plugin-session-replay-browser",e}(),cc=function(e,t){return cc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},cc(e,t)};function dc(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}cc(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hc=function(){return hc=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},hc.apply(this,arguments)};function pc(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})}function fc(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function gc(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vc(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function mc(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var yc="is",bc="is not",wc="contains",Sc="does not contain",kc="less",xc="less or equal",Cc="greater",Ec="greater or equal",Ic="version less",Oc="version less or equal",Pc="version greater",Tc="version greater or equal",Rc="set is",Mc="set is not",Ac="set contains",_c="set does not contain",Nc="set contains any",Dc="set does not contain any",Lc="regex match",Fc="regex does not match",Uc=-862048943,jc=461845907,Bc=function(e,t){void 0===t&&(t=0);for(var r=function(e){for(var t=[],r=0,n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return Uint8Array.from(t)}(e),n=r.length,i=n>>2,o=t,s=0;s<i;s++){var a=Vc(r,s<<2);o=qc(a,o)}var l=i<<2,u=0;switch(n-l){case 3:u^=r[l+2]<<16,u^=r[l+1]<<8,u^=r[l],u=Math.imul(u,Uc),u=Wc(u,15),o^=u=Math.imul(u,jc);break;case 2:u^=r[l+1]<<8,u^=r[l],u=Math.imul(u,Uc),u=Wc(u,15),o^=u=Math.imul(u,jc);break;case 1:u^=r[l],u=Math.imul(u,Uc),u=Wc(u,15),o^=u=Math.imul(u,jc)}return zc(o^=n)>>>0},qc=function(e,t){var r=e,n=t;return r=Math.imul(r,Uc),r=Wc(r,15),r=Math.imul(r,jc),n=Wc(n^=r,13),(n=Math.imul(n,5))+-430675100|0},zc=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-2048144789),t^=t>>>13,t=Math.imul(t,-1028477387),t^=t>>>16},Wc=function(e,t,r){return void 0===r&&(r=32),t>r&&(t%=r),(e<<t|(e&4294967295<<r-t>>>0)>>>0>>>r-t>>>0)>>>0},Vc=function(e,t){void 0===t&&(t=0);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return $c(r)},$c=function(e){return(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24},Hc=function(e,t){var r,n;if(t&&0!==t.length){try{for(var i=gc(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!s||!e||"object"!=typeof e)return;e=e[s]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return null==e?void 0:e}},Kc="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),Gc=function(){function e(e,t,r,n){void 0===n&&(n=void 0),this.major=e,this.minor=t,this.patch=r,this.preRelease=n}return e.parse=function(t){if(t){var r=new RegExp(Kc).exec(t);if(r){var n=Number(r[1]),i=Number(r[2]);if(!isNaN(n)&&!isNaN(i))return new e(n,i,Number(r[4])||0,r[5]||void 0)}}},e.prototype.compareTo=function(e){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch||this.preRelease&&!e.preRelease?-1:!this.preRelease&&e.preRelease?1:this.preRelease&&e.preRelease?this.preRelease>e.preRelease?1:this.preRelease<e.preRelease?-1:0:0},e}(),Jc=function(){function e(){}return e.prototype.evaluate=function(e,t){var r,n,i={},o={context:e,result:i};try{for(var s=gc(t),a=s.next();!a.done;a=s.next()){var l=a.value,u=this.evaluateFlag(o,l);u&&(i[l.key]=u)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},e.prototype.evaluateFlag=function(e,t){var r,n,i;try{for(var o=gc(t.segments),s=o.next();!s.done;s=o.next()){var a=s.value;if(i=this.evaluateSegment(e,t,a)){var l=hc(hc(hc({},t.metadata),a.metadata),i.metadata);i=hc(hc({},i),{metadata:l});break}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e.prototype.evaluateSegment=function(e,t,r){var n;return r.conditions?this.evaluateConditions(e,r.conditions)&&void 0!==(n=this.bucket(e,r))?t.variants[n]:void 0:void 0!==(n=this.bucket(e,r))?t.variants[n]:void 0},e.prototype.evaluateConditions=function(e,t){var r,n,i,o;try{for(var s=gc(t),a=s.next();!a.done;a=s.next()){var l=a.value,u=!0;try{for(var c=(i=void 0,gc(l)),d=c.next();!d.done;d=c.next()){var h=d.value;if(!(u=this.matchCondition(e,h)))break}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}if(u)return!0}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return!1},e.prototype.matchCondition=function(e,t){var r=Hc(e,t.selector);if(null==r)return this.matchNull(t.op,t.values);if(this.isSetOperator(t.op)){var n=this.coerceStringArray(r);return!!n&&this.matchSet(n,t.op,t.values)}var i=this.coerceString(r);return void 0!==i&&this.matchString(i,t.op,t.values)},e.prototype.getHash=function(e){return Bc(e)},e.prototype.bucket=function(e,t){var r,n,i,o;if(!t.bucket)return t.variant;var s=this.coerceString(Hc(e,t.bucket.selector));if(!s||0===s.length)return t.variant;var a="".concat(t.bucket.salt,"/").concat(s),l=this.getHash(a),u=l%100,c=Math.floor(l/100);try{for(var d=gc(t.bucket.allocations),h=d.next();!h.done;h=d.next()){var p=h.value,f=p.range[0],g=p.range[1];if(u>=f&&u<g)try{for(var v=(i=void 0,gc(p.distributions)),m=v.next();!m.done;m=v.next()){var y=m.value,b=y.range[0],w=y.range[1];if(c>=b&&c<w)return y.variant}}catch(e){i={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return t.variant},e.prototype.matchNull=function(e,t){var r=this.containsNone(t);switch(e){case yc:case wc:case kc:case xc:case Cc:case Ec:case Ic:case Oc:case Pc:case Tc:case Rc:case Ac:case Nc:return r;case bc:case Sc:case _c:case Dc:return!r;default:return!1}},e.prototype.matchSet=function(e,t,r){switch(t){case Rc:return this.setEquals(e,r);case Mc:return!this.setEquals(e,r);case Ac:return this.matchesSetContainsAll(e,r);case _c:return!this.matchesSetContainsAll(e,r);case Nc:return this.matchesSetContainsAny(e,r);case Dc:return!this.matchesSetContainsAny(e,r);default:return!1}},e.prototype.matchString=function(e,t,r){var n=this;switch(t){case yc:return this.matchesIs(e,r);case bc:return!this.matchesIs(e,r);case wc:return this.matchesContains(e,r);case Sc:return!this.matchesContains(e,r);case kc:case xc:case Cc:case Ec:return this.matchesComparable(e,t,r,function(e){return n.parseNumber(e)},this.comparator);case Ic:case Oc:case Pc:case Tc:return this.matchesComparable(e,t,r,function(e){return Gc.parse(e)},this.versionComparator);case Lc:return this.matchesRegex(e,r);case Fc:return!this.matchesRegex(e,r);default:return!1}},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var r=e.toLowerCase();if("true"===r||"false"===r)return t.some(function(e){return e.toLowerCase()===r})}return t.some(function(t){return e===t})},e.prototype.matchesContains=function(e,t){var r,n;try{for(var i=gc(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.toLowerCase().includes(s.toLowerCase()))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e.prototype.matchesComparable=function(e,t,r,n,i){var o=this,s=n(e),a=r.map(function(e){return n(e)}).filter(function(e){return void 0!==e});return void 0===s||0===a.length?r.some(function(r){return o.comparator(e,t,r)}):a.some(function(e){return i(s,t,e)})},e.prototype.comparator=function(e,t,r){switch(t){case kc:case Ic:return e<r;case xc:case Oc:return e<=r;case Cc:case Pc:return e>r;case Ec:case Tc:return e>=r;default:return!1}},e.prototype.versionComparator=function(e,t,r){var n=e.compareTo(r);switch(t){case kc:case Ic:return n<0;case xc:case Oc:return n<=0;case Cc:case Pc:return n>0;case Ec:case Tc:return n>=0;default:return!1}},e.prototype.matchesRegex=function(e,t){return t.some(function(t){return Boolean(new RegExp(t).exec(e))})},e.prototype.containsNone=function(e){return e.some(function(e){return"(none)"===e})},e.prototype.containsBooleans=function(e){return e.some(function(e){switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})},e.prototype.parseNumber=function(e){var t;return null!==(t=Number(e))&&void 0!==t?t:void 0},e.prototype.coerceString=function(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e))return e.map(function(e){return t.coerceString(e)}).filter(Boolean);var r=String(e);try{var n=JSON.parse(r);return Array.isArray(n)?e.map(function(e){return t.coerceString(e)}).filter(Boolean):(i=this.coerceString(r))?[i]:void 0}catch(e){var i;return(i=this.coerceString(r))?[i]:void 0}},e.prototype.isSetOperator=function(e){switch(e){case Rc:case Mc:case Ac:case _c:case Nc:case Dc:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var r=new Set(e),n=new Set(t);return r.size===n.size&&mc([],vc(n),!1).every(function(e){return r.has(e)})},e.prototype.matchesSetContainsAll=function(e,t){var r,n;if(e.length<t.length)return!1;try{for(var i=gc(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!this.matchesIs(s,e))return!1}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0},e.prototype.matchesSetContainsAny=function(e,t){var r,n;try{for(var i=gc(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(this.matchesIs(s,e))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e}(),Xc=function(e,t,r){var n,i;void 0===r&&(r=[]);var o=t[e];if(o){if(!o.dependencies||0===o.dependencies.length)return delete t[o.key],[o];r.push(o.key);var s=[],a=function(e){if(r.some(function(t){return t===e}))throw Error("Detected a cycle between flags ".concat(r));var n=Xc(e,t,r);n&&s.push.apply(s,mc([],vc(n),!1))};try{for(var l=gc(o.dependencies),u=l.next();!u.done;u=l.next()){a(u.value)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}return s.push(o),r.pop(),delete t[o.key],s}};const Yc="function"==typeof Buffer,Qc=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),Zc=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),ed=(e=>{let t={};return e.forEach((e,r)=>t[e]=r),t})(Zc),td=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,rd=String.fromCharCode.bind(String),nd=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_")),id=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),od=e=>{let t,r,n,i,o="";const s=e.length%3;for(let s=0;s<e.length;){if((r=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255||(i=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|i,o+=Zc[t>>18&63]+Zc[t>>12&63]+Zc[t>>6&63]+Zc[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},sd="function"==typeof btoa?e=>btoa(e):Yc?e=>Buffer.from(e,"binary").toString("base64"):od,ad=Yc?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(rd.apply(null,e.subarray(r,r+4096)));return sd(t.join(""))},ld=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?rd(192|t>>>6)+rd(128|63&t):rd(224|t>>>12&15)+rd(128|t>>>6&63)+rd(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return rd(240|t>>>18&7)+rd(128|t>>>12&63)+rd(128|t>>>6&63)+rd(128|63&t)},ud=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,cd=e=>e.replace(ud,ld),dd=Yc?e=>Buffer.from(e,"utf8").toString("base64"):Qc?e=>ad(Qc.encode(e)):e=>sd(cd(e)),hd=(e,t=!1)=>t?nd(dd(e)):dd(e),pd=e=>hd(e,!0),fd=e=>{if(e=e.replace(/\s+/g,""),!td.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r,n,i="";for(let o=0;o<e.length;)t=ed[e.charAt(o++)]<<18|ed[e.charAt(o++)]<<12|(r=ed[e.charAt(o++)])<<6|(n=ed[e.charAt(o++)]),i+=64===r?rd(t>>16&255):64===n?rd(t>>16&255,t>>8&255):rd(t>>16&255,t>>8&255,255&t);return i},gd=pd;var vd=function(e){function t(r,n){var i=e.call(this,n)||this;return i.statusCode=r,Object.setPrototypeOf(i,t.prototype),i}return dc(t,e),t}(Error),md=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return dc(t,e),t}(Error),yd=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getVariants=function(e,t){return pc(this,void 0,void 0,function(){var r,n,i,o;return fc(this,function(s){switch(s.label){case 0:return r=gd(JSON.stringify(e)),n={Authorization:"Api-Key ".concat(this.deploymentKey),"X-Amp-Exp-User":r},(null==t?void 0:t.flagKeys)&&(n["X-Amp-Exp-Flag-Keys"]=gd(JSON.stringify(t.flagKeys))),(null==t?void 0:t.trackingOption)&&(n["X-Amp-Exp-Track"]=t.trackingOption),i=new URL("".concat(this.serverUrl,"/sdk/v2/vardata?v=0")),(null==t?void 0:t.evaluationMode)&&i.searchParams.append("eval_mode",null==t?void 0:t.evaluationMode),(null==t?void 0:t.deliveryMethod)&&i.searchParams.append("delivery_method",null==t?void 0:t.deliveryMethod),[4,this.httpClient.request({requestUrl:i.toString(),method:"GET",headers:n,timeoutMillis:null==t?void 0:t.timeoutMillis})];case 1:if(200!=(o=s.sent()).status)throw new vd(o.status,"Fetch error response: status=".concat(o.status));return[2,JSON.parse(o.body)]}})})},e}(),bd=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getFlags=function(e){return pc(this,void 0,void 0,function(){var t,r;return fc(this,function(n){switch(n.label){case 0:return t={Authorization:"Api-Key ".concat(this.deploymentKey)},(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]="".concat(e.libraryName,"/").concat(e.libraryVersion)),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=gd(JSON.stringify(e.user))),[4,this.httpClient.request({requestUrl:"".concat(this.serverUrl,"/sdk/v2/flags")+((null==e?void 0:e.deliveryMethod)?"?delivery_method=".concat(e.deliveryMethod):""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis})];case 1:if(200!=(r=n.sent()).status)throw Error("Flags error response: status=".concat(r.status));return[2,JSON.parse(r.body).reduce(function(e,t){return e[t.key]=t,e},{})]}})})},e}(),wd="undefined"!=typeof globalThis?globalThis:global||self,Sd=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},kd=function(){function e(e,t){this.poller=void 0,this.action=e,this.ms=t}return e.prototype.start=function(){this.poller||(this.poller=wd.setInterval(this.action,this.ms),this.action())},e.prototype.stop=function(){this.poller&&(wd.clearInterval(this.poller),this.poller=void 0)},e}(),xd={},Cd={get exports(){return xd},set exports(e){xd=e}};!function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",l="model",u="name",c="type",d="vendor",h="version",p="architecture",f="console",g="mobile",v="tablet",m="smarttv",y="wearable",b="embedded",w="Amazon",S="Apple",k="ASUS",x="BlackBerry",C="Browser",E="Chrome",I="Firefox",O="Google",P="Huawei",T="LG",R="Microsoft",M="Motorola",A="Opera",_="Samsung",N="Sharp",D="Sony",L="Xiaomi",F="Zebra",U="Facebook",j=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},B=function(e,t){return typeof e===a&&-1!==q(t).indexOf(q(e))},q=function(e){return e.toLowerCase()},z=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,350)},W=function(e,t){for(var r,o,a,l,u,c,d=0;d<t.length&&!u;){var h=t[d],p=t[d+1];for(r=o=0;r<h.length&&!u;)if(u=h[r++].exec(e))for(a=0;a<p.length;a++)c=u[++o],typeof(l=p[a])===s&&l.length>0?2===l.length?typeof l[1]==i?this[l[0]]=l[1].call(this,c):this[l[0]]=l[1]:3===l.length?typeof l[1]!==i||l[1].exec&&l[1].test?this[l[0]]=c?c.replace(l[1],l[2]):n:this[l[0]]=c?l[1].call(this,c,l[2]):n:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):n):this[l]=c||n;d+=2}},V=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(B(t[r][i],e))return"?"===r?n:r}else if(B(t[r],e))return"?"===r?n:r;return e},$={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},H={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,h],[/opios[\/ ]+([\w\.]+)/i],[h,[u,A+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[u,A]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[u,"UC"+C]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[h,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[h,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+C],h],[/\bfocus\/([\w\.]+)/i],[h,[u,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[u,A+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[u,A+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[u,"MIUI "+C]],[/fxios\/([-\w\.]+)/i],[h,[u,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+C]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+C],h],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,U],h],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[u,E+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,E+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[u,"Android "+C]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,h],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[h,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[h,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[h,V,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[u,I+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,h],[/(cobalt)\/([\w\.]+)/i],[u,[h,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,q]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",q]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,q]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[d,_],[c,v]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[d,_],[c,g]],[/((ipod|iphone)\d+,\d+)/i],[l,[d,S],[c,g]],[/(ipad\d+,\d+)/i],[l,[d,S],[c,v]],[/\((ip(?:hone|od)[\w ]*);/i],[l,[d,S],[c,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[d,S],[c,v]],[/(macintosh);/i],[l,[d,S]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[d,P],[c,v]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[d,P],[c,g]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[l,/_/g," "],[d,L],[c,g]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[d,L],[c,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[d,"OPPO"],[c,g]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[d,"Vivo"],[c,g]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[l,[d,"Realme"],[c,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[l,[d,M],[c,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[d,M],[c,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[d,T],[c,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[d,T],[c,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[d,"Lenovo"],[c,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[d,"Nokia"],[c,g]],[/(pixel c)\b/i],[l,[d,O],[c,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[d,O],[c,g]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[d,D],[c,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[d,D],[c,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[d,"OnePlus"],[c,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[d,w],[c,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[d,w],[c,g]],[/(playbook);[-\w\),; ]+(rim)/i],[l,d,[c,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[d,x],[c,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[d,k],[c,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[d,k],[c,g]],[/(nexus 9)/i],[l,[d,"HTC"],[c,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[l,/_/g," "],[c,g]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[d,"Acer"],[c,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[d,"Meizu"],[c,g]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[d,N],[c,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,l,[c,g]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,l,[c,v]],[/(surface duo)/i],[l,[d,R],[c,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[d,"Fairphone"],[c,g]],[/(u304aa)/i],[l,[d,"AT&T"],[c,g]],[/\bsie-(\w*)/i],[l,[d,"Siemens"],[c,g]],[/\b(rct\w+) b/i],[l,[d,"RCA"],[c,v]],[/\b(venue[\d ]{2,7}) b/i],[l,[d,"Dell"],[c,v]],[/\b(q(?:mv|ta)\w+) b/i],[l,[d,"Verizon"],[c,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[d,"Barnes & Noble"],[c,v]],[/\b(tm\d{3}\w+) b/i],[l,[d,"NuVision"],[c,v]],[/\b(k88) b/i],[l,[d,"ZTE"],[c,v]],[/\b(nx\d{3}j) b/i],[l,[d,"ZTE"],[c,g]],[/\b(gen\d{3}) b.+49h/i],[l,[d,"Swiss"],[c,g]],[/\b(zur\d{3}) b/i],[l,[d,"Swiss"],[c,v]],[/\b((zeki)?tb.*\b) b/i],[l,[d,"Zeki"],[c,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],l,[c,v]],[/\b(ns-?\w{0,9}) b/i],[l,[d,"Insignia"],[c,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[d,"NextBook"],[c,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],l,[c,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],l,[c,g]],[/\b(ph-1) /i],[l,[d,"Essential"],[c,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[d,"Envizen"],[c,v]],[/\b(trio[-\w\. ]+) b/i],[l,[d,"MachSpeed"],[c,v]],[/\btu_(1491) b/i],[l,[d,"Rotor"],[c,v]],[/(shield[\w ]+) b/i],[l,[d,"Nvidia"],[c,v]],[/(sprint) (\w+)/i],[d,l,[c,g]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[d,R],[c,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[d,F],[c,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[d,F],[c,g]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,l,[c,f]],[/droid.+; (shield) bui/i],[l,[d,"Nvidia"],[c,f]],[/(playstation [345portablevi]+)/i],[l,[d,D],[c,f]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[d,R],[c,f]],[/smart-tv.+(samsung)/i],[d,[c,m]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[d,_],[c,m]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,T],[c,m]],[/(apple) ?tv/i],[d,[l,S+" TV"],[c,m]],[/crkey/i],[[l,E+"cast"],[d,O],[c,m]],[/droid.+aft(\w)( bui|\))/i],[l,[d,w],[c,m]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[d,N],[c,m]],[/(bravia[\w ]+)( bui|\))/i],[l,[d,D],[c,m]],[/(mitv-\w{5}) bui/i],[l,[d,L],[c,m]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,z],[l,z],[c,m]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[c,m]],[/((pebble))app/i],[d,l,[c,y]],[/droid.+; (glass) \d/i],[l,[d,O],[c,y]],[/droid.+; (wt63?0{2,3})\)/i],[l,[d,F],[c,y]],[/(quest( 2)?)/i],[l,[d,U],[c,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[c,b]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[l,[c,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[c,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[c,v]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[c,g]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[h,V,$]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[h,V,$]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[h,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,h],[/\(bb(10);/i],[h,[u,x]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[u,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[u,"webOS"]],[/crkey\/([\d\.]+)/i],[h,[u,E+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[u,"Chromium OS"],h],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,h],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,h]]},K=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof K))return new K(e,t).getResult();var i=e||(typeof r!==o&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),f=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(H,t):H;return this.getBrowser=function(){var e={};return e[u]=n,e[h]=n,W.call(e,i,f.browser),e.major=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e.version),e},this.getCPU=function(){var e={};return e[p]=n,W.call(e,i,f.cpu),e},this.getDevice=function(){var e={};return e[d]=n,e[l]=n,e[c]=n,W.call(e,i,f.device),e},this.getEngine=function(){var e={};return e[u]=n,e[h]=n,W.call(e,i,f.engine),e},this.getOS=function(){var e={};return e[u]=n,e[h]=n,W.call(e,i,f.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return i},this.setUA=function(e){return i=typeof e===a&&e.length>350?z(e,350):e,this},this.setUA(i),this};K.VERSION="0.7.33",K.BROWSER=j([u,h,"major"]),K.CPU=j([p]),K.DEVICE=j([l,d,c,f,g,m,v,y,b]),K.ENGINE=K.OS=j([u,h]),e.exports&&(t=e.exports=K),t.UAParser=K;var G=typeof r!==o&&(r.jQuery||r.Zepto);if(G&&!G.ua){var J=new K;G.ua=J.getResult(),G.ua.get=function(){return J.getUA()},G.ua.set=function(e){J.setUA(e);var t=J.getResult();for(var r in t)G.ua[r]=t[r]}}}("object"==typeof window?window:$)}(Cd,xd);var Ed=function(){return Ed=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ed.apply(this,arguments)};function Id(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})}function Od(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function Pd(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Td(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function Rd(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Md=function(e,t){var r,n;void 0===t&&(t=!1);var i=Ad(e,t),o=void 0,s=wd.document.cookie.split("; ");try{for(var a=Pd(s),l=a.next();!l.done;l=a.next()){var u=Td(l.value.split("=",2),2),c=u[0],d=u[1];c===i&&(o=decodeURIComponent(d))}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}if(o)try{if(t){var h=atob(o);return JSON.parse(decodeURIComponent(h))}var p=o.split("."),f=void 0;return p.length>=2&&p[1]&&(f=atob(p[1])),{deviceId:p[0],userId:f}}catch(e){return}},Ad=function(e,t){if(t){if((null==e?void 0:e.length)<10)return;return"AMP_".concat(e.substring(0,10))}if(!((null==e?void 0:e.length)<6))return"amp_".concat(e.substring(0,6))},_d=function(){function e(e,t,r){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=r,this.loadPersistedState(),r<=0&&(this.setup=void 0)}return e.prototype.setup=function(e,t){return Id(this,void 0,void 0,function(){return Od(this,function(r){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener(function(){null==t||t.fetch()}),[2,this.waitForConnectorIdentity(this.timeoutMillis)]})})},e.prototype.getUser=function(){var e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}},e.prototype.track=function(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)},e.prototype.loadPersistedState=function(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;var e=Md(this.apiKey,!0);return(e||(e=Md(this.apiKey,!1))||(e=function(e){var t=Ad(e,!0);try{var r=wd.localStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}}(this.apiKey))||!!(e=function(e){var t=Ad(e,!0);try{var r=wd.sessionStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}}(this.apiKey)))&&(this.commitIdentityToConnector(e),!0)},e.prototype.commitIdentityToConnector=function(e){var t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()},e.prototype.waitForConnectorIdentity=function(e){return Id(this,void 0,void 0,function(){var t,r=this;return Od(this,function(n){return(t=this.identityStore.getIdentity()).userId||t.deviceId?[2]:[2,Promise.race([new Promise(function(e){var t=function(){e(),r.identityStore.removeIdentityListener(t)};r.identityStore.addIdentityListener(t)}),new Promise(function(t,r){wd.setTimeout(r,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")})])]})})},e}();var Nd,Dd,Ld,Fd=wd.fetch||function(e,t){return t=t||{},new Promise(function(r,n){var i=new XMLHttpRequest,o=[],s=[],a={},l=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:l,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var u in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,r){o.push(t=t.toLowerCase()),s.push([t,r]),a[t]=a[t]?a[t]+","+r:r}),r(l())},i.onerror=n,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(u,t.headers[u]);i.send(t.body||null)})},Ud=function(){function e(e){this.client=e}return e.prototype.request=function(e){return Id(this,void 0,void 0,function(){return Od(this,function(t){switch(t.label){case 0:return[4,this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)];case 1:return[2,t.sent()]}})})},e}(),jd={request:function(e,t,r,n,i){return function(e,t){return null==t||t<=0?e:new Promise(function(r,n){wd.setTimeout(function(){n(new md("Request timeout after "+t+" milliseconds"))},t),e.then(r,n)})}(Id(void 0,void 0,void 0,function(){var i,o;return Od(this,function(s){switch(s.label){case 0:return[4,Fd(e,{method:t,headers:r,body:n})];case 1:return i=s.sent(),o={status:i.status},[4,i.text()];case 2:return o.body=s.sent(),[2,o]}})}),i)}};!function(e){e[e.Disable=0]="Disable",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug",e[e.Verbose=5]="Verbose"}(Nd||(Nd={})),function(e){e.LocalStorage="localStorage",e.InitialVariants="initialVariants"}(Dd||(Dd={})),function(e){e.LocalStorage="storage",e.InitialVariants="initial",e.SecondaryLocalStorage="secondary-storage",e.SecondaryInitialVariants="secondary-initial",e.FallbackInline="fallback-inline",e.FallbackConfig="fallback-config",e.LocalEvaluation="local-evaluation"}(Ld||(Ld={}));var Bd=function(e){return!e||e===Ld.FallbackInline||e===Ld.FallbackConfig||e===Ld.SecondaryInitialVariants},qd={debug:!1,logLevel:Nd.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:Dd.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,throwOnError:!1,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:jd},zd="1.20.0",Wd=function(){function e(e,t){var r,n=this;this.isReady=new Promise(function(e){n.resolve=e}),this.config=e,this.client=t;var i=null!==(r=e.instanceName)&&void 0!==r?r:qd.instanceName;this.queue=new $d(i),this.cache=new Vd(i)}return e.prototype.ready=function(){return this.integration?this.isReady:Promise.resolve()},e.prototype.setIntegration=function(e){var t=this;this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()},function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())},e.prototype.getUser=function(){return this.integration?this.integration.getUser():{}},e.prototype.track=function(e){if(this.cache.shouldTrack(e)){var t=this.getExposureEvent(e);this.queue.push(t)}},e.prototype.getExposureEvent=function(e){var t,r,n,i={eventType:"$exposure",eventProperties:e};return(null===(t=e.metadata)||void 0===t?void 0:t.exposureEvent)?i={eventType:null===(r=e.metadata)||void 0===r?void 0:r.exposureEvent,eventProperties:e}:"web"===(null===(n=e.metadata)||void 0===n?void 0:n.deliveryMethod)&&(i={eventType:"$impression",eventProperties:e}),i},e}(),Vd=function(){function e(e){this.isSessionStorageAvailable=Hd(),this.inMemoryCache={},this.storageKey="EXP_sent_v2_".concat(e),this.isSessionStorageAvailable&&wd.sessionStorage.removeItem("EXP_sent_".concat(e))}return e.prototype.shouldTrack=function(e){var t;if("web"===(null===(t=e.metadata)||void 0===t?void 0:t.deliveryMethod))return!0;this.loadCache();var r=this.inMemoryCache[e.flag_key],n=!1;return r&&r.variant===e.variant||(n=!0,this.inMemoryCache[e.flag_key]=e),this.storeCache(),n},e.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=wd.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},e.prototype.storeCache=function(){this.isSessionStorageAvailable&&wd.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))},e}(),$d=function(){function e(e,t){void 0===t&&(t=512),this.isLocalStorageAvailable=function(){var e=Sd();if(e)try{var t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){return!1}return!1}(),this.inMemoryQueue=[],this.storageKey="EXP_unsent_".concat(e),this.maxQueueSize=t}return e.prototype.push=function(e){this.loadQueue(),this.inMemoryQueue.push(e),this.flush(),this.storeQueue()},e.prototype.setTracker=function(e){var t=this;this.tracker=e,this.poller=wd.setInterval(function(){t.loadFlushStore()},1e3),this.loadFlushStore()},e.prototype.flush=function(){var e,t;if(this.tracker&&0!==this.inMemoryQueue.length){try{for(var r=Pd(this.inMemoryQueue),n=r.next();!n.done;n=r.next()){var i=n.value;try{if(!this.tracker(i))return}catch(e){return}}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.inMemoryQueue=[],this.poller&&(wd.clearInterval(this.poller),this.poller=void 0)}},e.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=wd.localStorage.getItem(this.storageKey);this.inMemoryQueue=e?JSON.parse(e):[]}},e.prototype.storeQueue=function(){this.isLocalStorageAvailable&&(this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),wd.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},e.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},e}(),Hd=function(){var e=Sd();if(e)try{var t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){return!1}return!1},Kd=function(){function e(e,t){void 0===t&&(t=Nd.Error),this.logger=e,this.logLevel=t}return e.prototype.error=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=Nd.Error&&(t=this.logger).error.apply(t,Rd([e],Td(r),!1))},e.prototype.warn=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=Nd.Warn&&(t=this.logger).warn.apply(t,Rd([e],Td(r),!1))},e.prototype.info=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=Nd.Info&&(t=this.logger).info.apply(t,Rd([e],Td(r),!1))},e.prototype.debug=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=Nd.Debug&&(t=this.logger).debug.apply(t,Rd([e],Td(r),!1))},e.prototype.verbose=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=Nd.Verbose&&(t=this.logger).verbose.apply(t,Rd([e],Td(r),!1))},e}(),Gd=function(){function e(){}return e.prototype.error=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.error.apply(console,Rd([e],Td(t),!1))},e.prototype.warn=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.warn.apply(console,Rd([e],Td(t),!1))},e.prototype.info=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.info.apply(console,Rd([e],Td(t),!1))},e.prototype.debug=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.debug.apply(console,Rd([e],Td(t),!1))},e.prototype.verbose=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.debug.apply(console,Rd([e],Td(t),!1))},e}(),Jd=function(){function e(){this.globalScope=Sd()}return e.prototype.get=function(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.localStorage.getItem(e)},e.prototype.put=function(e,t){var r;null===(r=this.globalScope)||void 0===r||r.localStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null===(t=this.globalScope)||void 0===t||t.localStorage.removeItem(e)},e}(),Xd=function(){function e(e,t){this.namespace=e,this.storage=t}return e.prototype.get=function(){return this.value},e.prototype.put=function(e){this.value=e},e.prototype.load=function(){var e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))},e.prototype.store=function(){void 0===this.value?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))},e}(),Yd=function(){function e(e,t,r){this.cache={},this.namespace=e,this.storage=t,this.transformer=r}return e.prototype.get=function(e){return this.cache[e]},e.prototype.getAll=function(){return Ed({},this.cache)},e.prototype.put=function(e,t){this.cache[e]=t},e.prototype.putAll=function(e){var t,r;try{for(var n=Pd(Object.keys(e)),i=n.next();!i.done;i=n.next()){var o=i.value;this.cache[o]=e[o]}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.clear=function(){this.cache={}},e.prototype.load=function(){var e,t,r,n=this.storage.get(this.namespace);try{r=JSON.parse(n)||{}}catch(e){return}var i={};try{for(var o=Pd(Object.keys(r)),s=o.next();!s.done;s=o.next()){var a=s.value;try{var l=void 0;(l=this.transformer?this.transformer(r[a]):r[a])&&(i[a]=l)}catch(e){}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.clear(),this.putAll(i)},e.prototype.store=function(e){void 0===e&&(e=this.cache),this.storage.put(this.namespace,JSON.stringify(e))},e}(),Qd=function(e){if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){var t=e.key,r=e.value,n=e.payload,i=e.metadata,o=e.expKey;i&&i.experimentKey?o=i.experimentKey:o&&((i=i||{}).experimentKey=o);var s={};return t?s.key=t:r&&(s.key=r),r&&(s.value=r),i&&(s.metadata=i),n&&(s.payload=n),o&&(s.expKey=o),s}},Zd=function(){function e(){this.globalScope=Sd()}return e.prototype.get=function(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.sessionStorage.getItem(e)},e.prototype.put=function(e,t){var r;null===(r=this.globalScope)||void 0===r||r.sessionStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null===(t=this.globalScope)||void 0===t||t.sessionStorage.removeItem(e)},e}(),eh=function(e){return null==e},th=function(e){return!!eh(e)||e&&0===Object.keys(e).length},rh=function(e){var t;return"local"===(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.evaluationMode)},nh=function(){function e(e,t,r,n){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=r,this.scalar=n}return e.prototype.start=function(e){return Id(this,void 0,void 0,function(){return Od(this,function(t){switch(t.label){case 0:if(this.started)throw Error("Backoff already started");return this.started=!0,[4,this.backoff(e,0,this.min)];case 1:return t.sent(),[2]}})})},e.prototype.cancel=function(){this.done=!0,clearTimeout(this.timeoutHandle)},e.prototype.backoff=function(e,t,r){return Id(this,void 0,void 0,function(){var n=this;return Od(this,function(i){return this.done||(this.timeoutHandle=wd.setTimeout(function(){return Id(n,void 0,void 0,function(){var n,i;return Od(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e()];case 1:return o.sent(),[3,3];case 2:return o.sent(),(n=t+1)<this.attempts&&(i=Math.min(r*this.scalar,this.max),this.backoff(e,n,i)),[3,3];case 3:return[2]}})})},r)),[2]})})},e}(),ih=function(e){return null==e?{}:"string"==typeof e?{key:e,value:e}:e},oh=function(e){if(!e)return{};var t=void 0;e.metadata&&(t=e.metadata.experimentKey);var r={};return e.key&&(r.key=e.key),e.value&&(r.value=e.value),e.payload&&(r.payload=e.payload),t&&(r.expKey=t),e.metadata&&(r.metadata=e.metadata),r},sh=function(){function e(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}return e.prototype.track=function(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))},e.prototype.setUserProperty=function(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)},e.prototype.unsetUserProperty=function(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))},e}(),ah=function(){function e(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}return e.prototype.track=function(e,t){var r={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,r)||(this.tracked={}),this.identity=r;var n=e.flag_key in this.tracked,i=this.tracked[e.flag_key];n&&i===e.variant||(this.tracked[e.flag_key]=e.variant,this.exposureTrackingProvider.track(e))},e.prototype.identityEquals=function(e,t){return e.userId===t.userId&&e.deviceId===t.deviceId},e}(),lh=function(){function e(t,r){var n,i,o,s,a=this;this.engine=new Jc,this.isRunning=!1,this.apiKey=t,r=function(e){var t,r;if(!e||"object"!=typeof e)return{};var n={};try{for(var i=Pd(Object.entries(e)),o=i.next();!o.done;o=i.next()){var s=Td(o.value,2),a=s[0],l=s[1];eh(l)||(n[a]=l)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}(r),this.config=Ed(Ed(Ed({},qd),r),{serverUrl:(null==r?void 0:r.serverUrl)||("eu"===(null===(n=null==r?void 0:r.serverZone)||void 0===n?void 0:n.toLowerCase())?"https://api.lab.eu.amplitude.com":qd.serverUrl),flagsServerUrl:(null==r?void 0:r.flagsServerUrl)||("eu"===(null===(i=null==r?void 0:r.serverZone)||void 0===i?void 0:i.toLowerCase())?"https://flag.lab.eu.amplitude.com":qd.flagsServerUrl),flagConfigPollingIntervalMillis:r.flagConfigPollingIntervalMillis<6e4?6e4:null!==(o=r.flagConfigPollingIntervalMillis)&&void 0!==o?o:qd.flagConfigPollingIntervalMillis}),this.logger=new Kd(this.config.loggerProvider||new Gd,e.getLogLevel(r));var l=null===(s=this.config)||void 0===s?void 0:s.internalInstanceNameSuffix;if(this.isWebExperiment="web"===l,this.poller=new kd(function(){return a.doFlags()},this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(var u in this.config.initialVariants)this.config.initialVariants[u]=Qd(this.config.initialVariants[u]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new sh(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new ah(this.config.exposureTrackingProvider)),this.integrationManager=new Wd(this.config,this);var c,d=new Ud(this.config.httpClient||jd);this.flagApi=new bd(this.apiKey,this.config.flagsServerUrl,d),this.evaluationApi=new yd(this.apiKey,this.config.serverUrl,d);var h=l?"".concat(this.config.instanceName,"-").concat(l):this.config.instanceName;c=this.isWebExperiment?new Zd:new Jd,this.variants=function(e,t,r){var n=e.substring(e.length-6),i="amp-exp-".concat(t,"-").concat(n);return new Yd(i,r,Qd)}(this.apiKey,h,c),this.flags=function(e,t,r){void 0===r&&(r=new Jd);var n=e.substring(e.length-6),i="amp-exp-".concat(t,"-").concat(n,"-flags");return new Yd(i,r)}(this.apiKey,h,c),this.fetchVariantsOptions=function(e,t,r){void 0===r&&(r=new Jd);var n=e.substring(e.length-6),i="amp-exp-".concat(t,"-").concat(n,"-variants-options");return new Xd(i,r)}(this.apiKey,h,c);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch(e){}this.mergeInitialFlagsWithStorage()}return e.prototype.start=function(e){return Id(this,void 0,void 0,function(){var t,r,n;return Od(this,function(i){switch(i.label){case 0:if(this.isRunning)return[2];this.isRunning=!0,this.setUser(e),i.label=1;case 1:return i.trys.push([1,6,,7]),t=this.doFlags(),null===(n=this.config.fetchOnStart)||void 0===n||n?[4,Promise.all([this.fetch(e),t])]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,t];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:if(r=i.sent(),this.config.throwOnError)throw r;return[3,7];case 7:return this.config.pollOnStart&&this.poller.start(),[2]}})})},e.prototype.stop=function(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)},e.prototype.fetch=function(){return Id(this,arguments,void 0,function(e,t){var r;return void 0===e&&(e=this.user),Od(this,function(n){switch(n.label){case 0:this.setUser(e||{}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)];case 2:return n.sent(),[3,4];case 3:if(r=n.sent(),this.config.throwOnError)throw r;return r instanceof md?this.logger.debug(r):this.logger.error(r),[3,4];case 4:return[2,this]}})})},e.prototype.variant=function(e,t){var r,n;if(!this.apiKey)return{value:void 0};var i=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,i),this.logger.debug("[Experiment] variant for ".concat(e," is ").concat((null===(r=i.variant)||void 0===r?void 0:r.key)||(null===(n=i.variant)||void 0===n?void 0:n.value))),i.variant||{}},e.prototype.exposure=function(e){var t=this.variantAndSource(e);this.exposureInternal(e,t)},e.prototype.all=function(){if(!this.apiKey)return{};var e=this.evaluate();for(var t in e){var r=this.flags.get(t);rh(r)||delete e[t]}return Ed(Ed(Ed({},this.secondaryVariants()),this.sourceVariants()),e)},e.prototype.clear=function(){this.variants.clear();try{this.variants.store()}catch(e){}},e.prototype.getUser=function(){var e;if(!this.user)return this.user;if(null===(e=this.user)||void 0===e?void 0:e.user_properties){var t=Ed({},this.user.user_properties);return Ed(Ed({},this.user),{user_properties:t})}return Ed({},this.user)},e.prototype.setUser=function(e){var t;if(e)if(null===(t=this.user)||void 0===t?void 0:t.user_properties){var r=Ed({},e.user_properties);this.user=Ed(Ed({},e),{user_properties:r})}else this.user=Ed({},e);else this.user=null},e.prototype.getUserProvider=function(){return this.userProvider},e.prototype.setUserProvider=function(e){return this.userProvider=e,this},e.prototype.mergeInitialFlagsWithStorage=function(){var e=this;this.config.initialFlags&&JSON.parse(this.config.initialFlags).forEach(function(t){e.flags.get(t.key)||e.flags.put(t.key,t)})},e.prototype.evaluate=function(e){var t,r,n=this.addContext(this.user),i=function(e,t){var r,n,i=hc({},e),o=[],s=t||Object.keys(i);try{for(var a=gc(s),l=a.next();!l.done;l=a.next()){var u=l.value,c=Xc(u,i);c&&o.push.apply(o,mc([],vc(c),!1))}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o}(this.flags.getAll(),e),o=function(e){var t,r,n,i;if(!e)return{};var o={user:e},s=Sd();s&&(o.page={url:s.location.href});var a={};if(!e.groups)return o;try{for(var l=Pd(Object.keys(e.groups)),u=l.next();!u.done;u=l.next()){var c=u.value,d=e.groups[c];if(d.length>0&&d[0]){var h=d[0],p={group_name:h},f=null===(i=null===(n=e.group_properties)||void 0===n?void 0:n[c])||void 0===i?void 0:i[h];f&&Object.keys(f).length>0&&(p.group_properties=f),a[c]=p}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return Object.keys(a).length>0&&(o.groups=a),delete o.user.groups,delete o.user.group_properties,o}(n),s=this.engine.evaluate(o,i),a={};try{for(var l=Pd(Object.keys(s)),u=l.next();!u.done;u=l.next()){var c=u.value;a[c]=oh(s[c])}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return a},e.prototype.variantAndSource=function(e,t){var r={};this.config.source===Dd.LocalStorage?r=this.localStorageVariantAndSource(e,t):this.config.source===Dd.InitialVariants&&(r=this.initialVariantsVariantAndSource(e,t));var n=this.flags.get(e);return(rh(n)||!r.variant&&n)&&(r=this.localEvaluationVariantAndSource(e,n,t)),r},e.prototype.localEvaluationVariantAndSource=function(e,t,r){var n,i={},o=this.evaluate([t.key])[e],s=Ld.LocalEvaluation,a=null===(n=null==o?void 0:o.metadata)||void 0===n?void 0:n.default;if(!eh(o)&&!a)return{variant:ih(o),source:s,hasDefaultVariant:!1};if(a&&(i={variant:ih(o),source:s,hasDefaultVariant:!0}),!eh(r))return{variant:ih(r),source:Ld.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var l=this.config.initialVariants[e];if(!eh(l))return{variant:ih(l),source:Ld.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};var u=ih(this.config.fallbackVariant),c={variant:u,source:Ld.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return th(u)?i:c},e.prototype.localStorageVariantAndSource=function(e,t){var r,n={},i=this.variants.get(e),o=null===(r=null==i?void 0:i.metadata)||void 0===r?void 0:r.default;if(!eh(i)&&!o)return{variant:ih(i),source:Ld.LocalStorage,hasDefaultVariant:!1};if(o&&(n={variant:ih(i),source:Ld.LocalStorage,hasDefaultVariant:!0}),!eh(t))return{variant:ih(t),source:Ld.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var s=this.config.initialVariants[e];if(!eh(s))return{variant:ih(s),source:Ld.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};var a=ih(this.config.fallbackVariant),l={variant:a,source:Ld.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return th(a)?n:l},e.prototype.initialVariantsVariantAndSource=function(e,t){var r,n={},i=this.config.initialVariants[e];if(!eh(i))return{variant:ih(i),source:Ld.InitialVariants,hasDefaultVariant:!1};var o=this.variants.get(e),s=null===(r=null==o?void 0:o.metadata)||void 0===r?void 0:r.default;if(!eh(o)&&!s)return{variant:ih(o),source:Ld.LocalStorage,hasDefaultVariant:!1};if(s&&(n={variant:ih(o),source:Ld.LocalStorage,hasDefaultVariant:!0}),!eh(t))return{variant:ih(t),source:Ld.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var a=ih(this.config.fallbackVariant),l={variant:a,source:Ld.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return th(a)?n:l},e.prototype.fetchInternal=function(e,t,r,n){return Id(this,void 0,void 0,function(){var i,o,s;return Od(this,function(a){switch(a.label){case 0:if(!this.apiKey)throw Error("Experiment API key is empty");this.logger.debug("[Experiment] Fetch all: retry=".concat(r)),r&&this.stopRetries(),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.doFetch(e,t,Ed({trackingOption:null===(s=this.fetchVariantsOptions.get())||void 0===s?void 0:s.trackingOption},n))];case 2:return i=a.sent(),[4,this.storeVariants(i,n)];case 3:return a.sent(),[2,i];case 4:throw o=a.sent(),r&&this.shouldRetryFetch(o)&&this.startRetries(e,n),o;case 5:return[2]}})})},e.prototype.setTracksAssignment=function(e){return Id(this,void 0,void 0,function(){return Od(this,function(t){return this.fetchVariantsOptions.put(Ed(Ed({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"})),this.fetchVariantsOptions.store(),[2]})})},e.prototype.cleanUserPropsForFetch=function(e){var t=Ed({},e);return delete t.cookie,t},e.prototype.doFetch=function(e,t,r){return Id(this,void 0,void 0,function(){var n,i,o,s,a,l,u;return Od(this,function(c){switch(c.label){case 0:return[4,this.addContextOrWait(e)];case 1:return e=c.sent(),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e),[4,this.evaluationApi.getVariants(e,Ed({timeoutMillis:t},r))];case 2:n=c.sent(),i={};try{for(o=Pd(Object.keys(n)),s=o.next();!s.done;s=o.next())a=s.value,i[a]=oh(n[a])}catch(e){l={error:e}}finally{try{s&&!s.done&&(u=o.return)&&u.call(o)}finally{if(l)throw l.error}}return this.logger.debug("[Experiment] Received variants: ",i),[2,i]}})})},e.prototype.doFlags=function(){return Id(this,void 0,void 0,function(){var e,t,r;return Od(this,function(n){switch(n.label){case 0:return n.trys.push([0,4,,5]),e=void 0,this.isWebExperiment?[4,this.addContextOrWait(this.getUser())]:[3,2];case 1:e=n.sent(),n.label=2;case 2:return[4,this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:zd,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?"web":void 0,user:(null==e?void 0:e.user_id)||(null==e?void 0:e.device_id)?{user_id:null==e?void 0:e.user_id,device_id:null==e?void 0:e.device_id}:void 0})];case 3:return t=n.sent(),this.flags.clear(),this.flags.putAll(t),[3,5];case 4:if(!((r=n.sent())instanceof md))throw r;if(this.logger.debug(r),this.config.throwOnError)throw r;return[3,5];case 5:try{this.flags.store()}catch(e){}return this.mergeInitialFlagsWithStorage(),[2]}})})},e.prototype.storeVariants=function(e,t){return Id(this,void 0,void 0,function(){var r,n,i,o;return Od(this,function(s){for(o in 0===(r=t&&t.flagKeys?t.flagKeys:[]).length&&this.variants.clear(),n=function(t){r=r.filter(function(e){return e!==t}),i.variants.put(t,e[t])},i=this,e)n(o);for(o in r)this.variants.remove(o);try{this.variants.store()}catch(e){}return this.logger.debug("[Experiment] Stored variants: ",e),[2]})})},e.prototype.startRetries=function(e,t){return Id(this,void 0,void 0,function(){var r=this;return Od(this,function(n){return this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new nh(8,500,1e4,1.5),this.retriesBackoff.start(function(){return Id(r,void 0,void 0,function(){return Od(this,function(r){switch(r.label){case 0:return[4,this.fetchInternal(e,1e4,!1,t)];case 1:return r.sent(),[2]}})})}),[2]})})},e.prototype.stopRetries=function(){this.retriesBackoff&&this.retriesBackoff.cancel()},e.prototype.addContext=function(e){var t,r=null===(t=this.userProvider)||void 0===t?void 0:t.getUser(),n=this.integrationManager.getUser(),i=Ed(Ed(Ed({},null==r?void 0:r.user_properties),n.user_properties),null==e?void 0:e.user_properties);return Ed(Ed(Ed(Ed({library:"experiment-js-client/".concat(zd)},r),n),e),{user_properties:i})},e.prototype.addContextOrWait=function(e){return Id(this,void 0,void 0,function(){return Od(this,function(t){switch(t.label){case 0:return[4,this.integrationManager.ready()];case 1:return t.sent(),[2,this.addContext(e)]}})})},e.prototype.sourceVariants=function(){return this.config.source==Dd.LocalStorage?this.variants.getAll():this.config.source==Dd.InitialVariants?this.config.initialVariants:void 0},e.prototype.secondaryVariants=function(){return this.config.source==Dd.LocalStorage?this.config.initialVariants:this.config.source==Dd.InitialVariants?this.variants.getAll():void 0},e.prototype.exposureInternal=function(e,t){var r,n,i,o,s,a,l,u,c;if(null===(i=null===(n=null===(r=t.variant)||void 0===r?void 0:r.metadata)||void 0===n?void 0:n.trackExposure)||void 0===i||i){this.legacyExposureInternal(e,t.variant,t.source);var d={flag_key:e},h=Bd(t.source);if(!h||t.hasDefaultVariant){(null===(o=t.variant)||void 0===o?void 0:o.expKey)&&(d.experiment_key=null===(s=t.variant)||void 0===s?void 0:s.expKey);var p=null===(a=t.variant)||void 0===a?void 0:a.metadata;if(h||(null==p?void 0:p.default)||((null===(l=t.variant)||void 0===l?void 0:l.key)?d.variant=t.variant.key:(null===(u=t.variant)||void 0===u?void 0:u.value)&&(d.variant=t.variant.value)),p&&(d.metadata=p),this.isWebExperiment&&(d.time=Date.now()),this.isWebExperiment){var f=Sd();if(null==f?void 0:f.location)try{var g=f.location.href;d.metadata.url=g.split("?")[0]||""}catch(e){}}var v=this.addContext(this.getUser());null===(c=this.userSessionExposureTracker)||void 0===c||c.track(d,v),this.integrationManager.track(d)}}},e.prototype.legacyExposureInternal=function(e,t,r){var n,i,o,s,a;if(this.analyticsProvider){var l=function(e,t,r,n){var i,o=null==r?void 0:r.value,s="[Experiment] ".concat(t);return{name:"[Experiment] Exposure",user:e,key:t,variant:r,userProperty:s,properties:{key:t,variant:o,source:n},userProperties:(i={},i[s]=o,i)}}(this.addContext(this.getUser()),e,t,r);Bd(r)||!(null==t?void 0:t.value)?null===(i=null===(n=this.analyticsProvider)||void 0===n?void 0:n.unsetUserProperty)||void 0===i||i.call(n,l):(null==t?void 0:t.value)&&(null===(s=null===(o=this.analyticsProvider)||void 0===o?void 0:o.setUserProperty)||void 0===s||s.call(o,l),null===(a=this.analyticsProvider)||void 0===a||a.track(l))}},e.getLogLevel=function(e){var t;return!0===e.debug?Nd.Debug:null!==(t=e.logLevel)&&void 0!==t?t:Nd.Error},e.prototype.shouldRetryFetch=function(e){return!(e instanceof vd)||(e.statusCode<400||e.statusCode>=500||429===e.statusCode)},e.prototype.addPlugin=function(e){"integration"===e.type&&this.integrationManager.setIntegration(e)},e}(),uh=function(){function e(e,t){var r,n,i;this.globalScope=Sd(),this.userAgent=void 0!==(null===(r=this.globalScope)||void 0===r?void 0:r.navigator)?null===(n=this.globalScope)||void 0===n?void 0:n.navigator.userAgent:void 0,this.ua=new xd.UAParser(this.userAgent).getResult(),this.localStorage=new Jd,this.sessionStorage=new Zd,this.userProvider=e,this.apiKey=t,this.storageKey="EXP_".concat(null===(i=this.apiKey)||void 0===i?void 0:i.slice(0,10),"_DEFAULT_USER_PROVIDER")}return e.prototype.getUser=function(){var e,t,r,n,i,o=(null===(e=this.userProvider)||void 0===e?void 0:e.getUser())||{};return Ed({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!==(r=null===(t=this.ua.device)||void 0===t?void 0:t.type)&&void 0!==r?r:"desktop",referring_url:null===(i=null===(n=this.globalScope)||void 0===n?void 0:n.document)||void 0===i?void 0:i.referrer.replace(/\/$/,""),cookie:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},o)},e.prototype.getLanguage=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},e.prototype.getOs=function(e){var t,r;return[null===(t=e.browser)||void 0===t?void 0:t.name,null===(r=e.browser)||void 0===r?void 0:r.major].filter(function(e){return null!=e}).join(" ")},e.prototype.getDeviceModel=function(e){var t;return null===(t=e.os)||void 0===t?void 0:t.name},e.prototype.getBrowser=function(e){var t,r=null===(t=e.browser)||void 0===t?void 0:t.name;return(null==r?void 0:r.includes("Chrom"))&&(r="Chrome"),(null==r?void 0:r.includes("Firefox"))&&(r="Firefox"),(null==r?void 0:r.includes("Safari"))&&(r="Safari"),(null==r?void 0:r.includes("Edge"))&&(r="Edge"),(null==r?void 0:r.includes("Opera"))&&(r="Opera"),r},e.prototype.getCookie=function(){var e,t,r,n,i;if(null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.document)||void 0===t?void 0:t.cookie)return Object.fromEntries(null===(i=null===(n=null===(r=this.globalScope)||void 0===r?void 0:r.document)||void 0===n?void 0:n.cookie)||void 0===i?void 0:i.split("; ").map(function(e){return e.split("=")}))},e.prototype.getLandingUrl=function(){var e,t;try{var r=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return r.landing_url||(r.landing_url=null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.location)||void 0===t?void 0:t.href.replace(/\/$/,""),this.sessionStorage.put(this.storageKey,JSON.stringify(r))),r.landing_url}catch(e){return}},e.prototype.getFirstSeen=function(){try{var e=JSON.parse(this.localStorage.get(this.storageKey)||"{}");return e.first_seen||(e.first_seen=(Date.now()/1e3).toString(),this.localStorage.put(this.storageKey,JSON.stringify(e))),e.first_seen}catch(e){return}},e.prototype.getUrlParam=function(){var e,t,r;if(this.globalScope){var n={};try{var i=new URL(this.globalScope.location.href);try{for(var o=Pd(i.searchParams),s=o.next();!s.done;s=o.next()){var a=Td(s.value,2),l=a[0],u=a[1];n[l]=Rd(Rd([],Td(null!==(r=n[l])&&void 0!==r?r:[]),!1),Td(u.split(",")),!1)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){return}return Object.entries(n).reduce(function(e,t){var r=Td(t,2),n=r[0],i=r[1];return e[n]=1==i.length?i[0]:i,e},{})}},e}();wd.experimentInstances={};var ch=wd.experimentInstances,dh=function(e){return(null==e?void 0:e.instanceName)||qd.instanceName},hh=function(e,t,r){var n=function(e,t){var r=dh(t),n=null==t?void 0:t.internalInstanceNameSuffix;return n?"".concat(r,".").concat(e,".").concat(n):"".concat(r,".").concat(e)}(e,t),i=ch[n];return i||(i=function(e,t){return new lh(e,Ed(Ed({},t),{userProvider:new uh(null==t?void 0:t.userProvider,e)}))}(e,t),r&&i.addPlugin(r()),ch[n]=i,i)},ph=function(){function e(t){this.name=e.pluginName,this.config=t}return e.prototype.setup=function(e,t){var r,n;return l(this,void 0,void 0,function(){var t;return u(this,function(i){return t=void 0!==(null===(r=this.config)||void 0===r?void 0:r.instanceName)||void 0===e.instanceName?this.config:s(s({},this.config),{instanceName:e.instanceName}),this.experiment=function(e,t){return hh(e,t,function(){return new _d(e,_e.getInstance(dh(t)),1e4)})}((null===(n=this.config)||void 0===n?void 0:n.deploymentKey)||e.apiKey,t),[2]})})},e.pluginName="@amplitude/experiment-analytics-plugin",e}(),fh=function(e){return new ph(e)},gh=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:vh(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),vh=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},mh=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(t){e(t)}),this.queue=[])},e}(),yh=function(){return yh=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},yh.apply(this,arguments)};function bh(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function wh(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}var Sh=function(e,t){var r,n,i=typeof e;if(i!==typeof t)return!1;try{for(var o=bh(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next()){if(s.value===i)return e===t}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}if(null==e&&null==t)return!0;if(null==e||null==t||e.length!==t.length)return!1;var a=Array.isArray(e),l=Array.isArray(t);if(a!==l)return!1;if(!a||!l){var u=Object.keys(e).sort(),c=Object.keys(t).sort();if(!Sh(u,c))return!1;var d=!0;return Object.keys(e).forEach(function(r){Sh(e[r],t[r])||(d=!1)}),d}for(var h=0;h<e.length;h++)if(!Sh(e[h],t[h]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=new Array(r);r--;)n[r]=[t[r],e[t[r]]];return n});var kh=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=yh({},this.identity.userProperties),r=yh(yh({},this.identity),{userProperties:t});return{setUserId:function(e){return r.userId=e,this},setDeviceId:function(e){return r.deviceId=e,this},setUserProperties:function(e){return r.userProperties=e,this},setOptOut:function(e){return r.optOut=e,this},updateUserProperties:function(e){var t,n,i,o,s,a,l=r.userProperties||{};try{for(var u=bh(Object.entries(e)),c=u.next();!c.done;c=u.next()){var d=wh(c.value,2),h=d[0],p=d[1];switch(h){case"$set":try{for(var f=(i=void 0,bh(Object.entries(p))),g=f.next();!g.done;g=f.next()){var v=wh(g.value,2),m=v[0],y=v[1];l[m]=y}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,bh(Object.keys(p))),w=b.next();!w.done;w=b.next()){delete l[m=w.value]}}catch(e){s={error:e}}finally{try{w&&!w.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":l={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return r.userProperties=l,this},commit:function(){return e.setIdentity(r),this}}},e.prototype.getIdentity=function(){return yh({},this.identity)},e.prototype.setIdentity=function(e){var t=yh({},this.identity);this.identity=yh({},e),Sh(t,this.identity)||this.listeners.forEach(function(t){t(e)})},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),xh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:self,Ch=function(){function e(){this.identityStore=new kh,this.eventBridge=new mh,this.applicationContextProvider=new gh}return e.getInstance=function(t){return xh.analyticsConnectorInstances||(xh.analyticsConnectorInstances={}),xh.analyticsConnectorInstances[t]||(xh.analyticsConnectorInstances[t]=new e),xh.analyticsConnectorInstances[t]},e}(),Eh=["boot"],Ih=Symbol.for("amplitude-engagement-plugin-caller");var Oh=(e=>(e.Local="https://local.amplitude.com:3010/",e.Staging="https://apps.stag2.amplitude.com/",e.Production="https://app.amplitude.com/",e.ProductionEU="https://app.eu.amplitude.com/",e))(Oh||{});var Ph=((e=>{if(typeof window<"u"&&window.opener)for(let t of Object.values(Oh))window.opener.postMessage({message:e},t)})("ENGAGEMENT_SNIPPET"),function(e){var t,r,n,i,o,s,a,l,u,c;let d=typeof window<"u"?window.engagement:void 0,h=!1,p={_q:null!=(t=null==d?void 0:d._q)?t:[],_configuration:{apiKey:null!=(n=null==(r=null==d?void 0:d._configuration)?void 0:r.apiKey)?n:"",serverUrl:null==(i=null==d?void 0:d._configuration)?void 0:i.serverUrl,chatUrl:null==(o=null==d?void 0:d._configuration)?void 0:o.chatUrl,mediaUrl:null==(s=null==d?void 0:d._configuration)?void 0:s.mediaUrl,serverZone:null!=(l=null==(a=null==d?void 0:d._configuration)?void 0:a.serverZone)?l:"US",autoRefreshIntervalSeconds:null==(u=null==d?void 0:d._configuration)?void 0:u.autoRefreshIntervalSeconds,options:{...null==(c=null==d?void 0:d._configuration)?void 0:c.options}},init(t,r){var n,i,o,s;if(p._configuration.apiKey)return void console.log("Engagement SDK has already been initialized. Ignoring additional init call.");if(!0===(null==r?void 0:r.skip))return console.log("Engagement SDK init skipped via `skip: true`. The SDK bundle will not be loaded."),void(h=!0);if(h&&(p._q.length=0),h=!1,null!=r&&r.useEngagementDomain){let e="EU"===(null!=(n=r.serverZone)?n:p._configuration.serverZone),t="amplitudeengagement.com";r.serverUrl||(r.serverUrl=e?`https://gs.eu.${t}`:`https://gs.${t}`),r.chatUrl||(r.chatUrl=e?`https://houston-chat.eu.${t}`:`https://houston-chat.${t}`),r.mediaUrl||(r.mediaUrl=e?`https://engagement-static.eu.${t}`:`https://engagement-static.${t}`),r.cdnUrl||(r.cdnUrl=e?`https://cdn.eu.${t}`:`https://cdn.${t}`)}let a;if(p._configuration={...p._configuration,...r,apiKey:t,options:{splitting:!0,...p._configuration.options,...null==r?void 0:r.options}},null!=(o=null==(i=p._configuration)?void 0:i.options)&&o.logger&&p._configuration.options.logger.enable(null!=(s=p._configuration.options.logLevel)?s:2),null!=r&&r.cdnUrl)a=p._configuration.options.splitting?`${r.cdnUrl}/engagement-browser/prod/split/index.js`:r.cdnUrl+"/engagement-browser/prod/index.min.js.gz";else{let e="EU"===p._configuration.serverZone?"https://cdn.eu.amplitude.com":"https://cdn.amplitude.com";a=p._configuration.options.splitting?`${e}/engagement-browser/prod/split/index.js`:`${e}/engagement-browser/prod/index.min.js.gz`}let l=null,u=()=>{if(h=!0,l&&(clearTimeout(l),l=null),p._q&&p._q.length>0)for(console.warn(`Engagement SDK failed to load within ${c}ms. Resolving pending calls gracefully.`);p._q.length>0;){let e=p._q.shift();if(!e)continue;let t=e[0],r=Eh.includes(t);if(console.warn(`Engagement SDK method '${t}' still in queue (isAsyncMethod=${r}); attempting to resolve as no-op.`),r&&e[1]instanceof Function&&e[2]instanceof Function){let r=e[1];console.warn(`Engagement SDK method '${t}' resolved as no-op due to script loading failure`),r(void 0)}}};e(a,p._configuration.options.splitting?"module":void 0,null==r?void 0:r.nonce,u);let c=1e4;l=setTimeout(()=>{u()},c)},plugin(e){let t=p.init,r=null==e?void 0:e.token,n=!0===(null==e?void 0:e.skip),i=(e,t)=>{let n=t.getIdentity(),i="function"==typeof r?r():r;return{user_id:e.getUserId(),device_id:e.getDeviceId(),user_properties:n.userProperties,getSessionId:e.getSessionId,...i?{token:i}:{}}};return{name:"@amplitude/engagement-browser",type:"enrichment",async setup(r,o){var s;if(n)return void t(r.apiKey,{skip:!0});let a=null!=(s=r.instanceName)?s:"$default_instance",l=Ch.getInstance(a).identityStore;p._configuration._installedViaPlugin=!0,t(r.apiKey,{serverZone:r.serverZone,...e,options:{logLevel:r.logLevel,logger:r.loggerProvider,...null==e?void 0:e.options}});let u=[{track:e=>{o.track(e)}}];await window.engagement.boot({user:()=>i(o,l),integrations:u},Ih),l.addIdentityListener(e=>{var t,r,n,s;null!=(t=window.engagement)&&t._.user&&null!=(r=window.engagement)&&r._analytics.hasBooted?(null==(s=null==(n=window.engagement)?void 0:n._.user)?void 0:s.user_id)!==e.userId?(window.engagement.shutdown(Ih),window.engagement.boot({user:()=>i(o,l),integrations:u},Ih)):window.engagement._setUserProperties(e.userProperties):console.warn("Engagement SDK not booted. Ignoring identity change.")})},execute:async e=>(n||window.engagement.forwardEvent(e),e)}}},f=p;return new Proxy(p,{get:function(e,t){return t in f?f[t]:"then"!==t?"gs"===t||"rc"===t||"assistant"===t?new Proxy({},{get:function(e,r){return function(){let e=Array.from(arguments),n=`${t}.${r}`;e.unshift(n),p._q.push(e)}}}):Eh.includes(t)?function(){let e=Array.prototype.slice.call(arguments);return new Promise((r,n)=>{e.unshift(t,r,n),p._q.push(e),h&&r(void 0)})}:function(){let e=Array.prototype.slice.call(arguments);e.unshift(t),p._q.push(e)}:void 0}})}((e,t,r,n)=>function(e,t,r,n){for(let i of e){let e=document.createElement("script");e.src=i,e.id="engagement-sdk-bundle",r&&e.setAttribute("nonce",r),t&&e.setAttribute("type",t),n&&(e.onerror=n);let o=document.getElementsByTagName("head")[0];o&&o.appendChild(e)}}([e||"https://cdn.amplitude.com/engagement-browser/prod/index.min.js.gz"],t,r,n))),Th=e=>(typeof window<"u"&&!window.engagement&&(window.engagement=Ph),Ph.plugin(e)),Rh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.sessionReplay=function(){return this._sessionReplay},t.prototype.experiment=function(){if(void 0!==this.config){var e=this.plugins(ph);return 0===e.length?void this.config.loggerProvider.debug("".concat(ph.pluginName," plugin is not found.")):1===e.length?e[0].experiment:void this.config.loggerProvider.debug("Multiple instances of ".concat(ph.pluginName," are found."))}},t.prototype.initAll=function(t,r){return l(this,void 0,void 0,function(){var n=this;return u(this,function(i){return this._initAllPromise||(this._initAllPromise=l(n,void 0,void 0,function(){var n,i;return u(this,function(o){switch(o.label){case 0:return n={serverZone:null==r?void 0:r.serverZone,instanceName:null==r?void 0:r.instanceName},e.prototype.add.call(this,{type:"enrichment",name:"@amplitude/unified-library-plugin",execute:function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(r){return e.library="".concat("amplitude-ts-unified","/").concat("1.1.36-video-analytics-5.0","-").concat(null!==(t=e.library)&&void 0!==t?t:""),[2,e]})})}}),[4,e.prototype.init.call(this,t,s(s({},null==r?void 0:r.analytics),n)).promise];case 1:return o.sent(),[4,e.prototype.add.call(this,(a=s(s({},null==r?void 0:r.sessionReplay),n),new uc(a))).promise];case 2:return o.sent(),[4,e.prototype.add.call(this,fh(s(s({},null==r?void 0:r.experiment),n))).promise];case 3:return o.sent(),void 0===(i=this.plugin(uc.pluginName))?this.config.loggerProvider.debug("".concat(uc.pluginName," plugin is not found.")):this._sessionReplay=i.sessionReplay,[4,e.prototype.add.call(this,Th(s(s({},null==r?void 0:r.engagement),n))).promise];case 4:return o.sent(),[2]}var a})}).finally(function(){n._initAllPromise=void 0})),[2,this._initAllPromise]})})},t.prototype.init=function(t,r,n){return void 0===t&&(t=""),e.prototype.init.call(this,t,r,n)},t}(va),Mh=function(){var e=new Rh;return{_setDiagnosticsSampleRate:be(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",ve(e),ye(e,["config"])),experiment:be(e.experiment.bind(e),"experiment",ve(e),ye(e,["config"])),sessionReplay:be(e.sessionReplay.bind(e),"sessionReplay",ve(e),ye(e,["config"])),initAll:be(e.initAll.bind(e),"initAll",ve(e),ye(e,["config"])),init:be(e.init.bind(e),"init",ve(e),ye(e,["config"])),add:be(e.add.bind(e),"add",ve(e),ye(e,["config.apiKey","timeline.plugins"])),remove:be(e.remove.bind(e),"remove",ve(e),ye(e,["config.apiKey","timeline.plugins"])),track:be(e.track.bind(e),"track",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),logEvent:be(e.logEvent.bind(e),"logEvent",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),identify:be(e.identify.bind(e),"identify",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),groupIdentify:be(e.groupIdentify.bind(e),"groupIdentify",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),setGroup:be(e.setGroup.bind(e),"setGroup",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),revenue:be(e.revenue.bind(e),"revenue",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),flush:be(e.flush.bind(e),"flush",ve(e),ye(e,["config.apiKey","timeline.queue.length"])),getUserId:be(e.getUserId.bind(e),"getUserId",ve(e),ye(e,["config","config.userId"])),setUserId:be(e.setUserId.bind(e),"setUserId",ve(e),ye(e,["config","config.userId"])),getDeviceId:be(e.getDeviceId.bind(e),"getDeviceId",ve(e),ye(e,["config","config.deviceId"])),setDeviceId:be(e.setDeviceId.bind(e),"setDeviceId",ve(e),ye(e,["config","config.deviceId"])),reset:be(e.reset.bind(e),"reset",ve(e),ye(e,["config","config.userId","config.deviceId"])),getSessionId:be(e.getSessionId.bind(e),"getSessionId",ve(e),ye(e,["config"])),setSessionId:be(e.setSessionId.bind(e),"setSessionId",ve(e),ye(e,["config"])),extendSession:be(e.extendSession.bind(e),"extendSession",ve(e),ye(e,["config"])),setOptOut:be(e.setOptOut.bind(e),"setOptOut",ve(e),ye(e,["config"])),getOptOut:be(e.getOptOut.bind(e),"getOptOut",ve(e),ye(e,["config"])),setTransport:be(e.setTransport.bind(e),"setTransport",ve(e),ye(e,["config"])),getIdentity:be(e.getIdentity.bind(e),"getIdentity",ve(e),ye(e,["config"])),setIdentity:be(e.setIdentity.bind(e),"setIdentity",ve(e),ye(e,["config","config.userId","config.deviceId"]))}},Ah=Mh(),_h=Ah._setDiagnosticsSampleRate,Nh=Ah.initAll,Dh=Ah.experiment,Lh=Ah.sessionReplay,Fh=Ah.add,Uh=Ah.extendSession,jh=Ah.flush,Bh=Ah.getDeviceId,qh=Ah.getIdentity,zh=Ah.getOptOut,Wh=Ah.getSessionId,Vh=Ah.getUserId,$h=Ah.groupIdentify,Hh=Ah.identify,Kh=Ah.logEvent,Gh=Ah.remove,Jh=Ah.reset,Xh=Ah.revenue,Yh=Ah.setDeviceId,Qh=Ah.setGroup,Zh=Ah.setIdentity,ep=Ah.setOptOut,tp=Ah.setSessionId,rp=Ah.setTransport,np=Ah.setUserId,ip=Ah.track,op=function(e,t){return op=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},op(e,t)};var sp=function(){return sp=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},sp.apply(this,arguments)};function ap(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}"function"==typeof SuppressedError&&SuppressedError;var lp="is",up="is not",cp="contains",dp="does not contain",hp="less",pp="less or equal",fp="greater",gp="greater or equal",vp="version less",mp="version less or equal",yp="version greater",bp="version greater or equal",wp="set is",Sp="set is not",kp="set contains",xp="set does not contain",Cp="set contains any",Ep="set does not contain any",Ip="regex match",Op="regex does not match",Pp=-862048943,Tp=461845907,Rp=function(e,t){void 0===t&&(t=0);for(var r=function(e){for(var t=[],r=0,n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return Uint8Array.from(t)}(e),n=r.length,i=n>>2,o=t,s=0;s<i;s++){var a=Np(r,s<<2);o=Mp(a,o)}var l=i<<2,u=0;switch(n-l){case 3:u^=r[l+2]<<16,u^=r[l+1]<<8,u^=r[l],u=Math.imul(u,Pp),u=_p(u,15),o^=u=Math.imul(u,Tp);break;case 2:u^=r[l+1]<<8,u^=r[l],u=Math.imul(u,Pp),u=_p(u,15),o^=u=Math.imul(u,Tp);break;case 1:u^=r[l],u=Math.imul(u,Pp),u=_p(u,15),o^=u=Math.imul(u,Tp)}return Ap(o^=n)>>>0},Mp=function(e,t){var r=e,n=t;return r=Math.imul(r,Pp),r=_p(r,15),r=Math.imul(r,Tp),n=_p(n^=r,13),(n=Math.imul(n,5))+-430675100|0},Ap=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-2048144789),t^=t>>>13,t=Math.imul(t,-1028477387),t^=t>>>16},_p=function(e,t,r){return void 0===r&&(r=32),t>r&&(t%=r),(e<<t|(e&4294967295<<r-t>>>0)>>>0>>>r-t>>>0)>>>0},Np=function(e,t){void 0===t&&(t=0);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return Dp(r)},Dp=function(e){return(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24},Lp=function(e,t){var r,n;if(t&&0!==t.length){try{for(var i=ap(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!s||!e||"object"!=typeof e)return;e=e[s]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e||void 0}},Fp="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),Up=function(){function e(e,t,r,n){void 0===n&&(n=void 0),this.major=e,this.minor=t,this.patch=r,this.preRelease=n}return e.parse=function(t){if(t){var r=new RegExp(Fp).exec(t);if(r){var n=Number(r[1]),i=Number(r[2]);if(!isNaN(n)&&!isNaN(i))return new e(n,i,Number(r[4])||0,r[5]||void 0)}}},e.prototype.compareTo=function(e){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch||this.preRelease&&!e.preRelease?-1:!this.preRelease&&e.preRelease?1:this.preRelease&&e.preRelease?this.preRelease>e.preRelease?1:this.preRelease<e.preRelease?-1:0:0},e}(),jp=function(){function e(){}return e.prototype.evaluate=function(e,t){var r,n,i={},o={context:e,result:i};try{for(var s=ap(t),a=s.next();!a.done;a=s.next()){var l=a.value,u=this.evaluateFlag(o,l);u&&(i[l.key]=u)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},e.prototype.evaluateFlag=function(e,t){var r,n,i;try{for(var o=ap(t.segments),s=o.next();!s.done;s=o.next()){var a=s.value;if(i=this.evaluateSegment(e,t,a)){var l=sp(sp(sp({},t.metadata),a.metadata),i.metadata);i=sp(sp({},i),{metadata:l});break}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e.prototype.evaluateSegment=function(e,t,r){var n,i,o,s;if(!r.conditions)return void 0!==(u=this.bucket(e,r))?t.variants[u]:void 0;try{for(var a=ap(r.conditions),l=a.next();!l.done;l=a.next()){var u,c=l.value,d=!0;try{for(var h=(o=void 0,ap(c)),p=h.next();!p.done;p=h.next()){var f=p.value;if(!(d=this.matchCondition(e,f)))break}}catch(e){o={error:e}}finally{try{p&&!p.done&&(s=h.return)&&s.call(h)}finally{if(o)throw o.error}}if(d)return void 0!==(u=this.bucket(e,r))?t.variants[u]:void 0}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}},e.prototype.matchCondition=function(e,t){var r=Lp(e,t.selector);if(r){if(this.isSetOperator(t.op)){var n=this.coerceStringArray(r);return!!n&&this.matchSet(n,t.op,t.values)}var i=this.coerceString(r);return void 0!==i&&this.matchString(i,t.op,t.values)}return this.matchNull(t.op,t.values)},e.prototype.getHash=function(e){return Rp(e)},e.prototype.bucket=function(e,t){var r,n,i,o;if(!t.bucket)return t.variant;var s=this.coerceString(Lp(e,t.bucket.selector));if(!s||0===s.length)return t.variant;var a="".concat(t.bucket.salt,"/").concat(s),l=this.getHash(a),u=l%100,c=Math.floor(l/100);try{for(var d=ap(t.bucket.allocations),h=d.next();!h.done;h=d.next()){var p=h.value,f=p.range[0],g=p.range[1];if(u>=f&&u<g)try{for(var v=(i=void 0,ap(p.distributions)),m=v.next();!m.done;m=v.next()){var y=m.value,b=y.range[0],w=y.range[1];if(c>=b&&c<w)return y.variant}}catch(e){i={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return t.variant},e.prototype.matchNull=function(e,t){var r=this.containsNone(t);switch(e){case lp:case cp:case hp:case pp:case fp:case gp:case vp:case mp:case yp:case bp:case wp:case kp:case Cp:return r;case up:case dp:case xp:case Ep:return!r;default:return!1}},e.prototype.matchSet=function(e,t,r){switch(t){case wp:return this.setEquals(e,r);case Sp:return!this.setEquals(e,r);case kp:return this.matchesSetContainsAll(e,r);case xp:return!this.matchesSetContainsAll(e,r);case Cp:return this.matchesSetContainsAny(e,r);case Ep:return!this.matchesSetContainsAny(e,r);default:return!1}},e.prototype.matchString=function(e,t,r){var n=this;switch(t){case lp:return this.matchesIs(e,r);case up:return!this.matchesIs(e,r);case cp:return this.matchesContains(e,r);case dp:return!this.matchesContains(e,r);case hp:case pp:case fp:case gp:return this.matchesComparable(e,t,r,function(e){return n.parseNumber(e)},this.comparator);case vp:case mp:case yp:case bp:return this.matchesComparable(e,t,r,function(e){return Up.parse(e)},this.versionComparator);case Ip:return this.matchesRegex(e,r);case Op:return!this.matchesRegex(e,r);default:return!1}},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var r=e.toLowerCase();if("true"===r||"false"===r)return t.some(function(e){return e.toLowerCase()===r})}return t.some(function(t){return e===t})},e.prototype.matchesContains=function(e,t){var r,n;try{for(var i=ap(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.toLowerCase().includes(s.toLowerCase()))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e.prototype.matchesComparable=function(e,t,r,n,i){var o=this,s=n(e),a=r.map(function(e){return n(e)}).filter(function(e){return void 0!==e});return void 0===s||0===a.length?r.some(function(r){return o.comparator(e,t,r)}):a.some(function(e){return i(s,t,e)})},e.prototype.comparator=function(e,t,r){switch(t){case hp:case vp:return e<r;case pp:case mp:return e<=r;case fp:case yp:return e>r;case gp:case bp:return e>=r;default:return!1}},e.prototype.versionComparator=function(e,t,r){var n=e.compareTo(r);switch(t){case hp:case vp:return n<0;case pp:case mp:return n<=0;case fp:case yp:return n>0;case gp:case bp:return n>=0;default:return!1}},e.prototype.matchesRegex=function(e,t){return t.some(function(t){return Boolean(new RegExp(t).exec(e))})},e.prototype.containsNone=function(e){return e.some(function(e){return"(none)"===e})},e.prototype.containsBooleans=function(e){return e.some(function(e){switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})},e.prototype.parseNumber=function(e){var t;return null!==(t=Number(e))&&void 0!==t?t:void 0},e.prototype.coerceString=function(e){if(e)return"object"==typeof e?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e))return e.map(function(e){return t.coerceString(e)}).filter(Boolean);var r=String(e);try{var n=JSON.parse(r);return Array.isArray(n)?e.map(function(e){return t.coerceString(e)}).filter(Boolean):void 0}catch(e){return}},e.prototype.isSetOperator=function(e){switch(e){case wp:case Sp:case kp:case xp:case Cp:case Ep:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var r=new Set(e),n=new Set(t);return r.size===n.size&&function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([],function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}(n),!1).every(function(e){return r.has(e)})},e.prototype.matchesSetContainsAll=function(e,t){var r,n;if(e.length<t.length)return!1;try{for(var i=ap(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!this.matchesIs(s,e))return!1}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0},e.prototype.matchesSetContainsAny=function(e,t){var r,n;try{for(var i=ap(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(this.matchesIs(s,e))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e}();"function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder;(e=>{let t={};e.forEach((e,r)=>t[e]=r)})(Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")),String.fromCharCode.bind(String),"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),function(e){function t(r,n){var i=e.call(this,n)||this;return i.statusCode=r,Object.setPrototypeOf(i,t.prototype),i}(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}op(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)})(t,e)}(Error);var Bp,qp=function(){var e=this;this.dbs={},this.createStore=function(t){return l(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,Ml(t,1,{upgrade:function(e){e.objectStoreNames.contains("eventTypesForSession")||e.createObjectStore("eventTypesForSession",{keyPath:"sessionId"})}})];case 1:return[2,e.sent()]}})})},this.openOrCreateDB=function(t){return l(e,void 0,void 0,function(){var e,r;return u(this,function(n){switch(n.label){case 0:return this.dbs&&this.dbs[t]?[2,this.dbs[t]]:(e="".concat(t.substring(0,10),"_amp_targeting"),[4,this.createStore(e)]);case 1:return r=n.sent(),this.dbs[t]=r,[2,r]}})})},this.updateEventListForSession=function(t){var r=t.sessionId,n=t.eventType,i=t.eventTime,o=t.loggerProvider,a=t.tx;return l(e,void 0,void 0,function(){var e,t,l,c,d,h,p,f,g;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,3,,4]),e=String(r),[4,a.store.get(e)];case 1:return t=u.sent(),l=t?t.eventTypes:{},c=l[n]||{},d=s(s({},l),((f={})[n]=s(s({},c),((g={})[i]={event_type:n},g)),f)),h={sessionId:e,eventTypes:d,lastUpdated:Date.now()},[4,a.store.put(h)];case 2:return u.sent(),[2,d];case 3:return p=u.sent(),o.warn("Failed to store events for targeting ".concat(r,": ").concat(p)),[3,4];case 4:return[2,void 0]}})})},this.deleteOldSessionEventTypes=function(t){var r=t.currentSessionId,n=t.loggerProvider,i=t.tx;return l(e,void 0,void 0,function(){var e,t,o,s,a,l;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,6,,7]),e=String(r),[4,i.store.getAll()];case 1:t=u.sent(),o=0,u.label=2;case 2:return o<t.length?(s=t[o],a=Date.now()-s.lastUpdated,s.sessionId!==e&&a>1728e5?[4,i.store.delete(s.sessionId)]:[3,4]):[3,5];case 3:u.sent(),u.label=4;case 4:return o++,[3,2];case 5:return[3,7];case 6:return l=u.sent(),n.warn("Failed to clear old session event types for targeting: ".concat(l)),[3,7];case 7:return[2]}})})},this.storeEventTypeForSession=function(t){var r=t.loggerProvider,n=t.sessionId,i=t.eventType,o=t.eventTime,s=t.apiKey;return l(e,void 0,void 0,function(){var e,t,a,l;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,5,,6]),[4,this.openOrCreateDB(s)];case 1:return e=u.sent(),(t=e.transaction("eventTypesForSession","readwrite"))?[4,this.updateEventListForSession({sessionId:n,tx:t,loggerProvider:r,eventType:i,eventTime:o})]:[2];case 2:return a=u.sent(),[4,this.deleteOldSessionEventTypes({currentSessionId:n,tx:t,loggerProvider:r})];case 3:return u.sent(),[4,t.done];case 4:return u.sent(),[2,a];case 5:return l=u.sent(),r.warn("Failed to store events for targeting ".concat(n,": ").concat(l)),[3,6];case 6:return[2,void 0]}})})}},zp=new qp,Wp=function(){var e=this;this.evaluateTargeting=function(t){var r=t.apiKey,n=t.loggerProvider,i=t.event,o=t.sessionId,a=t.userProperties,c=t.deviceId,d=t.page,h=t.flag;return l(e,void 0,void 0,function(){var e,t,l,p;return u(this,function(u){switch(u.label){case 0:return i&&i.time?[4,zp.storeEventTypeForSession({loggerProvider:n,apiKey:r,sessionId:o,eventType:i.event_type,eventTime:i.time})]:[3,2];case 1:return t=u.sent(),[3,3];case 2:t=void 0,u.label=3;case 3:return l=(e=t)&&new Set(Object.keys(e)),p={session_id:o,event:i,event_types:l&&Array.from(l),user:s(s({},a),{device_id:c,user_properties:a}),page:d},[2,this.evaluationEngine.evaluate(p,[h])]}})})},this.evaluationEngine=new jp},Vp=function(){var e=new Wp;return{evaluateTargeting:e.evaluateTargeting.bind(e)}}().evaluateTargeting,$p=Object.freeze({__proto__:null,evaluateTargeting:Vp}),Hp=Object.freeze({__proto__:null,compressionScript:'var WebWorker=function(e){"use strict";onmessage=function(e){var s="string"==typeof e.data?JSON.parse(e.data):e.data,t=s.event,a=s.sessionId,n=t.type,r=t.timestamp,i=t.delay,o=t.data,d=null!=i?JSON.stringify({type:n,timestamp:r,delay:i,data:o}):JSON.stringify({type:n,timestamp:r,data:o});postMessage({compressedEvent:d,sessionId:a})};var s=onmessage;return e.compressionOnMessage=s,Object.defineProperty(e,"__esModule",{value:!0}),e}({});\n',trackDestinationScript:'var WebWorker=function(e){"use strict";var t,r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)};function n(e,t,r,n){return new(r||(r=Promise))(function(s,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function i(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,i)}u((n=n.apply(e,t||[])).next())})}function s(e,t){var r,n,s,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=i(0),a.throw=i(1),a.return=i(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(o=0)),o;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(6===i[0]&&o.label<s[1]){o.label=s[1],s=i;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(i);break}s[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}"function"==typeof SuppressedError&&SuppressedError,function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(t||(t={})),t.US;var o,a=/payload.*exceed/i,i="X-Session-Replay-Event-Skipped";!function(e){e.GET_SR_PROPS="get-sr-props",e.DEBUG_INFO="debug-info",e.FETCH_REQUEST="fetch-request",e.METADATA="metadata",e.TARGETING_DECISION="targeting-decision",e.REPLAY_GATE_DECISION="replay-gate-decision"}(o||(o={}));var u="Network error occurred, event batch rejected";function c(e,t){return n(this,void 0,void 0,function(){var r,o,a,i,u,c,l,d,p,f,v,y,h,b,g=this;return s(this,function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),r=t.CompressionStream,o=new r("gzip"),a=o.writable.getWriter(),i=o.readable.getReader(),u=[],c=n(g,void 0,void 0,function(){var e,t,r;return s(this,function(n){switch(n.label){case 0:return[4,i.read()];case 1:if(e=n.sent(),t=e.done,r=e.value,t)return[3,3];u.push(r),n.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,a.write((new TextEncoder).encode(e))];case 1:return m.sent(),[4,a.close()];case 2:return m.sent(),[4,c];case 3:m.sent(),l=u.reduce(function(e,t){return e+t.length},0),d=new Uint8Array(l),p=0;try{for(f=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(u),v=f.next();!v.done;v=f.next())y=v.value,d.set(y,p),p+=y.length}catch(e){h={error:e}}finally{try{v&&!v.done&&(b=f.return)&&b.call(f)}finally{if(h)throw h.error}}return[2,d];case 4:return m.sent(),[2,null];case 5:return[2]}})})}var l=0,d=new Map,p=function(e,t){return fetch(e,t)},f=function(e,t){var r="".concat(++l);return new Promise(function(n,s){var o=t.signal,a=function(){d.delete(r);var e=new Error("Delegated session replay fetch aborted by send timeout");e.name="AbortError",s(e)};o.addEventListener("abort",a,{once:!0}),d.set(r,function(e){o.removeEventListener("abort",a),e.error?s(new Error(e.body)):n({status:e.status,headers:{get:function(t){return t===i?e.skipHeader:null}},text:function(){return Promise.resolve(e.body)}})}),postMessage({type:"fetch-request",requestId:r,url:e,method:"POST",headers:t.headers,body:t.body,keepalive:t.keepalive})})};function v(e,t,o){var l,d,p,f,v,y,h,b;return n(this,void 0,void 0,function(){var n,g,m,w,S,T,E,k,R,x,C,I,A,M,O;return s(this,function(s){switch(s.label){case 0:n=null!==(l=t.sendTimeoutMs)&&void 0!==l?l:1e4,s.label=1;case 1:return s.trys.push([1,14,,15]),!1!==t.enableTransportCompression&&"CompressionStream"in self?[4,c(e,self)]:[3,3];case 2:return m=s.sent(),[3,4];case 3:m=null,s.label=4;case 4:g=m,w="".concat(null!==(p=null===(d=t.version)||void 0===d?void 0:d.type)&&void 0!==p?p:"standalone","/").concat(null!==(v=null===(f=t.version)||void 0===f?void 0:f.version)&&void 0!==v?v:t.sdkVersion),S=new URLSearchParams({device_id:t.deviceId,session_id:"".concat(t.sessionId),type:t.eventType}),T="".concat((U=t.serverZone,P=t.trackServerUrl,P||("STAGING"===U?"https://api-sr.stag2.amplitude.com/sessions/v2/track":"EU"===U?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track")),"?").concat(S.toString()),E=r({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(t.apiKey),"X-Client-Version":t.sdkVersion,"X-Client-Library":w,"X-Client-Url":t.currentUrl.substring(0,1e3),"X-Client-Sample-Rate":"".concat(t.sampleRate),"X-Sampling-Hash-Alg":"xxhash32"},g?{"Content-Encoding":"gzip"}:{}),k=g?g.byteLength:new Blob([e]).size,R=new AbortController,x=n>0?setTimeout(function(){R.abort()},n):void 0,C=void 0,s.label=5;case 5:return s.trys.push([5,,7,8]),[4,o(T,{method:"POST",headers:E,body:null!=g?g:e,keepalive:k<=65536,signal:R.signal})];case 6:return C=s.sent(),[3,8];case 7:return x&&clearTimeout(x),[7];case 8:if(null===C)return[2,{shouldRetry:!1,success:!1,message:"Unexpected error occurred"}];if(C.status>=200&&C.status<300)return I=Math.round(new Blob(t.events).size/1024),A=null!==(b=null===(h=null===(y=C.headers)||void 0===y?void 0:y.get)||void 0===h?void 0:h.call(y,i))&&void 0!==b?b:null,[2,{shouldRetry:!1,success:!0,message:"Session replay event batch tracked successfully for session id ".concat(t.sessionId,", size of events: ").concat(I," KB"),skipCode:A}];if(413!==C.status)return[3,13];M="",s.label=9;case 9:return s.trys.push([9,11,,12]),[4,C.text()];case 10:return M=s.sent(),[3,12];case 11:return s.sent(),[3,12];case 12:return[2,{shouldRetry:!1,success:!1,message:u,payloadTooLarge:!0,isWaf:a.test(M)}];case 13:return C.status>=500||408===C.status||429===C.status||499===C.status?[2,{shouldRetry:!0,success:!1,message:"HTTP ".concat(C.status)}]:[2,{shouldRetry:!1,success:!1,message:u}];case 14:return(O=s.sent())&&"object"==typeof O&&"AbortError"===O.name?[2,{shouldRetry:!0,success:!1,message:"Session replay worker request timed out after ".concat(n,"ms")}]:[2,{shouldRetry:!1,success:!1,message:String(O)}];case 15:return[2]}var U,P})})}function y(e,t,r,o,a){var i;return n(this,void 0,void 0,function(){var n,u,c;return s(this,function(s){switch(s.label){case 0:n=1,s.label=1;case 1:return[4,v(t,r,a)];case 2:return(u=s.sent()).success?(postMessage({type:"log",id:e,message:u.message}),postMessage({type:"complete",id:e,skipCode:null!==(i=u.skipCode)&&void 0!==i?i:null}),[2]):u.payloadTooLarge&&o?(postMessage({type:"payload_too_large",id:e,isWaf:!0===u.isWaf}),[2]):o&&u.shouldRetry&&n<r.flushMaxRetries?[4,new Promise(function(e){return setTimeout(e,Math.random()*n*1e3)})]:[3,4];case 3:return s.sent(),n++,[3,5];case 4:return c=n>=r.flushMaxRetries?"Session replay event batch rejected due to exceeded retry count":u.message,postMessage({type:"warn",id:e,message:c}),postMessage({type:"complete",id:e}),[2];case 5:return[3,1];case 6:return[2]}})})}onmessage=function(e){return n(void 0,void 0,void 0,function(){var t,r,n,o,a,i,u,c;return s(this,function(s){switch(s.label){case 0:return"fetch-response"===(t=e.data).type?((r=d.get(t.requestId))&&(d.delete(t.requestId),r(t)),[2]):"send"!==t.type?[3,2]:(n=t.id,o=t.payload,a=t.context,i=t.useRetry,u=t.useCustomTransport,c=JSON.stringify(o),[4,y(n,c,a,i,u?f:p)]);case 1:s.sent(),s.label=2;case 2:return[2]}})})};var h=onmessage;return e.trackDestinationOnMessage=h,Object.defineProperty(e,"__esModule",{value:!0}),e}({});\n'}),Kp=Object.defineProperty,Gp=(e,t,r)=>((e,t,r)=>t in e?Kp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),Jp=Object.defineProperty,Xp=(e,t,r)=>((e,t,r)=>t in e?Jp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),Yp=Object.defineProperty,Qp=(e,t,r)=>((e,t,r)=>t in e?Yp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const Zp={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ef={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},tf={};function rf(e){if(tf[e])return tf[e];const t=function(e){var t,r;const n=null==(r=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:r.call(t,e);return n&&globalThis[n]?globalThis[n]:void 0}(e)||globalThis[e],r=t.prototype,n=e in Zp?Zp[e]:void 0,i=Boolean(n&&n.every(e=>{var t,n;return Boolean(null==(n=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),o=e in ef?ef[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return tf[e]=t.prototype,t.prototype;try{const n=document.createElement("iframe");document.body.appendChild(n);const i=n.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(n),o?tf[e]=o:r}catch{return r}}const nf={};function of(e,t,r){var n;const i=`${e}.${String(r)}`;if(nf[i])return nf[i].call(t);const o=rf(e),s=null==(n=Object.getOwnPropertyDescriptor(o,r))?void 0:n.get;return s?(nf[i]=s,s.call(t)):t[r]}const sf={};function af(e,t,r){const n=`${e}.${String(r)}`;if(sf[n])return sf[n].bind(t);const i=rf(e)[r];return"function"!=typeof i?t[r]:(sf[n]=i,i.bind(t))}const lf={childNodes:function(e){return of("Node",e,"childNodes")},parentNode:function(e){return of("Node",e,"parentNode")},parentElement:function(e){return of("Node",e,"parentElement")},textContent:function(e){return of("Node",e,"textContent")},contains:function(e,t){return af("Node",e,"contains")(t)},getRootNode:function(e){return af("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?of("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?of("Element",e,"shadowRoot"):null},querySelector:function(e,t){return of("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return of("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return rf("MutationObserver").constructor}};class uf{constructor(){Qp(this,"idNodeMap",new Map),Qp(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;return(null==(t=this.getMeta(e))?void 0:t.id)??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const e=this.nodeMetaMap.get(r);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function cf(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&cf(lf.parentNode(e),t,r);for(let r=e.classList.length;r--;){const n=e.classList[r];if(t.test(n))return!0}return!!r&&cf(lf.parentNode(e),t,r)}function df(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function hf(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var pf,ff={exports:{}};function gf(){if(pf)return ff.exports;pf=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return ff.exports=t(),ff.exports.createColors=t,ff.exports}const vf=hf(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var mf,yf;function bf(){if(yf)return mf;yf=1;let e=gf(),t=vf;class r extends Error{constructor(e,t,n,i,o,s){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),void 0!==t&&void 0!==n&&("number"==typeof t?(this.line=t,this.column=n):(this.line=t.line,this.column=t.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,r)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(r){if(!this.source)return"";let n=this.source;null==r&&(r=e.isColorSupported),t&&r&&(n=t(n));let i,o,s=n.split(/\r?\n/),a=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;if(r){let{bold:t,gray:r,red:n}=e.createColors(!0);i=e=>t(n(e)),o=e=>r(e)}else i=o=e=>e;return s.slice(a,l).map((e,t)=>{let r=a+1+t,n=" "+(" "+r).slice(-u)+" | ";if(r===this.line){let t=o(n.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+o(n)+e+"\n "+t+i("^")}return" "+o(n)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return mf=r,r.default=r,mf}var wf,Sf,kf,xf,Cf,Ef,If,Of,Pf,Tf,Rf,Mf,Af,_f,Nf,Df,Lf,Ff,Uf,jf,Bf,qf,zf,Wf,Vf,$f,Hf,Kf,Gf,Jf,Xf,Yf,Qf,Zf,eg,tg,rg,ng,ig,og,sg,ag,lg,ug,cg,dg,hg,pg,fg,gg,vg,mg,yg,bg={};function wg(){return wf||(wf=1,bg.isClean=Symbol("isClean"),bg.my=Symbol("my")),bg}function Sg(){if(kf)return Sf;kf=1;const e={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};class t{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let i=(e.raws.between||"")+(t?";":"");this.builder(r+n+i,e)}}beforeAfter(e,t){let r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let n=e.parent,i=0;for(;n&&"root"!==n.type;)i+=1,n=n.parent;if(r.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)r+=t}return r}block(e,t){let r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let i=e.nodes[n],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==n||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],void 0!==i))return i;let o=t.parent;if("before"===n){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[n];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[n])return s.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(t,n);{let e="raw"+((a=n)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[r],void 0!==i)return!1})}var a;return void 0===i&&(i=e[n]),s.rawCache[n]=i,i}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return t=r.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){let e=r.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}}return Sf=t,t.default=t,Sf}function kg(){if(Cf)return xf;Cf=1;let e=Sg();function t(t,r){new e(r).stringify(t)}return xf=t,t.default=t,xf}function xg(){if(If)return Ef;If=1;let{isClean:e,my:t}=wg(),r=bf(),n=Sg(),i=kg();function o(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if("proxyCache"===n)continue;let i=e[n],s=typeof i;"parent"===n&&"object"===s?t&&(r[n]=t):"source"===n?r[n]=i:Array.isArray(i)?r[n]=i.map(e=>o(e,r)):("object"===s&&null!==i&&(i=o(i)),r[n]=i)}return r}class s{constructor(r={}){this.raws={},this[e]=!1,this[t]=!0;for(let e in r)if("nodes"===e){this.nodes=[];for(let t of r[e])"function"==typeof t.clone?this.append(t.clone()):this.append(t)}else this[e]=r[e]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=o(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new r(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[e]){this[e]=!1;let t=this;for(;t=t.parent;)t[e]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let n=(t=this.toString()).indexOf(e.word);-1!==n&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===r[t]?(n=1,i+=1):n+=1;return{column:n,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let n=this.toString(),i=n.indexOf(e.word);-1!==i&&(t=this.positionInside(i,n),r=this.positionInside(i+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return(new n).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let r={},n=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let n=this[e];if(Array.isArray(n))r[e]=n.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof n&&n.toJSON)r[e]=n.toJSON(null,t);else if("source"===e){let o=t.get(n.input);null==o&&(o=i,t.set(n.input,i),i++),r[e]={end:n.end,inputId:o,start:n.start}}else r[e]=n}return n&&(r.inputs=[...t.keys()].map(e=>e.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=i){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,r){let n={node:this};for(let e in r)n[e]=r[e];return e.warn(t,n)}get proxyOf(){return this}}return Ef=s,s.default=s,Ef}function Cg(){if(Pf)return Of;Pf=1;let e=xg();class t extends e{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}}return Of=t,t.default=t,Of}function Eg(){if(Rf)return Tf;Rf=1;return Tf={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n}},Tf}function Ig(){if(Af)return Mf;Af=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=vf,{existsSync:r,readFileSync:n}=vf,{dirname:i,join:o}=vf;class s{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=i(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new e(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}loadFile(e){if(this.root=i(e),r(e))return this.mapFile=e,n(e,"utf-8").toString().trim()}loadMap(r,n){if(!1===n)return!1;if(n){if("string"==typeof n)return n;if("function"!=typeof n){if(n instanceof e)return t.fromSourceMap(n).toString();if(n instanceof t)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}{let e=n(r);if(e){let t=this.loadFile(e);if(!t)throw new Error("Unable to load previous source map: "+e.toString());return t}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let e=this.annotation;return r&&(e=o(i(r),e)),this.loadFile(e)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return Mf=s,s.default=s,Mf}function Og(){if(Nf)return _f;Nf=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=vf,{fileURLToPath:r,pathToFileURL:n}=vf,{isAbsolute:i,resolve:o}=vf,{nanoid:s}=Eg(),a=vf,l=bf(),u=Ig(),c=Symbol("fromOffsetCache"),d=Boolean(e&&t),h=Boolean(o&&i);class p{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!h||/^\w+:\/\//.test(t.from)||i(t.from)?this.file=t.from:this.file=o(t.from)),h&&d){let e=new u(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+s(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let o,s,a;if(t&&"object"==typeof t){let e=t,n=r;if("number"==typeof e.offset){let n=this.fromOffset(e.offset);t=n.line,r=n.col}else t=e.line,r=e.column;if("number"==typeof n.offset){let e=this.fromOffset(n.offset);s=e.line,a=e.col}else s=n.line,a=n.column}else if(!r){let e=this.fromOffset(t);t=e.line,r=e.col}let u=this.origin(t,r,s,a);return o=u?new l(e,void 0===u.endLine?u.line:{column:u.column,line:u.line},void 0===u.endLine?u.column:{column:u.endColumn,line:u.endLine},u.source,u.file,i.plugin):new l(e,void 0===s?t:{column:r,line:t},void 0===s?r:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:r,endColumn:a,endLine:s,line:t,source:this.css},this.file&&(n&&(o.input.url=n(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[c])r=this[c];else{let e=this.css.split("\n");r=new Array(e.length);let t=0;for(let n=0,i=e.length;n<i;n++)r[n]=t,t+=e[n].length+1;this[c]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let t,i=r.length-2;for(;n<i;)if(t=n+(i-n>>1),e<r[t])i=t-1;else{if(!(e>=r[t+1])){n=t;break}n=t+1}}return{col:e-r[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:o(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,o,s){if(!this.map)return!1;let a,l,u=this.map.consumer(),c=u.originalPositionFor({column:t,line:e});if(!c.source)return!1;"number"==typeof o&&(a=u.originalPositionFor({column:s,line:o})),l=i(c.source)?n(c.source):new URL(c.source,this.map.consumer().sourceRoot||n(this.map.mapFile));let d={column:c.column,endColumn:a&&a.column,endLine:a&&a.line,line:c.line,url:l.toString()};if("file:"===l.protocol){if(!r)throw new Error("file: protocol is not available in this PostCSS build");d.file=r(l)}let h=u.sourceContentFor(c.source);return h&&(d.source=h),d}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}}return _f=p,p.default=p,a&&a.registerInput&&a.registerInput(p),_f}function Pg(){if(Lf)return Df;Lf=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=vf,{dirname:r,relative:n,resolve:i,sep:o}=vf,{pathToFileURL:s}=vf,a=Og(),l=Boolean(e&&t),u=Boolean(r&&i&&n&&o);return Df=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let t of this.previous()){let n,i=this.toUrl(this.path(t.file)),o=t.root||r(t.file);!1===this.mapOpts.sourcesContent?(n=new e(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,i,this.toUrl(this.path(o)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),u&&l&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=t.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0});let e,r,n=1,i=1,o="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(t,a,l)=>{if(this.css+=t,a&&"end"!==l&&(s.generated.line=n,s.generated.column=i-1,a.source&&a.source.start?(s.source=this.sourcePath(a),s.original.line=a.source.start.line,s.original.column=a.source.start.column-1,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,this.map.addMapping(s))),e=t.match(/\n/g),e?(n+=e.length,r=t.lastIndexOf("\n"),i=t.length-r):i+=t.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===e.last&&!e.raws.semicolon||(a.source&&a.source.end?(s.source=this.sourcePath(a),s.original.line=a.source.end.line,s.original.column=a.source.end.column-1,s.generated.line=n,s.generated.column=i-2,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=i-1,this.map.addMapping(s)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let o=this.opts.to?r(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=r(i(o,this.mapOpts.annotation)));let s=n(o,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new a(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(s){let t=s(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===o&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},Df}function Tg(){if(Uf)return Ff;Uf=1;let e=xg();class t extends e{constructor(e){super(e),this.type="comment"}}return Ff=t,t.default=t,Ff}function Rg(){if(Bf)return jf;Bf=1;let e,t,r,n,{isClean:i,my:o}=wg(),s=Cg(),a=Tg(),l=xg();function u(e){return e.map(e=>(e.nodes&&(e.nodes=u(e.nodes)),delete e.source,e))}function c(e){if(e[i]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class d extends l{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,r,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],r=e(this.proxyOf.nodes[t],t),!1!==r);)this.indexes[n]+=1;return delete this.indexes[n],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...r)=>e[t](...r.map(e=>"function"==typeof e?(t,r)=>e(t.toProxy(),r):e)):"every"===t||"some"===t?r=>e[t]((e,...t)=>r(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r,n=this.index(e),i=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(let e of i)this.proxyOf.nodes.splice(n+1,0,e);for(let e in this.indexes)r=this.indexes[e],n<r&&(this.indexes[e]=r+i.length);return this.markDirty(),this}insertBefore(e,t){let r,n=this.index(e),i=0===n&&"prepend",o=this.normalize(t,this.proxyOf.nodes[n],i).reverse();n=this.index(e);for(let e of o)this.proxyOf.nodes.splice(n,0,e);for(let e in this.indexes)r=this.indexes[e],n<=r&&(this.indexes[e]=r+o.length);return this.markDirty(),this}normalize(n,l){if("string"==typeof n)n=u(e(n).nodes);else if(void 0===n)n=[];else if(Array.isArray(n)){n=n.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===n.type&&"document"!==this.type){n=n.nodes.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if(n.type)n=[n];else if(n.prop){if(void 0===n.value)throw new Error("Value field is missed in node creation");"string"!=typeof n.value&&(n.value=String(n.value)),n=[new s(n)]}else if(n.selector)n=[new t(n)];else if(n.name)n=[new r(n)];else{if(!n.text)throw new Error("Unknown node type in node creation");n=[new a(n)]}return n.map(e=>(e[o]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[i]&&c(e),void 0===e.raws.before&&l&&void 0!==l.raws.before&&(e.raws.before=l.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let n;try{n=e(t,r)}catch(e){throw t.addToError(e)}return!1!==n&&t.walk&&(n=t.walk(e)),n})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("atrule"===r.type&&e.test(r.name))return t(r,n)}):this.walk((r,n)=>{if("atrule"===r.type&&r.name===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("atrule"===e.type)return t(e,r)}))}walkComments(e){return this.walk((t,r)=>{if("comment"===t.type)return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("decl"===r.type&&e.test(r.prop))return t(r,n)}):this.walk((r,n)=>{if("decl"===r.type&&r.prop===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("decl"===e.type)return t(e,r)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("rule"===r.type&&e.test(r.selector))return t(r,n)}):this.walk((r,n)=>{if("rule"===r.type&&r.selector===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("rule"===e.type)return t(e,r)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return d.registerParse=t=>{e=t},d.registerRule=e=>{t=e},d.registerAtRule=e=>{r=e},d.registerRoot=e=>{n=e},jf=d,d.default=d,d.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,r.prototype):"rule"===e.type?Object.setPrototypeOf(e,t.prototype):"decl"===e.type?Object.setPrototypeOf(e,s.prototype):"comment"===e.type?Object.setPrototypeOf(e,a.prototype):"root"===e.type&&Object.setPrototypeOf(e,n.prototype),e[o]=!0,e.nodes&&e.nodes.forEach(e=>{d.rebuild(e)})},jf}function Mg(){if(zf)return qf;zf=1;let e,t,r=Rg();class n extends r{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},qf=n,n.default=n,qf}function Ag(){if(Vf)return Wf;Vf=1;let e={};return Wf=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function _g(){if(Hf)return $f;Hf=1;class e{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return $f=e,e.default=e,$f}function Ng(){if(Gf)return Kf;Gf=1;let e=_g();class t{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new e(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}}return Kf=t,t.default=t,Kf}function Dg(){if(Qf)return Yf;Qf=1;let e=Rg();class t extends e{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}return Yf=t,t.default=t,e.registerAtRule(t),Yf}function Lg(){if(eg)return Zf;eg=1;let e,t,r=Rg();class n extends r{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let n=super.normalize(e);if(t)if("prepend"===r)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of n)e.raws.before=t.raws.before;return n}removeChild(e,t){let r=this.index(e);return!t&&0===r&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},Zf=n,n.default=n,r.registerRoot(n),Zf}function Fg(){if(rg)return tg;rg=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,r){let n=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let r of e)u?u=!1:"\\"===r?u=!0:a?r===l&&(a=!1):'"'===r||"'"===r?(a=!0,l=r):"("===r?s+=1:")"===r?s>0&&(s-=1):0===s&&t.includes(r)&&(o=!0),o?(""!==i&&n.push(i.trim()),i="",o=!1):i+=r;return(r||""!==i)&&n.push(i.trim()),n}};return tg=e,e.default=e,tg}function Ug(){if(ig)return ng;ig=1;let e=Rg(),t=Fg();class r extends e{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return t.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}}return ng=r,r.default=r,e.registerRule(r),ng}function jg(){if(sg)return og;sg=1;let e=Cg(),t=function(){if(Xf)return Jf;Xf=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),r="\\".charCodeAt(0),n="/".charCodeAt(0),i="\n".charCodeAt(0),o=" ".charCodeAt(0),s="\f".charCodeAt(0),a="\t".charCodeAt(0),l="\r".charCodeAt(0),u="[".charCodeAt(0),c="]".charCodeAt(0),d="(".charCodeAt(0),h=")".charCodeAt(0),p="{".charCodeAt(0),f="}".charCodeAt(0),g=";".charCodeAt(0),v="*".charCodeAt(0),m=":".charCodeAt(0),y="@".charCodeAt(0),b=/[\t\n\f\r "#'()/;[\\\]{}]/g,w=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,S=/.[\r\n"'(/\\]/,k=/[\da-f]/i;return Jf=function(x,C={}){let E,I,O,P,T,R,M,A,_,N,D=x.css.valueOf(),L=C.ignoreErrors,F=D.length,U=0,j=[],B=[];function q(e){throw x.error("Unclosed "+e,U)}return{back:function(e){B.push(e)},endOfFile:function(){return 0===B.length&&U>=F},nextToken:function(x){if(B.length)return B.pop();if(U>=F)return;let C=!!x&&x.ignoreUnclosed;switch(E=D.charCodeAt(U),E){case i:case o:case a:case l:case s:I=U;do{I+=1,E=D.charCodeAt(I)}while(E===o||E===i||E===a||E===l||E===s);N=["space",D.slice(U,I)],U=I-1;break;case u:case c:case p:case f:case m:case g:case h:{let e=String.fromCharCode(E);N=[e,e,U];break}case d:if(A=j.length?j.pop()[1]:"",_=D.charCodeAt(U+1),"url"===A&&_!==e&&_!==t&&_!==o&&_!==i&&_!==a&&_!==s&&_!==l){I=U;do{if(R=!1,I=D.indexOf(")",I+1),-1===I){if(L||C){I=U;break}q("bracket")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["brackets",D.slice(U,I+1),U,I],U=I}else I=D.indexOf(")",U+1),P=D.slice(U,I+1),-1===I||S.test(P)?N=["(","(",U]:(N=["brackets",P,U,I],U=I);break;case e:case t:O=E===e?"'":'"',I=U;do{if(R=!1,I=D.indexOf(O,I+1),-1===I){if(L||C){I=U+1;break}q("string")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["string",D.slice(U,I+1),U,I],U=I;break;case y:b.lastIndex=U+1,b.test(D),I=0===b.lastIndex?D.length-1:b.lastIndex-2,N=["at-word",D.slice(U,I+1),U,I],U=I;break;case r:for(I=U,T=!0;D.charCodeAt(I+1)===r;)I+=1,T=!T;if(E=D.charCodeAt(I+1),T&&E!==n&&E!==o&&E!==i&&E!==a&&E!==l&&E!==s&&(I+=1,k.test(D.charAt(I)))){for(;k.test(D.charAt(I+1));)I+=1;D.charCodeAt(I+1)===o&&(I+=1)}N=["word",D.slice(U,I+1),U,I],U=I;break;default:E===n&&D.charCodeAt(U+1)===v?(I=D.indexOf("*/",U+2)+1,0===I&&(L||C?I=D.length:q("comment")),N=["comment",D.slice(U,I+1),U,I],U=I):(w.lastIndex=U+1,w.test(D),I=0===w.lastIndex?D.length-1:w.lastIndex-2,N=["word",D.slice(U,I+1),U,I],j.push(N),U=I)}return U++,N},position:function(){return U}}}}(),r=Tg(),n=Dg(),i=Lg(),o=Ug();const s={empty:!0,space:!0};return og=class{constructor(e){this.input=e,this.root=new i,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,r,i,o=new n;o.name=e[1].slice(1),""===o.name&&this.unnamedAtrule(o,e),this.init(o,e[2]);let s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?u.push("("===t?")":"]"):"{"===t&&u.length>0?u.push("}"):t===u[u.length-1]&&u.pop(),0===u.length){if(";"===t){o.source.end=this.getPosition(e[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===t){a=!0;break}if("}"===t){if(l.length>0){for(i=l.length-1,r=l[i];r&&"space"===r[0];)r=l[--i];r&&(o.source.end=this.getPosition(r[3]||r[2]),o.source.end.offset++)}this.end(e);break}l.push(e)}else l.push(e);if(this.tokenizer.endOfFile()){s=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(o.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(o,"params",l),s&&(e=l[l.length-1],o.source.end=this.getPosition(e[3]||e[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),a&&(o.nodes=[],this.current=o)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let r,n=0;for(let i=t-1;i>=0&&(r=e[i],"space"===r[0]||(n+=1,2!==n));i--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}colon(e){let t,r,n,i=0;for(let[o,s]of e.entries()){if(t=s,r=t[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return o}this.doubleColon(t)}n=t}return!1}comment(e){let t=new r;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=t(this.input)}decl(t,r){let n=new e;this.init(n,t[0][2]);let i,o=t[t.length-1];for(";"===o[0]&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}(t)),n.source.end.offset++;"word"!==t[0][0];)1===t.length&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let e=t[0][0];if(":"===e||"space"===e||"comment"===e)break;n.prop+=t.shift()[1]}for(n.raws.between="";t.length;){if(i=t.shift(),":"===i[0]){n.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s,a=[];for(;t.length&&(s=t[0][0],"space"===s||"comment"===s);)a.push(t.shift());this.precheckMissedSemicolon(t);for(let e=t.length-1;e>=0;e--){if(i=t[e],"!important"===i[1].toLowerCase()){n.important=!0;let r=this.stringFrom(t,e);r=this.spacesFromEnd(t)+r," !important"!==r&&(n.raws.important=r);break}if("important"===i[1].toLowerCase()){let r=t.slice(0),i="";for(let t=e;t>0;t--){let e=r[t][0];if(0===i.trim().indexOf("!")&&"space"!==e)break;i=r.pop()[1]+i}0===i.trim().indexOf("!")&&(n.important=!0,n.raws.important=i,t=r)}if("space"!==i[0]&&"comment"!==i[0])break}t.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(n.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(n,"value",a.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new o;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,r=null,n=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(r=l[0],a.push(l),"("===r||"["===r)i||(i=l),o.push("("===r?")":"]");else if(s&&n&&"{"===r)i||(i=l),o.push("}");else if(0===o.length){if(";"===r){if(n)return void this.decl(a,s);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),t&&n){if(!s)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,n){let i,o,a,l,u=r.length,c="",d=!0;for(let e=0;e<u;e+=1)i=r[e],o=i[0],"space"!==o||e!==u-1||n?"comment"===o?(l=r[e-1]?r[e-1][0]:"empty",a=r[e+1]?r[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let n=r.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:n,value:c}}e[t]=c}rule(e){e.pop();let t=new o;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},og}function Bg(){if(lg)return ag;lg=1;let e=Rg(),t=jg(),r=Og();function n(e,n){let i=new r(e,n),o=new t(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&n&&n.from&&(/\.scss$/i.test(n.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(n.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(n.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return o.root}return ag=n,n.default=n,e.registerParse(n),ag}function qg(){if(cg)return ug;cg=1;let{isClean:e,my:t}=wg(),r=Pg(),n=kg(),i=Rg(),o=Mg(),s=Ag(),a=Ng(),l=Bg(),u=Lg();const c={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},d={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},h={Once:!0,postcssPlugin:!0,prepare:!0};function p(e){return"object"==typeof e&&"function"==typeof e.then}function f(e){let t=!1,r=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function g(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:f(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function v(t){return t[e]=!1,t.nodes&&t.nodes.forEach(e=>v(e)),t}let m={};class y{constructor(e,r,n){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof r||null===r||"root"!==r.type&&"document"!==r.type)if(r instanceof y||r instanceof a)o=v(r.root),r.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let e=l;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{o=e(r,n)}catch(e){this.processed=!0,this.error=e}o&&!o[t]&&i.rebuild(o)}else o=v(r);this.result=new a(e,o,n),this.helpers={...m,postcss:m,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(r.postcssVersion&&"production"!==process.env.NODE_ENV){let e=r.postcssPlugin,t=r.postcssVersion,n=this.result.processor.version,i=t.split("."),o=n.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+n+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=r.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,r)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,r])};for(let t of this.plugins)if("object"==typeof t)for(let r in t){if(!d[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[r])if("object"==typeof t[r])for(let n in t[r])e(t,"*"===n?r:r+"-"+n.toLowerCase(),t[r][n]);else"function"==typeof t[r]&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(p(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];){t[e]=!0;let r=[g(t)];for(;r.length>0;){let e=this.visitTick(r);if(p(e))try{await e}catch(e){let t=r[r.length-1].node;throw this.handleError(e,t)}}}if(this.listeners.OnceExit)for(let[e,r]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map(e=>r(e,this.helpers));await Promise.all(e)}else await r(t,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return p(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=n;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new r(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(p(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];)t[e]=!0,this.walkSync(t);if(this.listeners.OnceExit)if("document"===t.type)for(let e of t.nodes)this.visitSync(this.listeners.OnceExit,e);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||s("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,n]of e){let e;this.result.lastPlugin=r;try{e=n(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(p(e))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void t.pop();if(i.length>0&&r.visitorIndex<i.length){let[e,t]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=e;try{return t(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==r.iterator){let i,o=r.iterator;for(;i=n.nodes[n.indexes[o]];)if(n.indexes[o]+=1,!i[e])return i[e]=!0,void t.push(g(i));r.iterator=0,delete n.indexes[o]}let o=r.events;for(;r.eventIndex<o.length;){let t=o[r.eventIndex];if(r.eventIndex+=1,0===t)return void(n.nodes&&n.nodes.length&&(n[e]=!0,r.iterator=n.getIterator()));if(this.listeners[t])return void(r.visitors=this.listeners[t])}t.pop()}walkSync(t){t[e]=!0;let r=f(t);for(let n of r)if(0===n)t.nodes&&t.each(t=>{t[e]||this.walkSync(t)});else{let e=this.listeners[n];if(e&&this.visitSync(e,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return y.registerPostcss=e=>{m=e},ug=y,y.default=y,u.registerLazyResult(y),o.registerLazyResult(y),ug}function zg(){if(fg)return pg;fg=1;let e=function(){if(hg)return dg;hg=1;let e=Pg(),t=kg(),r=Ag(),n=Bg();const i=Ng();class o{constructor(r,n,o){let s;n=n.toString(),this.stringified=!1,this._processor=r,this._css=n,this._opts=o,this._map=void 0;let a=t;this.result=new i(this._processor,s,this._opts),this.result.css=n;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,n);if(u.isMap()){let[e,t]=u.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else u.clearAnnotation(),this.result.css=u.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||r("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=n;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}}return dg=o,o.default=o,dg}(),t=qg(),r=Mg(),n=Lg();class i{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(!0===r.postcss?r=r():r.postcss&&(r=r.postcss),"object"==typeof r&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if("object"==typeof r&&r.postcssPlugin)t.push(r);else if("function"==typeof r)t.push(r);else{if("object"!=typeof r||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(r,n={}){return this.plugins.length||n.parser||n.stringifier||n.syntax?new t(this,r,n):new e(this,r,n)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return pg=i,i.default=i,n.registerProcessor(i),r.registerProcessor(i),pg}const Wg=df(function(){if(yg)return mg;yg=1;let e=bf(),t=Cg(),r=qg(),n=Rg(),i=zg(),o=kg(),s=function(){if(vg)return gg;vg=1;let e=Cg(),t=Ig(),r=Tg(),n=Dg(),i=Og(),o=Lg(),s=Ug();function a(l,u){if(Array.isArray(l))return l.map(e=>a(e));let{inputs:c,...d}=l;if(c){u=[];for(let e of c){let r={...e,__proto__:i.prototype};r.map&&(r.map={...r.map,__proto__:t.prototype}),u.push(r)}}if(d.nodes&&(d.nodes=l.nodes.map(e=>a(e,u))),d.source){let{inputId:e,...t}=d.source;d.source=t,null!=e&&(d.source.input=u[e])}if("root"===d.type)return new o(d);if("decl"===d.type)return new e(d);if("rule"===d.type)return new s(d);if("comment"===d.type)return new r(d);if("atrule"===d.type)return new n(d);throw new Error("Unknown node type: "+l.type)}return gg=a,a.default=a,gg}(),a=Mg(),l=_g(),u=Tg(),c=Dg(),d=Ng(),h=Og(),p=Bg(),f=Fg(),g=Ug(),v=Lg(),m=xg();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new i(e)}return y.plugin=function(e,t){let r,n=!1;function o(...r){console&&console.warn&&!n&&(n=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226"));let o=t(...r);return o.postcssPlugin=e,o.postcssVersion=(new i).version,o}return Object.defineProperty(o,"postcss",{get:()=>(r||(r=o()),r)}),o.process=function(e,t,r){return y([o(r)]).process(e,t)},o},y.stringify=o,y.parse=p,y.fromJSON=s,y.list=f,y.comment=e=>new u(e),y.atRule=e=>new c(e),y.decl=e=>new t(e),y.rule=e=>new g(e),y.root=e=>new v(e),y.document=e=>new a(e),y.CssSyntaxError=e,y.Declaration=t,y.Container=n,y.Processor=i,y.Document=a,y.Comment=u,y.Warning=l,y.AtRule=c,y.Result=d,y.Input=h,y.Rule=g,y.Root=v,y.Node=m,r.registerPostcss(y),mg=y,y.default=y,mg}());Wg.stringify,Wg.fromJSON,Wg.plugin,Wg.parse,Wg.list,Wg.document,Wg.comment,Wg.atRule,Wg.rule,Wg.decl,Wg.root,Wg.CssSyntaxError,Wg.Declaration,Wg.Container,Wg.Processor,Wg.Document,Wg.Comment,Wg.Warning,Wg.AtRule,Wg.Result,Wg.Input,Wg.Rule,Wg.Root,Wg.Node;var Vg=Object.defineProperty,$g=(e,t,r)=>((e,t,r)=>t in e?Vg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);function Hg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Kg(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var Gg,Jg={exports:{}};function Xg(){if(Gg)return Jg.exports;Gg=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return Jg.exports=t(),Jg.exports.createColors=t,Jg.exports}const Yg=Kg(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Qg,Zg;function ev(){if(Zg)return Qg;Zg=1;let e=Xg(),t=Yg;class r extends Error{constructor(e,t,n,i,o,s){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),void 0!==t&&void 0!==n&&("number"==typeof t?(this.line=t,this.column=n):(this.line=t.line,this.column=t.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,r)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(r){if(!this.source)return"";let n=this.source;null==r&&(r=e.isColorSupported),t&&r&&(n=t(n));let i,o,s=n.split(/\r?\n/),a=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;if(r){let{bold:t,gray:r,red:n}=e.createColors(!0);i=e=>t(n(e)),o=e=>r(e)}else i=o=e=>e;return s.slice(a,l).map((e,t)=>{let r=a+1+t,n=" "+(" "+r).slice(-u)+" | ";if(r===this.line){let t=o(n.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+o(n)+e+"\n "+t+i("^")}return" "+o(n)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return Qg=r,r.default=r,Qg}var tv,rv,nv,iv,ov,sv,av,lv,uv,cv,dv,hv,pv,fv,gv,vv,mv,yv,bv,wv,Sv,kv,xv,Cv,Ev,Iv,Ov,Pv,Tv,Rv,Mv,Av,_v,Nv,Dv,Lv,Fv,Uv,jv,Bv,qv,zv,Wv,Vv,$v,Hv,Kv,Gv,Jv,Xv,Yv,Qv,Zv,em={};function tm(){return tv||(tv=1,em.isClean=Symbol("isClean"),em.my=Symbol("my")),em}function rm(){if(nv)return rv;nv=1;const e={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};class t{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let i=(e.raws.between||"")+(t?";":"");this.builder(r+n+i,e)}}beforeAfter(e,t){let r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let n=e.parent,i=0;for(;n&&"root"!==n.type;)i+=1,n=n.parent;if(r.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)r+=t}return r}block(e,t){let r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let i=e.nodes[n],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==n||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],void 0!==i))return i;let o=t.parent;if("before"===n){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[n];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[n])return s.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(t,n);{let e="raw"+((a=n)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[r],void 0!==i)return!1})}var a;return void 0===i&&(i=e[n]),s.rawCache[n]=i,i}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return t=r.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){let e=r.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}}return rv=t,t.default=t,rv}function nm(){if(ov)return iv;ov=1;let e=rm();function t(t,r){new e(r).stringify(t)}return iv=t,t.default=t,iv}function im(){if(av)return sv;av=1;let{isClean:e,my:t}=tm(),r=ev(),n=rm(),i=nm();function o(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if("proxyCache"===n)continue;let i=e[n],s=typeof i;"parent"===n&&"object"===s?t&&(r[n]=t):"source"===n?r[n]=i:Array.isArray(i)?r[n]=i.map(e=>o(e,r)):("object"===s&&null!==i&&(i=o(i)),r[n]=i)}return r}class s{constructor(r={}){this.raws={},this[e]=!1,this[t]=!0;for(let e in r)if("nodes"===e){this.nodes=[];for(let t of r[e])"function"==typeof t.clone?this.append(t.clone()):this.append(t)}else this[e]=r[e]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=o(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new r(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[e]){this[e]=!1;let t=this;for(;t=t.parent;)t[e]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let n=(t=this.toString()).indexOf(e.word);-1!==n&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===r[t]?(n=1,i+=1):n+=1;return{column:n,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let n=this.toString(),i=n.indexOf(e.word);-1!==i&&(t=this.positionInside(i,n),r=this.positionInside(i+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return(new n).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let r={},n=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let n=this[e];if(Array.isArray(n))r[e]=n.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof n&&n.toJSON)r[e]=n.toJSON(null,t);else if("source"===e){let o=t.get(n.input);null==o&&(o=i,t.set(n.input,i),i++),r[e]={end:n.end,inputId:o,start:n.start}}else r[e]=n}return n&&(r.inputs=[...t.keys()].map(e=>e.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=i){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,r){let n={node:this};for(let e in r)n[e]=r[e];return e.warn(t,n)}get proxyOf(){return this}}return sv=s,s.default=s,sv}function om(){if(uv)return lv;uv=1;let e=im();class t extends e{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}}return lv=t,t.default=t,lv}function sm(){if(dv)return cv;dv=1;return cv={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n}},cv}function am(){if(pv)return hv;pv=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Yg,{existsSync:r,readFileSync:n}=Yg,{dirname:i,join:o}=Yg;class s{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=i(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new e(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}loadFile(e){if(this.root=i(e),r(e))return this.mapFile=e,n(e,"utf-8").toString().trim()}loadMap(r,n){if(!1===n)return!1;if(n){if("string"==typeof n)return n;if("function"!=typeof n){if(n instanceof e)return t.fromSourceMap(n).toString();if(n instanceof t)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}{let e=n(r);if(e){let t=this.loadFile(e);if(!t)throw new Error("Unable to load previous source map: "+e.toString());return t}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let e=this.annotation;return r&&(e=o(i(r),e)),this.loadFile(e)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return hv=s,s.default=s,hv}function lm(){if(gv)return fv;gv=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Yg,{fileURLToPath:r,pathToFileURL:n}=Yg,{isAbsolute:i,resolve:o}=Yg,{nanoid:s}=sm(),a=Yg,l=ev(),u=am(),c=Symbol("fromOffsetCache"),d=Boolean(e&&t),h=Boolean(o&&i);class p{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!h||/^\w+:\/\//.test(t.from)||i(t.from)?this.file=t.from:this.file=o(t.from)),h&&d){let e=new u(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+s(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let o,s,a;if(t&&"object"==typeof t){let e=t,n=r;if("number"==typeof e.offset){let n=this.fromOffset(e.offset);t=n.line,r=n.col}else t=e.line,r=e.column;if("number"==typeof n.offset){let e=this.fromOffset(n.offset);s=e.line,a=e.col}else s=n.line,a=n.column}else if(!r){let e=this.fromOffset(t);t=e.line,r=e.col}let u=this.origin(t,r,s,a);return o=u?new l(e,void 0===u.endLine?u.line:{column:u.column,line:u.line},void 0===u.endLine?u.column:{column:u.endColumn,line:u.endLine},u.source,u.file,i.plugin):new l(e,void 0===s?t:{column:r,line:t},void 0===s?r:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:r,endColumn:a,endLine:s,line:t,source:this.css},this.file&&(n&&(o.input.url=n(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[c])r=this[c];else{let e=this.css.split("\n");r=new Array(e.length);let t=0;for(let n=0,i=e.length;n<i;n++)r[n]=t,t+=e[n].length+1;this[c]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let t,i=r.length-2;for(;n<i;)if(t=n+(i-n>>1),e<r[t])i=t-1;else{if(!(e>=r[t+1])){n=t;break}n=t+1}}return{col:e-r[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:o(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,o,s){if(!this.map)return!1;let a,l,u=this.map.consumer(),c=u.originalPositionFor({column:t,line:e});if(!c.source)return!1;"number"==typeof o&&(a=u.originalPositionFor({column:s,line:o})),l=i(c.source)?n(c.source):new URL(c.source,this.map.consumer().sourceRoot||n(this.map.mapFile));let d={column:c.column,endColumn:a&&a.column,endLine:a&&a.line,line:c.line,url:l.toString()};if("file:"===l.protocol){if(!r)throw new Error("file: protocol is not available in this PostCSS build");d.file=r(l)}let h=u.sourceContentFor(c.source);return h&&(d.source=h),d}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}}return fv=p,p.default=p,a&&a.registerInput&&a.registerInput(p),fv}function um(){if(mv)return vv;mv=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Yg,{dirname:r,relative:n,resolve:i,sep:o}=Yg,{pathToFileURL:s}=Yg,a=lm(),l=Boolean(e&&t),u=Boolean(r&&i&&n&&o);return vv=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let t of this.previous()){let n,i=this.toUrl(this.path(t.file)),o=t.root||r(t.file);!1===this.mapOpts.sourcesContent?(n=new e(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,i,this.toUrl(this.path(o)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),u&&l&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=t.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0});let e,r,n=1,i=1,o="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(t,a,l)=>{if(this.css+=t,a&&"end"!==l&&(s.generated.line=n,s.generated.column=i-1,a.source&&a.source.start?(s.source=this.sourcePath(a),s.original.line=a.source.start.line,s.original.column=a.source.start.column-1,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,this.map.addMapping(s))),e=t.match(/\n/g),e?(n+=e.length,r=t.lastIndexOf("\n"),i=t.length-r):i+=t.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===e.last&&!e.raws.semicolon||(a.source&&a.source.end?(s.source=this.sourcePath(a),s.original.line=a.source.end.line,s.original.column=a.source.end.column-1,s.generated.line=n,s.generated.column=i-2,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=i-1,this.map.addMapping(s)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let o=this.opts.to?r(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=r(i(o,this.mapOpts.annotation)));let s=n(o,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new a(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(s){let t=s(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===o&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},vv}function cm(){if(bv)return yv;bv=1;let e=im();class t extends e{constructor(e){super(e),this.type="comment"}}return yv=t,t.default=t,yv}function dm(){if(Sv)return wv;Sv=1;let e,t,r,n,{isClean:i,my:o}=tm(),s=om(),a=cm(),l=im();function u(e){return e.map(e=>(e.nodes&&(e.nodes=u(e.nodes)),delete e.source,e))}function c(e){if(e[i]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class d extends l{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,r,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],r=e(this.proxyOf.nodes[t],t),!1!==r);)this.indexes[n]+=1;return delete this.indexes[n],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...r)=>e[t](...r.map(e=>"function"==typeof e?(t,r)=>e(t.toProxy(),r):e)):"every"===t||"some"===t?r=>e[t]((e,...t)=>r(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r,n=this.index(e),i=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(let e of i)this.proxyOf.nodes.splice(n+1,0,e);for(let e in this.indexes)r=this.indexes[e],n<r&&(this.indexes[e]=r+i.length);return this.markDirty(),this}insertBefore(e,t){let r,n=this.index(e),i=0===n&&"prepend",o=this.normalize(t,this.proxyOf.nodes[n],i).reverse();n=this.index(e);for(let e of o)this.proxyOf.nodes.splice(n,0,e);for(let e in this.indexes)r=this.indexes[e],n<=r&&(this.indexes[e]=r+o.length);return this.markDirty(),this}normalize(n,l){if("string"==typeof n)n=u(e(n).nodes);else if(void 0===n)n=[];else if(Array.isArray(n)){n=n.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===n.type&&"document"!==this.type){n=n.nodes.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if(n.type)n=[n];else if(n.prop){if(void 0===n.value)throw new Error("Value field is missed in node creation");"string"!=typeof n.value&&(n.value=String(n.value)),n=[new s(n)]}else if(n.selector)n=[new t(n)];else if(n.name)n=[new r(n)];else{if(!n.text)throw new Error("Unknown node type in node creation");n=[new a(n)]}return n.map(e=>(e[o]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[i]&&c(e),void 0===e.raws.before&&l&&void 0!==l.raws.before&&(e.raws.before=l.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let n;try{n=e(t,r)}catch(e){throw t.addToError(e)}return!1!==n&&t.walk&&(n=t.walk(e)),n})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("atrule"===r.type&&e.test(r.name))return t(r,n)}):this.walk((r,n)=>{if("atrule"===r.type&&r.name===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("atrule"===e.type)return t(e,r)}))}walkComments(e){return this.walk((t,r)=>{if("comment"===t.type)return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("decl"===r.type&&e.test(r.prop))return t(r,n)}):this.walk((r,n)=>{if("decl"===r.type&&r.prop===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("decl"===e.type)return t(e,r)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("rule"===r.type&&e.test(r.selector))return t(r,n)}):this.walk((r,n)=>{if("rule"===r.type&&r.selector===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("rule"===e.type)return t(e,r)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return d.registerParse=t=>{e=t},d.registerRule=e=>{t=e},d.registerAtRule=e=>{r=e},d.registerRoot=e=>{n=e},wv=d,d.default=d,d.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,r.prototype):"rule"===e.type?Object.setPrototypeOf(e,t.prototype):"decl"===e.type?Object.setPrototypeOf(e,s.prototype):"comment"===e.type?Object.setPrototypeOf(e,a.prototype):"root"===e.type&&Object.setPrototypeOf(e,n.prototype),e[o]=!0,e.nodes&&e.nodes.forEach(e=>{d.rebuild(e)})},wv}function hm(){if(xv)return kv;xv=1;let e,t,r=dm();class n extends r{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},kv=n,n.default=n,kv}function pm(){if(Ev)return Cv;Ev=1;let e={};return Cv=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function fm(){if(Ov)return Iv;Ov=1;class e{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return Iv=e,e.default=e,Iv}function gm(){if(Tv)return Pv;Tv=1;let e=fm();class t{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new e(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}}return Pv=t,t.default=t,Pv}function vm(){if(_v)return Av;_v=1;let e=dm();class t extends e{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}return Av=t,t.default=t,e.registerAtRule(t),Av}function mm(){if(Dv)return Nv;Dv=1;let e,t,r=dm();class n extends r{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let n=super.normalize(e);if(t)if("prepend"===r)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of n)e.raws.before=t.raws.before;return n}removeChild(e,t){let r=this.index(e);return!t&&0===r&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},Nv=n,n.default=n,r.registerRoot(n),Nv}function ym(){if(Fv)return Lv;Fv=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,r){let n=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let r of e)u?u=!1:"\\"===r?u=!0:a?r===l&&(a=!1):'"'===r||"'"===r?(a=!0,l=r):"("===r?s+=1:")"===r?s>0&&(s-=1):0===s&&t.includes(r)&&(o=!0),o?(""!==i&&n.push(i.trim()),i="",o=!1):i+=r;return(r||""!==i)&&n.push(i.trim()),n}};return Lv=e,e.default=e,Lv}function bm(){if(jv)return Uv;jv=1;let e=dm(),t=ym();class r extends e{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return t.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}}return Uv=r,r.default=r,e.registerRule(r),Uv}function wm(){if(qv)return Bv;qv=1;let e=om(),t=function(){if(Mv)return Rv;Mv=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),r="\\".charCodeAt(0),n="/".charCodeAt(0),i="\n".charCodeAt(0),o=" ".charCodeAt(0),s="\f".charCodeAt(0),a="\t".charCodeAt(0),l="\r".charCodeAt(0),u="[".charCodeAt(0),c="]".charCodeAt(0),d="(".charCodeAt(0),h=")".charCodeAt(0),p="{".charCodeAt(0),f="}".charCodeAt(0),g=";".charCodeAt(0),v="*".charCodeAt(0),m=":".charCodeAt(0),y="@".charCodeAt(0),b=/[\t\n\f\r "#'()/;[\\\]{}]/g,w=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,S=/.[\r\n"'(/\\]/,k=/[\da-f]/i;return Rv=function(x,C={}){let E,I,O,P,T,R,M,A,_,N,D=x.css.valueOf(),L=C.ignoreErrors,F=D.length,U=0,j=[],B=[];function q(e){throw x.error("Unclosed "+e,U)}return{back:function(e){B.push(e)},endOfFile:function(){return 0===B.length&&U>=F},nextToken:function(x){if(B.length)return B.pop();if(U>=F)return;let C=!!x&&x.ignoreUnclosed;switch(E=D.charCodeAt(U),E){case i:case o:case a:case l:case s:I=U;do{I+=1,E=D.charCodeAt(I)}while(E===o||E===i||E===a||E===l||E===s);N=["space",D.slice(U,I)],U=I-1;break;case u:case c:case p:case f:case m:case g:case h:{let e=String.fromCharCode(E);N=[e,e,U];break}case d:if(A=j.length?j.pop()[1]:"",_=D.charCodeAt(U+1),"url"===A&&_!==e&&_!==t&&_!==o&&_!==i&&_!==a&&_!==s&&_!==l){I=U;do{if(R=!1,I=D.indexOf(")",I+1),-1===I){if(L||C){I=U;break}q("bracket")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["brackets",D.slice(U,I+1),U,I],U=I}else I=D.indexOf(")",U+1),P=D.slice(U,I+1),-1===I||S.test(P)?N=["(","(",U]:(N=["brackets",P,U,I],U=I);break;case e:case t:O=E===e?"'":'"',I=U;do{if(R=!1,I=D.indexOf(O,I+1),-1===I){if(L||C){I=U+1;break}q("string")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["string",D.slice(U,I+1),U,I],U=I;break;case y:b.lastIndex=U+1,b.test(D),I=0===b.lastIndex?D.length-1:b.lastIndex-2,N=["at-word",D.slice(U,I+1),U,I],U=I;break;case r:for(I=U,T=!0;D.charCodeAt(I+1)===r;)I+=1,T=!T;if(E=D.charCodeAt(I+1),T&&E!==n&&E!==o&&E!==i&&E!==a&&E!==l&&E!==s&&(I+=1,k.test(D.charAt(I)))){for(;k.test(D.charAt(I+1));)I+=1;D.charCodeAt(I+1)===o&&(I+=1)}N=["word",D.slice(U,I+1),U,I],U=I;break;default:E===n&&D.charCodeAt(U+1)===v?(I=D.indexOf("*/",U+2)+1,0===I&&(L||C?I=D.length:q("comment")),N=["comment",D.slice(U,I+1),U,I],U=I):(w.lastIndex=U+1,w.test(D),I=0===w.lastIndex?D.length-1:w.lastIndex-2,N=["word",D.slice(U,I+1),U,I],j.push(N),U=I)}return U++,N},position:function(){return U}}}}(),r=cm(),n=vm(),i=mm(),o=bm();const s={empty:!0,space:!0};return Bv=class{constructor(e){this.input=e,this.root=new i,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,r,i,o=new n;o.name=e[1].slice(1),""===o.name&&this.unnamedAtrule(o,e),this.init(o,e[2]);let s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?u.push("("===t?")":"]"):"{"===t&&u.length>0?u.push("}"):t===u[u.length-1]&&u.pop(),0===u.length){if(";"===t){o.source.end=this.getPosition(e[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===t){a=!0;break}if("}"===t){if(l.length>0){for(i=l.length-1,r=l[i];r&&"space"===r[0];)r=l[--i];r&&(o.source.end=this.getPosition(r[3]||r[2]),o.source.end.offset++)}this.end(e);break}l.push(e)}else l.push(e);if(this.tokenizer.endOfFile()){s=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(o.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(o,"params",l),s&&(e=l[l.length-1],o.source.end=this.getPosition(e[3]||e[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),a&&(o.nodes=[],this.current=o)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let r,n=0;for(let i=t-1;i>=0&&(r=e[i],"space"===r[0]||(n+=1,2!==n));i--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}colon(e){let t,r,n,i=0;for(let[o,s]of e.entries()){if(t=s,r=t[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return o}this.doubleColon(t)}n=t}return!1}comment(e){let t=new r;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=t(this.input)}decl(t,r){let n=new e;this.init(n,t[0][2]);let i,o=t[t.length-1];for(";"===o[0]&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}(t)),n.source.end.offset++;"word"!==t[0][0];)1===t.length&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let e=t[0][0];if(":"===e||"space"===e||"comment"===e)break;n.prop+=t.shift()[1]}for(n.raws.between="";t.length;){if(i=t.shift(),":"===i[0]){n.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s,a=[];for(;t.length&&(s=t[0][0],"space"===s||"comment"===s);)a.push(t.shift());this.precheckMissedSemicolon(t);for(let e=t.length-1;e>=0;e--){if(i=t[e],"!important"===i[1].toLowerCase()){n.important=!0;let r=this.stringFrom(t,e);r=this.spacesFromEnd(t)+r," !important"!==r&&(n.raws.important=r);break}if("important"===i[1].toLowerCase()){let r=t.slice(0),i="";for(let t=e;t>0;t--){let e=r[t][0];if(0===i.trim().indexOf("!")&&"space"!==e)break;i=r.pop()[1]+i}0===i.trim().indexOf("!")&&(n.important=!0,n.raws.important=i,t=r)}if("space"!==i[0]&&"comment"!==i[0])break}t.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(n.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(n,"value",a.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new o;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,r=null,n=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(r=l[0],a.push(l),"("===r||"["===r)i||(i=l),o.push("("===r?")":"]");else if(s&&n&&"{"===r)i||(i=l),o.push("}");else if(0===o.length){if(";"===r){if(n)return void this.decl(a,s);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),t&&n){if(!s)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,n){let i,o,a,l,u=r.length,c="",d=!0;for(let e=0;e<u;e+=1)i=r[e],o=i[0],"space"!==o||e!==u-1||n?"comment"===o?(l=r[e-1]?r[e-1][0]:"empty",a=r[e+1]?r[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let n=r.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:n,value:c}}e[t]=c}rule(e){e.pop();let t=new o;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},Bv}function Sm(){if(Wv)return zv;Wv=1;let e=dm(),t=wm(),r=lm();function n(e,n){let i=new r(e,n),o=new t(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&n&&n.from&&(/\.scss$/i.test(n.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(n.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(n.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return o.root}return zv=n,n.default=n,e.registerParse(n),zv}function km(){if($v)return Vv;$v=1;let{isClean:e,my:t}=tm(),r=um(),n=nm(),i=dm(),o=hm(),s=pm(),a=gm(),l=Sm(),u=mm();const c={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},d={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},h={Once:!0,postcssPlugin:!0,prepare:!0};function p(e){return"object"==typeof e&&"function"==typeof e.then}function f(e){let t=!1,r=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function g(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:f(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function v(t){return t[e]=!1,t.nodes&&t.nodes.forEach(e=>v(e)),t}let m={};class y{constructor(e,r,n){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof r||null===r||"root"!==r.type&&"document"!==r.type)if(r instanceof y||r instanceof a)o=v(r.root),r.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let e=l;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{o=e(r,n)}catch(e){this.processed=!0,this.error=e}o&&!o[t]&&i.rebuild(o)}else o=v(r);this.result=new a(e,o,n),this.helpers={...m,postcss:m,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(r.postcssVersion&&"production"!==process.env.NODE_ENV){let e=r.postcssPlugin,t=r.postcssVersion,n=this.result.processor.version,i=t.split("."),o=n.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+n+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=r.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,r)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,r])};for(let t of this.plugins)if("object"==typeof t)for(let r in t){if(!d[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[r])if("object"==typeof t[r])for(let n in t[r])e(t,"*"===n?r:r+"-"+n.toLowerCase(),t[r][n]);else"function"==typeof t[r]&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(p(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];){t[e]=!0;let r=[g(t)];for(;r.length>0;){let e=this.visitTick(r);if(p(e))try{await e}catch(e){let t=r[r.length-1].node;throw this.handleError(e,t)}}}if(this.listeners.OnceExit)for(let[e,r]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map(e=>r(e,this.helpers));await Promise.all(e)}else await r(t,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return p(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=n;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new r(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(p(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];)t[e]=!0,this.walkSync(t);if(this.listeners.OnceExit)if("document"===t.type)for(let e of t.nodes)this.visitSync(this.listeners.OnceExit,e);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||s("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,n]of e){let e;this.result.lastPlugin=r;try{e=n(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(p(e))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void t.pop();if(i.length>0&&r.visitorIndex<i.length){let[e,t]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=e;try{return t(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==r.iterator){let i,o=r.iterator;for(;i=n.nodes[n.indexes[o]];)if(n.indexes[o]+=1,!i[e])return i[e]=!0,void t.push(g(i));r.iterator=0,delete n.indexes[o]}let o=r.events;for(;r.eventIndex<o.length;){let t=o[r.eventIndex];if(r.eventIndex+=1,0===t)return void(n.nodes&&n.nodes.length&&(n[e]=!0,r.iterator=n.getIterator()));if(this.listeners[t])return void(r.visitors=this.listeners[t])}t.pop()}walkSync(t){t[e]=!0;let r=f(t);for(let n of r)if(0===n)t.nodes&&t.each(t=>{t[e]||this.walkSync(t)});else{let e=this.listeners[n];if(e&&this.visitSync(e,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return y.registerPostcss=e=>{m=e},Vv=y,y.default=y,u.registerLazyResult(y),o.registerLazyResult(y),Vv}function xm(){if(Jv)return Gv;Jv=1;let e=function(){if(Kv)return Hv;Kv=1;let e=um(),t=nm(),r=pm(),n=Sm();const i=gm();class o{constructor(r,n,o){let s;n=n.toString(),this.stringified=!1,this._processor=r,this._css=n,this._opts=o,this._map=void 0;let a=t;this.result=new i(this._processor,s,this._opts),this.result.css=n;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,n);if(u.isMap()){let[e,t]=u.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else u.clearAnnotation(),this.result.css=u.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||r("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=n;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}}return Hv=o,o.default=o,Hv}(),t=km(),r=hm(),n=mm();class i{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(!0===r.postcss?r=r():r.postcss&&(r=r.postcss),"object"==typeof r&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if("object"==typeof r&&r.postcssPlugin)t.push(r);else if("function"==typeof r)t.push(r);else{if("object"!=typeof r||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(r,n={}){return this.plugins.length||n.parser||n.stringifier||n.syntax?new t(this,r,n):new e(this,r,n)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return Gv=i,i.default=i,n.registerProcessor(i),r.registerProcessor(i),Gv}const Cm=Hg(function(){if(Zv)return Qv;Zv=1;let e=ev(),t=om(),r=km(),n=dm(),i=xm(),o=nm(),s=function(){if(Yv)return Xv;Yv=1;let e=om(),t=am(),r=cm(),n=vm(),i=lm(),o=mm(),s=bm();function a(l,u){if(Array.isArray(l))return l.map(e=>a(e));let{inputs:c,...d}=l;if(c){u=[];for(let e of c){let r={...e,__proto__:i.prototype};r.map&&(r.map={...r.map,__proto__:t.prototype}),u.push(r)}}if(d.nodes&&(d.nodes=l.nodes.map(e=>a(e,u))),d.source){let{inputId:e,...t}=d.source;d.source=t,null!=e&&(d.source.input=u[e])}if("root"===d.type)return new o(d);if("decl"===d.type)return new e(d);if("rule"===d.type)return new s(d);if("comment"===d.type)return new r(d);if("atrule"===d.type)return new n(d);throw new Error("Unknown node type: "+l.type)}return Xv=a,a.default=a,Xv}(),a=hm(),l=fm(),u=cm(),c=vm(),d=gm(),h=lm(),p=Sm(),f=ym(),g=bm(),v=mm(),m=im();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new i(e)}return y.plugin=function(e,t){let r,n=!1;function o(...r){console&&console.warn&&!n&&(n=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226"));let o=t(...r);return o.postcssPlugin=e,o.postcssVersion=(new i).version,o}return Object.defineProperty(o,"postcss",{get:()=>(r||(r=o()),r)}),o.process=function(e,t,r){return y([o(r)]).process(e,t)},o},y.stringify=o,y.parse=p,y.fromJSON=s,y.list=f,y.comment=e=>new u(e),y.atRule=e=>new c(e),y.decl=e=>new t(e),y.rule=e=>new g(e),y.root=e=>new v(e),y.document=e=>new a(e),y.CssSyntaxError=e,y.Declaration=t,y.Container=n,y.Processor=i,y.Document=a,y.Comment=u,y.Warning=l,y.AtRule=c,y.Result=d,y.Input=h,y.Rule=g,y.Root=v,y.Node=m,r.registerPostcss(y),Qv=y,y.default=y,Qv}());Cm.stringify,Cm.fromJSON,Cm.plugin,Cm.parse,Cm.list,Cm.document,Cm.comment,Cm.atRule,Cm.rule,Cm.decl,Cm.root,Cm.CssSyntaxError,Cm.Declaration,Cm.Container,Cm.Processor,Cm.Document,Cm.Comment,Cm.Warning,Cm.AtRule,Cm.Result,Cm.Input,Cm.Rule,Cm.Root,Cm.Node;class Em{constructor(...e){$g(this,"parentElement",null),$g(this,"parentNode",null),$g(this,"ownerDocument"),$g(this,"firstChild",null),$g(this,"lastChild",null),$g(this,"previousSibling",null),$g(this,"nextSibling",null),$g(this,"ELEMENT_NODE",1),$g(this,"TEXT_NODE",3),$g(this,"nodeType"),$g(this,"nodeName"),$g(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof Em))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}const Im={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Om={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Pm={};function Tm(e){if(Pm[e])return Pm[e];const t=function(e){var t,r;const n=null==(r=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:r.call(t,e);return n&&globalThis[n]?globalThis[n]:void 0}(e)||globalThis[e],r=t.prototype,n=e in Im?Im[e]:void 0,i=Boolean(n&&n.every(e=>{var t,n;return Boolean(null==(n=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),o=e in Om?Om[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return Pm[e]=t.prototype,t.prototype;try{const n=document.createElement("iframe");document.body.appendChild(n);const i=n.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(n),o?Pm[e]=o:r}catch{return r}}const Rm={};function Mm(e,t,r){var n;const i=`${e}.${String(r)}`;if(Rm[i])return Rm[i].call(t);const o=Tm(e),s=null==(n=Object.getOwnPropertyDescriptor(o,r))?void 0:n.get;return s?(Rm[i]=s,s.call(t)):t[r]}const Am={};function _m(e,t,r){const n=`${e}.${String(r)}`;if(Am[n])return Am[n].bind(t);const i=Tm(e)[r];return"function"!=typeof i?t[r]:(Am[n]=i,i.bind(t))}const Nm={childNodes:function(e){return Mm("Node",e,"childNodes")},parentNode:function(e){return Mm("Node",e,"parentNode")},parentElement:function(e){return Mm("Node",e,"parentElement")},textContent:function(e){return Mm("Node",e,"textContent")},contains:function(e,t){return _m("Node",e,"contains")(t)},getRootNode:function(e){return _m("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Mm("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Mm("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Mm("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Mm("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return Tm("MutationObserver").constructor}};const Dm="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.";let Lm={map:{},getId:()=>(console.error(Dm),-1),getNode:()=>(console.error(Dm),null),removeNodeFromMap(){console.error(Dm)},has:()=>(console.error(Dm),!1),reset(){console.error(Dm)}};"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Lm=new Proxy(Lm,{get:(e,t,r)=>("map"===t&&console.error(Dm),Reflect.get(e,t,r))}));let Fm=Date.now;function Um(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:Nm.parentElement(e)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Fm=()=>(new Date).getTime());function jm(e){var t;let r=null;return"getRootNode"in e&&(null==(t=Nm.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Nm.host(Nm.getRootNode(e))&&(r=Nm.host(Nm.getRootNode(e))),r}function Bm(e){let t,r=e;for(;t=jm(r);)r=t;return r}function qm(e){const t=e.ownerDocument;if(!t)return!1;const r=Bm(e);return Nm.contains(t,r)}const zm=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:class{constructor(){Xp(this,"id",1),Xp(this,"styleIDMap",new WeakMap),Xp(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}},get _mirror(){return Lm},closestElementOfNode:Um,getBaseDimension:function e(t,r){var n,i;const o=null==(i=null==(n=t.ownerDocument)?void 0:n.defaultView)?void 0:i.frameElement;if(!o||o===r)return{x:0,y:0,relativeScale:1,absoluteScale:1};const s=o.getBoundingClientRect(),a=e(o,r),l=s.height/o.clientHeight;return{x:s.x*a.relativeScale+a.x,y:s.y*a.relativeScale+a.y,relativeScale:l,absoluteScale:a.absoluteScale*l}},getNestedRule:function e(t,r){const n=t[r[0]];return 1===r.length?n:e(n.cssRules[r[1]].cssRules,r.slice(2))},getPositionsAndIndex:function(e){const t=[...e],r=t.pop();return{positions:t,index:r}},getRootShadowHost:Bm,getShadowHost:jm,getWindowHeight:function(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight},getWindowScroll:function(e){var t,r,n,i;const o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:o.documentElement.scrollLeft||(null==o?void 0:o.body)&&(null==(t=Nm.parentElement(o.body))?void 0:t.scrollLeft)||(null==(r=null==o?void 0:o.body)?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==o?void 0:o.documentElement.scrollTop)||(null==o?void 0:o.body)&&(null==(n=Nm.parentElement(o.body))?void 0:n.scrollTop)||(null==(i=null==o?void 0:o.body)?void 0:i.scrollTop)||0}},getWindowWidth:function(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth},hasShadowRoot:function(e){return!!e&&(e instanceof Em&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Nm.shadowRoot(e)))},hookSetter:function e(t,r,n,i,o=window){const s=o.Object.getOwnPropertyDescriptor(t,r);return o.Object.defineProperty(t,r,i?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),s&&s.set&&s.set.call(this,e)}}),()=>e(t,r,s||{},!0)},inDom:function(e){const t=e.ownerDocument;return!!t&&(Nm.contains(t,e)||qm(e))},isAncestorRemoved:function e(t,r){if(function(e){const t=e&&"host"in e&&"mode"in e&&lf.host(e)||null;return Boolean(t&&"shadowRoot"in t&&lf.shadowRoot(t)===e)}(t))return!1;const n=r.getId(t);if(!r.has(n))return!0;const i=Nm.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||e(i,r))},isBlocked:function(e,t,r,n){if(!e)return!1;const i=Um(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(n&&null!==i.closest("."+t))return!0}else if(cf(i,t,n))return!0}catch(e){}if(r){if(i.matches(r))return!0;if(n&&null!==i.closest(r))return!0}return!1},isIgnored:function(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||-2===t.getId(e)},isSerialized:function(e,t){return-1!==t.getId(e)},isSerializedIframe:function(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))},isSerializedStylesheet:function(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))},iterateResolveTree:function e(t,r){r(t.value);for(let n=t.children.length-1;n>=0;n--)e(t.children[n],r)},legacy_isTouchEvent:function(e){return Boolean(e.changedTouches)},get nowTimestamp(){return Fm},on:function(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)},patch:function(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],i=r(n);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}},polyfill: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)},queueToResolveTrees:function(e){const t={},r=(e,r)=>{const n={value:e,parent:r,children:[]};return t[e.node.id]=n,n},n=[];for(const i of e){const{nextId:e,parentId:o}=i;if(e&&e in t){const o=t[e];if(o.parent){const e=o.parent.children.indexOf(o);o.parent.children.splice(e,0,r(i,o.parent))}else{const e=n.indexOf(o);n.splice(e,0,r(i,null))}continue}if(o in t){const e=t[o];e.children.push(r(i,e));continue}n.push(r(i,null))}return n},shadowHostInDom:qm,throttle:function(e,t,r={}){let n=null,i=0;return function(...o){const s=Date.now();i||!1!==r.leading||(i=s);const a=t-(s-i),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),i=s,e.apply(l,o)):n||!1===r.trailing||(n=setTimeout(()=>{i=!1===r.leading?0:Date.now(),n=null,e.apply(l,o)},a))}},uniqueTextMutations:function(e){const t=new Set,r=[];for(let n=e.length;n--;){const i=e[n];t.has(i.id)||(r.push(i),t.add(i.id))}return r}},Symbol.toStringTag,{value:"Module"}));for(var Wm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vm="undefined"==typeof Uint8Array?[]:new Uint8Array(256),$m=0;$m<64;$m++)Vm[Wm.charCodeAt($m)]=$m;"undefined"!=typeof self&&self.Blob&&new Blob(['(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext("2d");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map\n'],{type:"text/javascript;charset=utf-8"});try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(Bp=e.contentWindow)?void 0:Bp.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var Hm,Km;new uf,(Km=Hm||(Hm={}))[Km.NotStarted=0]="NotStarted",Km[Km.Running=1]="Running",Km[Km.Stopped=2]="Stopped";class Gm{constructor(e){Gp(this,"fileName"),Gp(this,"functionName"),Gp(this,"lineNumber"),Gp(this,"columnNumber"),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}}const Jm=/(^|@)\S+:\d+/,Xm=/^\s*at .*(\S+:\d+|\(native\))/m,Ym=/^(eval@)?(\[native code])?$/,Qm={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Xm)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(Xm)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const r=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=r?t.replace(r[0],""):t;const n=t.split(/\s+/).slice(1),i=this.extractLocation(r?r[1]:n.pop()),o=n.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new Gm({functionName:o,fileName:s,lineNumber:i[1],columnNumber:i[2]})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(Ym)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new Gm({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),n=r&&r[1]?r[1]:void 0,i=this.extractLocation(e.replace(t,""));return new Gm({functionName:n,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})}},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),n=[];for(let e=2,i=r.length;e<i;e+=2){const i=t.exec(r[e]);i&&n.push(new Gm({fileName:i[2],lineNumber:parseFloat(i[1])}))}return n},parseOpera10:function(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),n=[];for(let e=0,i=r.length;e<i;e+=2){const i=t.exec(r[e]);i&&n.push(new Gm({functionName:i[3]||void 0,fileName:i[2],lineNumber:parseFloat(i[1])}))}return n},parseOpera11:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(Jm)&&!e.match(/^Error created at/)},this).map(function(e){const t=e.split("@"),r=this.extractLocation(t.pop()),n=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Gm({functionName:n,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})},this)}};function Zm(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let r=e.localName;if(!r)break;r=r.toLowerCase();const n=e.parentElement,i=[];if(n.children&&n.children.length>0)for(let e=0;e<n.children.length;e++){const t=n.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===r&&i.push(t)}i.length>1&&(r+=`:eq(${i.indexOf(e)})`),t=r+(t?">"+t:""),e=n}return t}function ey(e){return"[object Object]"===Object.prototype.toString.call(e)}function ty(e,t){if(0===t)return!0;const r=Object.keys(e);for(const n of r)if(ey(e[n])&&ty(e[n],t-1))return!0;return!1}function ry(e,t){const r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);const n=[],i=[];return JSON.stringify(e,function(e,t){if(n.length>0){const r=n.indexOf(this);~r?n.splice(r+1):n.push(this),~r?i.splice(r,1/0,e):i.push(e),~n.indexOf(t)&&(t=n[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,n.indexOf(t)).join(".")+"]")}else n.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(function(e){if(ey(e)&&Object.keys(e).length>r.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(ey(e)&&ty(e,r.depthOfLimit))return!0;return!1}(t))return function(e){let t=e.toString();r.stringLengthLimit&&t.length>r.stringLengthLimit&&(t=`${t.slice(0,r.stringLengthLimit)}...`);return t}(t);if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const r in t){const n=t[r];Array.isArray(n)?e[r]=Zm(n.length?n[0]:null):e[r]=n}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}const ny={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function iy(e,t,r){const n=r?Object.assign({},ny,r):ny,i=n.logger;if(!i)return()=>{};let o;o="string"==typeof i?t[i]:i;let s=0,a=!1;const l=[];if(n.level.includes("error")){const r=t=>{const r=t.message,i=t.error,o=Qm.parse(i).map(e=>e.toString()),s=[ry(r,n.stringifyOptions)];e({level:"error",trace:o,payload:s})};t.addEventListener("error",r),l.push(()=>{t.removeEventListener("error",r)});const i=t=>{let r,i;t.reason instanceof Error?(r=t.reason,i=[ry(`Uncaught (in promise) ${r.name}: ${r.message}`,n.stringifyOptions)]):(r=new Error,i=[ry("Uncaught (in promise)",n.stringifyOptions),ry(t.reason,n.stringifyOptions)]);const o=Qm.parse(r).map(e=>e.toString());e({level:"error",trace:o,payload:i})};t.addEventListener("unhandledrejection",i),l.push(()=>{t.removeEventListener("unhandledrejection",i)})}for(const e of n.level)l.push(u(o,e));return()=>{l.forEach(e=>e())};function u(t,r){return t[r]?zm.patch(t,r,t=>(...i)=>{if(t.apply(this,i),!("assert"===r&&i[0]||a)){a=!0;try{const t=Qm.parse(new Error).map(e=>e.toString()).splice(1),o=("assert"===r?i.slice(1):i).map(e=>ry(e,n.stringifyOptions));s++,s<n.lengthThreshold?e({level:r,trace:t,payload:o}):s===n.lengthThreshold&&e({level:"warn",trace:[],payload:[ry("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...i)}finally{a=!1}}}):()=>{}}}const oy="rrweb/console@1";var sy,ay=Object.freeze({__proto__:null,PLUGIN_NAME:oy,getRecordConsolePlugin:e=>({name:oy,observer:iy,options:e})}),ly=Object.defineProperty,uy=(e,t,r)=>((e,t,r)=>t in e?ly(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),cy=Object.defineProperty,dy=(e,t,r)=>((e,t,r)=>t in e?cy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),hy=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(hy||{});const py={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},fy={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},gy={};function vy(e){if(gy[e])return gy[e];const t=function(e){var t,r;const n=null==(r=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:r.call(t,e);return n&&globalThis[n]?globalThis[n]:void 0}(e)||globalThis[e],r=t.prototype,n=e in py?py[e]:void 0,i=Boolean(n&&n.every(e=>{var t,n;return Boolean(null==(n=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),o=e in fy?fy[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return gy[e]=t.prototype,t.prototype;try{const n=document.createElement("iframe");document.body.appendChild(n);const i=n.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(n),o?gy[e]=o:r}catch{return r}}const my={};function yy(e,t,r){var n;const i=`${e}.${String(r)}`;if(my[i])return my[i].call(t);const o=vy(e),s=null==(n=Object.getOwnPropertyDescriptor(o,r))?void 0:n.get;return s?(my[i]=s,s.call(t)):t[r]}const by={};function wy(e,t,r){const n=`${e}.${String(r)}`;if(by[n])return by[n].bind(t);const i=vy(e)[r];return"function"!=typeof i?t[r]:(by[n]=i,i.bind(t))}const Sy={childNodes:function(e){return yy("Node",e,"childNodes")},parentNode:function(e){return yy("Node",e,"parentNode")},parentElement:function(e){return yy("Node",e,"parentElement")},textContent:function(e){return yy("Node",e,"textContent")},contains:function(e,t){return wy("Node",e,"contains")(t)},getRootNode:function(e){return wy("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?yy("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?yy("Element",e,"shadowRoot"):null},querySelector:function(e,t){return yy("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return yy("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return vy("MutationObserver").constructor}};function ky(e){return e.nodeType===e.ELEMENT_NODE}function xy(e){const t=e&&"host"in e&&"mode"in e&&Sy.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Sy.shadowRoot(t)===e)}function Cy(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function Ey(e){try{const r=e.rules||e.cssRules;if(!r)return null;let n=e.href;!n&&e.ownerNode&&e.ownerNode.ownerDocument&&(n=e.ownerNode.ownerDocument.location.href);const i=Array.from(r,e=>Iy(e,n)).join("");return(t=i).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}catch(e){return null}var t}function Iy(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=Ey(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const r=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}(e)}catch(r){t=e.cssText}return e.styleSheet.href?Fy(t,e.styleSheet.href):t}{let r=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(r=function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(r)),t?Fy(r,t):r}}class Oy{constructor(){dy(this,"idNodeMap",new Map),dy(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;return(null==(t=this.getMeta(e))?void 0:t.id)??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const e=this.nodeMetaMap.get(r);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Py({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:o}){let s=i||"";const a=n&&Ty(n);return(t[r.toLowerCase()]||a&&t[a])&&(s=o?o(s,e):"*".repeat(s.length)),s}function Ty(e){return e.toLowerCase()}const Ry="__rrweb_original__";function My(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Ty(t):null}function Ay(e,t){let r;try{r=new URL(e,t??window.location.href)}catch(e){return null}const n=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(null==n?void 0:n[1])??null}const _y=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Ny=/^(?:[a-z+]+:)?\/\//i,Dy=/^www\..*/i,Ly=/^(data:)([^,]*),(.*)/i;function Fy(e,t){return(e||"").replace(_y,(e,r,n,i,o,s)=>{const a=n||o||s,l=r||i||"";if(!a)return e;if(Ny.test(a)||Dy.test(a))return`url(${l}${a}${l})`;if(Ly.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${l})`;const u=t.split("/"),c=a.split("/");u.pop();for(const e of c)"."!==e&&(".."===e?u.pop():u.push(e));return`url(${l}${u.join("/")}${l})`})}function Uy(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function jy(e,t){return function(e,t,r=!1){const n=Array.from(t.childNodes),i=[];let o=0;if(n.length>1&&e&&"string"==typeof e){let t=Uy(e,r);const s=t.length/e.length;for(let a=1;a<n.length;a++)if(n[a].textContent&&"string"==typeof n[a].textContent){const l=Uy(n[a].textContent,r),u=100;let c=3;for(;c<l.length&&(l[c].match(/[a-zA-Z0-9]/)||-1!==l.indexOf(l.substring(0,c),1));c++);for(;c<l.length;c++){let d=l.substring(0,c),h=t.split(d),p=-1;if(2===h.length)p=h[0].length;else if(h.length>2&&""===h[0]&&""!==n[a-1].textContent)p=t.indexOf(d,1);else if(1===h.length){if(d=d.substring(0,d.length-1),h=t.split(d),h.length<=1)return i.push(e),i;c=u+1}else c===l.length-1&&(p=t.indexOf(d));if(h.length>=2&&c>u){const e=n[a-1].textContent;if(e&&"string"==typeof e){const r=Uy(e).length;p=t.indexOf(d,r)}-1===p&&(p=h[0].length)}if(-1!==p){let a=Math.floor(p/s);for(;a>0&&a<e.length;){if(o+=1,o>50*n.length)return i.push(e),i;const l=Uy(e.substring(0,a),r);if(l.length===p){i.push(e.substring(0,a)),e=e.substring(a),t=t.substring(p);break}l.length<p?a+=Math.max(1,Math.floor((p-l.length)/s)):a-=Math.max(1,Math.floor((l.length-p)*s))}break}}}}return i.push(e),i}(e,t).join("/* rr_split */")}const By="lightgrey";let qy=1;const zy=new RegExp("[^a-z0-9-_:]");function Wy(){return qy++}let Vy,$y;const Hy=/^[^ \t\n\r\u000c]+/,Ky=/^[, \t\n\r\u000c]+/;const Gy=new WeakMap;function Jy(e,t){return t&&""!==t.trim()?Yy(e,t):t}function Xy(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function Yy(e,t){let r=Gy.get(e);if(r||(r=e.createElement("a"),Gy.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function Qy(e,t,r,n){return n?"src"===r||"href"===r&&("use"!==t||"#"!==n[0])||"xlink:href"===r&&"#"!==n[0]?Jy(e,n):"background"!==r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r?function(e,t){if(""===t.trim())return t;let r=0;function n(e){let n;const i=e.exec(t.substring(r));return i?(n=i[0],r+=n.length,n):""}const i=[];for(;n(Ky),!(r>=t.length);){let o=n(Hy);if(","===o.slice(-1))o=Jy(e,o.substring(0,o.length-1)),i.push(o);else{let n="";o=Jy(e,o);let s=!1;for(;;){const e=t.charAt(r);if(""===e){i.push((o+n).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){r+=1,i.push((o+n).trim());break}"("===e&&(s=!0)}n+=e,r+=1}}}return i.join(", ")}(e,n):"style"===r?Fy(n,Yy(e)):"object"===t&&"data"===r?Jy(e,n):n:Jy(e,n):n}function Zy(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function eb(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&eb(Sy.parentNode(e),t,r);for(let r=e.classList.length;r--;){const n=e.classList[r];if(t.test(n))return!0}return!!r&&eb(Sy.parentNode(e),t,r)}function tb(e,t,r,n){let i;if(ky(e)){if(i=e,!Sy.childNodes(i).length)return!1}else{if(null===Sy.parentElement(e))return!1;i=Sy.parentElement(e)}try{if("string"==typeof t){if(n){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(eb(i,t,n))return!0;if(r)if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}catch(e){}return!1}function rb(e,t){const{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,maskAttributeFn:d,dataURLOptions:h={},inlineImages:p,recordCanvas:f,keepIframeSrcFn:g,newlyAddedElement:v=!1,cssCaptured:m=!1,applyBackgroundColorToBlockedElements:y=!1}=t,b=function(e,t){if(!t.hasNode(e))return;const r=t.getId(e);return 1===r?void 0:r}(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:hy.Document,childNodes:[],compatMode:e.compatMode}:{type:hy.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:hy.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return function(e,t){const{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:a,maskAttributeFn:l,dataURLOptions:u={},inlineImages:c,recordCanvas:d,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:f,applyBackgroundColorToBlockedElements:g=!1}=t,v=function(e,t,r){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let r=e.classList.length;r--;){const n=e.classList[r];if(t.test(n))return!0}if(r)return e.matches(r)}catch(e){}return!1}(e,n,i),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=Ty(e.tagName);return zy.test(t)?"div":t}(e);let y={};const b=e.attributes.length;for(let t=0;t<b;t++){const n=e.attributes[t];if(!Zy(m,n.name,n.value)){const t=Qy(r,m,Ty(n.name),n.value);if(l&&null!==t){const r=l(n.name,t,e);null!==r&&(y[n.name]=r)}else y[n.name]=t}}if("link"===m&&o){const t=Array.from(r.styleSheets).find(t=>t.href===e.href);let n=null;t&&(n=Ey(t)),n&&(delete y.rel,delete y.href,y._cssText=n)}if("style"===m&&e.sheet){let t=Ey(e.sheet);t&&(e.childNodes.length>1&&(t=jy(t,e)),y._cssText=t)}if("input"===m||"textarea"===m||"select"===m){const t=e.value,r=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=Py({element:e,type:My(e),tagName:m,value:t,maskInputOptions:s,maskInputFn:a}):r&&(y.checked=r)}"option"===m&&(e.selected&&!s.select?y.selected=!0:delete y.selected);"dialog"===m&&e.open&&(y.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal");if("canvas"===m&&d)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let r=0;r<e.width;r+=50)for(let n=0;n<e.height;n+=50){const i=t.getImageData,o=Ry in i?i[Ry]:i;if(new Uint32Array(o.call(t,r,n,Math.min(50,e.width-r),Math.min(50,e.height-n)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(y.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const t=e.toDataURL(u.type,u.quality),n=r.createElement("canvas");n.width=e.width,n.height=e.height;t!==n.toDataURL(u.type,u.quality)&&(y.rr_dataURL=t)}if("img"===m&&c){Vy||(Vy=r.createElement("canvas"),$y=Vy.getContext("2d"));const t=e,n=t.currentSrc||t.getAttribute("src")||"<unknown-src>",i=t.crossOrigin,o=()=>{t.removeEventListener("load",o);try{Vy.width=t.naturalWidth,Vy.height=t.naturalHeight,$y.drawImage(t,0,0),y.rr_dataURL=Vy.toDataURL(u.type,u.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(i?y.crossOrigin=i:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if("audio"===m||"video"===m){const t=y;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}p||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(v){const{width:t,height:r}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${r}px`,...g?{rr_background_color:By}:{}}}"iframe"!==m||h(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);let w;try{customElements.get(m)&&(w=!0)}catch(e){}return{type:hy.Element,tagName:m,attributes:y,childNodes:[],isSVG:Xy(e)||void 0,needBlock:v,rootId:f,isCustom:w}}(e,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,maskAttributeFn:d,dataURLOptions:h,inlineImages:p,recordCanvas:f,keepIframeSrcFn:g,newlyAddedElement:v,rootId:b,applyBackgroundColorToBlockedElements:y});case e.TEXT_NODE:return function(e,t){const{needsMask:r,maskTextFn:n,rootId:i,cssCaptured:o}=t,s=Sy.parentNode(e),a=s&&s.tagName;let l="";const u="STYLE"===a||void 0,c="SCRIPT"===a||void 0;c?l="SCRIPT_PLACEHOLDER":o||(l=Sy.textContent(e),u&&l&&(l=Fy(l,Yy(t.doc))));!u&&!c&&l&&r&&(l=n?n(l,Sy.parentElement(e)):l.replace(/[\S]/g,"*"));return{type:hy.Text,textContent:l||"",rootId:i}}(e,{doc:r,needsMask:s,maskTextFn:u,rootId:b,cssCaptured:m});case e.CDATA_SECTION_NODE:return{type:hy.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:hy.Comment,textContent:Sy.textContent(e)||"",rootId:b};default:return!1}}function nb(e){return null==e?"":e.toLowerCase()}function ib(e,t,r){return Array.from(e).map(e=>{const n=t(e);let i=[];if(!r.has(n)){r.add(n);try{i=Array.from(e.cssRules,(t,r)=>({rule:Iy(t,e.href),index:r}))}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}return{styleId:n,rules:i}})}function ob(e,t){var r,n;const{doc:i,mirror:o,blockClass:s,blockSelector:a,maskTextClass:l,maskTextSelector:u,skipChild:c=!1,inlineStylesheet:d=!0,maskInputOptions:h={},maskTextFn:p,maskInputFn:f,maskAttributeFn:g,slimDOMOptions:v,dataURLOptions:m={},inlineImages:y=!1,recordCanvas:b=!1,onSerialize:w,onAdoptedStyleSheet:S,onIframeLoad:k,iframeLoadTimeout:x=5e3,onStylesheetLoad:C,stylesheetLoadTimeout:E=5e3,keepIframeSrcFn:I=()=>!1,newlyAddedElement:O=!1,cssCaptured:P=!1,applyBackgroundColorToBlockedElements:T=!1}=t,R=t._emittedStyleIds??new Set;let{needsMask:M}=t,{preserveWhiteSpace:A=!0}=t;if(!M){M=tb(e,l,u,void 0===M)}const _=rb(e,{doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:M,inlineStylesheet:d,maskInputOptions:h,maskTextFn:p,maskInputFn:f,maskAttributeFn:g,dataURLOptions:m,inlineImages:y,recordCanvas:b,keepIframeSrcFn:I,newlyAddedElement:O,cssCaptured:P,applyBackgroundColorToBlockedElements:T});if(!_)return console.warn(e,"not serialized"),null;let N;N=o.hasNode(e)?o.getId(e):function(e,t){if(t.comment&&e.type===hy.Comment)return!0;if(e.type===hy.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&&"js"===Ay(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(nb(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===nb(e.attributes.name)||"icon"===nb(e.attributes.rel)||"apple-touch-icon"===nb(e.attributes.rel)||"shortcut icon"===nb(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&nb(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(nb(e.attributes.property).match(/^(og|twitter|fb):/)||nb(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===nb(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===nb(e.attributes.name)||"googlebot"===nb(e.attributes.name)||"bingbot"===nb(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===nb(e.attributes.name)||"generator"===nb(e.attributes.name)||"framework"===nb(e.attributes.name)||"publisher"===nb(e.attributes.name)||"progid"===nb(e.attributes.name)||nb(e.attributes.property).match(/^article:/)||nb(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===nb(e.attributes.name)||"yandex-verification"===nb(e.attributes.name)||"csrf-token"===nb(e.attributes.name)||"p:domain_verify"===nb(e.attributes.name)||"verify-v1"===nb(e.attributes.name)||"verification"===nb(e.attributes.name)||"shopify-checkout-api-token"===nb(e.attributes.name)))return!0}}return!1}(_,v)||!A&&_.type===hy.Text&&!_.textContent.replace(/^\s+|\s+$/gm,"").length?-2:Wy();const D=Object.assign(_,{id:N});if(o.add(e,D),-2===N)return null;w&&w(e);let L=!c;if(D.type===hy.Element){L=L&&!D.needBlock,delete D.needBlock;const t=Sy.shadowRoot(e);t&&Cy(t)&&(D.isShadowHost=!0,S&&(null==(r=t.adoptedStyleSheets)?void 0:r.length)&&(D.adoptedStyleSheets=ib(t.adoptedStyleSheets,S,R)))}if(D.type===hy.Document&&S){const t=e;(null==(n=t.adoptedStyleSheets)?void 0:n.length)&&(D.adoptedStyleSheets=ib(t.adoptedStyleSheets,S,R))}if((D.type===hy.Document||D.type===hy.Element)&&L){v.headWhitespace&&D.type===hy.Element&&"head"===D.tagName&&(A=!1);const t={doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:M,maskTextClass:l,maskTextSelector:u,skipChild:c,inlineStylesheet:d,maskInputOptions:h,maskTextFn:p,maskInputFn:f,maskAttributeFn:g,slimDOMOptions:v,dataURLOptions:m,inlineImages:y,recordCanvas:b,preserveWhiteSpace:A,onSerialize:w,onAdoptedStyleSheet:S,_emittedStyleIds:R,onIframeLoad:k,iframeLoadTimeout:x,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I,cssCaptured:!1,applyBackgroundColorToBlockedElements:T};if(D.type===hy.Element&&"textarea"===D.tagName&&void 0!==D.attributes.value);else{D.type===hy.Element&&void 0!==D.attributes._cssText&&"string"==typeof D.attributes._cssText&&(t.cssCaptured=!0);for(const r of Array.from(Sy.childNodes(e))){const e=ob(r,t);e&&D.childNodes.push(e)}}let r=null;if(ky(e)&&(r=Sy.shadowRoot(e)))for(const e of Array.from(Sy.childNodes(r))){const n=ob(e,t);n&&(Cy(r)&&(n.isShadow=!0),D.childNodes.push(n))}}const F=Sy.parentNode(e);return F&&xy(F)&&Cy(F)&&(D.isShadow=!0),D.type===hy.Element&&"iframe"===D.tagName&&function(e,t,r){const n=e.contentWindow;if(!n)return;let i,o=!1;try{i=n.document.readyState}catch(e){return}if("complete"!==i){const n=setTimeout(()=>{o||(t(),o=!0)},r);return void e.addEventListener("load",()=>{clearTimeout(n),o=!0,t()})}const s="about:blank";if(n.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,()=>{const t=e.contentDocument;if(t&&k){const r=ob(t,{doc:t,mirror:o,blockClass:s,blockSelector:a,needsMask:M,maskTextClass:l,maskTextSelector:u,skipChild:!1,inlineStylesheet:d,maskInputOptions:h,maskTextFn:p,maskInputFn:f,maskAttributeFn:g,slimDOMOptions:v,dataURLOptions:m,inlineImages:y,recordCanvas:b,preserveWhiteSpace:A,onSerialize:w,onAdoptedStyleSheet:S,onIframeLoad:k,iframeLoadTimeout:x,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I});r&&k(e,r)}},x),D.type===hy.Element&&"link"===D.tagName&&"string"==typeof D.attributes.rel&&("stylesheet"===D.attributes.rel||"preload"===D.attributes.rel&&"string"==typeof D.attributes.href&&"css"===Ay(D.attributes.href))&&function(e,t,r){let n,i=!1;try{n=e.sheet}catch(e){return}if(n)return;const o=setTimeout(()=>{i||(t(),i=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),i=!0,t()})}(e,()=>{if(C){const t=ob(e,{doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:M,maskTextClass:l,maskTextSelector:u,skipChild:!1,inlineStylesheet:d,maskInputOptions:h,maskTextFn:p,maskInputFn:f,maskAttributeFn:g,slimDOMOptions:v,dataURLOptions:m,inlineImages:y,recordCanvas:b,preserveWhiteSpace:A,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:x,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I});t&&C(e,t)}},E),D}function sb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ab(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var lb,ub={exports:{}};function cb(){if(lb)return ub.exports;lb=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return ub.exports=t(),ub.exports.createColors=t,ub.exports}const db=ab(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var hb,pb;function fb(){if(pb)return hb;pb=1;let e=cb(),t=db;class r extends Error{constructor(e,t,n,i,o,s){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),void 0!==t&&void 0!==n&&("number"==typeof t?(this.line=t,this.column=n):(this.line=t.line,this.column=t.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,r)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(r){if(!this.source)return"";let n=this.source;null==r&&(r=e.isColorSupported),t&&r&&(n=t(n));let i,o,s=n.split(/\r?\n/),a=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;if(r){let{bold:t,gray:r,red:n}=e.createColors(!0);i=e=>t(n(e)),o=e=>r(e)}else i=o=e=>e;return s.slice(a,l).map((e,t)=>{let r=a+1+t,n=" "+(" "+r).slice(-u)+" | ";if(r===this.line){let t=o(n.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+o(n)+e+"\n "+t+i("^")}return" "+o(n)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return hb=r,r.default=r,hb}var gb,vb,mb,yb,bb,wb,Sb,kb,xb,Cb,Eb,Ib,Ob,Pb,Tb,Rb,Mb,Ab,_b,Nb,Db,Lb,Fb,Ub,jb,Bb,qb,zb,Wb,Vb,$b,Hb,Kb,Gb,Jb,Xb,Yb,Qb,Zb,ew,tw,rw,nw,iw,ow,sw,aw,lw,uw,cw,dw,hw,pw,fw={};function gw(){return gb||(gb=1,fw.isClean=Symbol("isClean"),fw.my=Symbol("my")),fw}function vw(){if(mb)return vb;mb=1;const e={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};class t{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let i=(e.raws.between||"")+(t?";":"");this.builder(r+n+i,e)}}beforeAfter(e,t){let r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let n=e.parent,i=0;for(;n&&"root"!==n.type;)i+=1,n=n.parent;if(r.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)r+=t}return r}block(e,t){let r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let i=e.nodes[n],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==n||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],void 0!==i))return i;let o=t.parent;if("before"===n){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[n];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[n])return s.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(t,n);{let e="raw"+((a=n)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[r],void 0!==i)return!1})}var a;return void 0===i&&(i=e[n]),s.rawCache[n]=i,i}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return t=r.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){let e=r.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}}return vb=t,t.default=t,vb}function mw(){if(bb)return yb;bb=1;let e=vw();function t(t,r){new e(r).stringify(t)}return yb=t,t.default=t,yb}function yw(){if(Sb)return wb;Sb=1;let{isClean:e,my:t}=gw(),r=fb(),n=vw(),i=mw();function o(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if("proxyCache"===n)continue;let i=e[n],s=typeof i;"parent"===n&&"object"===s?t&&(r[n]=t):"source"===n?r[n]=i:Array.isArray(i)?r[n]=i.map(e=>o(e,r)):("object"===s&&null!==i&&(i=o(i)),r[n]=i)}return r}class s{constructor(r={}){this.raws={},this[e]=!1,this[t]=!0;for(let e in r)if("nodes"===e){this.nodes=[];for(let t of r[e])"function"==typeof t.clone?this.append(t.clone()):this.append(t)}else this[e]=r[e]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=o(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new r(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[e]){this[e]=!1;let t=this;for(;t=t.parent;)t[e]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let n=(t=this.toString()).indexOf(e.word);-1!==n&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===r[t]?(n=1,i+=1):n+=1;return{column:n,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let n=this.toString(),i=n.indexOf(e.word);-1!==i&&(t=this.positionInside(i,n),r=this.positionInside(i+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return(new n).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let r={},n=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let n=this[e];if(Array.isArray(n))r[e]=n.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof n&&n.toJSON)r[e]=n.toJSON(null,t);else if("source"===e){let o=t.get(n.input);null==o&&(o=i,t.set(n.input,i),i++),r[e]={end:n.end,inputId:o,start:n.start}}else r[e]=n}return n&&(r.inputs=[...t.keys()].map(e=>e.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=i){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,r){let n={node:this};for(let e in r)n[e]=r[e];return e.warn(t,n)}get proxyOf(){return this}}return wb=s,s.default=s,wb}function bw(){if(xb)return kb;xb=1;let e=yw();class t extends e{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}}return kb=t,t.default=t,kb}function ww(){if(Eb)return Cb;Eb=1;return Cb={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n}},Cb}function Sw(){if(Ob)return Ib;Ob=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=db,{existsSync:r,readFileSync:n}=db,{dirname:i,join:o}=db;class s{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=i(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new e(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}loadFile(e){if(this.root=i(e),r(e))return this.mapFile=e,n(e,"utf-8").toString().trim()}loadMap(r,n){if(!1===n)return!1;if(n){if("string"==typeof n)return n;if("function"!=typeof n){if(n instanceof e)return t.fromSourceMap(n).toString();if(n instanceof t)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}{let e=n(r);if(e){let t=this.loadFile(e);if(!t)throw new Error("Unable to load previous source map: "+e.toString());return t}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let e=this.annotation;return r&&(e=o(i(r),e)),this.loadFile(e)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return Ib=s,s.default=s,Ib}function kw(){if(Tb)return Pb;Tb=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=db,{fileURLToPath:r,pathToFileURL:n}=db,{isAbsolute:i,resolve:o}=db,{nanoid:s}=ww(),a=db,l=fb(),u=Sw(),c=Symbol("fromOffsetCache"),d=Boolean(e&&t),h=Boolean(o&&i);class p{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!h||/^\w+:\/\//.test(t.from)||i(t.from)?this.file=t.from:this.file=o(t.from)),h&&d){let e=new u(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+s(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let o,s,a;if(t&&"object"==typeof t){let e=t,n=r;if("number"==typeof e.offset){let n=this.fromOffset(e.offset);t=n.line,r=n.col}else t=e.line,r=e.column;if("number"==typeof n.offset){let e=this.fromOffset(n.offset);s=e.line,a=e.col}else s=n.line,a=n.column}else if(!r){let e=this.fromOffset(t);t=e.line,r=e.col}let u=this.origin(t,r,s,a);return o=u?new l(e,void 0===u.endLine?u.line:{column:u.column,line:u.line},void 0===u.endLine?u.column:{column:u.endColumn,line:u.endLine},u.source,u.file,i.plugin):new l(e,void 0===s?t:{column:r,line:t},void 0===s?r:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:r,endColumn:a,endLine:s,line:t,source:this.css},this.file&&(n&&(o.input.url=n(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[c])r=this[c];else{let e=this.css.split("\n");r=new Array(e.length);let t=0;for(let n=0,i=e.length;n<i;n++)r[n]=t,t+=e[n].length+1;this[c]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let t,i=r.length-2;for(;n<i;)if(t=n+(i-n>>1),e<r[t])i=t-1;else{if(!(e>=r[t+1])){n=t;break}n=t+1}}return{col:e-r[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:o(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,o,s){if(!this.map)return!1;let a,l,u=this.map.consumer(),c=u.originalPositionFor({column:t,line:e});if(!c.source)return!1;"number"==typeof o&&(a=u.originalPositionFor({column:s,line:o})),l=i(c.source)?n(c.source):new URL(c.source,this.map.consumer().sourceRoot||n(this.map.mapFile));let d={column:c.column,endColumn:a&&a.column,endLine:a&&a.line,line:c.line,url:l.toString()};if("file:"===l.protocol){if(!r)throw new Error("file: protocol is not available in this PostCSS build");d.file=r(l)}let h=u.sourceContentFor(c.source);return h&&(d.source=h),d}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}}return Pb=p,p.default=p,a&&a.registerInput&&a.registerInput(p),Pb}function xw(){if(Mb)return Rb;Mb=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=db,{dirname:r,relative:n,resolve:i,sep:o}=db,{pathToFileURL:s}=db,a=kw(),l=Boolean(e&&t),u=Boolean(r&&i&&n&&o);return Rb=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let t of this.previous()){let n,i=this.toUrl(this.path(t.file)),o=t.root||r(t.file);!1===this.mapOpts.sourcesContent?(n=new e(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,i,this.toUrl(this.path(o)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),u&&l&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=t.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0});let e,r,n=1,i=1,o="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(t,a,l)=>{if(this.css+=t,a&&"end"!==l&&(s.generated.line=n,s.generated.column=i-1,a.source&&a.source.start?(s.source=this.sourcePath(a),s.original.line=a.source.start.line,s.original.column=a.source.start.column-1,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,this.map.addMapping(s))),e=t.match(/\n/g),e?(n+=e.length,r=t.lastIndexOf("\n"),i=t.length-r):i+=t.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===e.last&&!e.raws.semicolon||(a.source&&a.source.end?(s.source=this.sourcePath(a),s.original.line=a.source.end.line,s.original.column=a.source.end.column-1,s.generated.line=n,s.generated.column=i-2,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=i-1,this.map.addMapping(s)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let o=this.opts.to?r(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=r(i(o,this.mapOpts.annotation)));let s=n(o,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new a(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(s){let t=s(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===o&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},Rb}function Cw(){if(_b)return Ab;_b=1;let e=yw();class t extends e{constructor(e){super(e),this.type="comment"}}return Ab=t,t.default=t,Ab}function Ew(){if(Db)return Nb;Db=1;let e,t,r,n,{isClean:i,my:o}=gw(),s=bw(),a=Cw(),l=yw();function u(e){return e.map(e=>(e.nodes&&(e.nodes=u(e.nodes)),delete e.source,e))}function c(e){if(e[i]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class d extends l{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,r,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],r=e(this.proxyOf.nodes[t],t),!1!==r);)this.indexes[n]+=1;return delete this.indexes[n],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...r)=>e[t](...r.map(e=>"function"==typeof e?(t,r)=>e(t.toProxy(),r):e)):"every"===t||"some"===t?r=>e[t]((e,...t)=>r(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r,n=this.index(e),i=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(let e of i)this.proxyOf.nodes.splice(n+1,0,e);for(let e in this.indexes)r=this.indexes[e],n<r&&(this.indexes[e]=r+i.length);return this.markDirty(),this}insertBefore(e,t){let r,n=this.index(e),i=0===n&&"prepend",o=this.normalize(t,this.proxyOf.nodes[n],i).reverse();n=this.index(e);for(let e of o)this.proxyOf.nodes.splice(n,0,e);for(let e in this.indexes)r=this.indexes[e],n<=r&&(this.indexes[e]=r+o.length);return this.markDirty(),this}normalize(n,l){if("string"==typeof n)n=u(e(n).nodes);else if(void 0===n)n=[];else if(Array.isArray(n)){n=n.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===n.type&&"document"!==this.type){n=n.nodes.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if(n.type)n=[n];else if(n.prop){if(void 0===n.value)throw new Error("Value field is missed in node creation");"string"!=typeof n.value&&(n.value=String(n.value)),n=[new s(n)]}else if(n.selector)n=[new t(n)];else if(n.name)n=[new r(n)];else{if(!n.text)throw new Error("Unknown node type in node creation");n=[new a(n)]}return n.map(e=>(e[o]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[i]&&c(e),void 0===e.raws.before&&l&&void 0!==l.raws.before&&(e.raws.before=l.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let n;try{n=e(t,r)}catch(e){throw t.addToError(e)}return!1!==n&&t.walk&&(n=t.walk(e)),n})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("atrule"===r.type&&e.test(r.name))return t(r,n)}):this.walk((r,n)=>{if("atrule"===r.type&&r.name===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("atrule"===e.type)return t(e,r)}))}walkComments(e){return this.walk((t,r)=>{if("comment"===t.type)return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("decl"===r.type&&e.test(r.prop))return t(r,n)}):this.walk((r,n)=>{if("decl"===r.type&&r.prop===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("decl"===e.type)return t(e,r)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("rule"===r.type&&e.test(r.selector))return t(r,n)}):this.walk((r,n)=>{if("rule"===r.type&&r.selector===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("rule"===e.type)return t(e,r)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return d.registerParse=t=>{e=t},d.registerRule=e=>{t=e},d.registerAtRule=e=>{r=e},d.registerRoot=e=>{n=e},Nb=d,d.default=d,d.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,r.prototype):"rule"===e.type?Object.setPrototypeOf(e,t.prototype):"decl"===e.type?Object.setPrototypeOf(e,s.prototype):"comment"===e.type?Object.setPrototypeOf(e,a.prototype):"root"===e.type&&Object.setPrototypeOf(e,n.prototype),e[o]=!0,e.nodes&&e.nodes.forEach(e=>{d.rebuild(e)})},Nb}function Iw(){if(Fb)return Lb;Fb=1;let e,t,r=Ew();class n extends r{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},Lb=n,n.default=n,Lb}function Ow(){if(jb)return Ub;jb=1;let e={};return Ub=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function Pw(){if(qb)return Bb;qb=1;class e{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return Bb=e,e.default=e,Bb}function Tw(){if(Wb)return zb;Wb=1;let e=Pw();class t{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new e(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}}return zb=t,t.default=t,zb}function Rw(){if(Kb)return Hb;Kb=1;let e=Ew();class t extends e{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}return Hb=t,t.default=t,e.registerAtRule(t),Hb}function Mw(){if(Jb)return Gb;Jb=1;let e,t,r=Ew();class n extends r{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let n=super.normalize(e);if(t)if("prepend"===r)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of n)e.raws.before=t.raws.before;return n}removeChild(e,t){let r=this.index(e);return!t&&0===r&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},Gb=n,n.default=n,r.registerRoot(n),Gb}function Aw(){if(Yb)return Xb;Yb=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,r){let n=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let r of e)u?u=!1:"\\"===r?u=!0:a?r===l&&(a=!1):'"'===r||"'"===r?(a=!0,l=r):"("===r?s+=1:")"===r?s>0&&(s-=1):0===s&&t.includes(r)&&(o=!0),o?(""!==i&&n.push(i.trim()),i="",o=!1):i+=r;return(r||""!==i)&&n.push(i.trim()),n}};return Xb=e,e.default=e,Xb}function _w(){if(Zb)return Qb;Zb=1;let e=Ew(),t=Aw();class r extends e{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return t.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}}return Qb=r,r.default=r,e.registerRule(r),Qb}function Nw(){if(tw)return ew;tw=1;let e=bw(),t=function(){if($b)return Vb;$b=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),r="\\".charCodeAt(0),n="/".charCodeAt(0),i="\n".charCodeAt(0),o=" ".charCodeAt(0),s="\f".charCodeAt(0),a="\t".charCodeAt(0),l="\r".charCodeAt(0),u="[".charCodeAt(0),c="]".charCodeAt(0),d="(".charCodeAt(0),h=")".charCodeAt(0),p="{".charCodeAt(0),f="}".charCodeAt(0),g=";".charCodeAt(0),v="*".charCodeAt(0),m=":".charCodeAt(0),y="@".charCodeAt(0),b=/[\t\n\f\r "#'()/;[\\\]{}]/g,w=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,S=/.[\r\n"'(/\\]/,k=/[\da-f]/i;return Vb=function(x,C={}){let E,I,O,P,T,R,M,A,_,N,D=x.css.valueOf(),L=C.ignoreErrors,F=D.length,U=0,j=[],B=[];function q(e){throw x.error("Unclosed "+e,U)}return{back:function(e){B.push(e)},endOfFile:function(){return 0===B.length&&U>=F},nextToken:function(x){if(B.length)return B.pop();if(U>=F)return;let C=!!x&&x.ignoreUnclosed;switch(E=D.charCodeAt(U),E){case i:case o:case a:case l:case s:I=U;do{I+=1,E=D.charCodeAt(I)}while(E===o||E===i||E===a||E===l||E===s);N=["space",D.slice(U,I)],U=I-1;break;case u:case c:case p:case f:case m:case g:case h:{let e=String.fromCharCode(E);N=[e,e,U];break}case d:if(A=j.length?j.pop()[1]:"",_=D.charCodeAt(U+1),"url"===A&&_!==e&&_!==t&&_!==o&&_!==i&&_!==a&&_!==s&&_!==l){I=U;do{if(R=!1,I=D.indexOf(")",I+1),-1===I){if(L||C){I=U;break}q("bracket")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["brackets",D.slice(U,I+1),U,I],U=I}else I=D.indexOf(")",U+1),P=D.slice(U,I+1),-1===I||S.test(P)?N=["(","(",U]:(N=["brackets",P,U,I],U=I);break;case e:case t:O=E===e?"'":'"',I=U;do{if(R=!1,I=D.indexOf(O,I+1),-1===I){if(L||C){I=U+1;break}q("string")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["string",D.slice(U,I+1),U,I],U=I;break;case y:b.lastIndex=U+1,b.test(D),I=0===b.lastIndex?D.length-1:b.lastIndex-2,N=["at-word",D.slice(U,I+1),U,I],U=I;break;case r:for(I=U,T=!0;D.charCodeAt(I+1)===r;)I+=1,T=!T;if(E=D.charCodeAt(I+1),T&&E!==n&&E!==o&&E!==i&&E!==a&&E!==l&&E!==s&&(I+=1,k.test(D.charAt(I)))){for(;k.test(D.charAt(I+1));)I+=1;D.charCodeAt(I+1)===o&&(I+=1)}N=["word",D.slice(U,I+1),U,I],U=I;break;default:E===n&&D.charCodeAt(U+1)===v?(I=D.indexOf("*/",U+2)+1,0===I&&(L||C?I=D.length:q("comment")),N=["comment",D.slice(U,I+1),U,I],U=I):(w.lastIndex=U+1,w.test(D),I=0===w.lastIndex?D.length-1:w.lastIndex-2,N=["word",D.slice(U,I+1),U,I],j.push(N),U=I)}return U++,N},position:function(){return U}}}}(),r=Cw(),n=Rw(),i=Mw(),o=_w();const s={empty:!0,space:!0};return ew=class{constructor(e){this.input=e,this.root=new i,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,r,i,o=new n;o.name=e[1].slice(1),""===o.name&&this.unnamedAtrule(o,e),this.init(o,e[2]);let s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?u.push("("===t?")":"]"):"{"===t&&u.length>0?u.push("}"):t===u[u.length-1]&&u.pop(),0===u.length){if(";"===t){o.source.end=this.getPosition(e[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===t){a=!0;break}if("}"===t){if(l.length>0){for(i=l.length-1,r=l[i];r&&"space"===r[0];)r=l[--i];r&&(o.source.end=this.getPosition(r[3]||r[2]),o.source.end.offset++)}this.end(e);break}l.push(e)}else l.push(e);if(this.tokenizer.endOfFile()){s=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(o.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(o,"params",l),s&&(e=l[l.length-1],o.source.end=this.getPosition(e[3]||e[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),a&&(o.nodes=[],this.current=o)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let r,n=0;for(let i=t-1;i>=0&&(r=e[i],"space"===r[0]||(n+=1,2!==n));i--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}colon(e){let t,r,n,i=0;for(let[o,s]of e.entries()){if(t=s,r=t[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return o}this.doubleColon(t)}n=t}return!1}comment(e){let t=new r;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=t(this.input)}decl(t,r){let n=new e;this.init(n,t[0][2]);let i,o=t[t.length-1];for(";"===o[0]&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}(t)),n.source.end.offset++;"word"!==t[0][0];)1===t.length&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let e=t[0][0];if(":"===e||"space"===e||"comment"===e)break;n.prop+=t.shift()[1]}for(n.raws.between="";t.length;){if(i=t.shift(),":"===i[0]){n.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s,a=[];for(;t.length&&(s=t[0][0],"space"===s||"comment"===s);)a.push(t.shift());this.precheckMissedSemicolon(t);for(let e=t.length-1;e>=0;e--){if(i=t[e],"!important"===i[1].toLowerCase()){n.important=!0;let r=this.stringFrom(t,e);r=this.spacesFromEnd(t)+r," !important"!==r&&(n.raws.important=r);break}if("important"===i[1].toLowerCase()){let r=t.slice(0),i="";for(let t=e;t>0;t--){let e=r[t][0];if(0===i.trim().indexOf("!")&&"space"!==e)break;i=r.pop()[1]+i}0===i.trim().indexOf("!")&&(n.important=!0,n.raws.important=i,t=r)}if("space"!==i[0]&&"comment"!==i[0])break}t.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(n.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(n,"value",a.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new o;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,r=null,n=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(r=l[0],a.push(l),"("===r||"["===r)i||(i=l),o.push("("===r?")":"]");else if(s&&n&&"{"===r)i||(i=l),o.push("}");else if(0===o.length){if(";"===r){if(n)return void this.decl(a,s);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),t&&n){if(!s)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,n){let i,o,a,l,u=r.length,c="",d=!0;for(let e=0;e<u;e+=1)i=r[e],o=i[0],"space"!==o||e!==u-1||n?"comment"===o?(l=r[e-1]?r[e-1][0]:"empty",a=r[e+1]?r[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let n=r.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:n,value:c}}e[t]=c}rule(e){e.pop();let t=new o;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},ew}function Dw(){if(nw)return rw;nw=1;let e=Ew(),t=Nw(),r=kw();function n(e,n){let i=new r(e,n),o=new t(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&n&&n.from&&(/\.scss$/i.test(n.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(n.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(n.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return o.root}return rw=n,n.default=n,e.registerParse(n),rw}function Lw(){if(ow)return iw;ow=1;let{isClean:e,my:t}=gw(),r=xw(),n=mw(),i=Ew(),o=Iw(),s=Ow(),a=Tw(),l=Dw(),u=Mw();const c={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},d={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},h={Once:!0,postcssPlugin:!0,prepare:!0};function p(e){return"object"==typeof e&&"function"==typeof e.then}function f(e){let t=!1,r=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function g(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:f(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function v(t){return t[e]=!1,t.nodes&&t.nodes.forEach(e=>v(e)),t}let m={};class y{constructor(e,r,n){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof r||null===r||"root"!==r.type&&"document"!==r.type)if(r instanceof y||r instanceof a)o=v(r.root),r.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let e=l;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{o=e(r,n)}catch(e){this.processed=!0,this.error=e}o&&!o[t]&&i.rebuild(o)}else o=v(r);this.result=new a(e,o,n),this.helpers={...m,postcss:m,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(r.postcssVersion&&"production"!==process.env.NODE_ENV){let e=r.postcssPlugin,t=r.postcssVersion,n=this.result.processor.version,i=t.split("."),o=n.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+n+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=r.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,r)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,r])};for(let t of this.plugins)if("object"==typeof t)for(let r in t){if(!d[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[r])if("object"==typeof t[r])for(let n in t[r])e(t,"*"===n?r:r+"-"+n.toLowerCase(),t[r][n]);else"function"==typeof t[r]&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(p(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];){t[e]=!0;let r=[g(t)];for(;r.length>0;){let e=this.visitTick(r);if(p(e))try{await e}catch(e){let t=r[r.length-1].node;throw this.handleError(e,t)}}}if(this.listeners.OnceExit)for(let[e,r]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map(e=>r(e,this.helpers));await Promise.all(e)}else await r(t,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return p(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=n;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new r(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(p(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];)t[e]=!0,this.walkSync(t);if(this.listeners.OnceExit)if("document"===t.type)for(let e of t.nodes)this.visitSync(this.listeners.OnceExit,e);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||s("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,n]of e){let e;this.result.lastPlugin=r;try{e=n(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(p(e))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void t.pop();if(i.length>0&&r.visitorIndex<i.length){let[e,t]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=e;try{return t(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==r.iterator){let i,o=r.iterator;for(;i=n.nodes[n.indexes[o]];)if(n.indexes[o]+=1,!i[e])return i[e]=!0,void t.push(g(i));r.iterator=0,delete n.indexes[o]}let o=r.events;for(;r.eventIndex<o.length;){let t=o[r.eventIndex];if(r.eventIndex+=1,0===t)return void(n.nodes&&n.nodes.length&&(n[e]=!0,r.iterator=n.getIterator()));if(this.listeners[t])return void(r.visitors=this.listeners[t])}t.pop()}walkSync(t){t[e]=!0;let r=f(t);for(let n of r)if(0===n)t.nodes&&t.each(t=>{t[e]||this.walkSync(t)});else{let e=this.listeners[n];if(e&&this.visitSync(e,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return y.registerPostcss=e=>{m=e},iw=y,y.default=y,u.registerLazyResult(y),o.registerLazyResult(y),iw}function Fw(){if(uw)return lw;uw=1;let e=function(){if(aw)return sw;aw=1;let e=xw(),t=mw(),r=Ow(),n=Dw();const i=Tw();class o{constructor(r,n,o){let s;n=n.toString(),this.stringified=!1,this._processor=r,this._css=n,this._opts=o,this._map=void 0;let a=t;this.result=new i(this._processor,s,this._opts),this.result.css=n;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,n);if(u.isMap()){let[e,t]=u.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else u.clearAnnotation(),this.result.css=u.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||r("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=n;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}}return sw=o,o.default=o,sw}(),t=Lw(),r=Iw(),n=Mw();class i{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(!0===r.postcss?r=r():r.postcss&&(r=r.postcss),"object"==typeof r&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if("object"==typeof r&&r.postcssPlugin)t.push(r);else if("function"==typeof r)t.push(r);else{if("object"!=typeof r||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(r,n={}){return this.plugins.length||n.parser||n.stringifier||n.syntax?new t(this,r,n):new e(this,r,n)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return lw=i,i.default=i,n.registerProcessor(i),r.registerProcessor(i),lw}var Uw=function(){if(pw)return hw;pw=1;let e=fb(),t=bw(),r=Lw(),n=Ew(),i=Fw(),o=mw(),s=function(){if(dw)return cw;dw=1;let e=bw(),t=Sw(),r=Cw(),n=Rw(),i=kw(),o=Mw(),s=_w();function a(l,u){if(Array.isArray(l))return l.map(e=>a(e));let{inputs:c,...d}=l;if(c){u=[];for(let e of c){let r={...e,__proto__:i.prototype};r.map&&(r.map={...r.map,__proto__:t.prototype}),u.push(r)}}if(d.nodes&&(d.nodes=l.nodes.map(e=>a(e,u))),d.source){let{inputId:e,...t}=d.source;d.source=t,null!=e&&(d.source.input=u[e])}if("root"===d.type)return new o(d);if("decl"===d.type)return new e(d);if("rule"===d.type)return new s(d);if("comment"===d.type)return new r(d);if("atrule"===d.type)return new n(d);throw new Error("Unknown node type: "+l.type)}return cw=a,a.default=a,cw}(),a=Iw(),l=Pw(),u=Cw(),c=Rw(),d=Tw(),h=kw(),p=Dw(),f=Aw(),g=_w(),v=Mw(),m=yw();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new i(e)}return y.plugin=function(e,t){let r,n=!1;function o(...r){console&&console.warn&&!n&&(n=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226"));let o=t(...r);return o.postcssPlugin=e,o.postcssVersion=(new i).version,o}return Object.defineProperty(o,"postcss",{get:()=>(r||(r=o()),r)}),o.process=function(e,t,r){return y([o(r)]).process(e,t)},o},y.stringify=o,y.parse=p,y.fromJSON=s,y.list=f,y.comment=e=>new u(e),y.atRule=e=>new c(e),y.decl=e=>new t(e),y.rule=e=>new g(e),y.root=e=>new v(e),y.document=e=>new a(e),y.CssSyntaxError=e,y.Declaration=t,y.Container=n,y.Processor=i,y.Document=a,y.Comment=u,y.Warning=l,y.AtRule=c,y.Result=d,y.Input=h,y.Rule=g,y.Root=v,y.Node=m,r.registerPostcss(y),hw=y,y.default=y,hw}();const jw=sb(Uw);jw.stringify,jw.fromJSON,jw.plugin,jw.parse,jw.list,jw.document,jw.comment,jw.atRule,jw.rule,jw.decl,jw.root,jw.CssSyntaxError,jw.Declaration,jw.Container,jw.Processor,jw.Document,jw.Comment,jw.Warning,jw.AtRule,jw.Result,jw.Input,jw.Rule,jw.Root,jw.Node;var Bw=Object.defineProperty,qw=(e,t,r)=>((e,t,r)=>t in e?Bw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);function zw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ww(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var Vw,$w={exports:{}};function Hw(){if(Vw)return $w.exports;Vw=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return $w.exports=t(),$w.exports.createColors=t,$w.exports}const Kw=Ww(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Gw,Jw;function Xw(){if(Jw)return Gw;Jw=1;let e=Hw(),t=Kw;class r extends Error{constructor(e,t,n,i,o,s){super(e),this.name="CssSyntaxError",this.reason=e,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),void 0!==t&&void 0!==n&&("number"==typeof t?(this.line=t,this.column=n):(this.line=t.line,this.column=t.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,r)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(r){if(!this.source)return"";let n=this.source;null==r&&(r=e.isColorSupported),t&&r&&(n=t(n));let i,o,s=n.split(/\r?\n/),a=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;if(r){let{bold:t,gray:r,red:n}=e.createColors(!0);i=e=>t(n(e)),o=e=>r(e)}else i=o=e=>e;return s.slice(a,l).map((e,t)=>{let r=a+1+t,n=" "+(" "+r).slice(-u)+" | ";if(r===this.line){let t=o(n.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+o(n)+e+"\n "+t+i("^")}return" "+o(n)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return Gw=r,r.default=r,Gw}var Yw,Qw,Zw,eS,tS,rS,nS,iS,oS,sS,aS,lS,uS,cS,dS,hS,pS,fS,gS,vS,mS,yS,bS,wS,SS,kS,xS,CS,ES,IS,OS,PS,TS,RS,MS,AS,_S,NS,DS,LS,FS,US,jS,BS,qS,zS,WS,VS,$S,HS,KS,GS,JS,XS={};function YS(){return Yw||(Yw=1,XS.isClean=Symbol("isClean"),XS.my=Symbol("my")),XS}function QS(){if(Zw)return Qw;Zw=1;const e={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};class t{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let i=(e.raws.between||"")+(t?";":"");this.builder(r+n+i,e)}}beforeAfter(e,t){let r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let n=e.parent,i=0;for(;n&&"root"!==n.type;)i+=1,n=n.parent;if(r.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)r+=t}return r}block(e,t){let r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let i=e.nodes[n],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==n||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],void 0!==i))return i;let o=t.parent;if("before"===n){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[n];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[n])return s.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(t,n);{let e="raw"+((a=n)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[r],void 0!==i)return!1})}var a;return void 0===i&&(i=e[n]),s.rawCache[n]=i,i}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return t=r.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){let e=r.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}}return Qw=t,t.default=t,Qw}function ZS(){if(tS)return eS;tS=1;let e=QS();function t(t,r){new e(r).stringify(t)}return eS=t,t.default=t,eS}function ek(){if(nS)return rS;nS=1;let{isClean:e,my:t}=YS(),r=Xw(),n=QS(),i=ZS();function o(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if("proxyCache"===n)continue;let i=e[n],s=typeof i;"parent"===n&&"object"===s?t&&(r[n]=t):"source"===n?r[n]=i:Array.isArray(i)?r[n]=i.map(e=>o(e,r)):("object"===s&&null!==i&&(i=o(i)),r[n]=i)}return r}class s{constructor(r={}){this.raws={},this[e]=!1,this[t]=!0;for(let e in r)if("nodes"===e){this.nodes=[];for(let t of r[e])"function"==typeof t.clone?this.append(t.clone()):this.append(t)}else this[e]=r[e]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=o(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new r(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[e]){this[e]=!1;let t=this;for(;t=t.parent;)t[e]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let n=(t=this.toString()).indexOf(e.word);-1!==n&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===r[t]?(n=1,i+=1):n+=1;return{column:n,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let n=this.toString(),i=n.indexOf(e.word);-1!==i&&(t=this.positionInside(i,n),r=this.positionInside(i+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return(new n).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let r={},n=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let n=this[e];if(Array.isArray(n))r[e]=n.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof n&&n.toJSON)r[e]=n.toJSON(null,t);else if("source"===e){let o=t.get(n.input);null==o&&(o=i,t.set(n.input,i),i++),r[e]={end:n.end,inputId:o,start:n.start}}else r[e]=n}return n&&(r.inputs=[...t.keys()].map(e=>e.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=i){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,r){let n={node:this};for(let e in r)n[e]=r[e];return e.warn(t,n)}get proxyOf(){return this}}return rS=s,s.default=s,rS}function tk(){if(oS)return iS;oS=1;let e=ek();class t extends e{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}}return iS=t,t.default=t,iS}function rk(){if(aS)return sS;aS=1;return sS={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n}},sS}function nk(){if(uS)return lS;uS=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Kw,{existsSync:r,readFileSync:n}=Kw,{dirname:i,join:o}=Kw;class s{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=i(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new e(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}loadFile(e){if(this.root=i(e),r(e))return this.mapFile=e,n(e,"utf-8").toString().trim()}loadMap(r,n){if(!1===n)return!1;if(n){if("string"==typeof n)return n;if("function"!=typeof n){if(n instanceof e)return t.fromSourceMap(n).toString();if(n instanceof t)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}{let e=n(r);if(e){let t=this.loadFile(e);if(!t)throw new Error("Unable to load previous source map: "+e.toString());return t}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let e=this.annotation;return r&&(e=o(i(r),e)),this.loadFile(e)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return lS=s,s.default=s,lS}function ik(){if(dS)return cS;dS=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Kw,{fileURLToPath:r,pathToFileURL:n}=Kw,{isAbsolute:i,resolve:o}=Kw,{nanoid:s}=rk(),a=Kw,l=Xw(),u=nk(),c=Symbol("fromOffsetCache"),d=Boolean(e&&t),h=Boolean(o&&i);class p{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!h||/^\w+:\/\//.test(t.from)||i(t.from)?this.file=t.from:this.file=o(t.from)),h&&d){let e=new u(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+s(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let o,s,a;if(t&&"object"==typeof t){let e=t,n=r;if("number"==typeof e.offset){let n=this.fromOffset(e.offset);t=n.line,r=n.col}else t=e.line,r=e.column;if("number"==typeof n.offset){let e=this.fromOffset(n.offset);s=e.line,a=e.col}else s=n.line,a=n.column}else if(!r){let e=this.fromOffset(t);t=e.line,r=e.col}let u=this.origin(t,r,s,a);return o=u?new l(e,void 0===u.endLine?u.line:{column:u.column,line:u.line},void 0===u.endLine?u.column:{column:u.endColumn,line:u.endLine},u.source,u.file,i.plugin):new l(e,void 0===s?t:{column:r,line:t},void 0===s?r:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:r,endColumn:a,endLine:s,line:t,source:this.css},this.file&&(n&&(o.input.url=n(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[c])r=this[c];else{let e=this.css.split("\n");r=new Array(e.length);let t=0;for(let n=0,i=e.length;n<i;n++)r[n]=t,t+=e[n].length+1;this[c]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let t,i=r.length-2;for(;n<i;)if(t=n+(i-n>>1),e<r[t])i=t-1;else{if(!(e>=r[t+1])){n=t;break}n=t+1}}return{col:e-r[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:o(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,o,s){if(!this.map)return!1;let a,l,u=this.map.consumer(),c=u.originalPositionFor({column:t,line:e});if(!c.source)return!1;"number"==typeof o&&(a=u.originalPositionFor({column:s,line:o})),l=i(c.source)?n(c.source):new URL(c.source,this.map.consumer().sourceRoot||n(this.map.mapFile));let d={column:c.column,endColumn:a&&a.column,endLine:a&&a.line,line:c.line,url:l.toString()};if("file:"===l.protocol){if(!r)throw new Error("file: protocol is not available in this PostCSS build");d.file=r(l)}let h=u.sourceContentFor(c.source);return h&&(d.source=h),d}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}}return cS=p,p.default=p,a&&a.registerInput&&a.registerInput(p),cS}function ok(){if(pS)return hS;pS=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Kw,{dirname:r,relative:n,resolve:i,sep:o}=Kw,{pathToFileURL:s}=Kw,a=ik(),l=Boolean(e&&t),u=Boolean(r&&i&&n&&o);return hS=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let t of this.previous()){let n,i=this.toUrl(this.path(t.file)),o=t.root||r(t.file);!1===this.mapOpts.sourcesContent?(n=new e(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,i,this.toUrl(this.path(o)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),u&&l&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=t.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new t({file:this.outputFile(),ignoreInvalidMapping:!0});let e,r,n=1,i=1,o="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(t,a,l)=>{if(this.css+=t,a&&"end"!==l&&(s.generated.line=n,s.generated.column=i-1,a.source&&a.source.start?(s.source=this.sourcePath(a),s.original.line=a.source.start.line,s.original.column=a.source.start.column-1,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,this.map.addMapping(s))),e=t.match(/\n/g),e?(n+=e.length,r=t.lastIndexOf("\n"),i=t.length-r):i+=t.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===e.last&&!e.raws.semicolon||(a.source&&a.source.end?(s.source=this.sourcePath(a),s.original.line=a.source.end.line,s.original.column=a.source.end.column-1,s.generated.line=n,s.generated.column=i-2,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=i-1,this.map.addMapping(s)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let o=this.opts.to?r(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=r(i(o,this.mapOpts.annotation)));let s=n(o,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new a(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(s){let t=s(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===o&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},hS}function sk(){if(gS)return fS;gS=1;let e=ek();class t extends e{constructor(e){super(e),this.type="comment"}}return fS=t,t.default=t,fS}function ak(){if(mS)return vS;mS=1;let e,t,r,n,{isClean:i,my:o}=YS(),s=tk(),a=sk(),l=ek();function u(e){return e.map(e=>(e.nodes&&(e.nodes=u(e.nodes)),delete e.source,e))}function c(e){if(e[i]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class d extends l{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,r,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],r=e(this.proxyOf.nodes[t],t),!1!==r);)this.indexes[n]+=1;return delete this.indexes[n],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...r)=>e[t](...r.map(e=>"function"==typeof e?(t,r)=>e(t.toProxy(),r):e)):"every"===t||"some"===t?r=>e[t]((e,...t)=>r(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r,n=this.index(e),i=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(let e of i)this.proxyOf.nodes.splice(n+1,0,e);for(let e in this.indexes)r=this.indexes[e],n<r&&(this.indexes[e]=r+i.length);return this.markDirty(),this}insertBefore(e,t){let r,n=this.index(e),i=0===n&&"prepend",o=this.normalize(t,this.proxyOf.nodes[n],i).reverse();n=this.index(e);for(let e of o)this.proxyOf.nodes.splice(n,0,e);for(let e in this.indexes)r=this.indexes[e],n<=r&&(this.indexes[e]=r+o.length);return this.markDirty(),this}normalize(n,l){if("string"==typeof n)n=u(e(n).nodes);else if(void 0===n)n=[];else if(Array.isArray(n)){n=n.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===n.type&&"document"!==this.type){n=n.nodes.slice(0);for(let e of n)e.parent&&e.parent.removeChild(e,"ignore")}else if(n.type)n=[n];else if(n.prop){if(void 0===n.value)throw new Error("Value field is missed in node creation");"string"!=typeof n.value&&(n.value=String(n.value)),n=[new s(n)]}else if(n.selector)n=[new t(n)];else if(n.name)n=[new r(n)];else{if(!n.text)throw new Error("Unknown node type in node creation");n=[new a(n)]}return n.map(e=>(e[o]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[i]&&c(e),void 0===e.raws.before&&l&&void 0!==l.raws.before&&(e.raws.before=l.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let n;try{n=e(t,r)}catch(e){throw t.addToError(e)}return!1!==n&&t.walk&&(n=t.walk(e)),n})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("atrule"===r.type&&e.test(r.name))return t(r,n)}):this.walk((r,n)=>{if("atrule"===r.type&&r.name===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("atrule"===e.type)return t(e,r)}))}walkComments(e){return this.walk((t,r)=>{if("comment"===t.type)return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("decl"===r.type&&e.test(r.prop))return t(r,n)}):this.walk((r,n)=>{if("decl"===r.type&&r.prop===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("decl"===e.type)return t(e,r)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("rule"===r.type&&e.test(r.selector))return t(r,n)}):this.walk((r,n)=>{if("rule"===r.type&&r.selector===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("rule"===e.type)return t(e,r)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}return d.registerParse=t=>{e=t},d.registerRule=e=>{t=e},d.registerAtRule=e=>{r=e},d.registerRoot=e=>{n=e},vS=d,d.default=d,d.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,r.prototype):"rule"===e.type?Object.setPrototypeOf(e,t.prototype):"decl"===e.type?Object.setPrototypeOf(e,s.prototype):"comment"===e.type?Object.setPrototypeOf(e,a.prototype):"root"===e.type&&Object.setPrototypeOf(e,n.prototype),e[o]=!0,e.nodes&&e.nodes.forEach(e=>{d.rebuild(e)})},vS}function lk(){if(bS)return yS;bS=1;let e,t,r=ak();class n extends r{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},yS=n,n.default=n,yS}function uk(){if(SS)return wS;SS=1;let e={};return wS=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function ck(){if(xS)return kS;xS=1;class e{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return kS=e,e.default=e,kS}function dk(){if(ES)return CS;ES=1;let e=ck();class t{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new e(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}}return CS=t,t.default=t,CS}function hk(){if(TS)return PS;TS=1;let e=ak();class t extends e{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}return PS=t,t.default=t,e.registerAtRule(t),PS}function pk(){if(MS)return RS;MS=1;let e,t,r=ak();class n extends r{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let n=super.normalize(e);if(t)if("prepend"===r)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of n)e.raws.before=t.raws.before;return n}removeChild(e,t){let r=this.index(e);return!t&&0===r&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(r={}){return new e(new t,this,r).stringify()}}return n.registerLazyResult=t=>{e=t},n.registerProcessor=e=>{t=e},RS=n,n.default=n,r.registerRoot(n),RS}function fk(){if(_S)return AS;_S=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,r){let n=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let r of e)u?u=!1:"\\"===r?u=!0:a?r===l&&(a=!1):'"'===r||"'"===r?(a=!0,l=r):"("===r?s+=1:")"===r?s>0&&(s-=1):0===s&&t.includes(r)&&(o=!0),o?(""!==i&&n.push(i.trim()),i="",o=!1):i+=r;return(r||""!==i)&&n.push(i.trim()),n}};return AS=e,e.default=e,AS}function gk(){if(DS)return NS;DS=1;let e=ak(),t=fk();class r extends e{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return t.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}}return NS=r,r.default=r,e.registerRule(r),NS}function vk(){if(FS)return LS;FS=1;let e=tk(),t=function(){if(OS)return IS;OS=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),r="\\".charCodeAt(0),n="/".charCodeAt(0),i="\n".charCodeAt(0),o=" ".charCodeAt(0),s="\f".charCodeAt(0),a="\t".charCodeAt(0),l="\r".charCodeAt(0),u="[".charCodeAt(0),c="]".charCodeAt(0),d="(".charCodeAt(0),h=")".charCodeAt(0),p="{".charCodeAt(0),f="}".charCodeAt(0),g=";".charCodeAt(0),v="*".charCodeAt(0),m=":".charCodeAt(0),y="@".charCodeAt(0),b=/[\t\n\f\r "#'()/;[\\\]{}]/g,w=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,S=/.[\r\n"'(/\\]/,k=/[\da-f]/i;return IS=function(x,C={}){let E,I,O,P,T,R,M,A,_,N,D=x.css.valueOf(),L=C.ignoreErrors,F=D.length,U=0,j=[],B=[];function q(e){throw x.error("Unclosed "+e,U)}return{back:function(e){B.push(e)},endOfFile:function(){return 0===B.length&&U>=F},nextToken:function(x){if(B.length)return B.pop();if(U>=F)return;let C=!!x&&x.ignoreUnclosed;switch(E=D.charCodeAt(U),E){case i:case o:case a:case l:case s:I=U;do{I+=1,E=D.charCodeAt(I)}while(E===o||E===i||E===a||E===l||E===s);N=["space",D.slice(U,I)],U=I-1;break;case u:case c:case p:case f:case m:case g:case h:{let e=String.fromCharCode(E);N=[e,e,U];break}case d:if(A=j.length?j.pop()[1]:"",_=D.charCodeAt(U+1),"url"===A&&_!==e&&_!==t&&_!==o&&_!==i&&_!==a&&_!==s&&_!==l){I=U;do{if(R=!1,I=D.indexOf(")",I+1),-1===I){if(L||C){I=U;break}q("bracket")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["brackets",D.slice(U,I+1),U,I],U=I}else I=D.indexOf(")",U+1),P=D.slice(U,I+1),-1===I||S.test(P)?N=["(","(",U]:(N=["brackets",P,U,I],U=I);break;case e:case t:O=E===e?"'":'"',I=U;do{if(R=!1,I=D.indexOf(O,I+1),-1===I){if(L||C){I=U+1;break}q("string")}for(M=I;D.charCodeAt(M-1)===r;)M-=1,R=!R}while(R);N=["string",D.slice(U,I+1),U,I],U=I;break;case y:b.lastIndex=U+1,b.test(D),I=0===b.lastIndex?D.length-1:b.lastIndex-2,N=["at-word",D.slice(U,I+1),U,I],U=I;break;case r:for(I=U,T=!0;D.charCodeAt(I+1)===r;)I+=1,T=!T;if(E=D.charCodeAt(I+1),T&&E!==n&&E!==o&&E!==i&&E!==a&&E!==l&&E!==s&&(I+=1,k.test(D.charAt(I)))){for(;k.test(D.charAt(I+1));)I+=1;D.charCodeAt(I+1)===o&&(I+=1)}N=["word",D.slice(U,I+1),U,I],U=I;break;default:E===n&&D.charCodeAt(U+1)===v?(I=D.indexOf("*/",U+2)+1,0===I&&(L||C?I=D.length:q("comment")),N=["comment",D.slice(U,I+1),U,I],U=I):(w.lastIndex=U+1,w.test(D),I=0===w.lastIndex?D.length-1:w.lastIndex-2,N=["word",D.slice(U,I+1),U,I],j.push(N),U=I)}return U++,N},position:function(){return U}}}}(),r=sk(),n=hk(),i=pk(),o=gk();const s={empty:!0,space:!0};return LS=class{constructor(e){this.input=e,this.root=new i,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,r,i,o=new n;o.name=e[1].slice(1),""===o.name&&this.unnamedAtrule(o,e),this.init(o,e[2]);let s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?u.push("("===t?")":"]"):"{"===t&&u.length>0?u.push("}"):t===u[u.length-1]&&u.pop(),0===u.length){if(";"===t){o.source.end=this.getPosition(e[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===t){a=!0;break}if("}"===t){if(l.length>0){for(i=l.length-1,r=l[i];r&&"space"===r[0];)r=l[--i];r&&(o.source.end=this.getPosition(r[3]||r[2]),o.source.end.offset++)}this.end(e);break}l.push(e)}else l.push(e);if(this.tokenizer.endOfFile()){s=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(o.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(o,"params",l),s&&(e=l[l.length-1],o.source.end=this.getPosition(e[3]||e[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),a&&(o.nodes=[],this.current=o)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let r,n=0;for(let i=t-1;i>=0&&(r=e[i],"space"===r[0]||(n+=1,2!==n));i--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}colon(e){let t,r,n,i=0;for(let[o,s]of e.entries()){if(t=s,r=t[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return o}this.doubleColon(t)}n=t}return!1}comment(e){let t=new r;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=t(this.input)}decl(t,r){let n=new e;this.init(n,t[0][2]);let i,o=t[t.length-1];for(";"===o[0]&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}(t)),n.source.end.offset++;"word"!==t[0][0];)1===t.length&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let e=t[0][0];if(":"===e||"space"===e||"comment"===e)break;n.prop+=t.shift()[1]}for(n.raws.between="";t.length;){if(i=t.shift(),":"===i[0]){n.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s,a=[];for(;t.length&&(s=t[0][0],"space"===s||"comment"===s);)a.push(t.shift());this.precheckMissedSemicolon(t);for(let e=t.length-1;e>=0;e--){if(i=t[e],"!important"===i[1].toLowerCase()){n.important=!0;let r=this.stringFrom(t,e);r=this.spacesFromEnd(t)+r," !important"!==r&&(n.raws.important=r);break}if("important"===i[1].toLowerCase()){let r=t.slice(0),i="";for(let t=e;t>0;t--){let e=r[t][0];if(0===i.trim().indexOf("!")&&"space"!==e)break;i=r.pop()[1]+i}0===i.trim().indexOf("!")&&(n.important=!0,n.raws.important=i,t=r)}if("space"!==i[0]&&"comment"!==i[0])break}t.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(n.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(n,"value",a.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new o;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,r=null,n=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(r=l[0],a.push(l),"("===r||"["===r)i||(i=l),o.push("("===r?")":"]");else if(s&&n&&"{"===r)i||(i=l),o.push("}");else if(0===o.length){if(";"===r){if(n)return void this.decl(a,s);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),t&&n){if(!s)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,n){let i,o,a,l,u=r.length,c="",d=!0;for(let e=0;e<u;e+=1)i=r[e],o=i[0],"space"!==o||e!==u-1||n?"comment"===o?(l=r[e-1]?r[e-1][0]:"empty",a=r[e+1]?r[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let n=r.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:n,value:c}}e[t]=c}rule(e){e.pop();let t=new o;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},LS}function mk(){if(jS)return US;jS=1;let e=ak(),t=vk(),r=ik();function n(e,n){let i=new r(e,n),o=new t(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&n&&n.from&&(/\.scss$/i.test(n.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(n.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(n.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return o.root}return US=n,n.default=n,e.registerParse(n),US}function yk(){if(qS)return BS;qS=1;let{isClean:e,my:t}=YS(),r=ok(),n=ZS(),i=ak(),o=lk(),s=uk(),a=dk(),l=mk(),u=pk();const c={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},d={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},h={Once:!0,postcssPlugin:!0,prepare:!0};function p(e){return"object"==typeof e&&"function"==typeof e.then}function f(e){let t=!1,r=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function g(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:f(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function v(t){return t[e]=!1,t.nodes&&t.nodes.forEach(e=>v(e)),t}let m={};class y{constructor(e,r,n){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof r||null===r||"root"!==r.type&&"document"!==r.type)if(r instanceof y||r instanceof a)o=v(r.root),r.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let e=l;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{o=e(r,n)}catch(e){this.processed=!0,this.error=e}o&&!o[t]&&i.rebuild(o)}else o=v(r);this.result=new a(e,o,n),this.helpers={...m,postcss:m,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(r.postcssVersion&&"production"!==process.env.NODE_ENV){let e=r.postcssPlugin,t=r.postcssVersion,n=this.result.processor.version,i=t.split("."),o=n.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+n+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=r.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,r)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,r])};for(let t of this.plugins)if("object"==typeof t)for(let r in t){if(!d[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[r])if("object"==typeof t[r])for(let n in t[r])e(t,"*"===n?r:r+"-"+n.toLowerCase(),t[r][n]);else"function"==typeof t[r]&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(p(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];){t[e]=!0;let r=[g(t)];for(;r.length>0;){let e=this.visitTick(r);if(p(e))try{await e}catch(e){let t=r[r.length-1].node;throw this.handleError(e,t)}}}if(this.listeners.OnceExit)for(let[e,r]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map(e=>r(e,this.helpers));await Promise.all(e)}else await r(t,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return p(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=n;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new r(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(p(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];)t[e]=!0,this.walkSync(t);if(this.listeners.OnceExit)if("document"===t.type)for(let e of t.nodes)this.visitSync(this.listeners.OnceExit,e);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||s("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,n]of e){let e;this.result.lastPlugin=r;try{e=n(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(p(e))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void t.pop();if(i.length>0&&r.visitorIndex<i.length){let[e,t]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=e;try{return t(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==r.iterator){let i,o=r.iterator;for(;i=n.nodes[n.indexes[o]];)if(n.indexes[o]+=1,!i[e])return i[e]=!0,void t.push(g(i));r.iterator=0,delete n.indexes[o]}let o=r.events;for(;r.eventIndex<o.length;){let t=o[r.eventIndex];if(r.eventIndex+=1,0===t)return void(n.nodes&&n.nodes.length&&(n[e]=!0,r.iterator=n.getIterator()));if(this.listeners[t])return void(r.visitors=this.listeners[t])}t.pop()}walkSync(t){t[e]=!0;let r=f(t);for(let n of r)if(0===n)t.nodes&&t.each(t=>{t[e]||this.walkSync(t)});else{let e=this.listeners[n];if(e&&this.visitSync(e,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}return y.registerPostcss=e=>{m=e},BS=y,y.default=y,u.registerLazyResult(y),o.registerLazyResult(y),BS}function bk(){if($S)return VS;$S=1;let e=function(){if(WS)return zS;WS=1;let e=ok(),t=ZS(),r=uk(),n=mk();const i=dk();class o{constructor(r,n,o){let s;n=n.toString(),this.stringified=!1,this._processor=r,this._css=n,this._opts=o,this._map=void 0;let a=t;this.result=new i(this._processor,s,this._opts),this.result.css=n;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,n);if(u.isMap()){let[e,t]=u.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else u.clearAnnotation(),this.result.css=u.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||r("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=n;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}}return zS=o,o.default=o,zS}(),t=yk(),r=lk(),n=pk();class i{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(!0===r.postcss?r=r():r.postcss&&(r=r.postcss),"object"==typeof r&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if("object"==typeof r&&r.postcssPlugin)t.push(r);else if("function"==typeof r)t.push(r);else{if("object"!=typeof r||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(r,n={}){return this.plugins.length||n.parser||n.stringifier||n.syntax?new t(this,r,n):new e(this,r,n)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return VS=i,i.default=i,n.registerProcessor(i),r.registerProcessor(i),VS}var wk=function(){if(JS)return GS;JS=1;let e=Xw(),t=tk(),r=yk(),n=ak(),i=bk(),o=ZS(),s=function(){if(KS)return HS;KS=1;let e=tk(),t=nk(),r=sk(),n=hk(),i=ik(),o=pk(),s=gk();function a(l,u){if(Array.isArray(l))return l.map(e=>a(e));let{inputs:c,...d}=l;if(c){u=[];for(let e of c){let r={...e,__proto__:i.prototype};r.map&&(r.map={...r.map,__proto__:t.prototype}),u.push(r)}}if(d.nodes&&(d.nodes=l.nodes.map(e=>a(e,u))),d.source){let{inputId:e,...t}=d.source;d.source=t,null!=e&&(d.source.input=u[e])}if("root"===d.type)return new o(d);if("decl"===d.type)return new e(d);if("rule"===d.type)return new s(d);if("comment"===d.type)return new r(d);if("atrule"===d.type)return new n(d);throw new Error("Unknown node type: "+l.type)}return HS=a,a.default=a,HS}(),a=lk(),l=ck(),u=sk(),c=hk(),d=dk(),h=ik(),p=mk(),f=fk(),g=gk(),v=pk(),m=ek();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new i(e)}return y.plugin=function(e,t){let r,n=!1;function o(...r){console&&console.warn&&!n&&(n=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226"));let o=t(...r);return o.postcssPlugin=e,o.postcssVersion=(new i).version,o}return Object.defineProperty(o,"postcss",{get:()=>(r||(r=o()),r)}),o.process=function(e,t,r){return y([o(r)]).process(e,t)},o},y.stringify=o,y.parse=p,y.fromJSON=s,y.list=f,y.comment=e=>new u(e),y.atRule=e=>new c(e),y.decl=e=>new t(e),y.rule=e=>new g(e),y.root=e=>new v(e),y.document=e=>new a(e),y.CssSyntaxError=e,y.Declaration=t,y.Container=n,y.Processor=i,y.Document=a,y.Comment=u,y.Warning=l,y.AtRule=c,y.Result=d,y.Input=h,y.Rule=g,y.Root=v,y.Node=m,r.registerPostcss(y),GS=y,y.default=y,GS}();const Sk=zw(wk);Sk.stringify,Sk.fromJSON,Sk.plugin,Sk.parse,Sk.list,Sk.document,Sk.comment,Sk.atRule,Sk.rule,Sk.decl,Sk.root,Sk.CssSyntaxError,Sk.Declaration,Sk.Container,Sk.Processor,Sk.Document,Sk.Comment,Sk.Warning,Sk.AtRule,Sk.Result,Sk.Input,Sk.Rule,Sk.Root,Sk.Node;class kk{constructor(...e){qw(this,"parentElement",null),qw(this,"parentNode",null),qw(this,"ownerDocument"),qw(this,"firstChild",null),qw(this,"lastChild",null),qw(this,"previousSibling",null),qw(this,"nextSibling",null),qw(this,"ELEMENT_NODE",1),qw(this,"TEXT_NODE",3),qw(this,"nodeType"),qw(this,"nodeName"),qw(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof kk))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}const xk={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Ck={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ek={};function Ik(e){if(Ek[e])return Ek[e];const t=function(e){var t,r;const n=null==(r=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:r.call(t,e);return n&&globalThis[n]?globalThis[n]:void 0}(e)||globalThis[e],r=t.prototype,n=e in xk?xk[e]:void 0,i=Boolean(n&&n.every(e=>{var t,n;return Boolean(null==(n=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),o=e in Ck?Ck[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return Ek[e]=t.prototype,t.prototype;try{const n=document.createElement("iframe");document.body.appendChild(n);const i=n.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(n),o?Ek[e]=o:r}catch{return r}}const Ok={};function Pk(e,t,r){var n;const i=`${e}.${String(r)}`;if(Ok[i])return Ok[i].call(t);const o=Ik(e),s=null==(n=Object.getOwnPropertyDescriptor(o,r))?void 0:n.get;return s?(Ok[i]=s,s.call(t)):t[r]}const Tk={};function Rk(e,t,r){const n=`${e}.${String(r)}`;if(Tk[n])return Tk[n].bind(t);const i=Ik(e)[r];return"function"!=typeof i?t[r]:(Tk[n]=i,i.bind(t))}function Mk(){return Ik("MutationObserver").constructor}const Ak={childNodes:function(e){return Pk("Node",e,"childNodes")},parentNode:function(e){return Pk("Node",e,"parentNode")},parentElement:function(e){return Pk("Node",e,"parentElement")},textContent:function(e){return Pk("Node",e,"textContent")},contains:function(e,t){return Rk("Node",e,"contains")(t)},getRootNode:function(e){return Rk("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Pk("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Pk("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Pk("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Pk("Element",e,"querySelectorAll")(t)},mutationObserver:Mk};function _k(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}const Nk="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.";let Dk={map:{},getId:()=>(console.error(Nk),-1),getNode:()=>(console.error(Nk),null),removeNodeFromMap(){console.error(Nk)},has:()=>(console.error(Nk),!1),reset(){console.error(Nk)}};function Lk(e,t,r={}){let n=null,i=0;return function(...o){const s=Date.now();i||!1!==r.leading||(i=s);const a=t-(s-i),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),i=s,e.apply(l,o)):n||!1===r.trailing||(n=setTimeout(()=>{i=!1===r.leading?0:Date.now(),n=null,e.apply(l,o)},a))}}function Fk(e,t,r,n,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(e){setTimeout(()=>{r.set.call(this,e)},0),o&&o.set&&o.set.call(this,e)}}),()=>Fk(e,t,o||{},!0)}function Uk(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],i=r(n);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Dk=new Proxy(Dk,{get:(e,t,r)=>("map"===t&&console.error(Nk),Reflect.get(e,t,r))}));let jk=Date.now;function Bk(e){var t,r,n,i;const o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:o.documentElement.scrollLeft||(null==o?void 0:o.body)&&(null==(t=Ak.parentElement(o.body))?void 0:t.scrollLeft)||(null==(r=null==o?void 0:o.body)?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==o?void 0:o.documentElement.scrollTop)||(null==o?void 0:o.body)&&(null==(n=Ak.parentElement(o.body))?void 0:n.scrollTop)||(null==(i=null==o?void 0:o.body)?void 0:i.scrollTop)||0}}function qk(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function zk(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Wk(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:Ak.parentElement(e)}function Vk(e,t,r,n){if(!e)return!1;const i=Wk(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(n&&null!==i.closest("."+t))return!0}else if(eb(i,t,n))return!0}catch(e){}if(r){if(i.matches(r))return!0;if(n&&null!==i.closest(r))return!0}return!1}function $k(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||-2===t.getId(e)}function Hk(e,t){if(xy(e))return!1;const r=t.getId(e);if(!t.has(r))return!0;const n=Ak.parentNode(e);return(!n||n.nodeType!==e.DOCUMENT_NODE)&&(!n||Hk(n,t))}function Kk(e){return Boolean(e.changedTouches)}function Gk(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Jk(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Xk(e){return!!e&&(e instanceof kk&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Ak.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(jk=()=>(new Date).getTime());class Yk{constructor(){uy(this,"id",1),uy(this,"styleIDMap",new WeakMap),uy(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}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 Qk(e){var t;let r=null;return"getRootNode"in e&&(null==(t=Ak.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Ak.host(Ak.getRootNode(e))&&(r=Ak.host(Ak.getRootNode(e))),r}function Zk(e){const t=e.ownerDocument;if(!t)return!1;const r=function(e){let t,r=e;for(;t=Qk(r);)r=t;return r}(e);return Ak.contains(t,r)}function ex(e){const t=e.ownerDocument;return!!t&&(Ak.contains(t,e)||Zk(e))}var tx=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(tx||{}),rx=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(rx||{}),nx=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(nx||{}),ix=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ix||{}),ox=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ox||{}),sx=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(sx||{}),ax=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(ax||{});function lx(e){return"__ln"in e}class ux{constructor(){uy(this,"length",0),uy(this,"head",null),uy(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&lx(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&lx(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const cx=(e,t)=>`${e}@${t}`;class dx{constructor(){uy(this,"frozen",!1),uy(this,"locked",!1),uy(this,"texts",[]),uy(this,"attributes",[]),uy(this,"attributeMap",new WeakMap),uy(this,"removes",[]),uy(this,"mapRemoves",[]),uy(this,"movedMap",{}),uy(this,"addedSet",new Set),uy(this,"movedSet",new Set),uy(this,"droppedSet",new Set),uy(this,"removesSubTreeCache",new Set),uy(this,"mutationCb"),uy(this,"blockClass"),uy(this,"blockSelector"),uy(this,"maskTextClass"),uy(this,"maskTextSelector"),uy(this,"inlineStylesheet"),uy(this,"maskInputOptions"),uy(this,"maskTextFn"),uy(this,"maskInputFn"),uy(this,"maskAttributeFn"),uy(this,"keepIframeSrcFn"),uy(this,"recordCanvas"),uy(this,"inlineImages"),uy(this,"slimDOMOptions"),uy(this,"dataURLOptions"),uy(this,"doc"),uy(this,"mirror"),uy(this,"iframeManager"),uy(this,"stylesheetManager"),uy(this,"shadowDomManager"),uy(this,"canvasManager"),uy(this,"processedNodeManager"),uy(this,"unattachedDoc"),uy(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),uy(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,r=new ux,n=e=>{let t=e,r=-2;for(;-2===r;)t=t&&t.nextSibling,r=t&&this.mirror.getId(t);return r},i=i=>{const o=Ak.parentNode(i);if(!o||!ex(i))return;let s=!1;if(i.nodeType===Node.TEXT_NODE){const e=o.tagName;if("TEXTAREA"===e)return;"STYLE"===e&&this.addedSet.has(o)&&(s=!0)}const a=xy(o)?this.mirror.getId(Qk(i)):this.mirror.getId(o),l=n(i);if(-1===a||-1===l)return r.addNode(i);const u=ob(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=>{Gk(e,this.mirror)&&this.iframeManager.addIframe(e),Jk(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Xk(i)&&this.shadowDomManager.addShadowRoot(Ak.shadowRoot(i),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)},cssCaptured:s});u&&(e.push({parentId:a,nextId:l,node:u}),t.add(u.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)px(this.removesSubTreeCache,e,this.mirror)&&!this.movedSet.has(Ak.parentNode(e))||i(e);for(const e of this.addedSet)fx(this.droppedSet,e)||px(this.removesSubTreeCache,e,this.mirror)?fx(this.movedSet,e)?i(e):this.droppedSet.add(e):i(e);let o=null;for(;r.length;){let e=null;if(o){const t=this.mirror.getId(Ak.parentNode(o.value)),r=n(o.value);-1!==t&&-1!==r&&(e=o)}if(!e){let t=r.tail;for(;t;){const r=t;if(t=t.previous,r){const t=this.mirror.getId(Ak.parentNode(r.value));if(-1===n(r.value))continue;if(-1!==t){e=r;break}{const t=r.value,n=Ak.parentNode(t);if(n&&n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=Ak.host(n);if(-1!==this.mirror.getId(t)){e=r;break}}}}}}if(!e){for(;r.head;)r.removeNode(r.head.value);break}o=e.previous,r.removeNode(e.value),i(e.value)}const s={texts:this.texts.map(e=>{const t=e.node,r=Ak.parentNode(t);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{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=>{const{attributes:t}=e;if("string"==typeof t.style){const r=JSON.stringify(e.styleDiff),n=JSON.stringify(e._unchangedStyles);r.length<t.style.length&&(r+n).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!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.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(s))}),uy(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));const r=Array.from(Ak.childNodes(e),e=>Ak.textContent(e)||"").join("");t.attributes.value=Py({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:My(e),value:r,maskInputFn:this.maskInputFn})}),uy(this,"processMutation",e=>{if(!$k(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=Ak.textContent(e.target);Vk(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:tb(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Wk(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let r=e.attributeName,n=e.target.getAttribute(r);if("value"===r){const e=My(t);n=Py({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:n,maskInputFn:this.maskInputFn})}if(Vk(e.target,this.blockClass,this.blockSelector,!1)||n===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===r&&!this.keepIframeSrcFn(n)){if(t.contentDocument)return;r="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===r&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!Zy(t.tagName,r)){if(i.attributes[r]=Qy(this.doc,Ty(t.tagName),Ty(r),n),this.maskAttributeFn&&"string"==typeof i.attributes[r]){const e=this.maskAttributeFn(r,i.attributes[r],t);null!==e?i.attributes[r]=e:delete i.attributes[r]}if("style"===r){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const r=this.unattachedDoc.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const n=t.style.getPropertyValue(e),o=t.style.getPropertyPriority(e);n!==r.style.getPropertyValue(e)||o!==r.style.getPropertyPriority(e)?i.styleDiff[e]=""===o?n:[n,o]:i._unchangedStyles[e]=[n,o]}for(const e of Array.from(r.style))""===t.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}else"open"===r&&"DIALOG"===t.tagName&&(t.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal")}break}case"childList":if(Vk(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const r=this.mirror.getId(t),n=xy(e.target)?this.mirror.getId(Ak.host(e.target)):this.mirror.getId(e.target);Vk(e.target,this.blockClass,this.blockSelector,!1)||$k(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(hx(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||Hk(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[cx(r,n)]?hx(this.movedSet,t):(this.removes.push({parentId:n,id:r,isShadow:!(!xy(e.target)||!Cy(e.target))||void 0}),function(e,t){const r=[e];for(;r.length;){const e=r.pop();t.has(e)||(t.add(e),Ak.childNodes(e).forEach(e=>r.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),uy(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if($k(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[cx(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Vk(e,this.blockClass,this.blockSelector,!1)||(Ak.childNodes(e).forEach(e=>this.genAdds(e)),Xk(e)&&Ak.childNodes(Ak.shadowRoot(e)).forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAttributeFn","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 hx(e,t){e.delete(t),Ak.childNodes(t).forEach(t=>hx(e,t))}function px(e,t,r){return 0!==e.size&&function(e,t){const r=Ak.parentNode(t);return!!r&&e.has(r)}(e,t)}function fx(e,t){return 0!==e.size&&gx(e,t)}function gx(e,t){const r=Ak.parentNode(t);return!!r&&(!!e.has(r)||gx(e,r))}let vx;const mx=e=>{if(!vx)return e;return(...t)=>{try{return e(...t)}catch(e){if(vx&&!0===vx(e))return;throw e}}};function yx(e){return(...t)=>{try{return e(...t)}catch(e){try{e._external_=!0}catch{}throw e}}}const bx=[];function wx(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Sx(e,t){const r=new dx;bx.push(r),r.init(e);const n=new(Mk())(mx(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function kx({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(!1===o.mouseInteraction)return()=>{};const s=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,a=[];let l=null;return Object.keys(nx).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(o=>{let s=Ty(o);const u=(t=>o=>{const s=wx(o);if(Vk(s,n,i,!0))return;let a=null,u=t;if("pointerType"in o){switch(o.pointerType){case"mouse":a=ix.Mouse;break;case"touch":a=ix.Touch;break;case"pen":a=ix.Pen}a===ix.Touch?nx[t]===nx.MouseDown?u="TouchStart":nx[t]===nx.MouseUp&&(u="TouchEnd"):ix.Pen}else Kk(o)&&(a=ix.Touch);null!==a?(l=a,(u.startsWith("Touch")&&a===ix.Touch||u.startsWith("Mouse")&&a===ix.Mouse)&&(a=null)):nx[t]===nx.Click&&(a=l,l=null);const c=Kk(o)?o.changedTouches[0]:o;if(!c)return;const d=r.getId(s),{clientX:h,clientY:p}=c;mx(e)({type:nx[u],id:d,x:h,y:p,...null!==a&&{pointerType:a}})})(o);if(window.PointerEvent)switch(nx[o]){case nx.MouseDown:case nx.MouseUp:s=s.replace("mouse","pointer");break;case nx.TouchStart:case nx.TouchEnd:return}a.push(_k(s,u,t))}),mx(()=>{a.forEach(e=>e())})}function xx({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){const s=mx(Lk(mx(o=>{const s=wx(o);if(!s||Vk(s,n,i,!0))return;const a=r.getId(s);if(s===t&&t.defaultView){const r=Bk(t.defaultView);e({id:a,x:r.left,y:r.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})}),o.scroll||100));return _k("scroll",s,t)}const Cx=["INPUT","TEXTAREA","SELECT"],Ex=new WeakMap;function Ix(e){return function(e,t){if(Rx("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Rx("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Rx("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Rx("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const r=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(r)}else if(e.parentStyleSheet){const r=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(r)}return t}(e,[])}function Ox(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function Px({mirror:e,stylesheetManager:t},r){var n,i,o;let s=null;s="#document"===r.nodeName?e.getId(r):e.getId(Ak.host(r));const a="#document"===r.nodeName?null==(n=r.defaultView)?void 0:n.Document:null==(o=null==(i=r.ownerDocument)?void 0:i.defaultView)?void 0:o.ShadowRoot,l=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&l?(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var r;const n=null==(r=l.set)?void 0:r.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(e){}return n}}),mx(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function Tx(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};let n;!function(e,t){const{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:f}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),r(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),n(...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),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),u(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),c(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),f(...e)}}(e,t),e.recordDOM&&(n=Sx(e,e.doc));const i=function({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(!1===t.mousemove)return()=>{};const i="number"==typeof t.mousemove?t.mousemove:50,o="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s,a=[];const l=Lk(mx(t=>{const r=Date.now()-s;e(a.map(e=>(e.timeOffset-=r,e)),t),a=[],s=null}),o),u=mx(Lk(mx(e=>{const t=wx(e),{clientX:r,clientY:i}=Kk(e)?e.changedTouches[0]:e;s||(s=jk()),a.push({x:r,y:i,id:n.getId(t),timeOffset:jk()-s}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?rx.Drag:e instanceof MouseEvent?rx.MouseMove:rx.TouchMove)}),i,{trailing:!1})),c=[_k("mousemove",u,r),_k("touchmove",u,r),_k("drag",u,r)];return mx(()=>{c.forEach(e=>e())})}(e),o=kx(e),s=xx(e),a=function({viewportResizeCb:e},{win:t}){let r=-1,n=-1;return _k("resize",mx(Lk(mx(()=>{const t=qk(),i=zk();r===t&&n===i||(e({width:Number(i),height:Number(t)}),r=t,n=i)}),200)),t)}(e,{win:r}),l=function({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:u,userTriggeredOnInput:c}){function d(e){let r=wx(e);const u=e.isTrusted,d=r&&r.tagName;if(r&&"OPTION"===d&&(r=Ak.parentElement(r)),!r||!d||Cx.indexOf(d)<0||Vk(r,n,i,!0))return;if(r.classList.contains(o)||s&&r.matches(s))return;let p=r.value,f=!1;const g=My(r)||"";"radio"===g||"checkbox"===g?f=r.checked:(a[d.toLowerCase()]||a[g])&&(p=Py({element:r,maskInputOptions:a,tagName:d,type:g,value:p,maskInputFn:l})),h(r,c?{text:p,isChecked:f,userTriggered:u}:{text:p,isChecked:f});const v=r.name;"radio"===g&&v&&f&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach(e=>{if(e!==r){const t=e.value;h(e,c?{text:t,isChecked:!f,userTriggered:!1}:{text:t,isChecked:!f})}})}function h(t,n){const i=Ex.get(t);if(!i||i.text!==n.text||i.isChecked!==n.isChecked){Ex.set(t,n);const i=r.getId(t);mx(e)({...n,id:i})}}const p=("last"===u.input?["change"]:["input","change"]).map(e=>_k(e,mx(d),t)),f=t.defaultView;if(!f)return()=>{p.forEach(e=>e())};const g=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),v=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&p.push(...v.map(e=>Fk(e[0],e[1],{set(){mx(d)({target:this,isTrusted:!1})}},!1,f))),mx(()=>{p.forEach(e=>e())})}(e),u=function({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:o}){const s=mx(o=>Lk(mx(i=>{const s=wx(i);if(!s||Vk(s,t,r,!0))return;const{currentTime:a,volume:l,muted:u,playbackRate:c,loop:d}=s;e({type:o,id:n.getId(s),currentTime:a,volume:l,muted:u,playbackRate:c,loop:d})}),i.media||500)),a=[_k("play",s(sx.Play),o),_k("pause",s(sx.Pause),o),_k("seeked",s(sx.Seeked),o),_k("volumechange",s(sx.VolumeChange),o),_k("ratechange",s(sx.RateChange),o)];return mx(()=>{a.forEach(e=>e())})}(e);let c=()=>{},d=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(c=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:mx((n,i,o)=>{const[s,a]=o,{id:l,styleId:u}=Ox(i,t,r.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,adds:[{rule:s,index:a}]}),yx(()=>n.apply(i,o))()})}),n.CSSStyleSheet.prototype.addRule=function(e,t,r=this.cssRules.length){const i=`${e} { ${t} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[i,r])};const o=n.CSSStyleSheet.prototype.deleteRule;let s,a;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:mx((n,i,o)=>{const[s]=o,{id:a,styleId:l}=Ox(i,t,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:s}]}),yx(()=>n.apply(i,o))()})}),n.CSSStyleSheet.prototype.removeRule=function(e){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:mx((n,i,o)=>{const[s]=o,{id:a,styleId:l}=Ox(i,t,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replace:s}),n.apply(i,o)})})),n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:mx((n,i,o)=>{const[s]=o,{id:a,styleId:l}=Ox(i,t,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replaceSync:s}),n.apply(i,o)})}));const l={};Mx("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(Mx("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),Mx("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),Mx("CSSSupportsRule")&&(l.CSSSupportsRule=n.CSSSupportsRule));const u={};return Object.entries(l).forEach(([n,i])=>{u[n]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(u[n].insertRule,{apply:mx((n,i,o)=>{const[s,a]=o,{id:l,styleId:u}=Ox(i.parentStyleSheet,t,r.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,adds:[{rule:s,index:[...Ix(i),a||0]}]}),n.apply(i,o)})}),i.prototype.deleteRule=new Proxy(u[n].deleteRule,{apply:mx((n,i,o)=>{const[s]=o,{id:a,styleId:l}=Ox(i.parentStyleSheet,t,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:[...Ix(i),s]}]}),n.apply(i,o)})})}),mx(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,s&&(n.CSSStyleSheet.prototype.replace=s),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})})}(e,{win:r}),d=Px(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:mx((i,s,a)=>{var l;const[u,c,d]=a;if(r.has(u))return o.apply(s,[u,c,d]);const{id:h,styleId:p}=Ox(null==(l=s.parentRule)?void 0:l.parentStyleSheet,t,n.styleMirror);return(h&&-1!==h||p&&-1!==p)&&e({id:h,styleId:p,set:{property:u,value:c,priority:d},index:Ix(s.parentRule)}),i.apply(s,a)})});const s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:mx((i,o,a)=>{var l;const[u]=a;if(r.has(u))return s.apply(o,[u]);const{id:c,styleId:d}=Ox(null==(l=o.parentRule)?void 0:l.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||d&&-1!==d)&&e({id:c,styleId:d,remove:{property:u},index:Ix(o.parentRule)}),i.apply(o,a)})}),mx(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}(e,{win:r}),e.collectFonts&&(p=function({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const n=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(e,t,r){const n=new o(e,t,r);return i.set(n,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),n};const s=Uk(t.fonts,"add",function(t){return function(r){return setTimeout(mx(()=>{const t=i.get(r);t&&(e(t),i.delete(r))}),0),t.apply(this,[r])}});return n.push(()=>{r.FontFace=o}),n.push(s),mx(()=>{n.forEach(e=>e())})}(e)));const f=function(e){const{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=e;let s=!0;const a=mx(()=>{const e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;t<l;t++){const o=e.getRangeAt(t),{startContainer:s,startOffset:l,endContainer:u,endOffset:c}=o;Vk(s,n,i,!0)||Vk(u,n,i,!0)||a.push({start:r.getId(s),startOffset:l,end:r.getId(u),endOffset:c})}o({ranges:a})});return a(),_k("selectionchange",a)}(e),g=function({doc:e,customElementCb:t}){const r=e.defaultView;return r&&r.customElements?Uk(r.customElements,"define",function(e){return function(r,n,i){try{t({define:{name:r}})}catch(e){console.warn(`Custom element callback failed for ${r}`)}return e.apply(this,[r,n,i])}}):()=>{}}(e),v=[];for(const t of e.plugins)v.push(t.observer(t.callback,r,t.options));return mx(()=>{bx.forEach(e=>e.reset()),null==n||n.disconnect(),i(),o(),s(),a(),l(),u(),c(),d(),h(),p(),f(),g(),v.forEach(e=>e())})}function Rx(e){return void 0!==window[e]}function Mx(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Ax{constructor(e){uy(this,"iframeIdToRemoteIdMap",new WeakMap),uy(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,n){const i=r||this.getIdToRemoteIdMap(e),o=n||this.getRemoteIdToIdMap(e);let s=i.get(t);return s||(s=this.generateIdFn(),i.set(t,s),o.set(s,t)),s}getIds(e,t){const r=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,r,n))}getRemoteId(e,t,r){const n=r||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const i=n.get(t);return i||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,r))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);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 _x{constructor(e){uy(this,"iframes",new WeakMap),uy(this,"crossOriginIframeMap",new WeakMap),uy(this,"crossOriginIframeMirror",new Ax(Wy)),uy(this,"crossOriginIframeStyleMirror"),uy(this,"crossOriginIframeRootIdMap",new WeakMap),uy(this,"mirror"),uy(this,"mutationCb"),uy(this,"wrappedEmit"),uy(this,"loadListener"),uy(this,"stylesheetManager"),uy(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ax(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 r,n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(r=e.contentWindow)||r.addEventListener("message",this.handleMessage.bind(this))),null==(n=this.loadListener)||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){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const r=this.crossOriginIframeMap.get(e.source);if(!r)return;const n=this.transformCrossOriginEvent(r,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case tx.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const r=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,r),this.patchRootIdOnNode(t.data.node,r),{timestamp:t.timestamp,type:tx.IncrementalSnapshot,data:{source:rx.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case tx.Meta:case tx.Load:case tx.DomContentLoaded:return!1;case tx.Plugin:return t;case tx.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case tx.IncrementalSnapshot:switch(t.data.source){case rx.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const r=this.crossOriginIframeRootIdMap.get(e);r&&this.patchRootIdOnNode(t.node,r)}),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 rx.Drag:case rx.TouchMove:case rx.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case rx.ViewportResize:return!1;case rx.MediaInteraction:case rx.MouseInteraction:case rx.Scroll:case rx.CanvasMutation:case rx.Input:return this.replaceIds(t.data,e,["id"]),t;case rx.StyleSheetRule:case rx.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case rx.Font:return t;case rx.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case rx.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(r=t.data.styles)||r.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,r,n){for(const i of n)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(r,t[i]):t[i]=e.getId(r,t[i]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}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===ax.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}}class Nx{constructor(e){uy(this,"shadowDoms",new WeakSet),uy(this,"mutationCb"),uy(this,"scrollCb"),uy(this,"bypassOptions"),uy(this,"mirror"),uy(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(!Cy(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const r=Sx({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(xx({...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(Ak.host(e))),this.restoreHandlers.push(Px({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){const r=this;this.restoreHandlers.push(Uk(e.prototype,"attachShadow",function(e){return function(n){const i=e.call(this,n),o=Ak.shadowRoot(this);return o&&ex(this)&&r.addShadowRoot(o,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var Dx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lx="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Fx=0;Fx<64;Fx++)Lx[Dx.charCodeAt(Fx)]=Fx;const Ux=new Map;const jx=(e,t,r)=>{if(!e||!zx(e,t)&&"object"!=typeof e)return;const n=function(e,t){let r=Ux.get(e);return r||(r=new Map,Ux.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name);let i=n.indexOf(e);return-1===i&&(i=n.length,n.push(e)),i};function Bx(e,t,r){if(e instanceof Array)return e.map(e=>Bx(e,t,r));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){return{rr_type:e.constructor.name,base64:function(e){var t,r=new Uint8Array(e),n=r.length,i="";for(t=0;t<n;t+=3)i+=Dx[r[t]>>2],i+=Dx[(3&r[t])<<4|r[t+1]>>4],i+=Dx[(15&r[t+1])<<2|r[t+2]>>6],i+=Dx[63&r[t+2]];return n%3==2?i=i.substring(0,i.length-1)+"=":n%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Bx(e.buffer,t,r),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:r}=e;return{rr_type:t,src:r}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[Bx(e.data,t,r),e.width,e.height]}}if(zx(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:jx(e,t,r)}}return e}const qx=(e,t,r)=>e.map(e=>Bx(e,t,r)),zx=(e,t)=>{const r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(r.find(r=>e instanceof t[r]))};function Wx(e,t,r,n){const i=[];try{const o=Uk(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(i,...o){if(!Vk(this,t,r,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=e),n&&["webgl","webgl2"].includes(e))if(o[0]&&"object"==typeof o[0]){const 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{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(e=>e())}}function Vx(e,t,r,n,i,o){const s=[],a=Object.getOwnPropertyNames(e);for(const l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if("function"!=typeof e[l])continue;const a=Uk(e,l,function(e){return function(...s){const a=e.apply(this,s);if(jx(a,o,this),"tagName"in this.canvas&&!Vk(this.canvas,n,i,!0)){const e=qx(s,o,this),n={type:t,property:l,args:e};r(this.canvas,n)}return a}});s.push(a)}catch{const n=Fk(e,l,{set(e){r(this.canvas,{type:t,property:l,args:[e],setter:!0})}});s.push(n)}return s}const $x='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext("2d");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map\n',Hx="undefined"!=typeof self&&self.Blob&&new Blob([$x],{type:"text/javascript;charset=utf-8"});function Kx(e){let t;try{if(t=Hx&&(self.URL||self.webkitURL).createObjectURL(Hx),!t)throw"";const r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent($x),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class Gx{constructor(e){uy(this,"pendingCanvasMutations",new Map),uy(this,"rafStamps",{latestId:0,invokeId:null}),uy(this,"mirror"),uy(this,"mutationCb"),uy(this,"resetObservers"),uy(this,"frozen",!1),uy(this,"locked",!1),uy(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)});const{sampling:t="all",win:r,blockClass:n,blockSelector:i,recordCanvas:o,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(r,n,i),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,r,n,i,{dataURLOptions:s})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,n,i){const o=Wx(t,r,n,!0),s=new Map,a=new Kx;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:r,type:n,width:i,height:o}=e.data;this.mutationCb({id:t,type:ox["2D"],commands:[{property:"clearRect",args:[0,0,i,o]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r}],type:n}]},0,0]}]})};const l=1e3/e;let u,c=0;const d=e=>{c&&e-c<l||(c=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{Vk(t,r,n,!0)||e.push(t)}),e})().forEach(async e=>{var t;const r=this.mirror.getId(e);if(s.get(r))return;if(0===e.width||0===e.height)return;if(s.set(r,!0),["webgl","webgl2"].includes(e.__context)){const r=e.getContext(e.__context);!1===(null==(t=null==r?void 0:r.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&r.clear(r.COLOR_BUFFER_BIT)}const n=await createImageBitmap(e);a.postMessage({id:r,bitmap:n,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[n])})),u=requestAnimationFrame(d)};u=requestAnimationFrame(d),this.resetObservers=()=>{o(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const n=Wx(e,t,r,!1),i=function(e,t,r,n){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const o=Uk(t.CanvasRenderingContext2D.prototype,s,function(i){return function(...o){return Vk(this.canvas,r,n,!0)||setTimeout(()=>{const r=qx(o,t,this);e(this.canvas,{type:ox["2D"],property:s,args:r})},0),i.apply(this,o)}});i.push(o)}catch{const r=Fk(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:ox["2D"],property:s,args:[t],setter:!0})}});i.push(r)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r),o=function(e,t,r,n){const i=[];return i.push(...Vx(t.WebGLRenderingContext.prototype,ox.WebGL,e,r,n,t)),void 0!==t.WebGL2RenderingContext&&i.push(...Vx(t.WebGL2RenderingContext.prototype,ox.WebGL2,e,r,n,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{n(),i(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||-1===t)return;const n=r.map(e=>{const{type:t,...r}=e;return r}),{type:i}=r[0];this.mutationCb({id:t,type:i,commands:n}),this.pendingCanvasMutations.delete(e)}}class Jx{constructor(e){uy(this,"trackedLinkElements",new WeakSet),uy(this,"mutationCb"),uy(this,"adoptedStyleSheetCb"),uy(this,"styleMirror",new Yk),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;const r={id:t,styleIds:[]},n=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);let r=[];try{r=Array.from(t.cssRules,(e,r)=>({rule:Iy(e,t.href),index:r}))}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}n.push({styleId:e,rules:r})}r.styleIds.push(e)}n.length>0&&(r.styles=n),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Xx{constructor(){uy(this,"nodeMap",new WeakMap),uy(this,"active",!1)}inOtherBuffer(e,t){const r=this.nodeMap.get(e);return r&&Array.from(r).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let Yx,Qx,Zx,eC=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(sy=e.contentWindow)?void 0:sy.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const tC=new Oy;function rC(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:d,maskInputOptions:h,slimDOMOptions:p,maskInputFn:f,maskTextFn:g,maskAttributeFn:v,hooks:m,packFn:y,sampling:b={},dataURLOptions:w={},mousemoveWait:S,recordDOM:k=!0,recordCanvas:x=!1,recordCrossOriginIframes:C=!1,recordAfter:E=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:I=!1,collectFonts:O=!1,inlineImages:P=!1,captureAdoptedStyleSheets:T=!0,plugins:R,keepIframeSrcFn:M=()=>!1,ignoreCSSAttributes:A=new Set([]),errorHandler:_,applyBackgroundColorToBlockedElements:N=!1}=e;vx=_;const D=!C||window.parent===window;let L=!1;if(!D)try{window.parent.document&&(L=!1)}catch(e){L=!0}if(D&&!t)throw new Error("emit function is required");if(!D&&!L)return()=>{};void 0!==S&&void 0===b.mousemove&&(b.mousemove=S),tC.reset();const F=!0===d?{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!==h?h:{password:!0},U=!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===p,headMetaDescKeywords:"all"===p,headTitleMutations:"all"===p}:p||{};let j;!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)}();let B=0;const q=e=>{for(const t of R||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!L&&(e=y(e)),e};Yx=(e,i)=>{var o;const s=e;if(s.timestamp=jk(),!(null==(o=bx[0])?void 0:o.isFrozen())||s.type===tx.FullSnapshot||s.type===tx.IncrementalSnapshot&&s.data.source===rx.Mutation||bx.forEach(e=>e.unfreeze()),D)null==t||t(q(s),i);else if(L){const e={type:"rrweb",event:q(s),origin:window.location.origin,isCheckout:i};window.parent.postMessage(e,"*")}if(s.type===tx.FullSnapshot)j=s,B=0;else if(s.type===tx.IncrementalSnapshot){if(s.data.source===rx.Mutation&&s.data.isAttachIframe)return;B++;const e=n&&B>=n,t=r&&s.timestamp-j.timestamp>r;(e||t)&&Qx(!0)}};const z=e=>{Yx({type:tx.IncrementalSnapshot,data:{source:rx.Mutation,...e}})},W=e=>Yx({type:tx.IncrementalSnapshot,data:{source:rx.Scroll,...e}}),V=e=>Yx({type:tx.IncrementalSnapshot,data:{source:rx.CanvasMutation,...e}}),$=new Jx({mutationCb:z,adoptedStyleSheetCb:e=>Yx({type:tx.IncrementalSnapshot,data:{source:rx.AdoptedStyleSheet,...e}})}),H=new _x({mirror:tC,mutationCb:z,stylesheetManager:$,recordCrossOriginIframes:C,wrappedEmit:Yx});for(const e of R||[])e.getMirror&&e.getMirror({nodeMirror:tC,crossOriginIframeMirror:H.crossOriginIframeMirror,crossOriginIframeStyleMirror:H.crossOriginIframeStyleMirror});const K=new Xx;Zx=new Gx({recordCanvas:x,mutationCb:V,win:window,blockClass:i,blockSelector:o,mirror:tC,sampling:b.canvas,dataURLOptions:w});const G=new Nx({mutationCb:z,scrollCb:W,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:F,dataURLOptions:w,maskTextFn:g,maskInputFn:f,maskAttributeFn:v,recordCanvas:x,inlineImages:P,sampling:b,slimDOMOptions:U,iframeManager:H,stylesheetManager:$,canvasManager:Zx,keepIframeSrcFn:M,processedNodeManager:K},mirror:tC});Qx=(e=!1)=>{if(!k)return;Yx({type:tx.Meta,data:{href:window.location.href,width:zk(),height:qk()}},e),$.reset(),G.init(),bx.forEach(e=>e.lock());const t=function(e,t){const{mirror:r=new Oy,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:h,maskAttributeFn:p,slimDOM:f=!1,dataURLOptions:g,preserveWhiteSpace:v,onSerialize:m,onAdoptedStyleSheet:y,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:k,keepIframeSrcFn:x=()=>!1,applyBackgroundColorToBlockedElements:C=!1}=t||{};return ob(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:!0===c?{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===c?{password:!0}:c,maskTextFn:d,maskInputFn:h,maskAttributeFn:p,slimDOMOptions:!0===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===f,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===f?{}:f,dataURLOptions:g,inlineImages:l,recordCanvas:u,preserveWhiteSpace:v,onSerialize:m,onAdoptedStyleSheet:y,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:k,keepIframeSrcFn:x,newlyAddedElement:!1,applyBackgroundColorToBlockedElements:C})}(document,{mirror:tC,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:F,maskTextFn:g,maskInputFn:f,maskAttributeFn:v,slimDOM:U,dataURLOptions:w,recordCanvas:x,inlineImages:P,applyBackgroundColorToBlockedElements:N,onSerialize:e=>{Gk(e,tC)&&H.addIframe(e),Jk(e,tC)&&$.trackLinkElement(e),Xk(e)&&G.addShadowRoot(Ak.shadowRoot(e),document)},onAdoptedStyleSheet:T?e=>$.styleMirror.add(e):void 0,onIframeLoad:(e,t)=>{H.attachIframe(e,t),G.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{$.attachLinkElement(e,t)},keepIframeSrcFn:M});if(!t)return console.warn("Failed to snapshot the document");Yx({type:tx.FullSnapshot,data:{node:t,initialOffset:Bk(window)}},e),bx.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,tC.getId(document))};try{const e=[],t=e=>{var t;return mx(Tx)({mutationCb:z,mousemoveCb:(e,t)=>Yx({type:tx.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Yx({type:tx.IncrementalSnapshot,data:{source:rx.MouseInteraction,...e}}),scrollCb:W,viewportResizeCb:e=>Yx({type:tx.IncrementalSnapshot,data:{source:rx.ViewportResize,...e}}),inputCb:e=>Yx({type:tx.IncrementalSnapshot,data:{source:rx.Input,...e}}),mediaInteractionCb:e=>Yx({type:tx.IncrementalSnapshot,data:{source:rx.MediaInteraction,...e}}),styleSheetRuleCb:e=>Yx({type:tx.IncrementalSnapshot,data:{source:rx.StyleSheetRule,...e}}),styleDeclarationCb:e=>Yx({type:tx.IncrementalSnapshot,data:{source:rx.StyleDeclaration,...e}}),canvasMutationCb:V,fontCb:e=>Yx({type:tx.IncrementalSnapshot,data:{source:rx.Font,...e}}),selectionCb:e=>{Yx({type:tx.IncrementalSnapshot,data:{source:rx.Selection,...e}})},customElementCb:e=>{Yx({type:tx.IncrementalSnapshot,data:{source:rx.CustomElement,...e}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:u,maskInputOptions:F,inlineStylesheet:c,sampling:b,recordDOM:k,recordCanvas:x,inlineImages:P,userTriggeredOnInput:I,collectFonts:O,doc:e,maskInputFn:f,maskTextFn:g,maskAttributeFn:v,keepIframeSrcFn:M,blockSelector:o,slimDOMOptions:U,dataURLOptions:w,mirror:tC,iframeManager:H,stylesheetManager:$,shadowDomManager:G,processedNodeManager:K,canvasManager:Zx,ignoreCSSAttributes:A,plugins:(null==(t=null==R?void 0:R.filter(e=>e.observer))?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>Yx({type:tx.Plugin,data:{plugin:e.name,payload:t}})})))||[]},m)};H.addLoadListener(r=>{try{e.push(t(r.contentDocument))}catch(e){console.warn(e)}});const r=()=>{Qx(),e.push(t(document)),eC=!0};return"interactive"===document.readyState||"complete"===document.readyState?r():(e.push(_k("DOMContentLoaded",()=>{Yx({type:tx.DomContentLoaded,data:{}}),"DOMContentLoaded"===E&&r()})),e.push(_k("load",()=>{Yx({type:tx.Load,data:{}}),"load"===E&&r()},window))),()=>{e.forEach(e=>e()),K.destroy(),eC=!1,vx=void 0}}catch(e){console.warn(e)}}var nC;rC.addCustomEvent=(e,t)=>{if(!eC)throw new Error("please add custom event after start recording");Yx({type:tx.Custom,data:{tag:e,payload:t}})},rC.freezePage=()=>{bx.forEach(e=>e.freeze())},rC.takeFullSnapshot=e=>{if(!eC)throw new Error("please take full snapshot after start recording");Qx(e)},rC.mirror=tC,function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(nC||(nC={}));var iC=Object.freeze({__proto__:null,record:rC}),oC=function(e){return void 0!==e&&("boolean"==typeof e?e:!1!==e.enabled)},sC=function(e,t,r,n){var i=function(e){var t;return"object"==typeof e&&null!==e?{allowlist:null!==(t=e.allowlist)&&void 0!==t?t:[],excludelist:e.excludelist||e.blocklist||[]}:{allowlist:[],excludelist:[]}}(t),o=function(e,t,r){if(0===t.length&&0===r.length)return e;var n=t.length>0?t:["/**"];try{var i=JSON.parse(e);return Dt(i,n,r),JSON.stringify(i)}catch(t){return e}}(e,i.allowlist,i.excludelist);return n(o,r)},aC=["image/","audio/","video/","application/octet-stream","font/"];function lC(e,t){if(new Blob([e]).size<=t)return{value:e,truncated:!1};for(var r=0,n=Math.min(e.length,t);r<n;){var i=Math.ceil((r+n)/2);new Blob([e.slice(0,i)]).size<=t?r=i:n=i-1}return r>0&&e.charCodeAt(r-1)>=55296&&e.charCodeAt(r-1)<=56319&&(r-=1),{value:e.slice(0,r),truncated:!0}}var uC=function(){function e(){this.fetchObserver=null}return e.prototype.start=function(e,t){this.eventCallback=e,this.networkConfig=t,this.observeFetch()},e.prototype.stop=function(){var e;null===(e=this.fetchObserver)||void 0===e||e.call(this),this.fetchObserver=null,this.eventCallback=void 0,this.networkConfig=void 0},e.prototype.notifyEvent=function(e){var t;null===(t=this.eventCallback)||void 0===t||t.call(this,e)},e.prototype.observeFetch=function(){var e=this,t=z();if(t){var r=t.fetch;r&&(t.fetch=function(t,n){return l(e,void 0,void 0,function(){var e,i,o,s,a,l,c,d,h,p,f,g,v=this;return u(this,function(u){switch(u.label){case 0:e=Date.now(),i={timestamp:e,type:"fetch",method:(null==n?void 0:n.method)||"GET",url:t.toString(),requestHeaders:null==n?void 0:n.headers},(o=null===(f=this.networkConfig)||void 0===f?void 0:f.body)&&oC(o.request)&&void 0!==(s=function(e){if(null!=e){if("string"==typeof e)return e;if(e instanceof URLSearchParams)return e.toString();if(e instanceof FormData){var t=[];return e.forEach(function(e,r){t.push("".concat(r,"=").concat("string"==typeof e?e:"[File]"))}),t.join("&")}}}(null==n?void 0:n.body))&&(a=null!==(g=o.maxBodySizeBytes)&&void 0!==g?g:10240,i.requestBody=sC(s,o.request,a,lC).value),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,r(t,n)];case 2:return l=u.sent(),h=Date.now(),i.status=l.status,i.duration=h-e,c={},l.headers.forEach(function(e,t){c[t]=e}),i.responseHeaders=c,o&&oC(o.response)?!function(e){return!!e&&aC.some(function(t){return e.toLowerCase().startsWith(t)})}(c["content-type"]||null)?l.clone().text().then(function(e){var t,r=null!==(t=o.maxBodySizeBytes)&&void 0!==t?t:10240,n=sC(e,o.response,r,lC),s=n.value,a=n.truncated;i.responseBody=s,i.responseBodyStatus=a?"truncated":"captured",v.notifyEvent(i)},function(){i.responseBodyStatus="error",v.notifyEvent(i)}):(i.responseBodyStatus="skipped_binary",this.notifyEvent(i)):this.notifyEvent(i),[2,l];case 3:throw d=u.sent(),h=Date.now(),i.duration=h-e,p=d,i.error={name:p.name||"UnknownError",message:p.message||"An unknown error occurred"},this.notifyEvent(i),d;case 4:return[2]}})})},this.fetchObserver=function(){t.fetch=r})}},e}(),cC=Object.freeze({__proto__:null,NetworkObservers:uC});e.Identify=F,e.Revenue=ie,e.Types=Rn,e._setDiagnosticsSampleRate=_h,e.add=Fh,e.createInstance=Mh,e.experiment=Dh,e.extendSession=Uh,e.flush=jh,e.getDeviceId=Bh,e.getIdentity=qh,e.getOptOut=zh,e.getSessionId=Wh,e.getUserId=Vh,e.groupIdentify=$h,e.identify=Hh,e.initAll=Nh,e.logEvent=Kh,e.remove=Gh,e.reset=Jh,e.revenue=Xh,e.sessionReplay=Lh,e.setDeviceId=Yh,e.setGroup=Qh,e.setIdentity=Zh,e.setOptOut=ep,e.setSessionId=tp,e.setTransport=rp,e.setUserId=np,e.track=ip,Object.defineProperty(e,"__esModule",{value:!0})});