@amplitude/unified 1.1.43 → 1.1.44-codexsemantic-review-integration.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(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};function r(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i,o,s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function l(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})}function u(e,t){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=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++,r=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],r=0}finally{n=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,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function h(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||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",T="rdt_cid",P="ttclid",R="twclid",A="wbraid",M={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 n=e[t];if(!L(t,n))return!1}return!0},L=function(e,t){var n,r;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){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;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,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[p.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===p.ADD?"number"==typeof n:e===p.UNSET||e===p.REMOVE||L(t,n)))},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,n){return void 0===t&&(t=0),void 0===n&&(n=U.Unknown),{event:e,code:t,message:n}},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,n=z();if(!(null===(t=null==n?void 0:n.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 r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,h([],d(r.entries()),!1).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(W[r]):W[r]}).join("")},$="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},K={},H={get exports(){return K},set exports(e){K=e}},G=Object.prototype.hasOwnProperty;function J(e){return"[Throws: "+(e?e.message:"?")+"]"}function Y(e){var t=[];return function e(n){if(null===n||"object"!=typeof n)return n;if(-1!==t.indexOf(n))return"[Circular]";if(t.push(n),"function"==typeof n.toJSON)try{var r=e(n.toJSON());return t.pop(),r}catch(e){return J(e)}if(Array.isArray(n)){var i=n.map(e);return t.pop(),i}var o=Object.keys(n).reduce(function(t,r){return t[r]=e(function(e,t){if(G.call(e,t))try{return e[t]}catch(e){return J(e)}return e[t]}(n,r)),t},{});return t.pop(),o}(e)}H.exports=function(e,t,n){return JSON.stringify(Y(e),t,n)};var X,Q=K.ensureProperties=Y,Z=K||t({__proto__:null,ensureProperties:Q,get default(){return K}},[K]),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 n,r;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!==(n=e.type)&&void 0!==n?n:"enrichment",this.pluginStatus.set(i,"locked"),[4,null===(r=e.setup)||void 0===r?void 0:r.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 n;return l(this,void 0,void 0,function(){var r,i;return u(this,function(o){switch(o.label){case 0:return this.pluginStatus.delete(e),r=this.plugins.findIndex(function(t){return t.name===e}),-1===r?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(i=this.plugins[r],this.plugins.splice(r,1),[4,null===(n=i.teardown)||void 0===n?void 0:n.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(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return l(this,void 0,void 0,function(){var t,n,r,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),n=t[0],r=d(e,2),i=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),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({},n))]:[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(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(v.name),"', event: ").concat(Z(n))),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({},n))]:[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(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(v.name),"', event: ").concat(Z(n))),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(n))),w=b.map(function(e){var t=s({},n);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(n,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,n,r=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 r.apply(e)}))];case 1:return i.sent(),t=this.plugins.filter(function(e){return"destination"===e.type}),n=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(n)];case 2:return i.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return l(this,void 0,void 0,function(){var t,n,r,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),n=t.next(),l.label=1;case 1:if(n.done)return[3,6];r=n.value,l.label=2;case 2:return l.trys.push([2,4,,5]),[4,r(e)];case 3:return l.sent(),[3,5];case 4:return i=l.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return o=l.sent(),s={error:o},[3,9];case 8:try{n&&!n.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()})},ne=function(e){return{promise:e||Promise.resolve()}},re=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(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return t.isReady=!0})];case 1:return n.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return l(this,void 0,void 0,function(){var n,r,i,o,s,a,l,d;return u(this,function(u){switch(u.label){case 0:n=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),r=c(n),i=r.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=r.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=r.return)&&d.call(r)}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,n){var r=function(e,t,n){return s(s(s({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ne(this.dispatch(r))},e.prototype.identify=function(e,t){var n=te(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),ne(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=function(e,t,n,r){var i;return s(s({},r),{event_type:o.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,n,r);return ne(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,i=new F;return i.set(e,t),s(s({},n),{event_type:o.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ne(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return s(s({},t),{event_type:o.REVENUE,event_properties:e.getEventProperties()})}(e,t);return ne(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),ne())},e.prototype._addPlugin=function(e){return ne(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)),ne())},e.prototype._removePlugin=function(e){return ne(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(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,n=null!==(t=this.userProperties)&&void 0!==t?t:{},r=s({},n);if(void 0===e)return r;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 n=e[t];switch(t){case i.CLEAR_ALL:Object.keys(r).forEach(function(e){delete r[e]});break;case i.UNSET:Object.keys(n).forEach(function(e){delete r[e]});break;case i.SET:Object.assign(r,n)}}}),Object.assign(r,o),r},e.prototype.process=function(e){return l(this,void 0,void 0,function(){var t,n,r,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 n=s.sent(),r=String(n),this.config.loggerProvider.error(r),[2,i=q(e,0,r)];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 ne(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[X.REVENUE_PRODUCT_ID]=this.productId,e[X.REVENUE_QUANTITY]=this.quantity,e[X.REVENUE_PRICE]=this.price,e[X.REVENUE_TYPE]=this.revenueType,e[X.REVENUE_CURRENCY]=this.currency,e[X.REVENUE]=this.revenue,e[X.RECEIPT]=this.receipt,e[X.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"}(X||(X={}));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,n,r,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!==(n=e.logLevel)&&void 0!==n?n: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!==(r=e.optOut)&&void 0!==r?r: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,n){if(void 0===e&&(e=""),void 0===t&&(t=ue().serverZone),void 0===n&&(n=ue().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:ue().serverZone;return{serverZone:r,serverUrl:de(r,n)}},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 n,r;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){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ye=function(e,t){return function(){var n,r,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){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},be=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=n(),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:{}};r&&c.states&&(c.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&c.states&&(c.states.after=r()),c.time&&(c.time.end=(new Date).toISOString()),l.debug(JSON.stringify(c,null,2))}):(r&&c.states&&(c.states.after=r()),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 ke=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 n,r=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(n=i.sent())&&n.length>0&&Promise.all(n.map(function(e){return r.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=V()),new Promise(function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"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,n,r,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=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),s=t,a=this.config.flushQueueSize,c=Math.max(a,1),r=s.reduce(function(e,t,n){var r=Math.floor(n/c);return e[r]||(e[r]=[]),e[r].push(t),e},[]),[4,r.reduce(function(t,n){return l(i,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}})})},Promise.resolve())]);case 1:return o.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var s,a,c})})},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),l(this,void 0,void 0,function(){var r,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")];r={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,r,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===(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: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 n;fe(e.statusCode)||null===(n=this.diagnosticsClient)||void 0===n||n.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 r=e.status;switch(r){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(r,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=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(r),o=t.filter(function(t,r){if(!i.has(r))return!0;n.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 n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(r),a=new Set(i),l=new Set(o),u=t.filter(function(t,r){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)))return l.has(r)&&(t.timeout=n.throttleTimeout),!0;n.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,n=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){var r,i,o;fe(t)?null===(o=this.diagnosticsClient)||void 0===o||o.increment("analytics.events.sent",e.length):(null===(r=this.diagnosticsClient)||void 0===r||r.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:n,stack_trace:ge()})),this.removeEvents(e),e.forEach(function(e){return e.callback(q(e.event,t,n))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(e){return e.event});this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){var t=new Set(e);this.queue=this.queue.filter(function(e){return!t.has(e)}),this.saveEvents()},e}();class xe{getApplicationContext(){return{versionName:this.versionName,language:Ce(),platform:"Web",os:void 0,deviceModel:void 0}}}const Ce=()=>"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||"";class Ee{constructor(){this.queue=[]}logEvent(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)}setEventReceiver(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(t=>{e(t)}),this.queue=[])}}const Ie=(e,t)=>{const n=["string","number","boolean","undefined"],r=typeof e;if(r!==typeof t)return!1;for(const i of n)if(i===r)return e===t;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;const i=Array.isArray(e),o=Array.isArray(t);if(i!==o)return!1;if(!i||!o){const n=Object.keys(e).sort(),r=Object.keys(t).sort();if(!Ie(n,r))return!1;let i=!0;return Object.keys(e).forEach(n=>{Ie(e[n],t[n])||(i=!1)}),i}for(let n=0;n<e.length;n++)if(!Ie(e[n],t[n]))return!1;return!0};Object.entries||(Object.entries=function(e){const t=Object.keys(e);let n=t.length;const r=new Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r});class Oe{constructor(){this.identity={userProperties:{}},this.listeners=new Set}editIdentity(){const e=this,t=Object.assign({},this.identity.userProperties),n=Object.assign(Object.assign({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut(e){return n.optOut=e,this},updateUserProperties:function(e){let t=n.userProperties||{};for(const[n,r]of Object.entries(e))switch(n){case"$set":for(const[e,n]of Object.entries(r))t[e]=n;break;case"$unset":for(const e of Object.keys(r))delete t[e];break;case"$clearAll":t={}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}}getIdentity(){return Object.assign({},this.identity)}setIdentity(e){const t=Object.assign({},this.identity);this.identity=Object.assign({},e),Ie(t,this.identity)||this.listeners.forEach(t=>{t(e)})}addIdentityListener(e){this.listeners.add(e)}removeIdentityListener(e){this.listeners.delete(e)}}const Te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self;class Pe{constructor(){this.identityStore=new Oe,this.eventBridge=new Ee,this.applicationContextProvider=new xe}static getInstance(e){return Te.analyticsConnectorInstances||(Te.analyticsConnectorInstances={}),Te.analyticsConnectorInstances[e]||(Te.analyticsConnectorInstances[e]=new Pe),Te.analyticsConnectorInstances[e]}}var Re=function(e){return Pe.getInstance(le(e))},Ae=function(){function e(){this.name="identity",this.type="before",this.identityStore=Re().identityStore}return e.prototype.execute=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(n){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=Re(e.instanceName).identityStore),[2]})})},e}(),Me=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},_e=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[f,t,e.substring(0,n)].filter(Boolean).join("_")},Ne=function(){var e,t,n,r;if("undefined"==typeof navigator)return"";var i=navigator.userLanguage;return null!==(r=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:i)&&void 0!==r?r:""},De=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 n=t.split("=",2),r=Le(n[0]),i=Le(n[1]);return i?(e[r]=i,e):e},{}):{}},Le=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Fe="AMP_PAGE_VIEW",Ue=Symbol.for("@amplitude/page-view-state"),je=function(e){return e||""},Be=function(){return z()},qe=function(e){var t;void 0===e&&(e=Be());try{var n=null===(t=null==e?void 0:e.sessionStorage)||void 0===t?void 0:t.getItem(Fe);if(!n)return;var r=JSON.parse(n);if(!r||"object"!=typeof r)return;return r}catch(e){return}},ze=function(e,t,n){var r;try{var i=e.sessionStorage;if(!i)return;var o=function(e){var t,n,r={};if(!e||"object"!=typeof e)return r;try{for(var i=c(Object.entries(e)),o=i.next();!o.done;o=i.next()){var s=d(o.value,2),a=s[0],l=s[1];"string"==typeof l&&(r[a]=l)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(null===(r=qe(e))||void 0===r?void 0:r.byApiKey),a=je(t);a&&(o[a]=n),i.setItem(Fe,JSON.stringify(s({pageViewId:n},Object.keys(o).length>0?{byApiKey:o}:{})))}catch(e){}},We=function(e,t){var n,r=Be();if(r){var i=je(e),o=null!==(n=r[Ue])&&void 0!==n?n:{byApiKey:{}},s=o.byApiKey[i];if(s&&s.href===t)return ze(r,e,s.pageViewId),s.pageViewId;var a=V();return o.byApiKey[i]={pageViewId:a,href:t},r[Ue]=o,ze(r,e,a),a}},Ve=function(e){var t,n,r=null===(n=null===(t=function(){var e;return null===(e=Be())||void 0===e?void 0:e[Ue]}())||void 0===t?void 0:t.byApiKey[je(e)])||void 0===n?void 0:n.pageViewId;return r||function(e){var t=qe();if(t){var n=je(e);if(n&&t.byApiKey&&"object"==typeof t.byApiKey){var r=t.byApiKey[n];return"string"==typeof r?r:void 0}return"string"==typeof t.pageViewId?t.pageViewId:void 0}}(e)},$e=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},Ke=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},He=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},Ge=function(e,t){var n=He(e.toString());return 31*Math.abs(n)%1e5/1e5<t},Je=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},Ye=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(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return l(this,void 0,void 0,function(){return u(this,function(n){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}(),Xe=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,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return t="AMP_TEST",n=s({},this.options),r=new e(n),i=String(Date.now()),[4,r.transaction(t,function(e){var n,r;try{e.set(i);var s=e.get()===i;return!s&&o.config.diagnosticsClient&&(null===(n=o.config.diagnosticsClient)||void 0===n||n.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===(r=o.config.diagnosticsClient)||void 0===r||r.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(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:return t=n.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var n=Qe(t);return void 0===n?void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t)):JSON.parse(n)}catch(n){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,n;return l(this,void 0,void 0,function(){var r,i,o,s,a,l,d,h,p;return u(this,function(u){switch(u.label){case 0:r=z(),i=r,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===(n=this.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(a=c(s),l=a.next();!l.done;l=a.next())if(d=l.value,Ze(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,n,r=this,i=z(),o=(null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[]).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 n;try{var i=a(t.substring(e.length+1));return i||null===(n=r.config.diagnosticsClient)||void 0===n||n.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(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var n;try{var r=z();if(!r||!r.document||"function"!=typeof r.btoa||"function"!=typeof r.encodeURIComponent)return;var i=null!==(n=this.options.expirationDays)&&void 0!==n?n: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(r.btoa(r.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)),r.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 n,r;return u(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];n="AMP_TLDTEST",r=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.transaction(n,function(n){if(e.cachedTlds[t])return!0;try{n.set(1);var r=!!n.get();return r&&(e.cachedTlds[t]=!0),r}finally{n.set(null)}})];case 2:return[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 n,r,i=this;return u(this,function(o){switch(o.label){case 0:if(n=function(){var e,t=z();return null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.locks}(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(e),r)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),Qe=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)},Ze=function(e,t){if(""===e&&""===t)return!0;if(!e||!t)return!1;var n=e.startsWith(".")?e.substring(1):e,r=t.startsWith(".")?t.substring(1):t;return n.toLowerCase()===r.toLowerCase()},et=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[f,t,e.substring(0,n)].filter(Boolean).join("_")},tt=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];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(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return l(this,void 0,void 0,function(){return u(this,function(r){try{null===(n=this.storage)||void 0===n||n.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(n){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}(),nt="tags",rt="counters",it="histograms",ot="events",st="internal",at="last_flush_timestamp",lt=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,n){var r=indexedDB.open(e.dbName,1);r.onerror=function(){e.dbPromise=null,n(new Error("Failed to open IndexedDB"))},r.onsuccess=function(){var n=r.result;n.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},n.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),n.close()},t(n)},r.onupgradeneeded=function(){var t=r.result;t?e.createTables(t):e.logger.debug("DiagnosticsStorage: Missing DB during upgrade.")}})},e.prototype.createTables=function(e){(e.objectStoreNames.contains(nt)||e.createObjectStore(nt,{keyPath:"key"}),e.objectStoreNames.contains(rt)||e.createObjectStore(rt,{keyPath:"key"}),e.objectStoreNames.contains(it)||e.createObjectStore(it,{keyPath:"key"}),e.objectStoreNames.contains(ot))||e.createObjectStore(ot,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(st)||e.createObjectStore(st,{keyPath:"key"})},e.prototype.setTags=function(e){return l(this,void 0,void 0,function(){var t,n,r,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(),n=t.transaction([nt],"readwrite"),r=n.objectStore(nt),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tags",e),t()},i.forEach(function(e){var t=d(e,2),n=t[0],i=t[1];r.put({key:n,value:i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tag",n,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,n,r,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(),n=t.transaction([rt],"readwrite"),r=n.objectStore(rt),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to increment counters",e),t()},i.forEach(function(e){var t=d(e,2),n=t[0],i=t[1],s=r.get(n);s.onsuccess=function(){var e=s.result,t=e?e.value:0;r.put({key:n,value:t+i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},s.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}})})];case 2:return 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,n,r,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(),n=t.transaction([it],"readwrite"),r=n.objectStore(it),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),t()},i.forEach(function(e){var t=d(e,2),n=t[0],i=t[1],s=r.get(n);s.onsuccess=function(){var e,t=s.result;e=t?{key:n,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:n,count:i.count,min:i.min,max:i.max,sum:i.sum},r.put(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},s.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}})})];case 2:return 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,n,r,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(),n=t.transaction([ot],"readwrite"),r=n.objectStore(ot),[2,new Promise(function(t){n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event records",e),t()};var i=r.count();i.onsuccess=function(){var t=i.result,n=Math.max(0,10-t);n<e.length&&o.logger.debug("DiagnosticsStorage: Only added ".concat(n," of ").concat(e.length," events due to storage limit")),e.slice(0,n).forEach(function(e){r.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 n,r,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 n=s.sent(),r=n.transaction([st],"readwrite"),i=r.objectStore(st),[2,new Promise(function(n,o){r.onabort=function(){return o(new Error("Failed to set internal value"))};var s=i.put({key:e,value:t});s.onsuccess=function(){return n()},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,n,r,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(),n=t.transaction([st],"readonly"),r=n.objectStore(st),[2,new Promise(function(t,i){n.onabort=function(){return i(new Error("Failed to get internal value"))};var o=r.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(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(at)];case 1:return[2,(e=n.sent())?parseInt(e.value,10):void 0];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(at,e.toString())];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).clear();i.onsuccess=function(){return n()},i.onerror=function(){return r(new Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return l(this,void 0,void 0,function(){var e,t,n,r,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([nt,rt,it,ot],"readwrite"),[4,Promise.all([this.getAllFromStore(t,nt),this.getAllFromStore(t,rt),this.getAllFromStore(t,it),this.getAllFromStore(t,ot)])];case 2:return n=d.apply(void 0,[l.sent(),4]),r=n[0],i=n[1],o=n[2],s=n[3],[4,Promise.all([this.clearTable(t,rt),this.clearTable(t,it),this.clearTable(t,ot)])];case 3:return l.sent(),[2,{tags:r,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(n,r){var i=e.objectStore(t).getAll();i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r(new Error("Failed to get all from ".concat(t)))}})},e}(),ut=function(e){var t,n,r=function(){var e=z();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]}();if(0!==r.length)try{for(var i=c(r),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&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},ct=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},dt=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},ht=3e5,pt=1e4,ft=function(){function e(e,t,n,r,i){void 0===n&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===n?"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(r,null,2)),this.config=s({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=Ge(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:lt.isSupported()?this.storage=new lt(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 n=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,r=null==t?void 0:t.stack,i=ut({filename:e.filename,stack:r});i&&n({type:"error",message:e.message,stack:r,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,r=e.reason instanceof Error?e.reason:void 0,i=null==r?void 0:r.stack,o=ct(i),s=ut({filename:o,stack:i});s&&n({type:"unhandledrejection",message:null!==(t=null==r?void 0:r.message)&&void 0!==t?t:dt(e.reason),stack:i,filename:o,errorName:null==r?void 0:r.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>=pt?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>=pt?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>=pt)this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");else{var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){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})},ht))},e.prototype.saveAllDataToStorage=function(){return l(this,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){switch(i.label){case 0:return this.storage?(e=s({},this.inMemoryTags),t=s({},this.inMemoryCounters),n=s({},this.inMemoryHistograms),r=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(n),this.storage.addEventRecords(r)])]):[2];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return l(this,void 0,void 0,function(){var e,t,n,r,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,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),s={},n.forEach(function(e){s[e.key]=e.value}),a={},r.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(n){switch(n.label){case 0:if(n.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 n.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=n.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,n;return u(this,function(r){switch(r.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return-1===(t=r.sent()||-1)?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(ht),[2]):(n=e-t)>=ht?(this._flush(),[2]):(this._setFlushTimer(ht-n),[2])}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=Ge(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),gt=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,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!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r: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}(),vt=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.customHeaders=t,n}return r(t,e),t.prototype.send=function(e,t){return l(this,void 0,void 0,function(){var n,r,i;return u(this,function(o){switch(o.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:s({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,(r=o.sent()).text()];case 2:i=o.sent();try{return[2,this.buildResponse(JSON.parse(i))]}catch(e){return[2,this.buildResponse({code:r.status})]}return[2]}})})},t}(gt);function mt(){return"undefined"!=typeof CompressionStream}function yt(e){return l(this,void 0,void 0,function(){var t,n;return u(this,function(r){switch(r.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];r.label=1;case 1:return r.trys.push([1,3,,4]),n=new Blob([e]).stream().pipeThrough(new t("gzip")),[4,new Response(n).arrayBuffer()];case 2:return[2,r.sent()];case 3:return r.sent(),[2,void 0];case 4:return[2]}})})}var bt=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 n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(Z(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){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 wt=401,St=403,kt=429,xt=function(){function e(t,n,r,i,o,s,a){void 0===r&&(r="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"===r?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=n,this.storage=a||new bt(t,n),this.customFetch=o}return e.prototype.subscribe=function(e,t,n){var r=V(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return-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(n){switch(n.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=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(n){t.sendCallback(n,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,n,r,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)}),n=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),null!==r.remoteConfig?this.sendCallback(e,r,"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 n,r;return u(this,function(i){switch(i.label){case 0:n=new Promise(function(e,n){setTimeout(function(){n("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=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(r,n,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 n,r,i,o,s,a,l=this;return u(this,function(c){switch(c.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){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 n=function(){var e=new Error("Remote config custom fetch aborted by timeout");e.name="AbortError",t(e)};m.addEventListener("abort",n,{once:!0}),v.then(function(t){m.removeEventListener("abort",n),e(t)},function(e){m.removeEventListener("abort",n),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===wt||h.status===St?(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!==kt&&(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?r<e-1?[4,new Promise(function(e){return setTimeout(e,l.getJitterDelay(n))})]:[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,r]}})})},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}(),Ct=z(),Et=null==Ct?void 0:Ct.console,It={},Ot={},Tt=!1;var Pt,Rt={addListener:function(e,t){var n,r=(n=e,!!Et&&"function"==typeof Et[n]&&(Ot[n]||(Ot[n]=Et[n],Et[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(It[n]&&!Tt){Tt=!0;var r=It[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return Tt=!1,Ot[n].apply(Et,e)}),!0));if(!r)return new Error("Console override failed");It[e]?It[e].push(t):It[e]=[t]},removeListener:function(e){var t,n;try{for(var r=c(Object.values(It)),i=r.next();!i.done;i=r.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&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var n=c(Object.entries(Ot)),r=n.next();!r.done;r=n.next()){var i=d(r.value,2),o=i[0],s=i[1];s&&(Et[o]=s)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}Ot={},It={}}};!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(Pt||(Pt={}));var At=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Mt="data-amp-track-",_t=["div","span","h1","h2","h3","h4","h5","h6"],Nt=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),Dt=Nt,Lt=Nt,Ft=["*"];function Ut(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function jt(e,t,n){e&&Bt({json:e,allowlist:t.map(qt),excludelist:n.map(qt),ancestors:[]})}function Bt(e){var t,n,r=e.json,i=e.targetObject,o=e.allowlist,s=e.excludelist,a=e.ancestors,l=e.parentObject,u=e.targetKey;i||(i=r);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);Ut(i[v])?Wt(m,o)&&!Wt(m,s)||delete i[v]:Bt({json:r,targetObject:i[v],allowlist:o,excludelist:s,ancestors:m,parentObject:i,targetKey:v})}}catch(e){t={error:e}}finally{try{g&&!g.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}0===Object.keys(i).length&&l&&u&&delete l[u]}function qt(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function zt(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&"**"===t[r];)r++;return r===t.length}var i=t[r];if("**"===i){if(r+1===t.length)return!0;for(var o=n;o<=e.length;o++)if(zt(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&zt(e,t,n+1,r+1)}function Wt(e,t){return t.some(function(t){return zt(e,t)})}var Vt=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;void 0===e&&(e=[]);var r=this.request.headers,i={};if(Array.isArray(r))r.forEach(function(e){var t=d(e,2),n=t[0],r=t[1];i[n]=r});else if(r instanceof Headers)r.forEach(function(e,t){i[t]=e});else if("object"==typeof r&&null!==r)try{for(var o=c(Object.entries(r)),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&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return Qt(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=Kt(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(n){return 0===e.length?[2,null]:[2,Yt(this.body,e,t)]})})},e}(),$t=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),Qt(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return Kt(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(n){return 0===e.length?[2,null]:[2,Yt(this.body,e,t)]})})},e}();function Kt(e,t){var n,r,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){n={error:e}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}i=u}else if("undefined"!=typeof ReadableStream&&e instanceof ReadableStream)return void(a=e);return i}}var Ht,Gt=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 n=this.response.headers,r={};return null===(t=null==n?void 0:n.forEach)||void 0===t||t.call(n,function(e,t){r[t]=e}),Qt(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},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(n){switch(n.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),n.label=1;case 1:return n.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,n.sent()];case 3:return n.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(n){switch(n.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,Yt(n.sent(),e,t)]}})})},e}(),Jt=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(void 0===e&&(e=[]),!this.headersString)return{};var r={},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&&(r[l]=u)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return Qt(r,{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 n;return u(this,function(r){return 0===e.length?[2,null]:(n=this.getJson())?(jt(n,e,t),[2,n]):[2,null]})})},e}();function Yt(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return jt(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(Ht||(Ht={}));var Xt="[REDACTED]",Qt=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,s=t.strategy,a=void 0===s?Ht.REMOVE:s,l=h([],d(N),!1),u={},p=function(t){var n=t.toLowerCase();l.find(function(e){return e.toLowerCase()===n})?a===Ht.REDACT&&(u[t]=Xt):o.find(function(e){return e.toLowerCase()===n})?u[t]=e[t]:a===Ht.REDACT&&(u[t]=Xt)};try{for(var f=c(Object.keys(e)),g=f.next();!g.done;g=f.next()){p(g.value)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}return u},Zt=function(){function e(e,t,n,r,i,o,s,a,l,u,c){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,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,n,r,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===(n=this.responseWrapper)||void 0===n?void 0:n.headers(h([],d(_),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter(function(e){var t=d(e,2);return t[0],void 0!==t[1]}))},e}();var en=function(e,t){void 0===t&&(t=V()),this.callback=e,this.id=t};function tn(e){try{e()}catch(e){}}var nn=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=z();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=z();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,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===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.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(n){try{n.callback(e)}catch(e){tn(function(){var n;null===(n=t.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,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==n?void 0:n.method)||d,r&&(u=r.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 Zt(e,d,o,o,l,n,u,p,r,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(n,r){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){tn(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(n,r)];case 2:return i=l.sent(),[3,4];case 3:return s=l.sent(),o=s,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new Vt(r):void 0,i?new Gt(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){tn(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 n;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&"InvalidStateError"===n.name&&tn(function(){var n;return null===(n=t.logger)||void 0===n?void 0:n.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))}),null}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=d(n,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){tn(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,n)},i.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];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"),n=new Jt(i.status,e,t?parseInt(t,10):void 0,s),r=i.$$AmplitudeAnalyticsEvent.headers,u=new $t(a,r);l.status=i.status,o.handleNetworkRequestEvent("xhr",{url:l.url,method:l.method},u,n,void 0,l.startTime,l.durationStart)}catch(e){tn(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),n.apply(i,t)},i.setRequestHeader=function(e,t){try{var n=this.$$AmplitudeAnalyticsEvent;n&&(n.headers[e]=t)}catch(e){tn(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}r.apply(this,[e,t])}}},e}(),rn=new nn,on=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({},M),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=De();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=De();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[T]=t[T],e[P]=t[P],e[R]=t[R],e[A]=t[A],e},e}(),sn="data-amp-mask",an="*****",ln=/\b(?:\d[ -]*?){13,16}\b/,un=/(\d{3}-?\d{2}-?\d{4})/g,cn=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,dn=function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var i=e;i=(i=(i=i.replace(ln,an)).replace(un,an)).replace(cn,an);try{for(var o=c(t),s=o.next();!s.done;s=o.next()){var a=s.value;try{i=i.replace(a,an)}catch(e){}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},hn=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(sn)?an:e?e(document.title):document.title},pn={};Object.defineProperty(pn,"__esModule",{value:!0}),pn.Observable=void 0;const fn=e=>Boolean(Symbol[e]),gn=e=>fn(e)?Symbol[e]:"@@"+e,vn=gn("iterator"),mn=gn("observable"),yn=gn("species");function bn(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function wn(e){let t=e.constructor;return void 0!==t&&(t=t[yn],null===t&&(t=void 0)),void 0!==t?t:Tn}function Sn(e){Sn.log?Sn.log(e):setTimeout(()=>{throw e})}function kn(e){Promise.resolve().then(()=>{try{e()}catch(e){Sn(e)}})}function xn(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=bn(t,"unsubscribe");e&&e.call(t)}}catch(e){Sn(e)}}function Cn(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function En(e,t,n){e._state="running";let r=e._observer;try{let i=bn(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(Cn(e),!i)throw n;i.call(r,n);break;case"complete":Cn(e),i&&i.call(r)}}catch(e){Sn(e)}"closed"===e._state?xn(e):"running"===e._state&&(e._state="ready")}function In(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void kn(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(En(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void En(e,t,n);e._queue.push({type:t,value:n})}}class On{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){In(n,"next",e)},error(e){In(n,"error",e)},complete(){In(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(Cn(this),xn(this))}}class Tn{constructor(e){if(!(this instanceof Tn))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 On(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(new TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(wn(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(wn(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=wn(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let s=!r;if(r=!0,!s||n)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!r&&!n)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=wn(this);return new t(n=>{let r,i=0;return function o(s){r=s.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=wn(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let s=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(s);e>=0&&r.splice(e,1),o()}});r.push(s)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[mn](){return this}static from(e){let t="function"==typeof this?this:Tn;if(null==e)throw new TypeError(e+" is not an object");let n=bn(e,mn);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof Tn}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(fn("iterator")&&(n=bn(e,vn),n))return new t(t=>{kn(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{kn(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:Tn)(t=>{kn(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[yn](){return this}}pn.Observable=Tn,Object.defineProperty(Tn,Symbol("extensions"),{value:{symbol:mn,hostReportError:Sn},configurable:!0});var Pn=pn.Observable;function Rn(e,t){return new Pn(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function An(e,t){return new Pn(function(n){var r=!1,i=new Set,o=function(){var e,t;r=!0;try{for(var n=c(i),o=n.next();!o.done;o=n.next()){var s=o.value;try{s.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},s=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),o())},complete:function(){i.delete(t),r||0!==i.size||(n.complete(),o(),r=!0)}});i.add(t)};return s(e),s(t),o})}function Mn(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new Pn(function(i){return t.add(i),null===n&&(n=e.subscribe({next:function(e){var n,r,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){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},error:function(e){var n,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){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,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&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var _n,Nn="https://app.amplitude.com",Dn={US:Nn,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var Ln="__AMPLITUDE_MESSENGER_INSTANCE__",Fn="__AMPLITUDE_MESSENGER__",Un=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?Nn:t;this[_n]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,s){r.requestCallbacks[i]={resolve:t,reject:s},r.notify(o),n.timeout>0&&setTimeout(function(){s(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.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 n,r,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){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return l(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.scriptLoadPromises.delete(e),r;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,s=i.endpoint;o&&(this.logger=o),s&&this.endpoint===Nn&&(this.endpoint=s),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,s;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.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=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(a);else{if("ping"===l)return void r.notify({action:"pong"});var u=r.actionHandlers.get(l);if(u)u(a.data);else{var c=null!==(s=r.pendingMessages.get(l))&&void 0!==s?s:[];c.push(a.data),r.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[Fn])===this&&delete e[Fn]},e}();function jn(e){var t,n=z(),r=null==n?void 0:n[Fn];if("object"==typeof(t=r)&&null!==t&&Ln in t&&!0===t[Ln])return r;var i=new Un(e);return n&&(n[Fn]=i),i}_n=Ln;var Bn=["desktop","tablet","mobile"],qn="__AMPLITUDE_BACKGROUND_CAPTURE__";function zn(e,t){var n,r=e;if(!0!==r[qn]){r[qn]=!0;var i=null!==(n=null==t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.1.0.js.gz",o=null,a=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(t){var n,r;null===(r=null===(n=e.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Initializing background capture (external script)");var l=new URL(i,e.endpoint).toString(),u=t&&"object"==typeof t?function(e){if("string"==typeof e)return Bn.includes(e)?e:void 0}(t.deviceMode):void 0;e.loadScriptOnce(l).then(function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),o=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,s({messenger:e,onBackgroundCapture:a},void 0!==u?{initialDeviceMode:u}:{})),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 Wn={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function Vn(e,t,n){var r,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){n.warn("Invalid regex pattern: ".concat(l),e)}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return e.concat(o)}function $n(e){var t,n,r,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),$n(S)}catch(e){}}}catch(e){t={error:e}}finally{try{b&&!b.done&&(n=y.return)&&n.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,T=null!==(p=C[O])&&void 0!==p?p:{},P=T.captureSafeHeaders,R=T.allowlist;(P||R)&&(void 0===R||Array.isArray(R)?C[O]=h(h([],d(P?_:[]),!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){r={error:e}}finally{try{x&&!x.done&&(i=k.return)&&i.call(k)}finally{if(r)throw r.error}}}catch(e){}void 0!==(null===(f=e.autocapture)||void 0===f?void 0:f.pageViews)&&(e.autocapture.screenViews=e.autocapture.pageViews);var A=null===(g=e.autocapture)||void 0===g?void 0:g.frustrationInteractions;A&&(A.rageClick&&(A.rageClicks=A.rageClick,delete A.rageClick),A.deadClick&&(A.deadClicks=A.deadClick,delete A.deadClick),A.errorClick&&(A.errorClicks=A.errorClick,delete A.errorClick));try{var M=null===(v=e.autocapture)||void 0===v?void 0:v.elementInteractions;if(M&&"object"==typeof M&&(!0===M.viewportContentUpdated&&(M.viewportContentUpdated={}),!1===M.viewportContentUpdated&&(M.viewportContentUpdated={enabled:!1}),void 0!==M.exposureDuration)){var N=M.viewportContentUpdated;void 0===N?M.viewportContentUpdated={exposureDuration:M.exposureDuration}:"object"==typeof N&&void 0===N.exposureDuration&&!1!==N.enabled&&(N.exposureDuration=M.exposureDuration),delete M.exposureDuration}}catch(e){}}}var Kn=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])&&(!function(){var e,t,n=z();return"string"==typeof(null===(t=null===(e=null==n?void 0:n.chrome)||void 0===e?void 0:e.runtime)||void 0===t?void 0:t.id)}()||!!(null==e?void 0:e[t]))},Hn=function(e){return Kn(e,"attribution")},Gn=function(e){return Kn(e,"formInteractions")},Jn=function(e){return Kn(e,"pageViews")},Yn=function(e){return Kn(e,"sessions")},Xn=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},Qn=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},Zn=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.webVitals;return"object"==typeof t&&null!==t?t:void 0}},er=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},tr=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}},nr=function(e){if(Qn(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},rr=function(e){if(er(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},ir=function(e){if(Xn(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:(n=null==t?void 0:t.captureRules,r=e.loggerProvider,null==n?void 0:n.map(function(e){var t,n;if((null===(t=e.urls)||void 0===t?void 0:t.length)&&(null===(n=e.hosts)||void 0===n?void 0:n.length)){var i=JSON.stringify(e.hosts),o=JSON.stringify(e.urls);return null==r||r.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 n,r},or=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return Jn(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}},sr=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,s=r.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},ar=function(e){return e&&void 0!==e._q};var lr="2.48.1",ur="amplitude-ts",cr=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(ur,"/").concat(lr),"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,n;return l(this,void 0,void 0,function(){var r,i,o;return u(this,function(a){return r=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,o=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=r),[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:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Ne()}),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}(),dr=1e3,hr=function(e){function t(t){var n,r,i,o=this;try{i=null===(n=z())||void 0===n?void 0:n.localStorage}catch(e){null===(r=null==t?void 0:t.loggerProvider)||void 0===r||r.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 r(t,e),t.prototype.set=function(t,n){var r;return l(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>dr?(i=n.length-dr,[4,e.prototype.set.call(this,t,n.slice(0,dr))]):[3,2];case 1:return o.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(dr,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(tt),pr=function(e){function t(){var t;return e.call(this,null===(t=z())||void 0===t?void 0:t.sessionStorage)||this}return r(t,e),t}(tt),fr=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return r(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),l(this,void 0,void 0,function(){var r=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===r.state.done){var e=a.responseText;try{i(r.buildResponse(JSON.parse(e)))}catch(e){i(r.buildResponse({code:a.status}))}}};var h={"Content-Type":"application/json",Accept:"*/*"},p=JSON.stringify(t),f=n&&p.length>=2048&&mt(),g=function(e){var t,n;h=s(s({},r.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&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}a.send(e)};l(r,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return f?[4,yt(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}(gt),gr=function(e){function t(t,n,r){void 0===t&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=!1!==n,i.referrerPolicy=r,i}return r(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),l(this,void 0,void 0,function(){var r,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 r=JSON.stringify(t),i=n&&r.length>=2048&&mt(),o=r,a={"Content-Type":"application/json",Accept:"*/*"},i?[4,yt(r)]:[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}(gt),vr=function(e){function t(){return e.call(this)||this}return r(t,e),t.prototype.send=function(e,t,n){return l(this,void 0,void 0,function(){var n=this;return u(this,function(r){return[2,new Promise(function(r,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 r(o.navigator.sendBeacon(e,s)?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(gt),mr=function(e,t,n){return void 0===n&&(n=!0),l(void 0,void 0,void 0,function(){var r,i,o,s,a,l,c,h,p;return u(this,function(u){switch(u.label){case 0:return r=function(e){return"".concat(f.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=u.sent())?n?[4,t.remove(r)]:[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:br(a),sessionId:yr(c),lastEventId:yr(p),lastEventTime:yr(h),optOut:Boolean(l)}]}})})},yr=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},br=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},wr="[Amplitude]",Sr="".concat(wr," Form Started"),kr="".concat(wr," Form Submitted"),xr="".concat(wr," File Downloaded"),Cr="session_start",Er="session_end",Ir="".concat(wr," File Extension"),Or="".concat(wr," File Name"),Tr="".concat(wr," Link ID"),Pr="".concat(wr," Link Text"),Rr="".concat(wr," Link URL"),Ar="".concat(wr," Form ID"),Mr="".concat(wr," Form Name"),_r="".concat(wr," Form Destination"),Nr="cookie",Dr=Object.freeze({__proto__:null,get IdentifyOperation(){return i},get SpecialEventType(){return o},get RevenueProperty(){return X},get LogLevel(){return oe},get ServerZone(){return Pt},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:At,DEFAULT_DATA_ATTRIBUTE_PREFIX:Mt,DEFAULT_ACTION_CLICK_ALLOWLIST:_t,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Wn}),Lr=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Fr=function(e,t,n,r,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=n.excludeInternalReferrers;if(f){var g=jr(f,r);if(!(g instanceof TypeError)&&e.referring_domain&&Wr(e.referring_domain,o)){if("always"===g)return Br(g,e.referring_domain,r),!1;if("ifEmptyCampaign"===g&&(d=s(s({},e),{referring_domain:void 0,referrer:void 0}),Object.values(d).every(function(e){return!e})))return Br(g,e.referring_domain,r),!1}}if(Ur(n.excludeReferrers,e.referring_domain))return r.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 r.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=Lr(l||"")!==Lr(h||""),y=!t||v||m;return y?r.debug("This is a new campaign. An $identify event will be sent."):r.debug("This is not a new campaign because it's the same as the previous one."),y},Ur=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})},jr=function(e,t){if(!0===e)return Wn.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(Wn).includes(n))return n;if(void 0===n)return Wn.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),new TypeError(r)};function Br(e,t,n){var r="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?n.debug(r):"ifEmptyCampaign"===e&&n.debug("".concat(r," with empty campaign parameters"))}var qr=["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"],zr=function(e){var t,n,r=e||(null===(n=null===(t=z())||void 0===t?void 0:t.location)||void 0===n?void 0:n.hostname);if(!r)return"";var i=r.split("."),o=i[i.length-1],s=i[i.length-2];return qr.find(function(e){return r.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],s=i[i.length-3]),s?"".concat(s,".").concat(o):o},Wr=function(e,t){var n=z();if(!n)return!1;var r,i,o,s=(t||"").trim()||zr(n.location.hostname);return r=e,o=(i=s).startsWith(".")?i:".".concat(i),!!(r.startsWith(".")?r:".".concat(r)).endsWith(o)},Vr=function(e){function t(t,n,r,i,o,s,a,l,u,c,d,h,p,f,g,v,m,y,b,w,S,k,x,C,E,I,O,T,P,R,A,M,_,N,D,L,F,U,j,B,q,z,W,V){void 0===r&&(r=new Ye),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=Nr),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="US"),void 0===O&&(O=18e5),void 0===T&&(T=new hr({loggerProvider:v})),void 0===P&&(P={ipAddress:!0,language:!0,platform:!0}),void 0===R&&(R="fetch"),void 0===A&&(A=!1),void 0===M&&(M=!0),void 0===U&&(U=!0),void 0===j&&(j=0),void 0===W&&(W=!1);var $,K=this;(K=e.call(this,{apiKey:t,instanceName:p,storageProvider:T,transportProvider:Hr(R)})||this).apiKey=t,K.appVersion=n,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=T,K.trackingOptions=P,K.transport=R,K.useBatch=A,K.fetchRemoteConfig=M,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.version=lr,K._optOut=!1,K._cookieStorage=r,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 H=null!==($=null==q?void 0:q.fetchRemoteConfig)&&void 0!==$?$:M;return K.remoteConfig=K.remoteConfig||{},K.remoteConfig.fetchRemoteConfig=H,K.fetchRemoteConfig=H,K.topLevelDomain=z||zr(),K}return r(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 Xe&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(_e(this.apiKey),e)},t}(ce),$r=function(e,t,n,r,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,T,P,R,A,M,_,N,D,L,F,U,j,B,q,z,W,$,K,H,G,J,Y,X,Q,Z,ee,te,ne,re,ie;return u(this,function(u){switch(u.label){case 0:return o=t.identityStorage||Nr,a="",o!==Nr||(null===(T=t.cookieOptions)||void 0===T?void 0:T.domain)||""===(null===(P=t.cookieOptions)||void 0===P?void 0:P.domain)?[3,2]:[4,Gr(void 0,r)];case 1:a=u.sent(),u.label=2;case 2:return l=s({domain:null!==(A=null===(R=t.cookieOptions)||void 0===R?void 0:R.domain)&&void 0!==A?A:a,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},t.cookieOptions),c={duplicateResolverFn:function(e){var t=Qe(e);if(!t)return!1;var n=JSON.parse(t);return Ze(n.cookieDomain,l.domain)},diagnosticsClient:r},d=Kr(t.identityStorage,l,c),[4,mr(e,d,null===(_=null===(M=t.cookieOptions)||void 0===M?void 0:M.upgrade)||void 0===_||_)];case 3:return h=u.sent(),[4,d.get(_e(e))];case 4:return p=u.sent(),f=De(),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!==(K=null!==($=t.userId)&&void 0!==$?$:null==p?void 0:p.userId)&&void 0!==K?K:h.userId,n.previousSessionDeviceId=null!==(H=null==p?void 0:p.deviceId)&&void 0!==H?H:h.deviceId,n.previousSessionUserId=null!==(G=null==p?void 0:p.userId)&&void 0!==G?G:h.userId,C={ipAddress:null===(Y=null===(J=t.trackingOptions)||void 0===J?void 0:J.ipAddress)||void 0===Y||Y,language:null===(Q=null===(X=t.trackingOptions)||void 0===X?void 0:X.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 Vr(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!==(ne=null==i?void 0:i.serverZone)&&void 0!==ne?ne:t.serverZone,S,k,t.sessionTimeout,t.storageProvider,C,t.transport,t.useBatch,t.fetchRemoteConfig,x,E,I,t.networkTrackingOptions,t.identify,null!==(re=null==i?void 0:i.enableDiagnostics)&&void 0!==re?re:t.enableDiagnostics,null!==(ie=null==i?void 0:i.diagnosticsSampleRate)&&void 0!==ie?ie:n._diagnosticsSampleRate,r,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 Ye),[2,O]}})})},Kr=function(e,t,n){switch(void 0===e&&(e=Nr),void 0===t&&(t={}),e){case"localStorage":return new hr;case"sessionStorage":return new pr;case"none":return new Ye;default:return new Xe(s(s({},t),{expirationDays:t.expiration}),n)}},Hr=function(e){var t="object"==typeof e?e.type:e,n="object"==typeof e?e.headers:void 0,r="object"==typeof e?e.enableKeepalive:void 0,i="object"==typeof e?e.referrerPolicy:void 0;return"xhr"===t?new fr(n):"beacon"===t?new vr:new gr(n,r,i)},Gr=function(e,t){return l(void 0,void 0,void 0,function(){var n,r,i,o,s,a,l;return u(this,function(u){switch(u.label){case 0:return[4,new Xe(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!u.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];if(n=null!=e?e:location.hostname,1===(r=n.split(".")).length)return[2,""];for(i=[],o=1,qr.find(function(e){return n.endsWith(".".concat(e))})&&(o=2),s=r.length-o-1;s>=0;--s)i.push(r.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,Xe.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(n)}),[2,""]}})})},Jr=function(e){var t;void 0===e&&(e={});var n,r,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,n,r;return u(this,function(i){switch(i.label){case 0:return t=g("undefined"!=typeof location&&location.href||""),r={event_type:f},n=[{}],[4,Xr()];case 1:return[2,(r.event_properties=s.apply(void 0,[s.apply(void 0,n.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":hn(dn),"[Amplitude] Page URL":t.split("?")[0],"[Amplitude] Page View ID":e}]),r)]}})})},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,i,s,a,l;return u(this,function(u){switch(u.label){case 0:return e=location.href,i=Zr(h,e,y||"")&&m(),y=e,i?(s=void 0,r&&(s=We(n.apiKey,Yr())),null==o||o.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return l=(a=t).track,[4,v(s)];case 2:l.apply(a,[u.sent()]),u.label=3;case 3:u.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,n=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),a=!0,i){try{r=new tt(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,n){var r=d(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),a&&b()}})}return m()?(o.log("Tracking page view event"),l=void 0,r&&(l=We(n.apiKey,Yr())),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;return u(this,function(a){switch(a.label){case 0:return"attribution"===c&&Qr(e)?(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,r&&(t=Ve(n.apiKey)),[4,v(t)]):[3,2];case 1:i=a.sent(),e.event_type=i.event_type,e.event_properties=s(s({},e.event_properties),i.event_properties),a.label=2;case 2:return n&&e.event_type===f&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=s(s({},e.event_properties),{"[Amplitude] Page Counter":n.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},Yr=function(){return"undefined"!=typeof location&&location.href||""},Xr=function(){return l(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return e=Je,[4,(new on).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},Qr=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[i.SET]||{},r=t[i.UNSET]||{},o=h(h([],d(Object.keys(n)),!1),d(Object.keys(r)),!1);return Object.keys(M).every(function(e){return o.includes(e)})}return!1},Zr=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname}return t!==n},ei=function(){var e,t,n=[],r=function(e,t,r){e.addEventListener(t,r),n.push({element:e,type:t,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(n,i){return l(void 0,void 0,void 0,function(){var o,s;return u(this,function(a){return t=function(e){if(Gn(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions}(n),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;r(e,"change",function(){var t,n=ni(e);s||i.track(Sr,((t={})[Ar]=ti(e.id),t[Mr]=ti(e.name),t[_r]=n,t)),s=!0}),r(e,"submit",function(r){var o,a,l=ni(e);if(s||i.track(Sr,((o={})[Ar]=ti(e.id),o[Mr]=ti(e.name),o[_r]=l,o)),s=!0,void 0!==(null==t?void 0:t.shouldTrackSubmit))if("function"==typeof t.shouldTrackSubmit&&"undefined"!=typeof SubmitEvent&&r instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(r))return}catch(e){n.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else n.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(kr,((a={})[Ar]=ti(e.id),a[Mr]=ti(e.name),a[_r]=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){n.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(e)))}})})}),e.observe(document.body,{subtree:!0,childList:!0}))}}else n.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):n.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(),n.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),n=[],[2]})})}}},ti=function(e){if("string"==typeof e)return e},ni=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},ri=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return l(void 0,void 0,void 0,function(){var i,o;return u(this,function(s){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(n.href),s=null==i?void 0:i[1];s&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",function(){var t;s&&r.track(xr,((t={})[Ir]=s,t[Or]=n.pathname,t[Tr]=e.id,t[Pr]=e.text,t[Rr]=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){n.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(e)))}})})}),e.observe(document.body,{subtree:!0,childList:!0}))}}else n.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):n.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(n){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),t=[],[2]})})}}},ii=!1,oi=function(){var e=z(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))};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(r){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,n("online",function(){!1!==e.offline&&(e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),n("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2])})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(n){return t.forEach(function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)}),t=[],[2]})})}}};function si(e,t){var n,r;if(e){$n(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===(n=i.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===n?void 0:n.length)){o.elementInteractions=s({},i.autocapture.elementInteractions);var a=o.elementInteractions,l=null!==(r=a.pageUrlAllowlist)&&void 0!==r?r:[],u=i.autocapture.elementInteractions.pageUrlAllowlistRegex;a.pageUrlAllowlist=Vn(l,u,t.loggerProvider),delete a.pageUrlAllowlistRegex}var d=function(e,t){var n,r,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=Vn(null!==(a=p.urls)&&void 0!==a?a:[],p.urlsRegex,t),delete p.urlsRegex}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.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 ai="1.30.4",li="[Amplitude] Element Clicked",ui="[Amplitude] Element Tag",ci="[Amplitude] Element Text",di="[Amplitude] Page URL",hi="[Amplitude] Viewport Height",pi="[Amplitude] Viewport Width",fi="[Amplitude] Page View ID",gi="data-amp-mask-attributes",vi="data-amp-internal-shadow";function mi(e,t){var n=e.getAttribute(t.explicitTrackingAttribute);if(null!==n&&""===n)return null;var r=e.getAttribute("id");return null===r||""===r?null:function(e,t){var n,r;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){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0}(r,t.autogeneratedIdPatterns)?r:null}function yi(e,t){return t.map(bi).join(" > ")}function bi(e){var t=e.tagName.toLowerCase(),n=e.parentElement;if(null===n)return t;var r=function(e,t){for(var n=0,r=0;r<t.children.length;r++){var i=t.children[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}(e,n);return"".concat(t,":nth-of-type(").concat(r,")")}var wi=":scope > ";function Si(e){var t;return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot||null!=e&&11===e.nodeType&&1===(null===(t=e.host)||void 0===t?void 0:t.nodeType)}function ki(e){var t,n=e.getRootNode();return Si(n)?n:null!==(t=e.ownerDocument)&&void 0!==t?t:document}function xi(e,t){var n,r,i,o;return u(this,function(s){switch(s.label){case 0:n=e,r=0,i=0,s.label=1;case 1:return null!==n&&i<1024?(i+=1,[4,n]):[3,3];case 2:return s.sent(),n.parentElement?(n=n.parentElement,[3,1]):r<t&&"function"==typeof n.getRootNode&&(o=function(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return Si(t)?t.host:null}(n),o&&o!==n)?(r+=1,n=o,[3,1]):[3,3];case 3:return[2]}})}function Ci(e,t){var n=[];if(t<=0)return n;for(var r=[[e,0]],i=0;r.length&&i<5e4;){i+=1;var o=d(r.pop(),2),s=o[0],a=o[1],l=s.shadowRoot;if(l&&a+1<=t){n.push({root:l,depth:a+1});for(var u=l.children,c=0;c<u.length;c++)r.push([u[c],a+1])}var h=s.children;for(c=0;c<h.length;c++)r.push([h[c],a])}return n}function Ei(e,t){for(var n=[],r=e,i=0;null!==r&&i<1024;){i+=1;var o=ki(r);n.push({root:o,target:r});var s=r.getRootNode();if(!Si(s))break;r=s.host}var a=n.length-1,l=!1,u=n;return a>t&&(u=n.slice(a-t),l=!0),{segments:u.reverse(),truncated:l}}function Ii(e,t){var n=e.tagName.toLowerCase(),r=e.parentElement;if(null===r){var i=e.getRootNode();return t&&Si(i)?"".concat(n,":nth-of-type(").concat(Oi(e,i.children),")"):n}return"".concat(n,":nth-of-type(").concat(Oi(e,r.children),")")}function Oi(e,t){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}var Ti={name:"explicitTrackingAttribute",try:function(e,t){var n=t.config.explicitTrackingAttribute,r=e.getAttribute(n);return null===r||""===r?null:"[".concat(n,"=").concat(JSON.stringify(r),"]")}};function Pi(e){var t=globalThis.CSS;if(t&&"function"==typeof t.escape)return t.escape(e);for(var n=String(e),r=n.length,i="",o=0;o<r;o++){var s=n.charCodeAt(o);0!==s?s>=1&&s<=31||127===s||0===o&&s>=48&&s<=57||1===o&&s>=48&&s<=57&&45===n.charCodeAt(0)?i+="\\".concat(s.toString(16)," "):i+=0!==o||1!==r||45!==s?s>=128||45===s||95===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?n.charAt(o):"\\".concat(n.charAt(o)):"\\-":i+="�"}return i}function Ri(e){return Pi(e)}var Ai={name:"stableId",try:function(e,t){var n=mi(e,t.config);return null===n?null:"".concat(e.tagName.toLowerCase(),"#").concat(Ri(n))}},Mi=!1,_i=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:Mi,maxShadowDomDepth:1});function Ni(e){var t;return s(s({},e),{shadowDomEnabled:null!==(t=e.shadowDomEnabled)&&void 0!==t?t:Mi,maxShadowDomDepth:Li(e.maxShadowDomDepth)})}function Di(e,t){if(!e)return Fi();var n,r=Fi();return"boolean"==typeof e.enabled&&(r.enabled=e.enabled),"string"==typeof e.explicitTrackingAttribute&&""!==e.explicitTrackingAttribute&&(r.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(r.autogeneratedIdPatterns=function(e,t){var n,r,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){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(r.unstableClassPatterns=function(e,t){var n,r,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){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.unstableClassPatterns,t)),r.maxAncestorWalkDepth="number"!=typeof(n=e.maxAncestorWalkDepth)?void 0:Number.isFinite(n)?n<=0?void 0:Math.floor(n):void 0,"boolean"==typeof e.shadowDomEnabled&&(r.shadowDomEnabled=e.shadowDomEnabled),r.maxShadowDomDepth=Li(e.maxShadowDomDepth),Ni(r)}function Li(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}function Fi(){return{enabled:_i.enabled,explicitTrackingAttribute:_i.explicitTrackingAttribute,autogeneratedIdPatterns:h([],d(_i.autogeneratedIdPatterns),!1),unstableClassPatterns:h([],d(_i.unstableClassPatterns),!1),maxAncestorWalkDepth:_i.maxAncestorWalkDepth,shadowDomEnabled:_i.shadowDomEnabled,maxShadowDomDepth:_i.maxShadowDomDepth}}var Ui=[Ti,Ai];function ji(e,t,n){var r,i,o,s,a;void 0===n&&(n={});var l=Ni(t),u=null!==(o=n.strategies)&&void 0!==o?o:Ui,d=null!==(a=null!==(s=n.scope)&&void 0!==s?s:e.ownerDocument)&&void 0!==a?a:document,h={scope:d,config:l},p=function(e,t){var n=[],r=e;for(;null!==r&&(n.push(r),!(void 0!==t&&n.length>t));)r=r.parentElement;return n}(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=yi(0,p.slice(0,m).reverse()),S="".concat(b," > ").concat(w);if(Bi(d,S,e,v.name,n.logger))return S}else if(Bi(d,b,e,v.name,n.logger))return b}}catch(e){r={error:e}}finally{try{g&&!g.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}return null}function Bi(e,t,n,r,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(r,'" emitted a malformed selector "').concat(t,'" (').concat(s,")")),!1}return 1===o.length&&o[0]===n}function qi(e,t,n){var r;try{r=e.querySelectorAll(t)}catch(e){return!1}return 1===r.length&&r[0]===n}var zi=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),Wi=function(e,t,n){var r,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute("id");if(t){if(o)return new zi($i(o),!0);var s=e.tagName.toLowerCase();if("body"===s||"head"===s||"html"===s)return new zi(s,!0)}var a=e.tagName.toLowerCase();if(o)return new zi(a+$i(o),!0);var l=e.parentNode;if(!l||l.nodeType===Node.DOCUMENT_NODE)return new zi(a,!0);for(var u=Vi(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=Vi(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(n&&"input"===a.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(k+="[type="+Pi(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+="."+Pi(C.value.slice(1))}}catch(e){r={error:e}}finally{try{C&&!C.done&&(i=x.return)&&i.call(x)}finally{if(r)throw r.error}}return new zi(k,!1)},Vi=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},$i=function(e){return"#"+Pi(e)};function Ki(e,t){try{return function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=Wi(r,Boolean(t),r===e);if(!i)break;if(n.push(i),i.optimized)break;r=r.parentElement}return n.reverse(),n.join(" > ")}(e)}catch(e){var n=e instanceof Error?e.message:String(e);return null==t||t.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(n)),""}}function Hi(e,t){void 0===t&&(t={});var n=Ni(e),r=new Set,i=t.logger,o=function(e){return Ki(e,i)},s=function(e,r){var o;return null!==(o=ji(e,n,{strategies:t.strategies,scope:r,logger:i}))&&void 0!==o?o:function(e,t,n){var r,i;void 0===n&&(n={});for(var o=Ni(t),s=null!==(i=null!==(r=n.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==i?i:document,a=Si(s),l=[],u=e,c=0,p=!(o.shadowDomEnabled&&a);null!==u&&!(p&&void 0!==o.maxAncestorWalkDepth&&c>o.maxAncestorWalkDepth);){var f=mi(u,o);if(null!==f){var g=h(["".concat(u.tagName.toLowerCase(),"#").concat(Ri(f))],d(l),!1).join(" > ");if(qi(s,g,e))return g}l.unshift(Ii(u,o.shadowDomEnabled)),u=u.parentElement,c+=1}var v=l.join(" > ");return o.shadowDomEnabled&&a&&null===u?"".concat(wi).concat(v):v}(e,n,{scope:r})},a=function(e,t){return function(e,t,n){return e&&n&&Si(t)?"".concat(wi).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 r,l;try{return n.shadowDomEnabled?function(e,t){var r=Ei(e,n.maxShadowDomDepth),o=r.segments;return r.truncated&&(null==i||i.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(n.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host"))),o.map(function(e){var n=e.target,r=e.root;return t(n,r)}).join(" >>> ")}(e,n.enabled?s:a):(n.enabled?s:o)(e,null!==(l=null!==(r=t.scope)&&void 0!==r?r: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)),Ki(e,i)}},getConfig:function(){return n},updateConfig:function(e){var t,o;n=Ni(e);try{for(var s=c(r),a=s.next();!a.done;a=s.next()){var l=a.value;try{l(n)}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 r.add(e),function(){r.delete(e)}}}}var Gi,Ji,Yi=Object.freeze({enabled:!1,maxDepth:0}),Xi=function(){var e=Yi,t=new Set;return{get:function(){return e},arm:function(n){return e.enabled||!n.enabled||(e=n,function(e){var n,r;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){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.clear()}(n)),e},onArm:function(n){if(e.enabled){var r=e;try{n(r)}catch(e){}return function(){}}return t.add(n),function(){t.delete(n)}}}},Qi=["input","select","textarea"],Zi=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&$e(window.location.href,n))&&!!$e(window.location.href,t)},eo=function(e,t){return function(n,r){var i,o,s=e.shouldTrackEventResolver,a=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!a)return!1;if(s)return s(n,r);if(!Zi(e))return!1;var l=String(null==r?void 0:r.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==r?void 0:r.matches)||void 0===t?void 0:t.call(r,e))});if(!u)return!1}switch(a){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:return"click"===n}}},to=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},no=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t},{})},ro=function(e,t,n){return void 0===n&&(n=Yi),n.enabled?oo(e,t,n.maxDepth):io(e,t)},io=function(e,t){return e?t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)})?e:io(null==e?void 0:e.parentElement,t):null},oo=function(e,t,n){var r,i;if(!e)return null;var o=function(e){if(t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))return{value:e}};try{for(var s=c(xi(e,n)),a=s.next();!a.done;a=s.next()){var l=o(a.value);if("object"==typeof l)return l.value}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return null},so=function(e,t,n){return void 0===n&&(n=Yi),n.enabled?lo(e,t,n.maxDepth):ao(e,t)},ao=function(e,t){var n=[];return t?(e.querySelectorAll(t).forEach(function(e){return n.push(e)}),n):n},lo=function(e,t,n){var r=ao(e,t),i=e instanceof Document?e.documentElement:e;return i?(Ci(i,n).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return r.push(e)})}),r):r},uo=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};function co(e){if(!e)return"";try{var t=new URL(e);return t.search="",Ke(t.href)}catch(t){return Ke(e)}}function ho(e){var t,n;return void 0===e&&(e=z()),co(null!==(n=null===(t=null==e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==n?n:"")}!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(Ji||(Ji={}));var po="__AMPLITUDE_VISUAL_TAGGING__";var fo=function(){var e,t,n,r,i=z();return{x:Math.floor(null!==(t=null!==(e=null==i?void 0:i.scrollX)&&void 0!==e?e:null==i?void 0:i.pageXOffset)&&void 0!==t?t:0),y:Math.floor(null!==(r=null!==(n=null==i?void 0:i.scrollY)&&void 0!==n?n:null==i?void 0:i.pageYOffset)&&void 0!==r?r:0)}};var go=z(),vo=function(e){return e.get()},mo={childList:!0,attributes:!0,characterData:!0,subtree:!0},yo=function(e){return new Pn(e?function(t){var n,r=new WeakSet,i=new WeakMap,o=function(e,t){r.has(e)||(r.add(e),Si(e)&&i.set(e,t),a.observe(e,mo))},s=function(e,t,n){var r=n-t;r<=0||Ci(e,r).forEach(function(e){var n=e.root,r=e.depth;return o(n,t+r)})},a=new MutationObserver(function(n){var r,o;t.next(n);try{var a=vo(e);if(!a.enabled)return;var l=function(e){var t=function(e){var t=e.getRootNode();if(!Si(t))return 0;var n=i.get(t);return null!=n?n:0}(e.target);e.addedNodes.forEach(function(e){e instanceof Element&&s(e,t,a.maxDepth)})};try{for(var u=c(n),d=u.next();!d.done;d=u.next()){l(d.value)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}}catch(e){}});if(document.body){var l=document.body;o(l,0),n=e.onArm(function(e){s(l,0,e.maxDepth)})}return function(){null==n||n(),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()}})},bo=function(e){return void 0===e&&(e="click"),new Pn(function(t){var n,r=function(e){t.next(e)};return null===(n=z())||void 0===n||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null===(t=z())||void 0===t||t.document.removeEventListener(e,r,{capture:!0})}})},wo=function(){var e=An(new Pn(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?n=s(s({},n),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(n.message=t.error),e.next(n)}};return go.addEventListener("error",t),function(){go.removeEventListener("error",t)}}),new Pn(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return go.addEventListener("unhandledrejection",t),function(){go.removeEventListener("unhandledrejection",t)}}));return An(e,new Pn(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return Rt.addListener("error",t),function(){Rt.removeListener(t)}}))},So=function(e,t,n){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})},ko={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},xo=function(e){var t,n,r,i,o=Object.values(ko).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=(r=void 0,c(l.definition)),d=u.next();!d.done;d=u.next()){var h=d.value,p=ko[h.event_type];p&&o[p].add(l.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==l?void 0:l.id,e)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},Co=function(e){var t,n,r,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=(r=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){r={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},Eo=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return ko[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)})})})},Io=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=Eo(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),o=function(e,t){var n,r,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){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.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;So(l.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}(),Oo=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",gi,sn,vi]),To=["type"],Po=["svg","path","g"],Ro=["password","hidden"];function Ao(e,t,n){var r,i,o,a,l;if(void 0===n&&(n=Yi),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 n=e.getRootNode();return t&&Si(n)?n.children:[]}(e,n.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!Oo.has(e.name)}),y=!function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!Qi.includes(i)&&!o}(e);if(!Ro.includes(String(e.getAttribute("type")))&&!Po.includes(u))try{for(var b=c(m),w=b.next();!w.done;w=b.next()){var S=w.value;y&&!To.includes(S.name)||(t.has(S.name)?v[S.name]=an:v[S.name]=String(S.value).substring(0,128))}}catch(e){r={error:e}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(r)throw r.error}}return Object.keys(v).length&&(d.attrs=v),e.shadowRoot&&(d.attrs=s(s({},d.attrs||{}),((o={})[vi]="true",o)),d.shadow=!0),d}function Mo(e,t){return void 0===t&&(t=Yi),e?t.enabled?function(e,t){var n,r,i=[];try{for(var o=c(xi(e,t)),s=o.next();!s.done;s=o.next()){var a=s.value;if("HTML"===a.tagName)break;i.push(a)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e,t.maxDepth):function(e){var t=[];t.push(e);var n=e.parentElement;for(;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e):[]}var _o;var No=function(e,t){var n,r,i,o=this;this.setPageViewApiKey=function(e){o.pageViewApiKey=e},this.replaceSensitiveString=function(e){return dn(e,o.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,i,s,a=performance.now();if(!e)return[];for(var l=o.getShadowMode(),u=Mo(e,l),p=new Map,f=u.length-1;f>=0;f--){var g=u[f];if(g){var v=to(g.getAttribute(gi)),m=f===u.length-1?[]:null!==(r=p.get(u[f+1]))&&void 0!==r?r: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 Ao(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 n=d(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=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&&(n=w.return)&&n.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,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?o.getText(t):o.getNearestLabel(n)},this.getElementPath=function(e){var t;if(!e)return"";var n=performance.now(),r=o.selectorEngine.generate(e),i=performance.now();return null===(t=o.diagnosticsClient)||void 0===t||t.recordHistogram("autocapturePlugin.getElementPath",i-n),r},this.updateRemoteConfig=function(e,t){var n;if(null!=e){var r=e.elementSelector,i=null!==(n=e.elementInteractions)&&void 0!==n?n:{};return"boolean"==typeof i.shadowDomEnabled&&(r=s(s({},null!=r?r:{}),{shadowDomEnabled:i.shadowDomEnabled})),"number"==typeof i.maxShadowDomDepth&&(r=s(s({},null!=r?r:{}),{maxShadowDomDepth:i.maxShadowDomDepth})),o.updateSelectorConfig(r,t)}},this.updateSelectorConfig=function(e,t){var n;if(null!=e){var r="boolean"==typeof e.enabled,i="boolean"==typeof e.shadowDomEnabled;if(r||i){var a=Di(e,t),l=o.selectorEngine.getConfig().enabled,u=o.shadowGate.get().enabled,c=o.shadowGate.arm(function(e){var t,n=null!==(t=e.maxShadowDomDepth)&&void 0!==t?t:1;return!e.shadowDomEnabled||n<=0?Yi:Object.freeze({enabled:!0,maxDepth:n})}(a));o.selectorEngine.updateConfig(s(s(s({},r?a:o.selectorEngine.getConfig()),{shadowDomEnabled:c.enabled}),c.enabled&&{maxShadowDomDepth:c.maxDepth})),r&&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===(n=o.diagnosticsClient)||void 0===n||n.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,n){var r,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=n,Object.entries(l).reduce(function(e,t){var n=d(t,2),r=n[0],i=n[1];if(r.startsWith(u)){var o=r.replace(u,"");o&&(e[o]=i||"")}return e},{})),m=((r={})["[Amplitude] Element Hierarchy"]=p,r[ui]=c,r[ci]=o.getText(t),r["[Amplitude] Element Position Left"]=null==h.left?null:Math.round(h.left),r["[Amplitude] Element Position Top"]=null==h.top?null:Math.round(h.top),r["[Amplitude] Element Attributes"]=v,r["[Amplitude] Element Path"]=o.getElementPath(t),r["[Amplitude] Element Parent Label"]=g,r[di]=Ke(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=hn(o.replaceSensitiveString),r[hi]=window.innerHeight,r[pi]=window.innerWidth,r),y=Ve(o.pageViewApiKey);if(y&&(m[fi]=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 no(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,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 n,r;if(void 0===t&&(t=Yi),!t.enabled)return e.target;var i=null===(n=e.composedPath)||void 0===n?void 0:n.call(e),o=null!==(r=e.target)&&void 0!==r?r:null;if(!i||0===i.length)return o;var s=i[0];if(!(s instanceof Element))return null!=s?s:o;var a=Ei(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 n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===t}(l,s.type);if(u)return s.closestTrackedAncestor=l,s.targetElementProperties=o.getEventProperties(s.type,s.closestTrackedAncestor,r),s}var c=ro(l,n,a);c&&(s.closestTrackedAncestor=c,s.targetElementProperties=o.getEventProperties(s.type,c,r))}}catch(e){}return s},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?o.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(sn,"], [contenteditable]");if(!e.querySelector(r))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(sn)||u.hasAttribute("contenteditable")?i+=an:i+=o.getTextWithMaskedDescendants(u)):i+=u.textContent||""}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.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 n,r;return!!Mo(e,t).some(function(e){return e.hasAttribute(sn)})||null!==(r=null===(n=document.documentElement)||void 0===n?void 0:n.hasAttribute(sn))&&void 0!==r&&r}(e,t):function(e){return null!==e.closest("[".concat(sn,"]"))}(e)},this.getText=function(e){if(o.hasMaskedAncestor(e))return an;var t="";return t=e.querySelector("[".concat(sn,"], [contenteditable]"))?o.getTextWithMaskedDescendants(e):e.innerText||"",o.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var i=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),s=((t={})[ui]=i,t[ci]=o.getText(e),t[di]=window.location.href.split("?")[0],t);return no(s)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(_o||(_o=Hi(Di())),_o),this.shadowGate=(Gi||(Gi=Xi()),Gi);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){n={error:e}}finally{try{p&&!p.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=l};function Do(e,t){var n=e.remoteConfigClient;if(e.fetchRemoteConfig&&n){var r=n.subscribe("configs.analyticsSDK.browserSDK.autocapture","all",function(n,r){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(r),") ").concat(JSON.stringify(n))),t.updateRemoteConfig(n,e.loggerProvider)});return function(){n.unsubscribe(r)}}}var Lo,Fo=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 Uo(e){var t=e.allObservables,n=e.onExposure,r=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(),n=t.document.documentElement.clientHeight||t.innerHeight,r=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,r);if(o<-1||o>n+1||s>=a||i.width<=0)return!1;for(var l=Fo(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=Fo(l,u.position)}return!0}(e)){if(!s.get(e)&&!a.get(e)){var t=setTimeout(function(){s.set(e,!0);var t=r.getElementPath(e);n(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,n=t.target;t.isIntersecting?(l.add(n),c(n)):(l.delete(n),u(n))}),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 jo(e){var t,n,r,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),n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=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(),r=setTimeout(function(){r=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(),n=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"}(Lo||(Lo={}));var Bo=function(e,t){var n,r,i,o,a,p,f,g,v,m,y,b;void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",ai);var w=e.dataAttributePrefix,S=void 0===w?Mt:w,k=e.visualTaggingOptions,x=void 0===k?{enabled:!0}:k;e.cssSelectorAllowlist=null!==(n=e.cssSelectorAllowlist)&&void 0!==n?n:At,e.actionClickAllowlist=null!==(r=e.actionClickAllowlist)&&void 0!==r?r:_t,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(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e},[]);var I,O,T="@amplitude/plugin-autocapture-browser",P=[],R=new No(e,t),A=new Set,M=new Set,_=new Set,N=function(){var t,n,r=Mn(bo().map(function(t){return R.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,S)})),i=Mn(new Pn(function(t){var n,r=function(n){var r=R.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,S);t.next(r)};return null===(n=z())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=z())||void 0===e?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(n=Mn(new Pn(function(t){var n=function(n){var r=R.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,S);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=R.shadowGate,s=Mn(yo(o).map(function(t){return R.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,S)})),a=new Pn(function(e){var t,n,r=function(t){e.next(t)};return null===(t=z())||void 0===t||t.addEventListener("scroll",r,{capture:!0,passive:!0}),null===(n=z())||void 0===n||n.addEventListener("resize",r,{passive:!0}),function(){var e,t;null===(e=z())||void 0===e||e.removeEventListener("scroll",r,{capture:!0}),null===(t=z())||void 0===t||t.removeEventListener("resize",r)}}),l=function(e,t,n,r){var i="function"==typeof n?n:void 0,o="function"==typeof n?r:n;return new Pn(function(n){var r=z();if(!(null==r?void 0:r.IntersectionObserver))return function(){};var s=new IntersectionObserver(function(e){e.forEach(function(e){n.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{so(e,a,vo(o)).forEach(function(e){s.observe(e)})}catch(e){}},c=function(){var e=null==r?void 0:r.document;if(e){var t=[];try{t=o&&vo(o).enabled?so(e,a,vo(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==r?void 0:r.document)&&u(r.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&&vo(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={})[Lo.ChangeObservable]=i,t[Lo.ClickObservable]=r,t[Lo.MutationObservable]=s,t[Lo.NavigateObservable]=n,t[Lo.ScrollObservable]=a,t[Lo.ExposureObservable]=l,t},D=xo(Object.values(null!==(m=null===(v=e.pageActions)||void 0===v?void 0:v.labeledEvents)&&void 0!==m?m:{})),L=Co(null!==(b=null===(y=e.pageActions)||void 0===y?void 0:y.triggers)&&void 0!==b?b:[]),F=function(e,t,n,r){return new Io(e,t,n,r)}(D,L,R,e);return{name:T,type:"enrichment",setup:function(t,n){return l(void 0,void 0,void 0,function(){var r,i,o,a,l,c,p,f,g,v,m,y,b,w,k,U,j,B,q,W,V,$,K,H,G,J,Y,X,Q,Z,ee,te,ne,re,ie,oe,se,ae,le,ue,ce,de,he;return u(this,function(u){return"undefined"==typeof document||(R.setPageViewApiKey(t.apiKey),r=!1,t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(t){!function(t){var n,r;t&&(e.pageActions=s(s({},e.pageActions),t),D=xo(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),L=Co(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),F.update(D,L,e))}(t)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),!0===e.shadowDomEnabled&&("number"!=typeof(i=e.maxShadowDomDepth)&&(i=1),R.updateSelectorConfig({shadowDomEnabled:!0,maxShadowDomDepth:i})),(o=Do(t,R))&&P.push({unsubscribe:o}),a=eo(e,e.cssSelectorAllowlist),l=eo(e,e.actionClickAllowlist),c=N(),p=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(uo).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(li,e.targetElementProperties)})}({allObservables:c,amplitude:n,shouldTrackEvent:a,evaluateTriggers:F.evaluate.bind(F)}),P.push(p),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(uo).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))})}({allObservables:c,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:n,shouldTrackEvent:a,evaluateTriggers:F.evaluate.bind(F)}),P.push(f),g=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,s=e.shouldTrackActionClick,a=n.clickObservable,l=n.mutationObservable,u=n.navigateObservable,c=a.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=ro(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(uo).filter(function(e){return s("click",e.closestTrackedAncestor)}),d=u?An(l,u):l,h=An(c,d),p=null,f=null;return Rn(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(li,i("click",e.closestTrackedAncestor)))})}({allObservables:c,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:n,shouldTrackEvent:a,shouldTrackActionClick:l}),g&&P.push(g),v=function(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0,minY:0},r=!0,i=function(){var e=fo(),t=e.x,i=e.y;n.maxX=t,n.maxY=i,n.minY=i,r=!1};i();var o=t.subscribe(function(){var e=fo(),t=e.x,i=e.y;if(r)return n.maxX=t,n.maxY=i,n.minY=i,void(r=!1);n.maxX=Math.max(n.maxX,t),n.maxY=Math.max(n.maxY,i),n.minY=Math.min(n.minY,i)});return{unsubscribe:function(){o.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0,n.minY=0,r=!0},isAwaitingSeed:function(){return r},seed:function(){return!!r&&(i(),!0)}}}({allObservables:c,amplitude:n}),P.push(v),m=s({},v.getState()),y=function(){v.seed();var e=v.getState();m.maxX=e.maxX,m.maxY=e.maxY,m.minY=e.minY},b=!1,w=!1,k=!1,j={},B=z(),W=function(){var e;v.reset();var t=v.getState();m.maxX=t.maxX,m.maxY=t.maxY,m.minY=t.minY,_.clear(),A.clear(),M.clear(),null===(e=j.exposure)||void 0===e||e.reset(),null==q||q.reset()},V=function(){b=!0},$=function(e){if(b)return e?void W():void(w=!0);e&&(null==q||q.reset()),e&&r?W():(e&&(r=!0,setTimeout(function(){r=!1},100)),function(e){var t,n,r,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=e.apiKey,p=o.getState(),f=z(),g=null!==(n=null==f?void 0:f.innerWidth)&&void 0!==n?n:0,v=null!==(r=null==f?void 0:f.innerHeight)&&void 0!==r?r:0,m=Array.from(s).filter(function(e){return!l.has(e)}),y=((t={})[di]=ho(f),t["[Amplitude] Max Page X"]=p.maxX+g,t["[Amplitude] Max Page Y"]=p.maxY+v,t["[Amplitude] Min Page Y"]=p.minY,t[hi]=v,t[pi]=g,t["[Amplitude] Element Exposed"]=m,t),b=Ve(h);b&&(y[fi]=b);var w=function(){o.reset();var e=o.getState();d.maxX=e.maxX,d.maxY=e.maxY,d.minY=e.minY,a.clear(),l.clear(),null==u||u.reset()};0!==m.length||p.maxX!==d.maxX||p.maxY!==d.maxY||p.minY!==d.minY?(null==i||i.track("[Amplitude] Viewport Content Updated",y),d.maxX=p.maxX,d.maxY=p.maxY,d.minY=p.minY,m.forEach(function(e){l.add(e)}),s.clear(),c&&w()):c&&w()}({amplitude:n,scrollTracker:v,currentElementExposed:_,elementExposedForPage:A,elementExposedInSentEvents:M,exposureTracker:j.exposure,isPageEnd:e,lastScroll:m,apiKey:t.apiKey}))},H=function(){K&&(clearTimeout(K),K=void 0)},G=function(){H(),K=setTimeout(function(){K=void 0,J()},0)},J=function(){if(H(),null==U||U.removeEventListener("abort",G),U=void 0,b){b=!1,v.reset(),y();var e=w,t=k;w=!1,k=!1,e&&$(t)}},Y=function(){H(),null==U||U.removeEventListener("abort",G),U=void 0,w=!1,k=!1},X=function(){U&&!U.aborted||J()},Q=function(e){H(),null==U||U.removeEventListener("abort",G),U=void 0,e&&(e.aborted?J():(U=e,e.addEventListener("abort",G,{once:!0})))},Z=ho(B),ee=function(e){var t=ho(B);return t!==Z&&(b&&e&&e.deferScrollBaseline?(Y(),W(),Z=t,!0):(Z=t,$(!0),(null==e?void 0:e.deferScrollBaseline)?(V(),!0):(y(),!1)))},te=function(e,t){var n=ho(B),r=function(e,t){var n;if(void 0===t&&(t=z()),null==e||""===e)return ho(t);var r=(null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.href)||"http://localhost/";try{return co(new URL(e,r).href)}catch(e){return ho(t)}}(t,B);n!==r?(Z=r,$(!0),e(),y()):e()},ne=function(e){!function(e,t,n,r,i){if(!t.has(e)&&!n.has(e)){t.add(e),r.add(e);var o=Array.from(r);JSON.stringify(o).length>=18e3&&i(!1)}}(e,A,M,_,$)},C&&(j.exposure=Uo({allObservables:c,onExposure:ne,dataExtractor:R,exposureDuration:E}),j.exposure&&P.push(j.exposure),q=jo({mutationObservable:c[Lo.MutationObservable],onRescan:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),null==O||O()},onFlush:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),$(!1)},exposureDuration:E}),q.start(),P.push({unsubscribe:function(){null==q||q.stop()}}),re=function(){if(b)return k=!0,w=!0,void J();$(!0)},null==B||B.addEventListener("beforeunload",re),I=function(){null==B||B.removeEventListener("beforeunload",re)},P.push({unsubscribe:function(){return I()}}),(ie=c[Lo.NavigateObservable])?(P.push(ie.subscribe(function(e){var t,n,r,i=null===(n=null===(t=e.event)||void 0===t?void 0:t.destination)||void 0===n?void 0:n.url;if(i){var o=co(i);if(o===Z)return;return b?(w=!1,k=!1,Z=o,$(!0),void Q(e.event.signal)):(Z=o,$(!0),V(),void Q(e.event.signal))}ee({deferScrollBaseline:!0})&&Q(null===(r=e.event)||void 0===r?void 0:r.signal)})),(oe=window.navigation)&&(oe.addEventListener("navigatesuccess",J),oe.addEventListener("navigateerror",X),P.push({unsubscribe:function(){Y(),b=!1,oe.removeEventListener("navigatesuccess",J),oe.removeEventListener("navigateerror",X)}}))):B&&(se=function(){ee()},B.addEventListener("popstate",se),ae=B.history.pushState,le=B.history.replaceState,B.history&&ae&&(B.history.pushState=new Proxy(ae,{apply:function(e,t,n){te(function(){e.apply(t,n)},n[2])}})),B.history&&le&&(B.history.replaceState=new Proxy(le,{apply:function(e,t,n){te(function(){e.apply(t,n)},n[2])}})),P.push({unsubscribe:function(){B.removeEventListener("popstate",se),B.history&&ae&&(B.history.pushState=ae),B.history&&le&&(B.history.replaceState=le)}}))),null===(he=null==t?void 0:t.loggerProvider)||void 0===he||he.log("".concat(T," has been successfully added.")),window.opener&&x.enabled&&(ue=e.cssSelectorAllowlist,ce=e.actionClickAllowlist,function(e,t){var n=e;if(!0!==n[po]){n[po]=!0;var r=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,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};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 n;a=null===(n=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===n?void 0:n.call(window,{getEventTagProps:r.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:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:ai}}}),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)})}}(de=jn(),{dataExtractor:R,isElementSelectable:eo(e,h(h([],d(ue),!1),d(ce),!1)),cssSelectorAllowlist:ue,actionClickAllowlist:ce}),zn(de),de.setup(s({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:Dn[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,n,r;return u(this,function(i){try{for(e=c(P),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]})})}}},qo=["mutation","navigate"];function zo(e,t){var n,r,i,o,s=t.event,a=s.pageX,l=s.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:l,l),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r: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 Wo(e){if(0===e.length)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:s({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function Vo(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.pointerDownObservable,s=r.selectionObservable,a=[],c={},d=null;function h(e){a=[],c={},e&&(zo(c,e),a.push(e))}var p=Rn(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(n){return zo(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 n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(a,e)||c.isOutOfBounds?(d&&(t=Wo(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(Wo(a))},1e3)}})]:[2,null]})})}),f=null==s?void 0:s.subscribe(function(){h()}),g=p.subscribe(function(e){null!==e&&n.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){g.unsubscribe(),null==f||f.unsubscribe()}}}var $o,Ko;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}($o||($o={})),function(e){e.X="x",e.Y="y"}(Ko||(Ko={}));function Ho(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function Go(e){e.changes=[],e.startTime=void 0}function Jo(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length;r++){if(i-t[r]<n)break}0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var Yo=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?20:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new Pn(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},s=void 0,a=null;function l(){void 0!==s&&(e.next(s),s=void 0,null!==a&&clearTimeout(a),Go(n),Go(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),function(e){var t=+Date.now();e.startTime=e.startTime||t;var n=e.changes,r=e.changesThreshold;n.push(t),n.length>r&&n.shift()}(e===Ko.X?n:i);var t=function(e,t){var n=void 0;if(Ho(e)&&(n=e.startTime),Ho(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return t?(s=s||t,a=setTimeout(function(){l(),a=null},o)):l(),Jo(n),Jo(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},Xo=function(e){var t=e.amplitude,n=e.options,r=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 Pn(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==n?(o.x>n.x?(r===$o.DECREASING&&e.next(Ko.X),r=$o.INCREASING):o.x<n.x&&(r===$o.INCREASING&&e.next(Ko.X),r=$o.DECREASING),o.y>n.y?(i===$o.DECREASING&&e.next(Ko.Y),i=$o.INCREASING):o.y<n.y&&(i===$o.INCREASING&&e.next(Ko.Y),i=$o.DECREASING),n=o):n=o})})}({allWindowObservables:r});return Yo({mouseDirectionChangeObservable:l,directionChanges:o,thresholdMs:a}).subscribe(function(e){Zi(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function Qo(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var Zo=4e3,es=function(e){var t;void 0===e&&(e={});var n="@amplitude/plugin-frustration-browser",r=[],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=Qo(e,"rageClicks",Ft,a),g=Qo(e,"deadClicks",Dt,o),v=Qo(e,"errorClicks",Lt,i),m=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:Mt,y=new No(e),b=h([],d(new Set(h(h(h([],d(f),!1),d(g),!1),d(v),!1))),!1),w=function(){var e,t,n=function(e){return Mn(bo(e).map(function(e){return y.addAdditionalEventProperties(e,"click",b,m,!0)}))},r=n("click"),i=n("pointerdown"),o=Mn(wo().map(function(e){return y.addTypeAndTimestamp(e,"error")})),a=Mn(yo(y.shadowGate).map(function(e){return y.addAdditionalEventProperties(e,"mutation",b,m)}));window.navigation&&(t=Mn(new Pn(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=Mn(new Pn(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 n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),u=Mn(new Pn(function(e){var t=function(t){e.next(t)},n={capture:!0};return go.document.addEventListener("mousemove",t,n),function(){go.document.removeEventListener("mousemove",t,n)}}));return(e={})[Lo.ClickObservable]=r,e[Lo.PointerDownObservable]=i,e[Lo.MutationObservable]=a,e[Lo.NavigateObservable]=t,e[Lo.BrowserErrorObservable]=o,e[Lo.SelectionObservable]=l,e[Lo.MouseMoveObservable]=u,e};return{name:n,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,T;return u(this,function(u){return"undefined"==typeof document||(y.setPageViewApiKey(t.apiKey),l=w(),(d=Do(t,y))&&r.push({unsubscribe:d}),a&&(h=eo(e,f),b=Vo({allObservables:l,amplitude:c,shouldTrackRageClick:h}),r.push(b)),o&&(S=eo(e,g),k=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,o=n.clickObservable,a=n.mutationObservable,l=n.navigateObservable,u=o.filter(function(e){return uo(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Ji.LEFT_OR_TOUCH_CONTACT}),c=l?An(a,l):a,d=An(u,c),h=null;return Rn(d,function(e){return h&&qo.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 n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",s(s({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}})}({amplitude:c,allObservables:l,getEventProperties:function(e,t){return y.getEventProperties(e,t,m)},shouldTrackDeadClick:S}),r.push(k)),i&&(x=eo(e,v),C=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackErrorClick,i=n.pointerDownObservable,o=n.browserErrorObservable,a=i.filter(function(e){return uo(e)&&r("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Ji.LEFT_OR_TOUCH_CONTACT}),l=null,u=null,c=function(){null!==l&&(clearTimeout(l),l=null),u=null};return An(a,o).subscribe(function(e){var n;if("click"===e.type)return c(),u=e,void(l=setTimeout(c,2e3));"error"===e.type&&u&&(t.track("[Amplitude] Error Click",s(((n={})["[Amplitude] Kind"]=e.event.kind,n["[Amplitude] Message"]=e.event.message,n["[Amplitude] Stack"]=e.event.stack,n["[Amplitude] Filename"]=e.event.filename,n["[Amplitude] Line Number"]=e.event.lineNumber,n["[Amplitude] Column Number"]=e.event.columnNumber,n),u.targetElementProperties)),c())})}({amplitude:c,allObservables:l,shouldTrackErrorClick:x}),r.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>Zo&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(I," is above the maximum of ").concat(Zo,", setting to ").concat(Zo)),I=Zo)),O=Xo({amplitude:c,options:e,allObservables:l,directionChanges:E,thresholdMs:I}),r.push(O)),null===(T=null==t?void 0:t.loggerProvider)||void 0===T||T.log("".concat(n," 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]})})}}};function ts(e,t){var n=e.startTime+e.duration;return t.filter(function(t){return t.startTime<n&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}function ns(e,t){var n,r=ts(e,t),i=null!==(n=e.scripts)&&void 0!==n?n:[],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},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),{"[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 rs(e,t){var n,r=ts(e,t),i=null!==(n=e.attribution)&&void 0!==n?n:[];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},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}function is(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,i=void 0===r?100:r,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,n,r=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&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}for(var l=r-1e4;s.length>0&&s[0].startTime<l;)s.shift()});try{a.observe({entryTypes:["measure"]})}catch(e){}var l=new PerformanceObserver(function(e){var r,a;try{for(var l=c(e.getEntries()),u=l.next();!u.done;u=l.next()){var d=u.value;if(!Zi(n))return;if(!(d.duration<i)){var h="long-animation-frame"===o?ns(d,s):rs(d,s);t.track("[Amplitude] Main Thread Block",h)}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(r)throw r.error}}});try{l.observe({entryTypes:[o]})}catch(e){return a.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){l.disconnect(),a.disconnect()}}}var os,ss,as=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",n=[],r=!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||(r&&(s=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(s=e.mainThreadBlock.durationThreshold),a=is({amplitude:o,options:e,durationThreshold:s}),n.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,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]})})}}},ls="[Amplitude] Network Request",us="500-599";function cs(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function ds(e,t){var n,r,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){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function hs(e){var t;if(e)try{var n=null===(t=z())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),s=r.href,a=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:r.href,host:a}}catch(t){try{return function(e){var t,n=e.indexOf("#"),r=n>=0?e.slice(n+1):"",i=n>=0?e.slice(0,n):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:r,href:e,hrefWithoutQueryOrHash:a,host:null!==(t=null==l?void 0:l[1])&&void 0!==t?t:""}}(e)}catch(e){return}}}function ps(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 fs(e){var t,n,r;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null==e?void 0:e.blocklist)||void 0===n?void 0:n.length)&&!(null===(r=null==e?void 0:e.excludelist)||void 0===r?void 0:r.length)}function gs(e,t){var n;void 0===t&&(t={});var r=hs(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(cs(o,"*.amplitude.com")||cs(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find(function(e){return cs(o,e)}))return!1;if(!t.captureRules&&void 0!==e.status&&!ds(e.status,us))return!1;if(t.captureRules&&(h([],d(t.captureRules),!1).reverse().find(function(t){if(i=function(e,t,n,r,i){if((!e.hosts||e.hosts.find(function(e){return cs(t,e)}))&&(!r||!e.urls||$e(r,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return!((n||0===n)&&!ds(n,e.statusCodeRange||us))}(t,o,e.status,e.url,e.method),i){var n=ps(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var s=ps(t.requestHeaders);if(e.requestWrapper&&s){var a=e.requestWrapper.headers(s);a&&(e.requestHeaders=a)}if(e.responseWrapper&&t.responseBody&&!fs(t.responseBody)){var l=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,l)}if(e.requestWrapper&&t.requestBody&&!fs(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 n=t.body;if("string"!=typeof n)return!1;if(JSON.parse(n).events.find(function(e){return e.event_type===ls}))return!0}catch(e){}return!1}(o,e.requestWrapper)}function vs(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return gs(e.event,n)}).subscribe(function(e){var t,n,o,s=e.event,a=hs(s.url);if(a){var c=null===(n=s.responseWrapper)||void 0===n?void 0:n.bodySize,h=null===(o=s.requestWrapper)||void 0===o?void 0:o.bodySize;!function(e,t,n,r){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==r||r.debug("Failed to stringify request body",e)}if(s)try{e["[Amplitude] Response Body"]=JSON.stringify(s)}catch(e){null==r||r.debug("Failed to stringify response body")}a.label=2;case 2:return null==n||n.track(ls,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,r,i)}})}!function(e){e.NetworkObservable="networkObservable"}(os||(os={}));var ms=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new Pn(function(e){var n=new en(function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)});return rn.subscribe(n,t),function(){rn.unsubscribe(n)}});return(e={})[os.NetworkObservable]=n,e};return{name:n,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=r(),t=null==i?void 0:i.loggerProvider,ss=vs({allObservables:s,networkTrackingOptions:e,amplitude:o,loggerProvider:t}),null==t||t.log("".concat(n," 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 ss.unsubscribe(),[2]})})}}},ys="web-vitals-browser",bs="[Amplitude] Web Vitals",ws={LCP:"[Amplitude] LCP",FCP:"[Amplitude] FCP",INP:"[Amplitude] INP",CLS:"[Amplitude] CLS",TTFB:"[Amplitude] TTFB"};let Ss=-1;const ks=()=>Ss,xs=e=>{addEventListener("pageshow",t=>{t.persisted&&(Ss=t.timeStamp,e(t))},!0)},Cs=(e,t,n,r)=>{let i,o;return s=>{t.value>=0&&(s||r)&&(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,n),e(t)))}},Es=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Is=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Os=()=>Is()?.activationStart??0;let Ts=-1;const Ps=new Set,Rs=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,As=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of Ps)e();isFinite(Ts)||(Ts="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",As,!0))}},Ms=(e=!1)=>{if(e&&(Ts=1/0),Ts<0){const e=Os(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;Ts=t??Rs(),addEventListener("visibilitychange",As,!0),addEventListener("prerenderingchange",As,!0),xs(()=>{setTimeout(()=>{Ts=Rs()})})}return{get firstHiddenTime(){return Ts},onHidden(e){Ps.add(e)}}},_s=(e,t=-1,n,r=0,i,o,s)=>{const a=Is(),l=a?.navigationId||0;let u="navigate";return n?u=n:ks()>=0?u="back-forward-cache":a&&(document.prerendering||Os()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:r||l,navigationInteractionId:i,navigationURL:o||a?.name,navigationStartTime:s||0}},Ns=new WeakMap;function Ds(e,t){let n=Ns.get(t);return n||(n=new WeakMap,Ns.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}class Ls{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const Fs=(e,t,n={})=>{try{const r=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(r.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();r.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of r)e.observe({type:t,buffered:!0,...n});return e}}catch{}},Us=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,js=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Bs=e=>{let t=!1;return()=>{t||(e(),t=!0)}};class qs{l}const zs=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Ws=[1800,3e3],Vs=(e,t={})=>{const n=Us(t);zs(()=>{const r=Ds(t,qs),i=Ms();let o,s=_s("FCP");const a=Fs(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),t.startTime<i.firstHiddenTime&&(s.value=Math.max(t.startTime-Os(),0),s.entries.push(t),s.navigationId=t.navigationId||s.navigationId,o(!0)))});a&&(o=Cs(e,s,Ws,t.reportAllChanges),xs(n=>{s=_s("FCP",-1,"back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,ks()),o=Cs(e,s,Ws,t.reportAllChanges),Es(()=>{s.value=performance.now()-n.timeStamp,o(!0)})})),n&&Fs(["soft-navigation"],n=>{n.forEach(n=>{r.l&&n.navigationId&&js(r.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);s=_s("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o=Cs(e,s,Ws,t.reportAllChanges),o(!0)})},t)})},$s=[.1,.25],Ks=(e,t={})=>{const n=Ms();Vs(Bs(()=>{let r,i=_s("CLS",0);const o=Ds(t,Ls),s=(n,s,a,l,u)=>{i=_s("CLS",0,n,s,a,l,u),o.i=0,r=Cs(e,i,$s,t.reportAllChanges)},a=(e=!1)=>{o.i>i.value&&(i.value=o.i,i.entries=o.o),r(e)},l=e=>{a(!0),s("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=e=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):l(t);a()},c=["layout-shift"];Us(t)&&c.push("soft-navigation");const d=Fs(c,u);d&&(r=Cs(e,i,$s,t.reportAllChanges),n.onHidden(()=>{u(d.takeRecords()),r(!0)}),xs(()=>{s("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,ks()),Es(r)}),setTimeout(r))}))};let Hs=0,Gs=1/0,Js=0;const Ys=e=>{for(const t of e)t.interactionId&&(Gs=Math.min(Gs,t.interactionId),Js=Math.max(Js,t.interactionId),Hs=Js?(Js-Gs)/7+1:0)};let Xs;const Qs=()=>Xs?Hs:performance.interactionCount??0;class Zs{u=0;v=[];m=new Map;p;T;_(){return Qs()-this.u}M(){this.u=Qs(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}}const ea=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const i=Bs(e);let o=-1;const s=()=>{r(o),i()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),o=n(()=>{removeEventListener("visibilitychange",s,{capture:!0}),i()},{timeout:t})}},ta=[200,500],na=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=Ms();zs(()=>{"interactionCount"in performance||Xs||(Xs=Fs(["event"],Ys,{durationThreshold:0}));let r,i=_s("INP");const o=Ds(t,Zs),s=(n,s,a,l,u)=>{o.M(),i=_s("INP",-1,n,s,a,l,u),r=Cs(e,i,ta,t.reportAllChanges)},a=()=>{const e=o.L(i.navigationType);e&&e.P!==i.value&&(i.value=e.P,i.entries=e.entries,r())},l=e=>{a(),r(!0),s("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{ea(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):l(t);a(),t&&r(!0)})},c=["event","first-input"];Us(t)&&c.push("soft-navigation");const d=Fs(c,u,{...t,durationThreshold:t.durationThreshold??40});r=Cs(e,i,ta,t.reportAllChanges),d&&(n.onHidden(()=>{u(d.takeRecords(),!0)}),xs(()=>{s("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,ks())}))})};class ra{p;l;h(e){this.p?.(e)}}const ia=[2500,4e3],oa=(e,t={})=>{let n=!1;const r=Us(t);zs(()=>{let i,o=Ms(),s=_s("LCP");const a=Ds(t,ra),l=(r,a,l,u,c)=>{s=_s("LCP",-1,r,a,l,u,c),i=Cs(e,s,ia,t.reportAllChanges),n=!1,"soft-navigation"===r&&(o=Ms(!0))},u=e=>{a.l&&e.navigationId&&js(a.l,e),n||i(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&c([t])},c=e=>{t.reportAllChanges||r||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){u(t);continue}let e=0,n=[],r=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-Os(),0),a.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const i=t;if(!s.navigationId)continue;if("interactionId"in i&&i.interactionId!=s.navigationInteractionId)continue;r=i.largestContentfulPaint?.renderTime||0,e=Math.max(r-t.startTime,0),i.largestContentfulPaint&&(a.h(i.largestContentfulPaint),n=[i.largestContentfulPaint])}r<o.firstHiddenTime&&(s.value=e,s.entries=n,i())}},d=["largest-contentful-paint"];r&&d.push("interaction-contentful-paint","soft-navigation");const h=Fs(d,c);if(h){i=Cs(e,s,ia,t.reportAllChanges);const o=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!n){const e=s.id;ea(()=>{if(!n){if(!r){h.disconnect();for(const e of o)removeEventListener(e,a,{capture:!0})}e===s.id&&(n=!0,i(!0))}})}};for(const e of o)addEventListener(e,a,{capture:!0});xs(r=>{l("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,ks()),i=Cs(e,s,ia,t.reportAllChanges),Es(()=>{s.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})},sa=[800,1800],aa=e=>{document.prerendering?zs(()=>aa(e)):"complete"!==document.readyState?addEventListener("load",()=>aa(e),!0):setTimeout(e)},la=(e,t={})=>{const n=Us(t);let r=_s("TTFB"),i=Cs(e,r,sa,t.reportAllChanges);aa(()=>{const o=Is();if(o){const s=o.responseStart;r.value=Math.max(s-Os(),0),r.entries=[o],i(!0),xs(()=>{r=_s("TTFB",0,"back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,ks()),i=Cs(e,r,sa,t.reportAllChanges),i(!0)}),n&&Fs(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(r=_s("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),r.entries=[n],i=Cs(e,r,sa,t.reportAllChanges),i(!0))})},t)}})};function ua(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function ca(e,t){void 0===t&&(t=!1);var n={value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(ua(e)),navigationStart:t?Math.floor(performance.timeOrigin+(e.navigationStartTime||0)):Math.floor(performance.timeOrigin)};return t&&(n.navigationId=e.navigationId),n}var da=Object.values(ws);var ha,pa=function(){var e,t=null,n=z(),r=null==n?void 0:n.document,i=null==n?void 0:n.location,o=!1,s=new Set;return{name:ys,type:"enrichment",setup:function(n,a){return l(void 0,void 0,void 0,function(){var l,d,h,p,f,g,v,m;return u(this,function(u){return void 0===r||(o=!0,l=new Map,d=-1,h=function(e){var t=e.navigationId,o=l.get(t);return o||(o=function(e,t,n){var r="",i="";try{var o=new URL(e);r=o.hostname,i=o.pathname}catch(e){n.debug("Web vitals plugin is unable to parse page URL: ",e)}var s=Ke(e,n);return{"[Amplitude] Page Domain":r,"[Amplitude] Page Location":s,"[Amplitude] Page Path":Ke(i,n),"[Amplitude] Page Title":t,"[Amplitude] Page URL":Ke(s.split("?")[0],n)}}(e.navigationURL||(null==i?void 0:i.href)||"",r.title||"",n.loggerProvider),l.set(t,o)),o},p=function(e){s.add(e);var t=l.get(e);t&&(l.delete(e),function(e){return da.some(function(t){return t in e})}(t)&&a.track(bs,t))},f=function(){var e,t;try{for(var n=c(Array.from(l.keys())),r=n.next();!r.done;r=n.next()){var i=r.value;p(i)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},g=function(t){void 0!==e&&clearTimeout(e),e=setTimeout(function(){var n,r;e=void 0;try{for(var i=c(Array.from(l.keys())),o=i.next();!o.done;o=i.next()){var s=o.value;s<t&&p(s)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},1e3)},m={reportSoftNavs:!0},oa((v=function(e){return function(t){o&&!s.has(t.navigationId)&&(h(t)[e]=ca(t,!0),t.navigationId>d&&(-1!==d&&g(t.navigationId),d=t.navigationId))}})(ws.LCP),m),Vs(v(ws.FCP),m),na(v(ws.INP),m),Ks(v(ws.CLS),m),la(v(ws.TTFB),m),t=function(){"hidden"===r.visibilityState&&t&&f()},r.addEventListener("visibilitychange",t)),[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(n){return o=!1,void 0!==e&&(clearTimeout(e),e=void 0),t&&(null==r||r.removeEventListener("visibilitychange",t),t=null),[2]})})}}},fa=function(e){return void 0===e&&(e={}),!0===e.reportSoftNav&&function(){var e=z();return e&&"PerformanceSoftNavigation"in e}()?pa():function(){var e=null,t=z(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:ys,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===n||(o=Ke((null==r?void 0:r.href)||"",t.loggerProvider),s={"[Amplitude] Page Domain":(null==r?void 0:r.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":Ke((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":Ke(o.split("?")[0],t.loggerProvider)},oa(function(e){s["[Amplitude] LCP"]=ca(e)}),Vs(function(e){s["[Amplitude] FCP"]=ca(e)}),na(function(e){s["[Amplitude] INP"]=ca(e)}),Ks(function(e){s["[Amplitude] CLS"]=ca(e)}),la(function(e){s["[Amplitude] TTFB"]=ca(e)}),e=function(){"hidden"===n.visibilityState&&e&&(i.track(bs,s),n.removeEventListener("visibilitychange",e),e=null)},n.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==n||n.removeEventListener("visibilitychange",e)),[2]})})}}}()},ga=function(){function e(e,t){var n,r,i;this.shouldTrackNewCampaign=!1,this.options=s({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=(null===(n=t.cookieOptions)||void 0===n?void 0:n.domain)||t.topLevelDomain,i=r,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[]),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=et(t.apiKey,"MKTG"),this.webExpStorageKey=et(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=M,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(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return t=d.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||Me(this.sessionTimeout,this.lastEventTime),Fr(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return 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 on).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,i,o=(t=this.currentCampaign,n=this.options,r=s(s({},M),t),i=Object.entries(r).reduce(function(e,t){var r,i=d(t,2),o=i[0],s=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=s?s:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),s?e.set(o,s):e.unset(o)},new F),te(i));return e&&(o.event_id=e),o},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),va=new Set([o.IDENTIFY,o.GROUP_IDENTIFY]),ma=function(e){var t;void 0===e&&(e={});var n,r,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 on).parse()];case 1:return e=t.sent(),p=Je(e),d&&(null==r||r.log("Tracking attribution fallback event."),null==n||n.track("[Amplitude] Attribution",p)),[2]}})})},m=function(){v()},y=function(e){return new Proxy(e,{apply:function(e,t,n){Reflect.apply(e,t,n),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 n=t,r=e.loggerProvider,f=!0,r.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 va.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(n){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]})})}}},ya="AMP_CURRENT_PAGE",ba="AMP_PREVIOUS_PAGE",wa="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(ha||(ha={}));var Sa=new Set([o.IDENTIFY,o.GROUP_IDENTIFY,o.REVENUE]),ka=function(e){var t=(void 0===e?{}:e).internalDomains,n=void 0===t?[]:t,r=z(),i=void 0,o=!1,a=void 0,c=!1,h=!1,p=function(e){var t;try{t=new URL(e).hostname}catch(e){null==a||a.error("Could not parse URL: ",e)}return t},f=function(e){var t="undefined"!=typeof location&&location.hostname||"",r=e?p(e):void 0;if(!r)return ha.Direct;var i=n.some(function(e){return-1!==t.indexOf(e)}),o=n.some(function(e){return-1!==r.indexOf(e)});return t===r||o&&i?ha.Internal:ha.External},g=function(){return l(void 0,void 0,void 0,function(){var e,t,n,r,s;return u(this,function(a){switch(a.label){case 0:return i&&o?[4,i.get(wa)]:[3,3];case 1:return e=a.sent(),t=Ke("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[ya])||"",r=void 0,r=t===n?(null==e?void 0:e[ba])||"":n||(document.referrer||""),[4,i.set(wa,(s={},s[ya]=t,s[ba]=r,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,n,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,!r)return[3,7];try{i=new tt(r.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||"",n=t?p(t):void 0,s="undefined"!=typeof location&&location.hostname||"",l=Ke("undefined"!=typeof location&&location.href||""),[4,i.get(wa)]):[3,6];case 2:return f=u.sent(),m=(null==f?void 0:f[ya])||"",!!n&&n!==s&&m!==l?[4,i.set(wa,(y={},y[ya]=l,y[ba]=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:r.addEventListener("popstate",v),c||(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=d(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),h&&v()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=d(n,3),i=r[0],o=r[1],s=r[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,n,r;return u(this,function(a){switch(a.label){case 0:return t=Ke("undefined"!=typeof location&&location.href||""),i&&o?[4,i.get(wa)]:[3,2];case 1:if(n=a.sent(),r=(null==n?void 0:n[ba])||"",Sa.has(e.event_type))return[2,e];e.event_properties=s(s({},e.event_properties||{}),{"[Amplitude] Page Domain":xa(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":xa(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":xa(e,"[Amplitude] Page Path","undefined"!=typeof location&&Ke(location.pathname)||""),"[Amplitude] Page Title":xa(e,"[Amplitude] Page Title",hn(dn)),"[Amplitude] Page URL":xa(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":r,"[Amplitude] Previous Page Type":f(r)}),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 r&&(r.removeEventListener("popstate",v),h=!1),i&&o?[4,i.set(wa,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}};return m};function xa(e,t,n){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?n:e.event_properties[t]}var Ca,Ea=function(){var e,t,n;function r(t){if(t)try{var n=new Function("return "+t)();if("function"==typeof n)return n;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){n=e&&function(e){return"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body}(e)?r(e.body||""):r("")}),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 r;return u(this,function(i){if(n)try{return[2,null!==(r=n(t))&&void 0!==r?r:null]}catch(n){return null==e||e.error("Could not execute custom enrichment function",n),[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},Ia="userProperty",Oa="eventProperty",Ta=function(e){return e===Ia||e===Oa},Pa=[Ia,Oa],Ra=function(e,t){return function(e){var t=h([],d(new Set((Array.isArray(e)?e:[e]).filter(Ta))),!1);return t.length>0?t:h([],d(Pa),!1)}(e.trackingMethod).includes(t)},Aa=function(e){return Ra(e,Ia)},Ma=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return r(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),ne(this._init(s(s({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,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,T,P=this;return u(this,function(R){switch(R.label){case 0:return this.initializing?[2]:(this.initializing=!0,f=function(e){var t,n;return void 0===e&&(e={}),!0===(null===(t=e.remoteConfig)||void 0===t?void 0:t.fetchRemoteConfig)||!1!==(null===(n=e.remoteConfig)||void 0===n?void 0:n.fetchRemoteConfig)&&!1!==e.fetchRemoteConfig}(t),g=null!==(n=t.loggerProvider)&&void 0!==n?n:new ae,t.loggerProvider||g.enable(null!==(r=t.logLevel)&&void 0!==r?r: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 xt(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,n,r){if(g.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},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 ft(t.apiKey,g,v,{enabled:b,sampleRate:y})).setTag("library","".concat(ur,"/").concat(lr)),w.setTag("platform","Web"),w.setTag("web_environment",function(){var e=z();if(!e)return"unknown";var t=function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.chrome)||void 0===t?void 0:t.runtime)||void 0===n?void 0:n.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,n;return"string"==typeof(null===(n=null===(t=e.process)||void 0===t?void 0:t.versions)||void 0===n?void 0:n.node)}(e)?"node":"unknown"}()),"undefined"!=typeof navigator&&w.setTag("user_agent",navigator.userAgent),[4,$r(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,n,r){S.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&si(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 Hn(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?s({},e.defaultTracking.attribution):{}}(this.config),Hn(this.config.defaultTracking)&&Aa(k)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return l(P,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[3,2]:(this.webAttribution=new ga(k,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new ga(k,this.config),[4,this.webAttribution.init()]):[3,8];case 7:R.sent(),R.label=8;case 8:return x=De(),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(P,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]})})}),(T=Re(this.config.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,10]:[4,this.add(oi()).promise];case 9:R.sent(),R.label=10;case 10:return[4,this.add(new ke({diagnosticsClient:w})).promise];case 11:return R.sent(),[4,this.add(new cr).promise];case 12:return R.sent(),[4,this.add(new Ae).promise];case 13:return R.sent(),function(e){ii||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."),ii=!0)}(this.config),M=this.config.defaultTracking,Kn(M,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(ri()).promise]):[3,15];case 14:R.sent(),R.label=15;case 15:return Gn(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(ei()).promise]):[3,17];case 16:R.sent(),R.label=17;case 17:return Jn(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Jr(or(this.config))).promise]):[3,20];case 18:return R.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return l(P,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(Jr(or(this.config))).promise]);case 1:return t.sent(),[2]}})})}),R.label=20;case 20:return Hn(this.config.defaultTracking)&&function(e){return Ra(e,Oa)}(k)?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(ma(k)).promise]):[3,22];case 21:R.sent(),R.label=22;case 22:return Qn(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Bo(nr(this.config),{diagnosticsClient:w})).promise]):[3,24];case 23:R.sent(),R.label=24;case 24:return er(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(es(rr(this.config))).promise]):[3,26];case 25:R.sent(),R.label=26;case 26:return Xn(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(ms(ir(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||"object"==typeof e.webVitals&&null!==e.webVitals)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(fa(Zn(this.config))).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(as(tr(this.config))).promise]):[3,32];case 31:R.sent(),R.label=32;case 32:return function(e){return Kn(e,"pageUrlEnrichment")}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(ka()).promise]):[3,34];case 33:R.sent(),R.label=34;case 34:return("boolean"==typeof(A=this.config.customEnrichment)?A:"object"==typeof A&&null!==A&&!1!==A.enabled)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(Ea()).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(),T.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=a(t,["time"]),i=s(s({},"number"==typeof n&&{time:n}),e.groups&&{groups:e.groups});P.track(e.eventType,r,Object.keys(i).length?i:void 0)}),[2]}var A,M})})},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){Re(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){Re(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,n,r;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!==(r=e.userProperties)&&void 0!==r?r:{};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&&(n=s.return)&&n.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,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),ne(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,ne(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return ne(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId();r!==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,Yn(this.config.defaultTracking)&&(r&&i&&n.push(this.track(Er,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,n);return this.config.identify&&n.push(this.track(te(this.config.identify)).promise),Yn(this.config.defaultTracking)&&n.push(this.track(Cr,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,ne(Promise.all(n))},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=Hr(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(ar(t)){var r=t._q;t._q=[],t=sr(new F,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(ar(r)){var o=r._q;r._q=[],r=sr(new F,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(ar(t)){var r=t._q;t._q=[],t=sr(new ie,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!Aa(this.webAttribution.options))return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return l(this,void 0,void 0,function(){var n,r,i;return u(this,function(o){return n=Date.now(),r=Me(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===Cr||t.event_type===Er||t.session_id&&t.session_id!==this.getSessionId()||(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=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}(re),_a="[Amplitude]",Na="".concat(_a," Session Replay ID"),Da=Pt.US,La={enabled:!0},Fa=1e3,Ua="".concat(_a," Session Replay Debug"),ja="https://api-sr.amplitude.com/sessions/v2/track",Ba="https://api-sr.eu.amplitude.com/sessions/v2/track",qa="https://api-sr.stag2.amplitude.com/sessions/v2/track",za=9e6,Wa=/payload.*exceed/i,Va=500,$a=1e4,Ka=1024,Ha="X-Session-Replay-Event-Skipped",Ga="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"}(Ca||(Ca={}));var Ja=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 n=this.logger[e];return"function"==typeof n?(null!==(t=n.__rrweb_original__)&&void 0!==t?t:n).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),Ya="medium";var Xa=new Map,Qa=function(e){var t=Xa.get(e);if(t)return t;var n="\0TRAIL\0",r="\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(/\/\*\*$/,n)).replace(/\/\*\*\//g,r)).replace(/\*\*/g,i)).replace(/\*/g,o)).replace(/\?/g,s)).replace(/[.+^${}()|[\]\\]/g,"\\$&")).split(n).join("(/.*)?")).split(r).join("/(.*\\/)?")).split(i).join(".*")).split(o).join(".*")).split(s).join(".");var l=new RegExp("^".concat(a,"$"));return Xa.set(e,l),l},Za=function(e,t,n){switch(t){case"light":if("input"!==e)return!1;var r=n?function(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?t.toLowerCase():null}(n):"";return!!r&&(!!["password","hidden","email","tel"].includes(r)||!!n.autocomplete.startsWith("cc-"));case"medium":return"input"===e;case"conservative":return!0;default:return Za(e,Ya,n)}},el=function(e,t){var n,r,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(Qa(a.match).test(e))return a.maskLevel}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null!==(i=t.defaultMaskLevel)&&void 0!==i?i:Ya},tl=function(e,t,n,r){var i,o;if(void 0===t&&(t={defaultMaskLevel:Ya}),n){if(n.closest(".amp-mask, [data-amp-mask]"))return!0;var s=(null!==(i=t.maskSelector)&&void 0!==i?i:[]).some(function(e){return n.closest(e)});if(s)return!0;if(n.closest(".amp-unmask, [data-amp-unmask]"))return!1;var a=(null!==(o=t.unmaskSelector)&&void 0!==o?o:[]).some(function(e){return n.closest(e)});if(a)return!1}return Za(e,el(r,t),n)},nl=function(e,t,n){return function(r,i){return tl(e,t,i,null==n?void 0:n())?r.replace(/[^\s]/g,"*"):r}},rl=function(e,t){return function(n,r,i){var o;if("style"===n)return r;if(!(null!==(o=null==e?void 0:e.maskAttributes)&&void 0!==o?o:[]).includes(n))return r;var s=["INPUT","SELECT","TEXTAREA"].includes(i.tagName)?"input":"text";return tl(s,e,i,null==t?void 0:t())?r.replace(/[^\s]/g,"*"):r}},il=function(e){var t=null==e?void 0:e.blockSelector;return h(h([],d("string"==typeof t?t?[t]:[]:null!=t?t:[]),!1),["[data-amp-block]"],!1).join(",")},ol=function(e,t){var n,r;return e&&("conservative"===el(t,e)||"conservative"===e.defaultMaskLevel||(null===(n=e.urlMaskLevels)||void 0===n?void 0:n.some(function(e){return"conservative"===e.maskLevel})))?"*":h(h([],d(null!==(r=null==e?void 0:e.maskSelector)&&void 0!==r?r:[]),!1),["[data-amp-mask]"],!1).join(",")};function sl(e,t){return t||("STAGING"===e?qa:"EU"===e?Ba:ja)}var al=function(){var e=z();return(null==e?void 0:e.location)?e.location.href:""},ll=function(e,t){var n,r;try{for(var i=c(t),o=i.next();!o.done;o=i.next()){var s=o.value,a=Qa(s.selector);if(a.test(e))return e.replace(a,s.replacement)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ul=function(){return l(void 0,void 0,void 0,function(){var e,t,n,r,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(),n=t.usage,r=t.quota,i=t.usageDetails,o=n?Math.round(n/Ka):0,s=n&&r?Math.round(1e3*(n/r+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:""}]}})})},cl=function(e){var t=s({},e),n=t.apiKey;return t.apiKey="****".concat(n.substring(n.length-4)),t},dl=function(){return{flushMaxRetries:2,logLevel:oe.Warn,loggerProvider:new ae,transportProvider:new vt}},hl=function(e){function t(t,n){var r,i,o,a,l,u,c,p,f,g,v,m,y,b,w=this,S=dl();(w=e.call(this,s(s({transportProvider:S.transportProvider,loggerProvider:new Ja(n.loggerProvider||S.loggerProvider)},n),{apiKey:t}))||this).flushMaxRetries=void 0!==n.flushMaxRetries&&n.flushMaxRetries<=S.flushMaxRetries?n.flushMaxRetries:S.flushMaxRetries,w.apiKey=t,w.sampleRate=n.sampleRate||0,w.serverZone=n.serverZone||Da,w.configServerUrl=n.configServerUrl,w.trackServerUrl=n.trackServerUrl,w.shouldInlineStylesheet=n.shouldInlineStylesheet,w.inlineImages=n.inlineImages,w.version=n.version,w.performanceConfig=n.performanceConfig||La,w.storeType=null!==(r=n.storeType)&&void 0!==r?r:"memory",w.applyBackgroundColorToBlockedElements=null!==(i=n.applyBackgroundColorToBlockedElements)&&void 0!==i&&i,w.enableUrlChangePolling=null!==(o=n.enableUrlChangePolling)&&void 0!==o&&o,w.urlChangePollingInterval=null!==(a=n.urlChangePollingInterval)&&void 0!==a?a:Fa,w.captureDocumentTitle=null!==(l=n.captureDocumentTitle)&&void 0!==l&&l,void 0!==n.fullSnapshotIntervalMs&&(w.fullSnapshotIntervalMs=n.fullSnapshotIntervalMs),void 0!==n.eagerFullSnapshotSend&&(w.eagerFullSnapshotSend=n.eagerFullSnapshotSend),w.captureFullSnapshotOnFocus=null!==(u=n.captureFullSnapshotOnFocus)&&void 0!==u&&u,void 0!==n.maxPersistedEventsSizeBytes&&(w.maxPersistedEventsSizeBytes=ml(n.maxPersistedEventsSizeBytes,fl,gl,"maxPersistedEventsSizeBytes",w.loggerProvider)),void 0!==n.maxSingleEventSizeBytes&&(w.maxSingleEventSizeBytes=ml(n.maxSingleEventSizeBytes,fl,vl,"maxSingleEventSizeBytes",w.loggerProvider)),w.privacyConfig=s(s({},null!==(c=n.privacyConfig)&&void 0!==c?c:{}),{unmaskSelector:Array.from(new Set(h([".".concat("amp-unmask")],d(null!==(f=null===(p=n.privacyConfig)||void 0===p?void 0:p.unmaskSelector)&&void 0!==f?f:[]),!1)))}),n.interactionConfig&&(w.interactionConfig=n.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)),n.debugMode&&(w.debugMode=n.debugMode);var k=n;return w.useWebWorker=null===(m=null!==(g=n.useWebWorker)&&void 0!==g?g:null===(v=k.experimental)||void 0===v?void 0:v.useWebWorker)||void 0===m||m,w.enableTransportCompression=null===(y=n.enableTransportCompression)||void 0===y||y,w.sendTimeoutMs=n.sendTimeoutMs,w.captureAdoptedStyleSheets=null===(b=n.captureAdoptedStyleSheets)||void 0===b||b,n.crossOriginIframes&&(w.crossOriginIframes=n.crossOriginIframes),n.flushIntervalConfig?w.flushIntervalConfig=function(e,t){var n,r,i={};void 0!==e.minIntervalMs&&(!Number.isFinite(e.minIntervalMs)||e.minIntervalMs<pl?(t.warn("flushIntervalConfig.minIntervalMs ".concat(e.minIntervalMs," is below floor ").concat(pl,"ms; clamping.")),i.minIntervalMs=pl):i.minIntervalMs=e.minIntervalMs);void 0!==e.maxIntervalMs&&(Number.isNaN(e.maxIntervalMs)||e.maxIntervalMs<pl?(t.warn("flushIntervalConfig.maxIntervalMs ".concat(e.maxIntervalMs," is below floor ").concat(pl,"ms; clamping.")),i.maxIntervalMs=pl):i.maxIntervalMs=e.maxIntervalMs);if(void 0!==i.minIntervalMs||void 0!==i.maxIntervalMs){var o=null!==(n=i.minIntervalMs)&&void 0!==n?n:Va,s=null!==(r=i.maxIntervalMs)&&void 0!==r?r:$a;s<o&&(void 0===i.maxIntervalMs?(t.warn("flushIntervalConfig.minIntervalMs (".concat(o,") exceeds the default maxIntervalMs (").concat($a,"); raising max to match min.")),i.maxIntervalMs=o):void 0===i.minIntervalMs?(t.warn("flushIntervalConfig.maxIntervalMs (".concat(s,") is below the default minIntervalMs (").concat(Va,"); 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}(n.flushIntervalConfig,w.loggerProvider):w.flushIntervalConfig={minIntervalMs:1e3,maxIntervalMs:1e4},w.handleSendEvents=n.handleSendEvents,w.handleFetchConfig=n.handleFetchConfig,w}return r(t,e),t}(ce),pl=100,fl=1e3,gl=8e6,vl=1e7;function ml(e,t,n,r,i){if(Number.isFinite(e))return e<t?(i.warn("".concat(r," ").concat(e," is below floor ").concat(t,"; clamping.")),t):e>n?(i.warn("".concat(r," ").concat(e," exceeds ceiling ").concat(n,"; clamping.")),n):e;i.warn("".concat(r," value is not a finite number (got ").concat(String(e),"); ignoring."))}var yl=(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))(yl||{}),bl=(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))(bl||{}),wl=(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))(wl||{}),Sl=function(e,t){var n=document.createDocumentFragment();return function(e,t,n){var r,i,o=s({},e);try{for(var a=c(["blockSelector","maskSelector","unmaskSelector"]),l=a.next();!l.done;l=a.next()){var u=l.value,d=e[u],h=("string"==typeof d?[d]:null!=d?d:[]).filter(function(e){try{return t(e),!0}catch(t){if(!n)throw new Error("Invalid privacy selector: ".concat(e));return n(e),!1}});o[u]=h.length?h:void 0}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}(e,function(e){n.querySelector(e)},function(e){t.warn('[session-replay-browser] omitting selector "'.concat(e,'" because it is invalid'))})},kl=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){var e,t,n,r,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,T,P=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){P.remoteConfigClient.subscribe("configs.sessionReplay",{timeout:1500},function(n,r){var i;if(P.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(r,":"),JSON.stringify(n,null,2)),n){var o=n,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!==(n=null!==(t=v.defaultMaskLevel)&&void 0!==t?t:y.defaultMaskLevel)&&void 0!==n?n:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:h([],d(new Set(h(h([],d(null!==(r=y.maskAttributes)&&void 0!==r?r:[]),!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,n,r,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&&(n=h.return)&&n.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){r={error:e}}finally{try{g&&!g.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.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&&(T=k.return)&&T.call(k)}finally{if(O)throw O.error}}l.privacyConfig=Sl(b,this.localConfig.loggerProvider)}return m&&Object.keys(m).length>0&&(l.targetingConfig=m),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:cl(l)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:l,remoteConfig:p}]}})})},e.prototype.sanitizeMinSessionDurationMs=function(e){if("number"==typeof e&&Number.isFinite(e)){if(!(e<0))return e>xl?(this.localConfig.loggerProvider.warn("min_session_duration_ms remote value ".concat(e," exceeds ").concat(xl,"ms ceiling; clamping.")),xl):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}(),xl=6e4,Cl=function(e,t){return l(void 0,void 0,void 0,function(){var n,r;return u(this,function(i){return n=new hl(e,t),r=new xt(e,n.loggerProvider,n.serverZone,t.configServerUrl,t.handleFetchConfig),[2,new kl(r,n)]})})};function El(e){for(var t=e.length,n=0;n<t&&!(e.charCodeAt(n)>127);n++);if(n===t)return t;for(var r=n;n<t;n++){var i=e.charCodeAt(n);if(i<=127)r++;else if(i<=2047)r+=2;else if(i>=55296&&i<=56319){var o=n+1<t?e.charCodeAt(n+1):NaN;o>=56320&&o<=57343?(r+=4,n++):r+=3}else r+=3}return r}function Il(e){for(var t=0,n=0;n<e.length;n++)t+=El(e[n]);return t}function Ol(e,t){if(!(3*e.length<=t)){var n=El(e);return n>t?n:void 0}}function Tl(e){if(e.type!==yl.IncrementalSnapshot)return!1;var t=e.data;return t.source===bl.Mutation&&!t.isAttachIframe}function Pl(e){var t,n,r=new Map;if(e.forEach(function(e,t){if(e.attributes&&"style"in e.attributes){var n=r.get(e.id);n?n.push(t):r.set(e.id,[t])}}),0===r.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,n){var r;("object"!=typeof(r=i(e))||null===r)&&(t=n)});var n=[];if(e.forEach(function(e,r){r!==t&&(o.add(e),r>t&&n.push(e))}),n.length>0){var r=n[n.length-1],s=function(e){var t,n,r,i,o={};try{for(var s=c(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{for(var u=(r=void 0,c(Object.keys(l))),d=u.next();!d.done;d=u.next()){var h=d.value;o[h]=l[h]}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o}(n.map(function(e){return i(e)}));o.delete(r),a.set(r,s)}};try{for(var u=c(r.values()),d=u.next();!d.done;d=u.next()){l(d.value)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(n=u.return)&&n.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 n=a.get(t);if(void 0===n)if(o.has(t)){var r=s({},e.attributes);delete r.style,Object.keys(r).length>0&&h.push(s(s({},e),{attributes:r}))}else h.push(e);else h.push(s(s({},e),{attributes:s(s({},e.attributes),{style:n})}))}),h}function Rl(e){var t,n,r,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 n,r,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){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.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&&(n=v.return)&&n.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=(r=void 0,c(p)),E=C.next();!E.done;E=C.next()){var I=d(E.value,2),O=I[0],T=I[1];if(!f.has(O)&&!g.has(O)&&!k.has(O)&&(f.has(T)||g.has(T)||k.has(T))){var P=u.get(O),R=a.get(O);void 0!==P&&void 0!==R&&P<R?g.add(O):void 0!==P&&void 0!==R&&P===R?k.add(O):f.add(O),x=!0}}}catch(e){r={error:e}}finally{try{E&&!E.done&&(i=C.return)&&i.call(C)}finally{if(r)throw r.error}}}var A=f.size>0||g.size>0||k.size>0,M=[];e.forEach(function(e,t){var n,r;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))||M.push(s))}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.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=A?D.filter(function(e){return!f.has(e.id)&&!g.has(e.id)&&!k.has(e.id)}):D,F={source:bl.Mutation,removes:M,adds:A?_.filter(function(e){return!f.has(e.node.id)&&!g.has(e.node.id)&&!k.has(e.node.id)}):_,texts:A?N.filter(function(e){return!f.has(e.id)&&!g.has(e.id)&&!k.has(e.id)}):N,attributes:Pl(L)};return s(s({},o),{data:F})}function Al(e){if(e.length<=1)return e;for(var t=[],n=0;n<e.length;)if(Tl(e[n])){for(var r=n+1;r<e.length&&Tl(e[r]);)r++;t.push(r>n+1?Rl(e.slice(n,r)):e[n]),n=r}else t.push(e[n]),n++;return t}var Ml=function(){function e(e,t,n,r,i){var o,s=this;this.taskQueue=[],this.pendingQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t=e,n=t.type,r=t.timestamp,i=t.delay,o=t.data;return null!=i?JSON.stringify({type:n,timestamp:r,delay:i,data:o}):JSON.stringify({type:n,timestamp:r,data:o})},this.addCompressedEventToManager=function(e,t){var n,r=Ol(e,null!==(n=s.config.maxSingleEventSizeBytes)&&void 0!==n?n:za);void 0===r?s.eventsManager&&s.deviceId&&s.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:s.deviceId}):s.config.loggerProvider.warn("Session replay event dropped: serialized size ".concat(Math.round(r/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."))},this.addCompressedEvent=function(e,t){if(s.worker)try{s.worker.postMessage({event:e,sessionId:t})}catch(n){"DataCloneError"===n.name?s.worker.postMessage(JSON.stringify({event:e,sessionId:t})):s.config.loggerProvider.warn("Unexpected error while posting message to worker:",n)}else{var n=s.compressEvent(e);s.addCompressedEventToManager(n,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 n=t.event,r=t.sessionId,i=s.compressEvent(n);s.addCompressedEventToManager(i,r)}}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=n,this.timeout=(null===(o=t.performanceConfig)||void 0===o?void 0:o.timeout)||2e3,this.onFullSnapshotProcessed=i,r){t.loggerProvider.log("Enabling web worker for compression");try{var l=new Blob([r],{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,n=t.compressedEvent,r=t.sessionId;s.addCompressedEventToManager(n,r)},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 n,r,i,o;if(e.type===yl.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){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.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,n=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 r=this.taskQueue.shift();if(r){var i=r.event,o=r.sessionId;this.addCompressedEvent(i,o)}}this.taskQueue.length>0||this.pendingQueue.length>0?requestIdleCallback(function(e){n.processQueue(e)},{timeout:this.timeout}):this.isProcessing=!1},e.prototype.mergeMutationTasks=function(e){var t,n,r;if(!1===(null===(r=this.config.performanceConfig)||void 0===r?void 0:r.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=Al(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&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}o=a}return i},e}(),_l="Session replay event batch rejected due to exceeded retry count",Nl="Failed to store session replay events in IndexedDB",Dl="Session replay event batch dropped: server signalled capture disabled or session out of valid range for this session",Ll="1.51.5";function Fl(e,t){return l(this,void 0,void 0,function(){var n,r,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]),n=t.CompressionStream,r=new n("gzip"),i=r.writable.getWriter(),o=r.readable.getReader(),s=[],a=l(b,void 0,void 0,function(){var e,t,n;return u(this,function(r){switch(r.label){case 0:return[4,o.read()];case 1:if(e=r.sent(),t=e.done,n=e.value,t)return[3,3];s.push(n),r.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 Ul=function(){function e(e){var t=e.trackServerUrl,n=e.loggerProvider,r=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=n,this.payloadBatcher=r||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,r;e.preventDefault(),n.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),n.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&&(r=i.return)&&r.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)n.log(t.message);else if("warn"===t.type)n.warn(t.message);else if("payload_too_large"===t.type){var r=l.pendingWorkerRequests.get(t.id);if(r)r.timeout&&clearTimeout(r.timeout),l.handlePayloadTooLargeResponse(r.context,t.isWaf),r.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){n.warn("Failed to handle delegated session replay fetch:",e)})},this.worker=p}catch(e){n.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,n,r=this,i=e.events,o=e.sessionId,s=e.deviceId,a=e.apiKey,l=e.serverZone,u=function(e){return El(e)},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(sl(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){r.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(sl(l,this.trackServerUrl),"?").concat(y.toString()),w=z();try{var S=new Blob([d],{type:"application/json"});!1===(null===(n=null===(t=null==w?void 0:w.navigator)||void 0===t?void 0:t.sendBeacon)||void 0===n?void 0:n.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=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.filter(function(t){return e.killedSessions.has(t.sessionId)?(e.completeRequest({context:t,err:Dl}),!1):t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:_l}),!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 n=this.flushPauseUntilMs-Date.now(),r=n>e?n:e;n>0&&(this.mergeOnNextFlush=!0),this.scheduled=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},r)}},e.prototype.flush=function(e){return void 0===e&&(e=!1),l(this,void 0,void 0,function(){var t,n,r,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]),n=c(t),r=n.next(),l.label=2;case 2:return r.done?[3,5]:(i=r.value,[4,this.send(i,e)]);case 3:l.sent(),l.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return o=l.sent(),s={error:o},[3,8];case 7:try{r&&!r.done&&(a=n.return)&&a.call(n)}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,n,r,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&&(n=w.return)&&n.call(w)}finally{if(t)throw t.error}}var E=[],I=function(e){var t,n;if(1===e.length)return E.push(e[0]),"continue";var r=null,i=0,o=function(){r&&E.push(r),r=null,i=0},a=function(e){var t=Il(e.events);if(null===r)return r=s(s({},e),{events:h([],d(e.events),!1),attempts:0}),i=t,"continue";if(i+t>4e6)return o(),r=s(s({},e),{events:h([],d(e.events),!1),attempts:0}),i=t,"continue";var n=r.onComplete,a=e.onComplete;r.events=r.events.concat(e.events),i+=t,r.onComplete=function(){return l(y,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,Promise.allSettled([n(),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&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}o()};try{for(var O=c(b.values()),T=O.next();!T.done;T=O.next()){I(T.value)}}catch(e){r={error:e}}finally{try{T&&!T.done&&(i=O.return)&&i.call(O)}finally{if(r)throw r.error}}return E},e.prototype.send=function(e,t){return void 0===t&&(t=!0),l(this,void 0,void 0,function(){var n,r,i,o;return u(this,function(s){return this.killedSessions.has(e.sessionId)?[2,this.completeRequest({context:e,err:Dl})]:(n=e.apiKey)?(r=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(n,r,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,n,r){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:n,useRetry:r,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:al(),sdkVersion:Ll,enableTransportCompression:o.enableTransportCompression,sendTimeoutMs:o.sendTimeoutMs}})})]})})},e.prototype.rememberTimedOutRequest=function(e,t){var n,r;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){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},e.prototype.handleDelegatedFetch=function(e,t){var n,r,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===(r=null===(n=h.headers)||void 0===n?void 0:n.get)||void 0===r?void 0:r.call(n,Ha))&&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,n,r,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,T,P,R,A,M,_,N,D;return u(this,function(u){switch(u.label){case 0:l=al(),g=Ll,v=n.sampleRate,m=new URLSearchParams({device_id:t,session_id:"".concat(n.sessionId),type:"".concat(n.type)}),y="".concat(null!==(a=null===(o=n.version)||void 0===o?void 0:o.type)&&void 0!==a?a:"standalone","/").concat(null!==(d=null===(c=n.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(r),w=z(),this.enableTransportCompression&&w&&"CompressionStream"in w?[4,Fl(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:El(b),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"}:{}),T={headers:E,body:I=null!=S?S:b,method:"POST",keepalive:O=x<=65536,signal:C.signal},P="".concat(sl(n.serverZone,this.trackServerUrl),"?").concat(m.toString()),0===r.events.length)return this.completeRequest({context:n}),[2];R=this.sendTimeoutMs>0?setTimeout(function(){C.abort()},this.sendTimeoutMs):void 0,A=void 0,u.label=5;case 5:return u.trys.push([5,,10,11]),this.handleSendEvents?[4,(L=this.handleSendEvents({url:P,method:"POST",headers:E,body:I,keepalive:O}),F=C.signal,new Promise(function(e,t){var n=function(){var e=new Error("Custom session replay transport aborted by send timeout");e.name="AbortError",t(e)};F.addEventListener("abort",n,{once:!0}),L.then(function(t){F.removeEventListener("abort",n),e(t)},function(e){F.removeEventListener("abort",n),t(e)})}))]:[3,7];case 6:return M=u.sent(),[3,9];case 7:return[4,fetch(P,T)];case 8:M=u.sent(),u.label=9;case 9:return A=M,[3,11];case 10:return R&&clearTimeout(R),[7];case 11:if(null===A)return this.completeRequest({context:n,err:"Unexpected error occurred"}),[2];if(A.status>=200&&A.status<300&&(_=null!==(f=null===(p=null===(h=A.headers)||void 0===h?void 0:h.get)||void 0===p?void 0:p.call(h,Ha))&&void 0!==f?f:null,this.applyServerDirective(n.sessionId,_)),i)return[3,12];N="";try{N=JSON.stringify(A.body,null,2)}catch(e){}return this.completeRequest({context:n,success:"".concat(A.status,": ").concat(N)}),[3,18];case 12:if(N="",413!==A.status)return[3,16];u.label=13;case 13:return u.trys.push([13,15,,16]),[4,A.text()];case 14:return N=u.sent(),[3,16];case 15:return u.sent(),[3,16];case 16:return[4,this.handleReponse(A.status,n,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(n)]:[3,21];case 20:return u.sent(),[3,22];case 21:this.completeRequest({context:n,err:D}),u.label=22;case 22:return[3,23];case 23:return[2]}var L,F})})},e.prototype.handleReponse=function(e,t,n){return void 0===n&&(n=""),l(this,void 0,void 0,function(){var r;return u(this,function(i){switch(i.label){case 0:switch(r=(new gt).buildStatus(e),r){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,Wa.test(n)),[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 n=t?"WAF (compressed payload too large)":"server (event too large)",r=Math.round(e.events.reduce(function(e,t){return e+t.length},0)/Ka);if(t)if(1!==e.events.length){this.loggerProvider.warn("Session replay event batch rejected by ".concat(n," (").concat(e.events.length," events, ").concat(r," 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(r," KB, 1 event) rejected by ").concat(n," — cannot split further")});else this.completeRequest({context:e,err:"Session replay event batch dropped: ".concat(n," rejected payload (").concat(e.events.length," events, ").concat(r," KB) — not retrying non-WAF 413")})},e.prototype.handleSuccessResponse=function(e){var t=Math.round(Il(e.events)/Ka);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(n){switch(n.label){case 0:return t=Math.random()*e.attempts*this.retryTimeout,e.attempts++,e.attempts>(e.flushMaxRetries||0)?(this.completeRequest({context:e,err:_l}),[2]):[4,new Promise(function(e){return setTimeout(e,t)})];case 1:return n.sent(),[4,this.send(e,!0)];case 2:return n.sent(),[2]}})})},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.onComplete(),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e.prototype.applyServerDirective=function(e,t){if(null===t)return this.flushPauseUntilMs=0,void(this.mergeLogFiredThisPause=!1);if("429"===t){var n=this.flushPauseUntilMs>Date.now();return this.flushPauseUntilMs=Date.now()+6e4,void(n||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 n,r,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){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.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:Dl}):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 jl=(e,t)=>t.some(t=>e instanceof t);let Bl,ql;const zl=new WeakMap,Wl=new WeakMap,Vl=new WeakMap;let $l={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return zl.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Jl(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Kl(e){$l=e($l)}function Hl(e){return(ql||(ql=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Yl(this),t),Jl(this.request)}:function(...t){return Jl(e.apply(Yl(this),t))}}function Gl(e){return"function"==typeof e?Hl(e):(e instanceof IDBTransaction&&function(e){if(zl.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});zl.set(e,t)}(e),jl(e,Bl||(Bl=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,$l):e)}function Jl(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(Jl(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return Vl.set(t,e),t}(e);if(Wl.has(e))return Wl.get(e);const t=Gl(e);return t!==e&&(Wl.set(e,t),Vl.set(t,e)),t}const Yl=e=>Vl.get(e);function Xl(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=Jl(s);return r&&s.addEventListener("upgradeneeded",e=>{r(Jl(s.result),e.oldVersion,e.newVersion,Jl(s.transaction),e)}),n&&s.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}const Ql=["get","getKey","getAll","getAllKeys","count"],Zl=["put","add","delete","clear"],eu=new Map;function tu(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(eu.get(t))return eu.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=Zl.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Ql.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;return r&&(s=s.index(t.shift())),(await Promise.all([s[n](...t),i&&o.done]))[0]};return eu.set(t,o),o}Kl(e=>({...e,get:(t,n,r)=>tu(t,n)||e.get(t,n,r),has:(t,n)=>!!tu(t,n)||e.has(t,n)}));const nu=["continue","continuePrimaryKey","advance"],ru={},iu=new WeakMap,ou=new WeakMap,su={get(e,t){if(!nu.includes(t))return e[t];let n=ru[t];return n||(n=ru[t]=function(...e){iu.set(this,ou.get(this)[t](...e))}),n}};async function*au(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const n=new Proxy(t,su);for(ou.set(n,t),Vl.set(n,Yl(t));t;)yield n,t=await(iu.get(n)||t.continue()),iu.delete(n)}function lu(e,t){return t===Symbol.asyncIterator&&jl(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&jl(e,[IDBIndex,IDBObjectStore])}Kl(e=>({...e,get:(t,n,r)=>lu(t,n)?au:e.get(t,n,r),has:(t,n)=>lu(t,n)||e.has(t,n)}));var uu=function(){function e(e){var t,n,r,i=this;this.minInterval=Va,this.maxInterval=$a,this.maxPersistedEventsSize=6e6,this._timeAtLastSplit=Date.now(),this.eventsContentBytes=new WeakMap,this.sequenceContentBytes=new Map,this.shouldSplitEventsList=function(e,t){var n=i.getEventsArraySize(e),r=i.maxPersistedEventsSize-n,o=t.length>=r;return!o&&3*t.length>=r&&(o=El(t)>=r),!!o||!!(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!==(n=e.maxInterval)&&void 0!==n?n:this.maxInterval,this.maxPersistedEventsSize=null!==(r=e.maxPersistedEventsSize)&&void 0!==r?r:this.maxPersistedEventsSize,this.interval=this.minInterval}return Object.defineProperty(e.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),e.prototype.isPrefixOf=function(e,t){return!(t.length<e.length)&&(0===e.length||t[e.length-1]===e.tail)},e.prototype.measureContentBytes=function(e,t){if(e&&e.length===t.length&&this.isPrefixOf(e,t))return e;var n=0,r=0;e&&this.isPrefixOf(e,t)&&(n=e.contentBytes,r=e.length);for(var i=r;i<t.length;i++)n+=El(t[i]);return{length:t.length,contentBytes:n,tail:t.length>0?t[t.length-1]:void 0}},e.prototype.getEventsContentBytes=function(e){var t=this.measureContentBytes(this.eventsContentBytes.get(e),e);return this.eventsContentBytes.set(e,t),t.contentBytes},e.prototype.getEventsArraySize=function(e){return this.getEventsContentBytes(e)+(2+Math.max(0,e.length-1)+2*e.length)},e.prototype.recallSequenceContentBytes=function(e,t){var n=this.sequenceContentBytes.get(e);n&&n.length===t.length&&this.isPrefixOf(n,t)&&this.eventsContentBytes.set(t,n)},e.prototype.rememberSequenceContentBytes=function(e,t){var n=this.measureContentBytes(this.sequenceContentBytes.get(e),t);this.sequenceContentBytes.set(e,n),this.eventsContentBytes.set(t,n)},e.prototype.forgetSequenceContentBytes=function(e){this.sequenceContentBytes.delete(e)},e}(),cu=function(e,t,n){!function(e){return"object"==typeof e&&null!==e&&"AbortError"===e.name}(n)?e.warn(t):e.debug(t)};var du="sessionCurrentSequence",hu="sequencesToSend",pu=5e3;function fu(e,t,n){var r=setTimeout(n,t);return e.then(function(){return clearTimeout(r)},function(){return clearTimeout(r)}),function(){return clearTimeout(r)}}var gu,vu,mu,yu=function(e){var t,n;return e.objectStoreNames.contains(du)||(n=e.createObjectStore(du,{keyPath:"sessionId"})),e.objectStoreNames.contains(hu)||(t=e.createObjectStore(hu,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:n}},bu=function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,(n=Xl(e,1,{upgrade:yu}),r=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(r,"ms")))},r);n.then(function(t){clearTimeout(o),e(t)},function(e){clearTimeout(o),t(e)})}))];case 1:return[2,t.sent()]}var n,r,i})})},wu=function(e){function t(t){var n,r=this;return(r=e.call(this,t)||this).consecutiveFailures=0,r.hasTriggeredFallback=!1,r.emptyFilteredCount=0,r.getSequencesToSend=function(){return l(r,void 0,void 0,function(){var e,t,n,r,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]),n=[],(r=this.db.transaction("sequencesToSend","readwrite")).done.catch(function(n){e||t||(cu(d.loggerProvider,"".concat(Nl,": ").concat(n),n),d.recordFailure())}),i=fu(r.done,pu,function(){e||t||(t=!0,cu(d.loggerProvider,"".concat(Nl,": transaction timed out")),d.recordFailure())}),[4,r.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:n.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,n];case 9:return c=u.sent(),t||(e=!0,cu(this.loggerProvider,"".concat(Nl,": ").concat(c),c),this.recordFailure()),[3,10];case 10:return[2,void 0]}})})},r.storeCurrentSequence=function(e){return l(r,void 0,void 0,function(){var t,n,r,i,o,l,c,d,h=this;return u(this,function(u){switch(u.label){case 0:t=!1,n=!1,u.label=1;case 1:return u.trys.push([1,5,,6]),(r=this.db.transaction([du,hu],"readwrite")).done.catch(function(e){t||n||(cu(h.loggerProvider,"".concat(Nl,": ").concat(e),e),h.recordFailure())}),i=fu(r.done,pu,function(){t||n||(n=!0,cu(h.loggerProvider,"".concat(Nl,": transaction timed out")),h.recordFailure())}),[4,r.objectStore(du).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,r.objectStore(hu).put({sessionId:e,events:o.events,tabId:this.tabId})];case 3:return l=u.sent(),[4,r.objectStore(du).put({sessionId:e,events:[],tabId:this.tabId})];case 4:return u.sent(),this.rememberSequenceContentBytes(e,[]),this.recordSuccess(),i(),o.tabId,c=a(o,["tabId"]),[2,s(s({},c),{sessionId:e,sequenceId:l})];case 5:return d=u.sent(),this.forgetSequenceContentBytes(e),n||(t=!0,cu(this.loggerProvider,"".concat(Nl,": ").concat(d),d),this.recordFailure()),[3,6];case 6:return[2,void 0]}})})},r.addEventToCurrentSequence=function(e,t){return l(r,void 0,void 0,function(){var n,r,i,o,s,a,l,c,d,h,p,f,g,v,m=this;return u(this,function(u){switch(u.label){case 0:n=!1,r=!1,u.label=1;case 1:return u.trys.push([1,15,,16]),(i=this.db.transaction([du,hu],"readwrite")).done.catch(function(e){n||r||(cu(m.loggerProvider,"".concat(Nl,": ").concat(e),e),m.recordFailure())}),o=fu(i.done,pu,function(){n||r||(r=!0,cu(m.loggerProvider,"".concat(Nl,": transaction timed out")),m.recordFailure())}),[4,i.objectStore(du).get(e)];case 2:return(null==(s=u.sent())?void 0:s.tabId)&&s.tabId!==this.tabId?s.events.length>0?[4,i.objectStore(hu).put({sessionId:e,events:s.events,tabId:s.tabId})]:[3,4]:[3,6];case 3:u.sent(),u.label=4;case 4:return a=[t],[4,i.objectStore(du).put({sessionId:e,events:a,tabId:this.tabId})];case 5:return u.sent(),this.rememberSequenceContentBytes(e,a),this.recordSuccess(),o(),[2,void 0];case 6:return(l=s)?[3,8]:(c=[t],[4,i.objectStore(du).put({sessionId:e,events:c,tabId:this.tabId})]);case 7:return u.sent(),this.rememberSequenceContentBytes(e,c),this.recordSuccess(),o(),[2,void 0];case 8:return this.recallSequenceContentBytes(e,l.events),this.shouldSplitEventsList(l.events,t)?[3,10]:(d=l.events.concat(t),[4,i.objectStore(du).put({sessionId:e,events:d,tabId:this.tabId})]);case 9:return u.sent(),this.rememberSequenceContentBytes(e,d),this.recordSuccess(),o(),[2,void 0];case 10:return 0!==(h=l.events).length?[3,12]:(this.maybeLogEmptyFiltered("addEventToCurrentSequence"),p=[t],[4,i.objectStore(du).put({sessionId:e,events:p,tabId:this.tabId})]);case 11:return u.sent(),this.rememberSequenceContentBytes(e,p),this.recordSuccess(),o(),[2,void 0];case 12:return f=[t],[4,i.objectStore(du).put({sessionId:e,events:f,tabId:this.tabId})];case 13:return u.sent(),this.rememberSequenceContentBytes(e,f),[4,i.objectStore(hu).put({sessionId:e,events:h,tabId:this.tabId})];case 14:return g=u.sent(),this.recordSuccess(),o(),[2,{events:h,sessionId:e,sequenceId:g}];case 15:return v=u.sent(),this.forgetSequenceContentBytes(e),r||(n=!0,cu(this.loggerProvider,"".concat(Nl,": ").concat(v),v),this.recordFailure()),[3,16];case 16:return[2,void 0]}})})},r.storeSendingEvents=function(e,t){return l(r,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.db.put(hu,{sessionId:e,events:t,tabId:this.tabId})];case 1:return n=i.sent(),this.recordSuccess(),[2,n];case 2:return r=i.sent(),cu(this.loggerProvider,"".concat(Nl,": ").concat(r),r),this.recordFailure(),[3,3];case 3:return[2,void 0]}})})},r.cleanUpSessionEventsStore=function(e,t){return l(r,void 0,void 0,function(){var e;return u(this,function(n){switch(n.label){case 0:if(!t)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.db.delete(hu,t)];case 2:return n.sent(),this.recordSuccess(),[3,4];case 3:return e=n.sent(),cu(this.loggerProvider,"".concat(Nl,": ").concat(e),e),this.recordFailure(),[3,4];case 4:return[2]}})})},r.db=t.db,r.tabId=t.tabId,r.onPersistentFailure=t.onPersistentFailure,r.consecutiveFailureThreshold=null!==(n=t.consecutiveFailureThreshold)&&void 0!==n?n:1,r}return r(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,n){var r;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(n.apiKey.substring(0,10),"_amp_session_replay_events").concat(i),[4,bu(o)];case 1:return a=u.sent(),l=null!==(r=n.tabId)&&void 0!==r?r: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({},n),{db:a,tabId:l}))];case 2:return c=u.sent(),cu(n.loggerProvider,"".concat(Nl,": ").concat(c),c),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return l(this,void 0,void 0,function(){var t,n,r,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:n=c.apply(void 0,[u.sent()]),r=n.next(),u.label=5;case 5:if(r.done)return[3,7];if((i=r.value).tabId&&i.tabId!==this.tabId)return[3,6];i.tabId,o=a(i,["tabId"]),t.push(o),u.label=6;case 6:return r=n.next(),[3,5];case 7:return[3,10];case 8:return s=u.sent(),l={error:s},[3,10];case 9:try{r&&!r.done&&(d=n.return)&&d.call(n)}finally{if(l)throw l.error}return[7];case 10:return[2,t]}})})},t}(uu),Su=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 r(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,n=h([],d(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:n},this.resetCurrentSequence(e),{sequenceId:t,events:n,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,n,r,i,o,s,a,l,h;return u(this,function(u){e=[];try{for(t=c(Object.entries(this.finalizedSequences)),n=t.next();!n.done;n=t.next())r=d(n.value,2),i=r[0],o=r[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{n&&!n.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(n){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 n;return u(this,function(r){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(0===this.sequences[e].length?this.maybeLogEmptyFiltered("addEventToCurrentSequence"):n=this.addSequence(e)),this.sequences[e].push(t),[2,n]})})},t.prototype.storeSendingEvents=function(e,t){return l(this,void 0,void 0,function(){return u(this,function(n){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}(uu),ku=function(e){var t=e.config,n=e.minInterval,r=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,T,P,R,A;return u(this,function(M){switch(M.label){case 0:return g=null!==(A=t.maxSingleEventSizeBytes)&&void 0!==A?A:za,v=new Ul(s(s({},t),{loggerProvider:t.loggerProvider,payloadBatcher:a,workerScript:p})),m=function(){return new Su({loggerProvider:t.loggerProvider,maxInterval:r,minInterval:n,maxPersistedEventsSize:i})},b=!1,S=function(){return l(void 0,void 0,void 0,function(){var e,n,r;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 n=i.sent(),[3,3];case 2:n=void 0,i.label=3;case 3:return e=n,w=m(),e&&y&&(r=y,e.forEach(function(e){O({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r})})),[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,wu.new(o,{loggerProvider:t.loggerProvider,minInterval:n,maxInterval:r,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=M.sent(),[3,3];case 2:x=m(),M.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){for(var n=e.events,r=e.sessionId,i=e.deviceId,s=e.sequenceId,a=n,c=[],d=0;d<n.length;d++){var h=Ol(n[d],g);void 0!==h?(0===c.length&&(a=n.slice(0,d)),c.push(h)):a!==n&&a.push(n[d])}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/1024)," KB")}).join(", "),". If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support.")),0!==a.length?(t.debugMode&&ul().then(function(e){var n=e.totalStorageSize,r=e.percentOfQuota,i=e.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(n," KB, percentage of quota: ").concat(r,"%, usage details: ").concat(i))}).catch(function(){}),v.sendEventsList({events:a,sessionId:r,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(r,s)];case 1:return e.sent(),[2]}})})}})):w.cleanUpSessionEventsStore(r,s).catch(function(e){t.loggerProvider.warn("Failed to clean up session replay events store:",e)})},T=function(e){var n=e.sessionId,r=e.deviceId;if(y=r,!f||f()){var i=E+C.length;w.storeCurrentSequence(n).then(function(e){e&&(I(i),O({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r}))}).catch(function(e){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",e)})}},P=function(e){var n=e.deviceId;return l(void 0,void 0,void 0,function(){var e;return u(this,function(r){switch(r.label){case 0:return y=n,[4,w.getSequencesToSend()];case 1:return(null==(e=r.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:n})}),[2]):[2]}})})},R=function(e){var n=e.event,r=e.sessionId,i=e.deviceId;y=i;var o=!f||f(),s=E+C.length;C.push(n.data),w.addEventToCurrentSequence(r,n.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:T,addEvent:R,sendStoredEvents:P,flush:e,getBeaconEvents:function(){return h([],d(C),!1)},dropPendingBeaconEvents:function(){I(E+C.length)},trackDestination:v}]}})})},xu=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new Map;e.forEach(function(e){n.set(e.name,e.manager)}),this.managers=n}return e.prototype.sendStoredEvents=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return t=[],this.managers.forEach(function(n){t.push(n.sendStoredEvents(e))}),[4,Promise.all(t)];case 1:return n.sent(),[2]}})})},e.prototype.addEvent=function(e){var t,n=e.sessionId,r=e.event,i=e.deviceId;null===(t=this.managers.get(r.type))||void 0===t||t.addEvent({sessionId:n,event:r,deviceId:i})},e.prototype.sendCurrentSequenceEvents=function(e){var t=e.sessionId,n=e.deviceId;this.managers.forEach(function(e){e.sendCurrentSequenceEvents({sessionId:t,deviceId:n})})},e.prototype.flush=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return t=[],this.managers.forEach(function(n){t.push(n.flush(e))}),[4,Promise.all(t)];case 1:return n.sent(),[2]}})})},e}();function Cu(e,t){if(mu=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 n={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};gu=s(s({},n),t),vu=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(gu.root,n);var r=Eu(e,"all",function(){return Eu(e,"two",function(){return Eu(e,"one",function(){return Eu(e,"none")})})});if(r){var i=Du(Lu(r,e));return i.length>0&&(r=i[0]),Ou(r)}throw new Error("Selector was not found.")}function Eu(e,t,n){for(var r=null,i=[],o=e,s=0,a=function(){var e,a,l=(new Date).getTime()-mu.getTime();if(void 0!==gu.timeoutMs&&l>gu.timeoutMs)throw new Error("Timeout: Can't find a unique selector after ".concat(l,"ms"));var u=Mu(function(e){var t=e.getAttribute("id");if(t&&gu.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(o))||Mu.apply(void 0,h([],d(function(e){var t=Array.from(e.attributes).filter(function(e){return gu.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))||Mu.apply(void 0,h([],d(function(e){var t=Array.from(e.classList).filter(gu.className);return t.map(function(e){return{name:"."+CSS.escape(e),penalty:1}})}(o)),!1))||Mu(function(e){var t=e.tagName.toLowerCase();if(gu.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 n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(o);if("all"==t)p&&(u=u.concat(u.filter(Au).map(function(e){return Ru(e,p)})));else if("two"==t)u=u.slice(0,1),p&&(u=u.concat(u.filter(Au).map(function(e){return Ru(e,p)})));else if("one"==t){var f=d(u=u.slice(0,1),1)[0];p&&Au(f)&&(u=[Ru(f,p)])}else"none"==t&&(u=[{name:"*",penalty:3}],p&&(u=[Ru(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>=gu.seedMinLength&&(r=Iu(i,n)))return"break";o=o.parentElement,s++};o;){if("break"===a())break}return r||(r=Iu(i,n)),!r&&n?n():r}function Iu(e,t){var n,r,i=Du(Nu(e));if(i.length>gu.threshold)return t?t():null;try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(Pu(a))return a}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null}function Ou(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var i=e[r].level||0;n=t.level===i-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function Tu(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function Pu(e){var t=Ou(e);switch(vu.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 Ru(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function Au(e){return"html"!==e.name&&!e.name.startsWith("#")}function Mu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(_u);return n.length>0?n:null}function _u(e){return null!=e}function Nu(e,t){var n,r,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]),n=c(e[0]),r=n.next(),l.label=2;case 2:return r.done?[3,5]:(i=r.value,[5,c(Nu(e.slice(1,e.length),t.concat(i)))]);case 3:l.sent(),l.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return o=l.sent(),s={error:o},[3,8];case 7:try{r&&!r.done&&(a=n.return)&&a.call(n)}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 Du(e){return h([],d(e),!1).sort(function(e,t){return Tu(e)-Tu(t)})}function Lu(e,t,n){var r,i,o;return void 0===n&&(n={counter:0,visited:new Map}),u(this,function(s){switch(s.label){case 0:if(!(e.length>2&&e.length>gu.optimizedMinLength))return[3,5];r=1,s.label=1;case 1:return r<e.length-1?n.counter>gu.maxNumberOfTries?[2]:(n.counter+=1,(i=h([],d(e),!1)).splice(r,1),o=Ou(i),n.visited.has(o)?[2]:Pu(i)&&function(e,t){return vu.querySelector(Ou(e))===t}(i,t)?[4,i]:[3,4]):[3,5];case 2:return s.sent(),n.visited.set(o,!0),[5,c(Lu(i,t,n))];case 3:s.sent(),s.label=4;case 4:return r++,[3,1];case 5:return[2]}})}var Fu=function(e){var t=e.version,n=e.events,r=[];return n.forEach(function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&r.push(t)}),{version:t,events:r}},Uu=function(e){var t=e.version,n=e.events,r=[];n.forEach(function(e){var t=JSON.parse(e);"click"===t.type&&r.push(t)});var i=r.reduce(function(e,t){var n=t.x,r=t.y,i=t.selector,o=t.timestamp,a=o-o%36e5,l="".concat(n,":").concat(r,":").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)}},ju=function(e,t){var n=this;this.createHook=function(e){var t=e.eventsManager,r=e.sessionId,i=e.deviceIdFn,o=e.mirror,s=e.ugcFilterRules,a=e.performanceOptions;return function(e){if(e.type===wl.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=Cu(g,a)}catch(e){n.logger.debug("error resolving selector from finder")}var v=ll(u.href,s),m={x:h+n.scrollWatcher.currentScrollX,y:p+n.scrollWatcher.currentScrollY,selector:f,viewportHeight:c,viewportWidth:d,pageUrl:v,timestamp:Date.now(),type:"click"},y=i();y&&t.addEvent({sessionId:r,event:{type:"interaction",data:JSON.stringify(m)},deviceId:y})}}}}}},this.logger=e,this.scrollWatcher=t};function Bu(){var e=z();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||0}function qu(){var e=z();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||0}var zu=function(){function e(e,t){var n=z();n&&n.navigator&&"function"==typeof n.navigator.sendBeacon?this.sendBeacon=function(e,t){try{if(n.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch(e){}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(e,t){var n=new XMLHttpRequest;return n.open("POST",e,!0),n.setRequestHeader("Accept","*/*"),n.send(JSON.stringify(t)),!0},this.basePageUrl=sl(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 n,r=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=r.loggerProvider)||void 0===t||t.warn("Custom transport failed to send session replay interaction beacon:",e)})}catch(e){null===(n=this.loggerProvider)||void 0===n||n.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}(),Wu=function(){function e(e,t){var n=this;this.timestamp=Date.now(),this.hook=function(e){n.update(e)},this.send=function(e){return function(t){var r,i,o,s,a=e(),l=z();if(l&&a){var u=null!==(r=l.scrollX)&&void 0!==r?r:0,c=null!==(i=l.scrollY)&&void 0!==i?i:0;(u>0||c>0)&&n.update({id:1,x:u,y:c}),n.transport.send(a,{version:1,events:[{maxScrollX:n._maxScrollX,maxScrollY:n._maxScrollY,maxScrollWidth:n._maxScrollWidth,maxScrollHeight:n._maxScrollHeight,viewportHeight:Bu(),viewportWidth:qu(),pageUrl:ll(l.location.href,null!==(s=null===(o=n.config.interactionConfig)||void 0===o?void 0:o.ugcFilterRules)&&void 0!==s?s:[]),timestamp:n.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=qu(),this._maxScrollHeight=Bu(),this.config=t,this.transport=e}return e.default=function(t,n){return new e(new zu(t,n),n)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),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 n=qu();this._maxScrollX=e.x;var r=e.x+n;r>this._maxScrollWidth&&(this._maxScrollWidth=r),this.timestamp=t}if(e.y>this._maxScrollY){var i=Bu();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),Vu=function(e){var t=e.sessionId,n=e.deviceId;this.deviceId=n,this.sessionId=t,t&&n&&(this.sessionReplayId=function(e,t){return"".concat(t,"/").concat(e)}(t,n))},$u=864e5,Ku=function(e){return"".concat("AMP_SR_START_").concat(e.substring(0,10),"_")},Hu=function(e,t){return"".concat(Ku(e)).concat(t)},Gu=function(){try{var e=z();return null==e?void 0:e.localStorage}catch(e){return}},Ju=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,Xl(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,n;return u(this,function(r){switch(r.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 n=r.sent(),this.dbs[t]=n,[2,n]}})})},this.getTargetingMatchForSession=function(t){var n=t.loggerProvider,r=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(r)];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(),cu(n,"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 n=t.loggerProvider,r=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(r)];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(),cu(n,"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 n=t.loggerProvider,r=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(r)];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(),cu(n,"Failed to clear old targeting matches for sessions: ".concat(d),d),[3,9];case 9:return[2]}})})}},Yu=new Ju,Xu=function(e){var t=e.sessionId,n=e.targetingConfig,r=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,Yu.clearStoreOfOldSessions({loggerProvider:r,apiKey:i,currentSessionId:t})];case 1:return u.sent(),[4,Yu.getTargetingMatchForSession({loggerProvider:r,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 lf})];case 4:return a=u.sent().evaluateTargeting,l=s(s({},o),{flag:n,sessionId:"string"==typeof t?parseInt(t,10):t,apiKey:i,loggerProvider:r}),[4,a(l)];case 5:return(d=u.sent())&&d.sr_targeting_config&&(e="on"===d.sr_targeting_config.key),Yu.storeTargetingMatchForSession({loggerProvider:r,apiKey:i,sessionId:t,targetingMatch:e}),[3,7];case 6:return h=u.sent(),p=h,r.warn(p.message),[3,7];case 7:return[2,e]}})})},Qu=2654435761,Zu=2246822519,ec=3266489917,tc=374761393;function nc(e,t){return(e<<t|e>>>32-t)>>>0}function rc(e,t){return e=nc(e=e+Math.imul(t,Zu)>>>0,13),e=Math.imul(e,Qu)>>>0}function ic(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function oc(e,t){void 0===t&&(t=0);var n,r=function(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<e.length){var i=e.charCodeAt(n+1);i>=56320&&i<=57343&&(r=i-56320+(r-55296<<10)+65536,n++)}r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<65536?t.push(224|r>>12,128|r>>6&63,128|63&r):t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r)}return new Uint8Array(t)}(e),i=r.length,o=0;if(i>=16){for(var s=t+Qu+Zu>>>0,a=t+Zu>>>0,l=t>>>0,u=t-Qu>>>0;o<=i-16;)s=rc(s,ic(r,o)),a=rc(a,ic(r,o+=4)),l=rc(l,ic(r,o+=4)),u=rc(u,ic(r,o+=4)),o+=4;n=nc(s,1)+nc(a,7)+nc(l,12)+nc(u,18)>>>0}else n=t+tc>>>0;for(n=n+i>>>0;o<=i-4;)n=n+Math.imul(ic(r,o),ec)>>>0,n=Math.imul(nc(n,17),668265263)>>>0,o+=4;for(;o<i;)n=n+Math.imul(r[o],tc)>>>0,n=Math.imul(nc(n,11),Qu)>>>0,o++;return n^=n>>>15,n=Math.imul(n,Zu)>>>0,n^=n>>>13,n=Math.imul(n,ec)>>>0,(n^=n>>>16)>>>0}var sc="__amplitude_url_tracking_patched__",ac=new WeakMap;function lc(e,t,n){if(void 0===n&&(n={}),!(null==e?void 0:e.location))return function(){};var r=n.enablePolling,i=void 0!==r&&r,o=n.pollingInterval,s=void 0===o?Fa: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=ac.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=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=e.apply(this,t);return p(),r};return t[sc]=!0,t},g=e.history;if(null==g?void 0:g.pushState){var v=Reflect.get(g,"pushState");v[sc]||(g.pushState=f(v))}if(null==g?void 0:g.replaceState){var m=Reflect.get(g,"replaceState");m[sc]||(g.replaceState=f(m))}c={callbacks:h,notify:p,onPopStateOrHashChange:function(){return p()},listenersAttached:!1},ac.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 uc(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,n,r){var i,o,a,l=s(s({},e),r),u=l.ugcFilterRules||[],c=null!==(i=l.enablePolling)&&void 0!==i&&i,d=null!==(o=l.pollingInterval)&&void 0!==o?o:Fa,h=null!==(a=l.captureDocumentTitle)&&void 0!==a&&a;if(!n)return function(){};var p=void 0,f=function(){return n.location&&n.location.href||""},g=function(){var e=f();if(void 0===p||e!==p){p=e;var r=function(){var e=n.innerHeight,t=n.innerWidth,r=n.document,i=f(),o="";return h&&(o=(null==r?void 0:r.title)||""),{href:u.length>0?ll(i,u):i,title:o,viewportHeight:e,viewportWidth:t,type:"url-change-event"}}();t(r)}},v=lc(n,function(){return g()},c?{enablePolling:!0,pollingInterval:d}:{});return g(),function(){return v()}},options:e}}uc();var cc=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:Ga,action:"start"}),this.mutationObserver=new MutationObserver(function(e){var n,r,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){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.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:Ga,action:"stop"})},e.prototype.sendToIframeAfterLoad=function(e){var t=this,n=function(){t.pendingLoadListeners.delete(e),t.sendToIframe(e,{type:Ga,action:"start"})};this.pendingLoadListeners.set(e,n),e.addEventListener("load",n,{once:!0})},e.prototype.sendToAllIframes=function(e){var t=this;document.querySelectorAll("iframe").forEach(function(n){return t.sendToIframe(n,e)})},e.prototype.sendToIframe=function(e,t){var n;try{null===(n=e.contentWindow)||void 0===n||n.postMessage(t,"*")}catch(e){}},e}();var dc,hc,pc,fc=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 n=z();n&&(n.removeEventListener("blur",e.blurListener),n.removeEventListener("focus",e.focusListener),!t&&n.addEventListener("blur",e.blurListener),!t&&n.addEventListener("focus",e.focusListener),n.self&&"onpagehide"in n.self?(n.removeEventListener("pagehide",e.pageLeaveListener),!t&&n.addEventListener("pagehide",e.pageLeaveListener)):(n.removeEventListener("beforeunload",e.pageLeaveListener),!t&&n.addEventListener("beforeunload",e.pageLeaveListener)))},this.blurListener=function(){e.sendEvents()},this.focusListener=function(){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 n;null===(n=e.eventCompressor)||void 0===n||n.flushQueue(),e.sendEvents(),e.pageLeaveFns.forEach(function(e){e(t)})},this.evaluateTargetingAndCapture=function(t,n,r,i){return void 0===n&&(n=!1),void 0===r&&(r=!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(!n)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,Xu({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 n?(this.initialize(!0),[3,5]):[3,3];case 3:return!r&&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,n,r){return void 0===n&&(n={}),void 0===r&&(r=!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!==Ca.METADATA?(e={config:cl(i),version:Ll},r?[4,ul()]:[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({},n),e)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(t," due to no ongoing recording.")),[3,4];case 3:return 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,n,r;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===(n=e.crossOriginIframeCoordinator)||void 0===n||n.stop(),e.crossOriginIframeCoordinator=null,null===(r=e.crossOriginParentSignalCleanup)||void 0===r||r.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 Ja(new ae)}return e.prototype.init=function(e,t){return ne(this._init(e,t))},e.prototype.setupUrlChangeListener=function(){var e,t,n=this;null===(e=this.urlChangeCleanup)||void 0===e||e.call(this);var r=z();if(null==r?void 0:r.location){var i=!!(null===(t=this.config)||void 0===t?void 0:t.targetingConfig),o=lc(r,function(e){if(n.currentPageUrl=e,i){var t=++n.latestUrlChangeTargetingEvaluationId;n.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:e}},!1,!1,!0),n.loggerProvider.debug("Queued URL-change targeting re-evaluation #".concat(t," for ").concat(e,"."))}});this.urlChangeCleanup=function(){o(),n.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,n=null===(t=null===(e=z())||void 0===e?void 0:e.location)||void 0===t?void 0:t.href;return null!=n?{url:n}:void 0},e.prototype._init=function(e,t){var n,r,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,T,P,R,A,M,_,N,D,L,F,U,j,B,q,W,V,$,K,H,G,J,Y,X,Q,Z=this;return u(this,function(u){switch(u.label){case 0:return null===(n=this.urlChangeCleanup)||void 0===n||n.call(this),this.recordingEnabled=!0,this.startChildRecordingOnSetup=!1,this.loggerProvider=new Ja(t.loggerProvider||new ae),Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.currentPageUrl=al(),this.identifiers=new Vu({sessionId:t.sessionId,deviceId:t.deviceId}),l=Date.now(),function(e,t,n){var r,i,o=Gu();if(o){var s=Ku(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>=$u)&&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){r={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}catch(e){null==n||n.debug("Failed to prune stale replay start times: ".concat(String(e)))}}}(e,l,this.loggerProvider),this.sessionStartTime=void 0!==t.sessionId&&null!==(r=function(e,t,n,r){var i=Gu();if(i){var o=Hu(e,t);try{var s=i.getItem(o);if(null!==s){var a=Number(s);if(Number.isFinite(a)&&a>0&&a<=n&&n-a<$u)return a}return i.setItem(o,String(n)),n}catch(e){return void(null==r||r.debug("Failed to read/write replay start time from storage: ".concat(String(e))))}}}(e,t.sessionId,l,this.loggerProvider))&&void 0!==r?r:l,k=this,[4,Cl(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,Ll,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=Wu.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 ju(this.loggerProvider,O)),T=[],"idb"!==(P=this.config.storeType)||(null===(p=z())||void 0===p?void 0:p.indexedDB)||(P="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(P," for event storage.")),M=z(),this.config.useWebWorker&&M&&M.Worker?[4,Promise.resolve().then(function(){return uf})]:[3,4];case 3:_=u.sent(),N=_.compressionScript,D=_.trackDestinationScript,R=N,A=D,u.label=4;case 4:return u.trys.push([4,6,,7]),[4,ku({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:P,trackDestinationWorkerScript:A,shouldSend:function(){return!Z.isBelowMinSessionDuration()}})];case 5:return L=u.sent(),this.rrwebEventManager=L,T.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?Uu:Fu,u.label=8;case 8:return u.trys.push([8,10,,11]),[4,ku({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:P,trackDestinationWorkerScript:A})];case 9:return j=u.sent(),T.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(xu.bind.apply(xu,h([void 0],d(T),!1))),this.eventCompressor&&this.eventCompressor.terminate(),W=!0===this.config.eagerFullSnapshotSend?function(){return Z.sendEvents()}:void 0,this.eventCompressor=new Ml(this.eventsManager,this.config,this.getDeviceId(),R,W),this.pendingEmitEvents.length>0){V=this.pendingEmitEvents.splice(0);try{for($=c(V),K=$.next();!K.done;K=$.next())H=K.value,G=H.event,J=H.sessionId,this.eventCompressor.enqueueEvent(G,J)}catch(e){X={error:e}}finally{try{K&&!K.done&&(Q=$.return)&&Q.call($)}finally{if(X)throw X.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 n=Z.getDeviceId();n&&(Z.isBelowMinSessionDuration()||L.trackDestination.sendBeacon({events:t,sessionId:Z.identifiers.sessionId,deviceId:n,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)&&(zn(Y=jn()),Y.setup(s({logger:this.loggerProvider},this.config.serverZone&&{endpoint:Dn[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 ne(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t,n){var r,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===(r=this.identifiers)||void 0===r?void 0:r.sessionId,l=this.getDeviceId(),void 0===a||a!==e||void 0!==t&&t!==l||void 0!==(null==n?void 0:n.userProperties)&&0!==Object.keys(n.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 Vu({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,n,r){var i=Gu();if(i)try{i.setItem(Hu(e,t),String(n))}catch(e){null==r||r.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,n){var r=Gu();if(r)try{r.removeItem(Hu(e,t))}catch(e){null==n||n.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==n?void 0:n.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,n=this.identifiers;if(!t||!n)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var r=this.getShouldRecord(),i={};return r&&((e={})[Na]=n.sessionReplayId?n.sessionReplayId:null,i=e,t.debugMode&&(i[Ua]=JSON.stringify({appHash:He(t.apiKey).toString()}))),this.addCustomRRWebEvent(Ca.GET_SR_PROPS,{shouldRecord:r,eventProperties:i},10===this.eventCount),10===this.eventCount&&(this.eventCount=0),this.eventCount++,i},e.prototype.sendEvents=function(e){var t,n,r=e||(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId),i=this.getDeviceId();if(this.eventsManager&&r&&i){if(this.isBelowMinSessionDuration()){var o=this.sessionStartTime,s=this.config.minSessionDurationMs;return this.loggerProvider.log("Session ".concat(r," not sent: duration ").concat(Date.now()-o,"ms is below minimum ").concat(s,"ms.")),void this.suppressedSendCount++}if(!this.hasEmittedGateDecision&&void 0!==(null===(n=this.config)||void 0===n?void 0:n.minSessionDurationMs)&&this.recordCancelCallback&&this.recordFunction){this.hasEmittedGateDecision=!0;var a=void 0!==this.sessionStartTime?Date.now()-this.sessionStartTime:void 0;this.addCustomRRWebEvent(Ca.REPLAY_GATE_DECISION,{sessionId:r,suppressedSendCount:this.suppressedSendCount,elapsedMs:a,minSessionDurationMs:this.config.minSessionDurationMs},!1)}this.eventsManager.sendCurrentSequenceEvents({sessionId:r,deviceId:i})}},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),l(this,void 0,void 0,function(){var n;return u(this,function(r){return(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId)?(n=this.getDeviceId())?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:n}),[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,n;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(n=Re(this.config.instanceName).identityStore.getIdentity().optOut);return void 0!==n?n:null===(t=this.config)||void 0===t?void 0:t.optOut},e.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.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,n=!1,r="",i=!1;this.config.targetingConfig?this.sessionTargetingMatch?(r="Capturing replays for session ".concat(this.identifiers.sessionId," due to matching targeting conditions."),this.loggerProvider.log(r),n=!0,i=!0):(r="Not capturing replays for session ".concat(this.identifiers.sessionId," due to not matching targeting conditions."),this.loggerProvider.log(r),n=!1,i=!1):(e=this.identifiers.sessionId,t=this.config.sampleRate,oc(e.toString())%1e6/1e6<t)?(n=!0,i=!0):(r="Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate."),this.loggerProvider.log(r),n=!1,i=!1);return this.lastShouldRecordDecision!==n&&this.config.targetingConfig&&(this.addCustomRRWebEvent(Ca.TARGETING_DECISION,{message:r,sessionId:this.identifiers.sessionId,matched:i,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=n),n},e.prototype.getBlockSelectors=function(){var e;return il(null===(e=this.config)||void 0===e?void 0:e.privacyConfig)},e.prototype.getMaskTextSelectors=function(){var e;return ol(null===(e=this.config)||void 0===e?void 0:e.privacyConfig,this.currentPageUrl)},e.prototype.getRecordingPlugins=function(e){var t,n,r,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=uc({ugcFilterRules:(null===(n=null===(t=this.config)||void 0===t?void 0:t.interactionConfig)||void 0===n?void 0:n.ugcFilterRules)||[],enablePolling:(null===(r=this.config)||void 0===r?void 0:r.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 xy})];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(n){switch(n.label){case 0:if(this.recordFunction)return[2,this.recordFunction];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return wC})];case 2:return e=n.sent().record,this.recordFunction=e,[2,e];case 3:return t=n.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(n){switch(n.label){case 0:if(this.recordEventsInFlight)return this.recordEventsPendingShouldLogMetadata=e,[2];this.recordEventsInFlight=!0,n.label=1;case 1:return n.trys.push([1,,6,7]),[4,this._recordEvents(e)];case 2:n.sent(),n.label=3;case 3:return null===this.recordEventsPendingShouldLogMetadata?[3,5]:(t=this.recordEventsPendingShouldLogMetadata,this.recordEventsPendingShouldLogMetadata=null,[4,this._recordEvents(t)]);case 4:return n.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,n,r,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,T=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===(n=l.loggingConfig)||void 0===n?void 0:n.network,m=sl(l.serverZone,l.trackServerUrl),y=[ja,Ba,qa,m],null===(r=this.networkObservers)||void 0===r||r.start(function(e){y.some(function(t){return e.url.startsWith(t)})||T.addCustomRRWebEvent(Ca.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 n=t.parent;function r(t){if(t.source===n){var r=t.data;(null==r?void 0:r.type)===Ga&&("start"===r.action?e.onStart():"stop"===r.action&&e.onStop())}}return t.addEventListener("message",r),function(){return t.removeEventListener("message",r)}}({onStart:function(){T.recordingEnabled&&T._recordEventsInChildMode(g,p,l,S)},onStop:function(){try{T.recordCancelCallback&&T.recordCancelCallback(),T.recordCancelCallback=null}catch(t){var e=t;T.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(T.shouldOptOut()||!T.recordingEnabled)return T.loggerProvider.log(T.shouldOptOut()?"Opting session ".concat(p," out of recording due to optOut config."):"Session Replay capture stopping for ".concat(p,".")),T.stopRecordingEvents(),void T.sendEvents();e.type===yl.Meta&&(e.data.href=ll(e.data.href,k)),T.eventCompressor?T.eventCompressor.enqueueEvent(e,p):T.pendingEmitEvents.push({event:e,sessionId:p})},"Error while capturing replay: ")),{plugins:I,recordCrossOriginIframes:x})),x&&!E&&C&&(this.crossOriginIframeCoordinator||(this.crossOriginIframeCoordinator=new cc),this.crossOriginIframeCoordinator.start()),this.addCustomRRWebEvent(Ca.DEBUG_INFO),e&&this.addCustomRRWebEvent(Ca.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,n,r){var i=this,o=e.privacyConfig;return s(s(s(s({emit:n,inlineStylesheet:e.shouldInlineStylesheet,inlineImages:e.inlineImages,hooks:t},function(e,t){return void 0===t&&(t=function(){return""}),{maskAllInputs:!0,maskTextClass:"amp-mask",blockClass:"amp-block",blockSelector:il(e),maskTextSelector:ol(e,t()),maskInputFn:nl("input",e,t),maskTextFn:nl("text",e,t),maskAttributeFn:rl(e,t)}}(o,function(){return i.currentPageUrl})),{applyBackgroundColorToBlockedElements:e.applyBackgroundColorToBlockedElements}),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(r,t.toString()),!0}})},e.prototype._recordEventsInChildMode=function(e,t,n,r){try{this.recordCancelCallback&&this.recordCancelCallback(),this.recordCancelCallback=null,this.recordCancelCallback=e(s(s({},this.buildRRWebRecordOptions(n,r,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 ne(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(n){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,n,r,i,o,s){var a=(null==e?void 0:e.toString())?He(e.toString()):void 0;this.metadata={joinedConfig:t,localConfig:n,remoteConfig:r,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,n;return l(this,void 0,void 0,function(){var r,i;return u(this,function(o){switch(o.label){case 0:if(!(null===(n=null===(t=null===(e=this.config)||void 0===e?void 0:e.loggingConfig)||void 0===t?void 0:t.network)||void 0===n?void 0:n.enabled)||this.networkObservers)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return IC})];case 2:return r=o.sent().NetworkObservers,this.networkObservers=new r,[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}(),gc=function(e){return function(){var t=e.config||dl();return{logger:t.loggerProvider,logLevel:t.logLevel}}},vc=function(){var e=new fc;return{init:be(e.init.bind(e),"init",gc(e)),evaluateTargetingAndCapture:be(e.evaluateTargetingAndCapture.bind(e),"evaluateTargetingAndRecord",gc(e)),setSessionId:be(e.setSessionId.bind(e),"setSessionId",gc(e)),getSessionId:be(e.getSessionId.bind(e),"getSessionId",gc(e)),getSessionReplayProperties:be(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",gc(e)),flush:be(e.flush.bind(e),"flush",gc(e)),start:be(e.start.bind(e),"start",gc(e)),stop:be(e.stop.bind(e),"stop",gc(e)),shutdown:be(e.shutdown.bind(e),"shutdown",gc(e))}}(),mc=vc.init,yc=vc.setSessionId,bc=vc.getSessionId,wc=vc.getSessionReplayProperties,Sc=vc.flush,kc=vc.start,xc=vc.stop,Cc=vc.shutdown,Ec=vc.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"}(dc||(dc={})),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"}(hc||(hc={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(pc||(pc={}));var Ic=[dc.SET,dc.SET_ONCE,dc.ADD,dc.APPEND,dc.PREPEND,dc.POSTINSERT],Oc="1.36.4",Tc="".concat("[Amplitude]"," Session Replay ID"),Pc=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:Sc,getSessionId:bc,getSessionReplayProperties:wc,init:mc,setSessionId:yc,start:kc,stop:xc,shutdown:Cc,evaluateTargetingAndCapture:Ec},this.options=s({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var n,r,i,o,a,c,d,h,p;return l(this,void 0,void 0,function(){var t,l,f;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=Re(this.config.instanceName).identityStore,l=t.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:null!==(n=this.options.deviceId)&&void 0!==n?n: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===(r=this.config.remoteConfig)||void 0===r?void 0:r.serverUrl),trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null===(i=this.options.privacyConfig)||void 0===i?void 0:i.blockSelector,maskAttributes:null===(o=this.options.privacyConfig)||void 0===o?void 0:o.maskAttributes,maskSelector:null===(a=this.options.privacyConfig)||void 0===a?void 0:a.maskSelector,unmaskSelector:null===(c=this.options.privacyConfig)||void 0===c?void 0:c.unmaskSelector,defaultMaskLevel:null===(d=this.options.privacyConfig)||void 0===d?void 0:d.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!==(h=this.options.useWebWorker)&&void 0!==h?h:null===(p=this.options.experimental)||void 0===p?void 0:p.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 f=u.sent(),null==e||e.loggerProvider.error("Session Replay: Failed to initialize due to ".concat(f.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(n){switch(n.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 n.sent(),[2]}})})},e.prototype.onOptOutChanged=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(n){switch(n.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:n.sent(),n.label=3;case 3:n.label=4;case 4:return[2]}})})},e.prototype.execute=function(e){var t,n,r;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(n){if(Ic.includes(n)){var r=e.user_properties&&e.user_properties[n];t=s(s({},t),r)}}),t}}(e)),l=z(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:a,page:null!=(null===(n=null==l?void 0:l.location)||void 0===n?void 0:n.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[Tc],[2,Promise.resolve(e)];case 9:return d=u.sent(),null===(r=this.config)||void 0===r||r.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}();const Rc="is",Ac="is not",Mc="contains",_c="does not contain",Nc="less",Dc="less or equal",Lc="greater",Fc="greater or equal",Uc="version less",jc="version less or equal",Bc="version greater",qc="version greater or equal",zc="set is",Wc="set is not",Vc="set contains",$c="set does not contain",Kc="set contains any",Hc="set does not contain any",Gc="regex match",Jc="regex does not match",Yc=-862048943,Xc=461845907,Qc=(e,t=0)=>{const n=(e=>{const t=[];let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296==(64512&i)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return Uint8Array.from(t)})(e),r=n.length,i=r>>2;let o=t;for(let e=0;e<i;e++){const t=nd(n,e<<2);o=Zc(t,o)}const s=i<<2;let a=0;switch(r-s){case 3:a^=n[s+2]<<16,a^=n[s+1]<<8,a^=n[s],a=Math.imul(a,Yc),a=td(a,15),a=Math.imul(a,Xc),o^=a;break;case 2:a^=n[s+1]<<8,a^=n[s],a=Math.imul(a,Yc),a=td(a,15),a=Math.imul(a,Xc),o^=a;break;case 1:a^=n[s],a=Math.imul(a,Yc),a=td(a,15),a=Math.imul(a,Xc),o^=a}return o^=r,ed(o)>>>0},Zc=(e,t)=>{let n=e,r=t;return n=Math.imul(n,Yc),n=td(n,15),n=Math.imul(n,Xc),r^=n,r=td(r,13),r=Math.imul(r,5),r+-430675100|0},ed=e=>{let t=e;return t^=t>>>16,t=Math.imul(t,-2048144789),t^=t>>>13,t=Math.imul(t,-1028477387),t^=t>>>16,t},td=(e,t,n=32)=>{t>n&&(t%=n);return(e<<t|(e&4294967295<<n-t>>>0)>>>0>>>n-t>>>0)>>>0},nd=(e,t=0)=>{const n=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return rd(n)},rd=e=>(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24,id=(e,t)=>{if(t&&0!==t.length){for(const n of t){if(!n||!e||"object"!=typeof e)return;e=e[n]}return null==e?void 0:e}};class od{constructor(e,t,n,r=void 0){this.major=e,this.minor=t,this.patch=n,this.preRelease=r}static parse(e){if(!e)return;const t=new RegExp("^(\\d+)\\.(\\d+)(\\.(\\d+)(-(([-\\w]+\\.?)*))?)?$").exec(e);if(!t)return;const n=Number(t[1]),r=Number(t[2]);if(isNaN(n)||isNaN(r))return;const i=Number(t[4])||0,o=t[5]||void 0;return new od(n,r,i,o)}compareTo(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}}class sd{evaluate(e,t){const n={},r={context:e,result:n};for(const e of t){const t=this.evaluateFlag(r,e);t&&(n[e.key]=t)}return n}evaluateWithTraces(e,t){const n={},r={},i={context:e,result:n};for(const e of t){const{variant:t,trace:o}=this.evaluateFlagWithTrace(i,e);t&&(n[e.key]=t),r[e.key]=o}return{results:n,traces:r}}evaluateFlag(e,t){let n;for(const r of t.segments)if(n=this.evaluateSegment(e,t,r),n){const e=Object.assign(Object.assign(Object.assign({},t.metadata),r.metadata),n.metadata);n=Object.assign(Object.assign({},n),{metadata:e});break}return n}evaluateFlagWithTrace(e,t){var n,r;const i=[];let o,s,a;for(const l of t.segments){if(!l.conditions){const r=this.bucket(e,l),u=void 0!==r;i.push({segmentMetadata:l.metadata,conditionsPassed:!0,bucketed:u,bucketVariant:r,conditionResult:void 0,matched:u}),o||void 0===r||(o=t.variants[r],s=l,a=null===(n=l.metadata)||void 0===n?void 0:n.segmentName);continue}const u=[];let c=!1;for(const t of l.conditions){let n=!0;const r=[];for(const i of t){const t=id(e,i.selector),o=this.matchCondition(e,i);if(r.push({propValue:t,condition:i,matched:o}),!o){n=!1;break}}if(u.push(r),n){c=!0;break}}let d,h=!1;c&&(d=this.bucket(e,l),h=void 0!==d),i.push({segmentMetadata:l.metadata,conditionsPassed:c,bucketed:h,bucketVariant:d,conditionResult:u,matched:c&&h}),c&&void 0!==d&&!o&&(o=t.variants[d],s=l,a=null===(r=l.metadata)||void 0===r?void 0:r.segmentName)}if(o&&s){const e=Object.assign(Object.assign(Object.assign({},t.metadata),s.metadata),o.metadata);o=Object.assign(Object.assign({},o),{metadata:e})}return{variant:o,trace:{flagKey:t.key,matched:void 0!==o,matchedSegment:a,steps:i}}}evaluateSegment(e,t,n){if(!n.conditions){const r=this.bucket(e,n);return void 0!==r?t.variants[r]:void 0}if(this.evaluateConditions(e,n.conditions)){const r=this.bucket(e,n);return void 0!==r?t.variants[r]:void 0}}evaluateConditions(e,t){for(const n of t){let t=!0;for(const r of n)if(t=this.matchCondition(e,r),!t)break;if(t)return!0}return!1}matchCondition(e,t){const n=id(e,t.selector);if(null==n)return this.matchNull(t.op,t.values);{const e=this.coerceStringArray(n);if(this.isSetOperator(t.op))return!!e&&this.matchSet(e,t.op,t.values);if(e)return this.matchStringsNonSet(e,t.op,t.values);{const e=this.coerceString(n);return void 0!==e&&this.matchString(e,t.op,t.values)}}}getHash(e){return Qc(e)}bucket(e,t){if(!t.bucket)return t.variant;const n=this.coerceString(id(e,t.bucket.selector));if(!n||0===n.length)return t.variant;const r=`${t.bucket.salt}/${n}`,i=this.getHash(r),o=i%100,s=Math.floor(i/100);for(const e of t.bucket.allocations){const t=e.range[0],n=e.range[1];if(o>=t&&o<n)for(const t of e.distributions){const e=t.range[0],n=t.range[1];if(s>=e&&s<n)return t.variant}}return t.variant}matchNull(e,t){const n=this.containsNone(t);switch(e){case Rc:case Mc:case Nc:case Dc:case Lc:case Fc:case Uc:case jc:case Bc:case qc:case zc:case Vc:case Kc:return n;case Ac:case _c:case $c:case Hc:return!n;default:return!1}}matchSet(e,t,n){switch(t){case zc:return this.setEquals(e,n);case Wc:return!this.setEquals(e,n);case Vc:return this.matchesSetContainsAll(e,n);case $c:return!this.matchesSetContainsAll(e,n);case Kc:return this.matchesSetContainsAny(e,n);case Hc:return!this.matchesSetContainsAny(e,n);default:return!1}}matchString(e,t,n){switch(t){case Rc:return this.matchesIs(e,n);case Ac:return!this.matchesIs(e,n);case Mc:return this.matchesContains(e,n);case _c:return!this.matchesContains(e,n);case Nc:case Dc:case Lc:case Fc:return this.matchesComparable(e,t,n,e=>this.parseNumber(e),(e,t,n)=>this.comparator(e,t,n));case Uc:case jc:case Bc:case qc:return this.matchesComparable(e,t,n,e=>od.parse(e),(e,t,n)=>this.versionComparator(e,t,n));case Gc:return this.matchesRegex(e,n);case Jc:return!this.matchesRegex(e,n);default:return!1}}matchStringsNonSet(e,t,n){return e.some(e=>this.matchString(e,t,n))}matchesIs(e,t){if(this.containsBooleans(t)){const n=e.toLowerCase();if("true"===n||"false"===n)return t.some(e=>e.toLowerCase()===n)}return t.some(t=>e===t)}matchesContains(e,t){for(const n of t)if(e.toLowerCase().includes(n.toLowerCase()))return!0;return!1}matchesComparable(e,t,n,r,i){const o=r(e),s=n.map(e=>r(e)).filter(e=>void 0!==e);return void 0===o||0===s.length?n.some(n=>this.comparator(e,t,n)):s.some(e=>i(o,t,e))}comparator(e,t,n){switch(t){case Nc:case Uc:return e<n;case Dc:case jc:return e<=n;case Lc:case Bc:return e>n;case Fc:case qc:return e>=n;default:return!1}}versionComparator(e,t,n){const r=e.compareTo(n);switch(t){case Nc:case Uc:return r<0;case Dc:case jc:return r<=0;case Lc:case Bc:return r>0;case Fc:case qc:return r>=0;default:return!1}}matchesRegex(e,t){return t.some(t=>Boolean(new RegExp(t).exec(e)))}containsNone(e){return e.some(e=>"(none)"===e)}containsBooleans(e){return e.some(e=>{switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})}parseNumber(e){var t;return null!==(t=Number(e))&&void 0!==t?t:void 0}coerceString(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)}coerceStringArray(e){if(Array.isArray(e)){return e.map(e=>this.coerceString(e)).filter(Boolean)}const t=String(e);if(t.startsWith("["))try{const e=JSON.parse(t);return Array.isArray(e)?e.map(e=>this.coerceString(e)).filter(Boolean):void 0}catch(e){return}}isSetOperator(e){switch(e){case zc:case Wc:case Vc:case $c:case Kc:case Hc:return!0;default:return!1}}setEquals(e,t){const n=new Set(e),r=new Set(t);return n.size===r.size&&[...r].every(e=>n.has(e))}matchesSetContainsAll(e,t){if(e.length<t.length)return!1;for(const n of t)if(!this.matchesIs(n,e))return!1;return!0}matchesSetContainsAny(e,t){for(const n of t)if(this.matchesIs(n,e))return!0;return!1}}const ad=(e,t)=>{const n=Object.assign({},e),r=[],i=t||Object.keys(n);for(const e of i){const t=ld(e,n);t&&r.push(...t)}return r},ld=(e,t,n=[])=>{const r=t[e];if(!r)return;if(!r.dependencies||0===r.dependencies.length)return delete t[r.key],[r];n.push(r.key);const i=[];for(const e of r.dependencies){if(n.some(t=>t===e))throw Error(`Detected a cycle between flags ${n.join(", ")}`);const r=ld(e,t,n);r&&i.push(...r)}return i.push(r),n.pop(),delete t[r.key],i};function ud(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const cd="function"==typeof Buffer,dd=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),hd=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),pd=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(hd),fd=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,gd=String.fromCharCode.bind(String),vd=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_")),md=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),yd=e=>{let t,n,r,i,o="";const s=e.length%3;for(let s=0;s<e.length;){if((n=e.charCodeAt(s++))>255||(r=e.charCodeAt(s++))>255||(i=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|i,o+=hd[t>>18&63]+hd[t>>12&63]+hd[t>>6&63]+hd[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},bd="function"==typeof btoa?e=>btoa(e):cd?e=>Buffer.from(e,"binary").toString("base64"):yd,wd=cd?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(gd.apply(null,e.subarray(n,n+4096)));return bd(t.join(""))},Sd=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?gd(192|t>>>6)+gd(128|63&t):gd(224|t>>>12&15)+gd(128|t>>>6&63)+gd(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return gd(240|t>>>18&7)+gd(128|t>>>12&63)+gd(128|t>>>6&63)+gd(128|63&t)},kd=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,xd=e=>e.replace(kd,Sd),Cd=cd?e=>Buffer.from(e,"utf8").toString("base64"):dd?e=>wd(dd.encode(e)):e=>bd(xd(e)),Ed=(e,t=!1)=>t?vd(Cd(e)):Cd(e),Id=e=>Ed(e,!0),Od=e=>{if(e=e.replace(/\s+/g,""),!fd.test(e))throw new TypeError("malformed base64.");let t,n,r;e+="==".slice(2-(3&e.length));let i=[];for(let o=0;o<e.length;)t=pd[e.charAt(o++)]<<18|pd[e.charAt(o++)]<<12|(n=pd[e.charAt(o++)])<<6|(r=pd[e.charAt(o++)]),64===n?i.push(gd(t>>16&255)):64===r?i.push(gd(t>>16&255,t>>8&255)):i.push(gd(t>>16&255,t>>8&255,255&t));return i.join("")},Td=Id;class Pd extends Error{constructor(e,t){super(t),this.statusCode=e,Object.setPrototypeOf(this,Pd.prototype)}}class Rd extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Rd.prototype)}}class Ad{constructor(e,t,n){this.deploymentKey=e,this.serverUrl=t,this.httpClient=n}getVariants(e,t){return ud(this,void 0,void 0,function*(){const n=Td(JSON.stringify(e)),r={Authorization:`Api-Key ${this.deploymentKey}`,"X-Amp-Exp-User":n};(null==t?void 0:t.flagKeys)&&(r["X-Amp-Exp-Flag-Keys"]=Td(JSON.stringify(t.flagKeys))),(null==t?void 0:t.trackingOption)&&(r["X-Amp-Exp-Track"]=t.trackingOption),(null==t?void 0:t.exposureTrackingOption)&&(r["X-Amp-Exp-Exposure-Track"]=t.exposureTrackingOption);const i=new URL(`${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);const o=yield this.httpClient.request({requestUrl:i.toString(),method:"GET",headers:r,timeoutMillis:null==t?void 0:t.timeoutMillis});if(200!=o.status)throw new Pd(o.status,`Fetch error response: status=${o.status}`);return JSON.parse(o.body)})}}class Md{constructor(e,t,n){this.deploymentKey=e,this.serverUrl=t,this.httpClient=n}getFlags(e){return ud(this,void 0,void 0,function*(){const t={Authorization:`Api-Key ${this.deploymentKey}`};(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]=`${e.libraryName}/${e.libraryVersion}`),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=Td(JSON.stringify(e.user)));const n=yield this.httpClient.request({requestUrl:`${this.serverUrl}/sdk/v2/flags`+((null==e?void 0:e.deliveryMethod)?`?delivery_method=${e.deliveryMethod}`:""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis});if(200!=n.status)throw Error(`Flags error response: status=${n.status}`);return JSON.parse(n.body).reduce((e,t)=>(e[t.key]=t,e),{})})}}const _d=()=>"undefined"!=typeof globalThis&&null!==globalThis?globalThis:"undefined"!=typeof window&&null!==window?window:"undefined"!=typeof self&&null!==self?self:"undefined"!=typeof global&&null!==global?global:void 0,Nd=()=>{var e;return null===(e=_d())||void 0===e?void 0:e.localStorage},Dd=()=>{var e;return null===(e=_d())||void 0===e?void 0:e.sessionStorage},Ld=()=>{const e=_d();return(null==e?void 0:e.setTimeout)?e.setTimeout.bind(e):void 0},Fd=()=>{const e=_d();return(null==e?void 0:e.setInterval)?e.setInterval.bind(e):void 0},Ud=()=>{const e=_d();return(null==e?void 0:e.clearInterval)?e.clearInterval.bind(e):void 0};class jd{constructor(e,t){this.poller=void 0,this.action=e,this.ms=t}start(){if(this.poller)return;const e=Fd();e&&(this.poller=e(()=>{this.action()},this.ms),this.action())}stop(){if(!this.poller)return;const e=Ud();e&&e(this.poller),this.poller=void 0}}var Bd={},qd={get exports(){return Bd},set exports(e){Bd=e}};function zd(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})}!function(e,t){!function(n,r){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",T="Huawei",P="LG",R="Microsoft",A="Motorola",M="Opera",_="Samsung",N="Sharp",D="Sony",L="Xiaomi",F="Zebra",U="Facebook",j=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];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 n,o,a,l,u,c,d=0;d<t.length&&!u;){var h=t[d],p=t[d+1];for(n=o=0;n<h.length&&!u;)if(u=h[n++].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]):r:this[l[0]]=c?l[1].call(this,c,l[2]):r:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):r):this[l]=c||r;d+=2}},V=function(e,t){for(var n in t)if(typeof t[n]===s&&t[n].length>0){for(var i=0;i<t[n].length;i++)if(B(t[n][i],e))return"?"===n?r:n}else if(B(t[n],e))return"?"===n?r:n;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"},K={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,M+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[u,M]],[/(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,M+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[u,M+" 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,T],[c,v]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[d,T],[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,A],[c,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[d,A],[c,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[d,P],[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,P],[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,P],[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]]},H=function(e,t){if(typeof e===s&&(t=e,e=r),!(this instanceof H))return new H(e,t).getResult();var i=e||(typeof n!==o&&n.navigator&&n.navigator.userAgent?n.navigator.userAgent:""),f=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(K,t):K;return this.getBrowser=function(){var e={};return e[u]=r,e[h]=r,W.call(e,i,f.browser),e.major=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:r}(e.version),e},this.getCPU=function(){var e={};return e[p]=r,W.call(e,i,f.cpu),e},this.getDevice=function(){var e={};return e[d]=r,e[l]=r,e[c]=r,W.call(e,i,f.device),e},this.getEngine=function(){var e={};return e[u]=r,e[h]=r,W.call(e,i,f.engine),e},this.getOS=function(){var e={};return e[u]=r,e[h]=r,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};H.VERSION="0.7.33",H.BROWSER=j([u,h,"major"]),H.CPU=j([p]),H.DEVICE=j([l,d,c,f,g,m,v,y,b]),H.ENGINE=H.OS=j([u,h]),e.exports&&(t=e.exports=H),t.UAParser=H;var G=typeof n!==o&&(n.jQuery||n.Zepto);if(G&&!G.ua){var J=new H;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 n in t)G.ua[n]=t[n]}}}("object"==typeof window?window:$)}(qd,Bd),"function"==typeof SuppressedError&&SuppressedError;const Wd=(e,t=!1)=>{const n=Vd(e,t);let r;const i=(()=>{var e;return null===(e=_d())||void 0===e?void 0:e.document})();if(!i)return;const o=i.cookie.split("; ");for(const e of o){const[t,i]=e.split("=",2);t===n&&(r=decodeURIComponent(i))}if(r)try{if(t){const e=atob(r);return JSON.parse(decodeURIComponent(e))}const e=r.split(".");let n;return e.length>=2&&e[1]&&(n=atob(e[1])),{deviceId:e[0],userId:n}}catch(e){return}},Vd=(e,t)=>{if(t){if((null==e?void 0:e.length)<10)return;return`AMP_${e.substring(0,10)}`}if(!((null==e?void 0:e.length)<6))return`amp_${e.substring(0,6)}`};class $d{constructor(e,t,n){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=n,this.loadPersistedState(),n<=0&&(this.setup=void 0)}setup(e,t){return zd(this,void 0,void 0,function*(){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener(()=>{null==t||t.fetch()}),this.waitForConnectorIdentity(this.timeoutMillis)})}getUser(){const e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}}track(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent(Object.assign({eventType:e.eventType,eventProperties:e.eventProperties},e.groups&&{groups:e.groups})),!0)}loadPersistedState(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;let e=Wd(this.apiKey,!0);return e?(this.commitIdentityToConnector(e),!0):(e=Wd(this.apiKey,!1),e?(this.commitIdentityToConnector(e),!0):(e=(e=>{const t=Vd(e,!0);try{const e=Nd();if(!e)return;const n=e.getItem(t);if(!n)return;const r=JSON.parse(n);if("object"!=typeof r)return;return r}catch(e){return}})(this.apiKey),e?(this.commitIdentityToConnector(e),!0):(e=(e=>{const t=Vd(e,!0);try{const e=Dd();if(!e)return;const n=e.getItem(t);if(!n)return;const r=JSON.parse(n);if("object"!=typeof r)return;return r}catch(e){return}})(this.apiKey),!!e&&(this.commitIdentityToConnector(e),!0))))}commitIdentityToConnector(e){const t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()}waitForConnectorIdentity(e){return zd(this,void 0,void 0,function*(){const t=this.identityStore.getIdentity();if(!t.userId&&!t.deviceId)return Promise.race([new Promise(e=>{const t=()=>{e(),this.identityStore.removeIdentityListener(t)};this.identityStore.addIdentityListener(t)}),new Promise((t,n)=>{const r=Ld();r?r(n,e,"Timed out waiting for Amplitude Analytics SDK to initialize."):n("Timed out waiting for Amplitude Analytics SDK to initialize.")})])})}}const Kd=(()=>{const e=_d();return(null==e?void 0:e.fetch)?e.fetch.bind(e):void 0})()||function(e,t){return t=t||{},new Promise(function(n,r){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,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n}),n(l())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(u,t.headers[u]);i.send(t.body||null)})};class Hd{constructor(e){this.client=e}request(e){return zd(this,void 0,void 0,function*(){return yield this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)})}}const Gd={request:(e,t,n,r,i)=>((e,t)=>null==t||t<=0?e:new Promise(function(n,r){const i=Ld();i&&i(function(){r(new Rd(`Request timeout after ${t} milliseconds`))},t),e.then(n,r)}))(zd(void 0,void 0,void 0,function*(){const i=yield Kd(e,{method:t,headers:n,body:r});return{status:i.status,body:yield i.text()}}),i)};var Jd,Yd,Xd;!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"}(Jd||(Jd={})),function(e){e.LocalStorage="localStorage",e.InitialVariants="initialVariants"}(Yd||(Yd={})),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"}(Xd||(Xd={}));const Qd=e=>!e||e===Xd.FallbackInline||e===Xd.FallbackConfig||e===Xd.SecondaryInitialVariants,Zd={debug:!1,logLevel:Jd.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:Yd.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:Gd};var eh="1.24.0";const th=e=>null==e,nh=e=>!!th(e)||e&&0===Object.keys(e).length,rh=e=>{if(!nh(e))return JSON.stringify(Object.keys(e).sort().map(t=>[t,[...e[t]].sort()]))},ih=e=>{var t;return"local"===(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.evaluationMode)};class oh{constructor(e,t){var n;this.isReady=new Promise(e=>{this.resolve=e}),this.config=e,this.client=t;const r=null!==(n=e.instanceName)&&void 0!==n?n:Zd.instanceName;this.queue=new ah(r,512,e.internalPersistenceAllowed),this.cache=new sh(r,e.internalPersistenceAllowed)}ready(){return this.integration?this.isReady:Promise.resolve()}setIntegration(e){this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(()=>{this.queue.setTracker(this.integration.track.bind(e)),this.resolve()},()=>{this.queue.setTracker(this.integration.track.bind(e)),this.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())}getUser(){return this.integration?this.integration.getUser():{}}track(e,t){if(this.cache.shouldTrack(e,t)){const n=e.variant?null==t?void 0:t.groups:void 0,r=this.getExposureEvent(e,n);this.queue.push(r)}}getExposureEvent(e,t){var n,r;let i="$exposure";(null===(n=e.metadata)||void 0===n?void 0:n.exposureEvent)?i=e.metadata.exposureEvent:"web"===(null===(r=e.metadata)||void 0===r?void 0:r.deliveryMethod)&&(i="$impression");const o={eventType:i,eventProperties:e};return nh(t)||(o.groups=t),o}}class sh{constructor(e,t){this.persistenceAllowed=t,this.clearStoredOnReopen=!1,this.hasGatedEntries=!1,this.inMemoryCache={},this.identity={},this.storageKey=`EXP_sent_v3_${e}`}isGated(){return void 0!==this.persistenceAllowed&&!this.persistenceAllowed()}usableStorage(){if(this.isGated())return;void 0===this.isSessionStorageAvailable&&(this.isSessionStorageAvailable=lh());const e=Dd();return this.isSessionStorageAvailable&&e?(this.clearStoredOnReopen&&(this.clearStoredOnReopen=!1,e.removeItem(this.storageKey)),e):void 0}shouldTrack(e,t){var n,r;if("web"===(null===(n=e.metadata)||void 0===n?void 0:n.deliveryMethod))return!0;const i={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id,groups:rh(null==t?void 0:t.groups)};this.identityEquals(this.identity,i)||this.clearCache(),this.identity=i,this.loadCache();const o=e.flag_key in this.inMemoryCache,s=this.inMemoryCache[e.flag_key],a=null!==(r=e.variant)&&void 0!==r?r:null;let l=!1;return o&&(null!=s?s:null)===a||(l=!0,this.inMemoryCache[e.flag_key]=a,this.isGated()&&(this.hasGatedEntries=!0)),this.storeCache(),l}clearCache(){this.inMemoryCache={},this.hasGatedEntries=!1;const e=this.usableStorage();e?e.removeItem(this.storageKey):this.isGated()&&(this.clearStoredOnReopen=!0)}identityEquals(e,t){return e.groups===t.groups&&(e.userId&&t.userId?e.userId===t.userId:!e.userId&&!t.userId&&e.deviceId===t.deviceId)}loadCache(){const e=this.usableStorage();if(e){const t=e.getItem(this.storageKey),n=t?JSON.parse(t):{};this.hasGatedEntries?(this.inMemoryCache=Object.assign(Object.assign({},n),this.inMemoryCache),this.hasGatedEntries=!1):this.inMemoryCache=n}}storeCache(){const e=this.usableStorage();if(e)try{e.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))}catch(e){}}}class ah{constructor(e,t=512,n){this.persistenceAllowed=n,this.inMemoryQueue=[],this.holdsGatedEvents=!1,this.storageKey=`EXP_unsent_${e}`,this.maxQueueSize=t}push(e){this.loadQueue(),this.inMemoryQueue.push(e),this.canPersist()||(this.holdsGatedEvents=!0),this.flush(),this.storeQueue()}setTracker(e){this.tracker=e;const t=Fd();t&&(this.poller=t(()=>{this.loadFlushStore()},1e3)),this.loadFlushStore()}flush(){if(!this.tracker)return;if(0===this.inMemoryQueue.length)return;let e=0;for(;e<this.inMemoryQueue.length;e++)try{if(!this.tracker(this.inMemoryQueue[e]))break}catch(e){break}if(this.inMemoryQueue=this.inMemoryQueue.slice(e),0===this.inMemoryQueue.length&&this.poller){const e=Ud();e&&e(this.poller),this.poller=void 0}}canPersist(){return!this.persistenceAllowed||this.persistenceAllowed()}usableStorage(){if(!this.canPersist())return;void 0===this.isLocalStorageAvailable&&(this.isLocalStorageAvailable=(()=>{const e=_d();if(e)try{const t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){return!1}return!1})());const e=Nd();return this.isLocalStorageAvailable&&e?e:void 0}loadQueue(){const e=this.usableStorage();if(e){const t=e.getItem(this.storageKey),n=t?JSON.parse(t):[];this.holdsGatedEvents?(this.inMemoryQueue=[...n,...this.inMemoryQueue],this.holdsGatedEvents=!1):this.inMemoryQueue=n}}storeQueue(){const e=this.usableStorage();if(e){if(0===this.inMemoryQueue.length)return void e.removeItem(this.storageKey);this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),e.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue))}}loadFlushStore(){this.loadQueue(),this.flush(),this.storeQueue()}}const lh=()=>{const e=_d();if(e)try{const t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){return!1}return!1};class uh{constructor(e,t=Jd.Error){this.logger=e,this.logLevel=t}error(e,...t){this.logLevel>=Jd.Error&&this.logger.error(e,...t)}warn(e,...t){this.logLevel>=Jd.Warn&&this.logger.warn(e,...t)}info(e,...t){this.logLevel>=Jd.Info&&this.logger.info(e,...t)}debug(e,...t){this.logLevel>=Jd.Debug&&this.logger.debug(e,...t)}verbose(e,...t){this.logLevel>=Jd.Verbose&&this.logger.verbose(e,...t)}}class ch{error(e,...t){console.error(e,...t)}warn(e,...t){console.warn(e,...t)}info(e,...t){console.info(e,...t)}debug(e,...t){console.debug(e,...t)}verbose(e,...t){console.debug(e,...t)}}class dh{constructor(){this.globalScope=_d()}get(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.localStorage.getItem(e)}put(e,t){var n;null===(n=this.globalScope)||void 0===n||n.localStorage.setItem(e,t)}delete(e){var t;null===(t=this.globalScope)||void 0===t||t.localStorage.removeItem(e)}}class hh{constructor(e,t){this.namespace=e,this.storage=t}get(){return this.value}put(e){this.value=e}load(){const e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))}store(){void 0===this.value?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))}}class ph{constructor(e,t,n){this.cache={},this.namespace=e,this.storage=t,this.transformer=n}get(e){return this.cache[e]}getAll(){return Object.assign({},this.cache)}put(e,t){this.cache[e]=t}putAll(e){for(const t of Object.keys(e))this.cache[t]=e[t]}remove(e){delete this.cache[e]}clear(){this.cache={}}load(){const e=this.storage.get(this.namespace);let t;try{t=JSON.parse(e)||{}}catch(e){return}const n={};for(const e of Object.keys(t))try{let r;r=this.transformer?this.transformer(t[e]):t[e],r&&(n[e]=r)}catch(e){}this.clear(),this.putAll(n)}store(e=this.cache){this.storage.put(this.namespace,JSON.stringify(e))}}const fh=e=>{if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){const t=e.key,n=e.value,r=e.payload;let i=e.metadata,o=e.expKey;i&&i.experimentKey?o=i.experimentKey:o&&(i=i||{},i.experimentKey=o);const s={};return t?s.key=t:n&&(s.key=n),n&&(s.value=n),i&&(s.metadata=i),r&&(s.payload=r),o&&(s.expKey=o),s}};class gh{constructor(){this.globalScope=_d()}get(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.sessionStorage.getItem(e)}put(e,t){var n;null===(n=this.globalScope)||void 0===n||n.sessionStorage.setItem(e,t)}delete(e){var t;null===(t=this.globalScope)||void 0===t||t.sessionStorage.removeItem(e)}}class vh{constructor(e,t,n,r){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=n,this.scalar=r}start(e){return zd(this,void 0,void 0,function*(){if(this.started)throw Error("Backoff already started");this.started=!0,yield this.backoff(e,0,this.min)})}cancel(){this.done=!0;const e=(()=>{const e=_d();return(null==e?void 0:e.clearTimeout)?e.clearTimeout.bind(e):void 0})();e&&e(this.timeoutHandle)}backoff(e,t,n){return zd(this,void 0,void 0,function*(){if(this.done)return;const r=Ld();r&&(this.timeoutHandle=r(()=>{(()=>{zd(this,void 0,void 0,function*(){try{yield e()}catch(r){const i=t+1;if(i<this.attempts){const t=Math.min(n*this.scalar,this.max);yield this.backoff(e,i,t)}}})})()},n))})}}const mh=e=>{var t,n;if(!e)return{};const r={user:e},i=_d();(null==i?void 0:i.location)&&(r.page={url:i.location.href});const o={};if(!e.groups)return r;for(const r of Object.keys(e.groups)){const i=e.groups[r];if(i.length>0&&i[0]){const s=i[0],a={group_name:s},l=null===(n=null===(t=e.group_properties)||void 0===t?void 0:t[r])||void 0===n?void 0:n[s];l&&Object.keys(l).length>0&&(a.group_properties=l),o[r]=a}}return Object.keys(o).length>0&&(r.groups=o),delete r.user.groups,delete r.user.group_properties,r},yh=e=>null==e?{}:"string"==typeof e?{key:e,value:e}:e,bh=e=>{if(!e)return{};let t;e.metadata&&(t=e.metadata.experimentKey);const n={};return e.key&&(n.key=e.key),e.value&&(n.value=e.value),e.payload&&(n.payload=e.payload),t&&(n.expKey=t),e.metadata&&(n.metadata=e.metadata),n};class wh{constructor(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}track(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))}setUserProperty(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)}unsetUserProperty(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))}}class Sh{constructor(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}track(e,t){const n={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id,groups:rh(null==t?void 0:t.groups)};this.identityEquals(this.identity,n)||(this.tracked={}),this.identity=n;const r=e.flag_key in this.tracked,i=this.tracked[e.flag_key];r&&i===e.variant||(this.tracked[e.flag_key]=e.variant,!e.variant||nh(null==t?void 0:t.groups)?this.exposureTrackingProvider.track(e):this.exposureTrackingProvider.track(e,t.groups))}identityEquals(e,t){return e.userId===t.userId&&e.deviceId===t.deviceId&&e.groups===t.groups}}class kh{constructor(e,t){var n,r,i,o,s;this.engine=new sd,this.isRunning=!1,this.apiKey=e,t=(e=>{if(!e||"object"!=typeof e)return{};const t={};for(const[n,r]of Object.entries(e))th(r)||(t[n]=r);return t})(t),this.config=Object.assign(Object.assign(Object.assign({},Zd),t),{serverUrl:(null==t?void 0:t.serverUrl)||("eu"===(null===(n=null==t?void 0:t.serverZone)||void 0===n?void 0:n.toLowerCase())?"https://api.lab.eu.amplitude.com":Zd.serverUrl),flagsServerUrl:(null==t?void 0:t.flagsServerUrl)||("eu"===(null===(r=null==t?void 0:t.serverZone)||void 0===r?void 0:r.toLowerCase())?"https://flag.lab.eu.amplitude.com":Zd.flagsServerUrl),flagConfigPollingIntervalMillis:t.flagConfigPollingIntervalMillis<6e4?6e4:null!==(i=t.flagConfigPollingIntervalMillis)&&void 0!==i?i:Zd.flagConfigPollingIntervalMillis}),this.logger=new uh(this.config.loggerProvider||new ch,kh.getLogLevel(t));const a=null===(o=this.config)||void 0===o?void 0:o.internalInstanceNameSuffix;if(this.isWebExperiment="web"===a,this.poller=new jd(()=>zd(this,void 0,void 0,function*(){try{yield this.doFlags()}catch(e){this.logger.info(e)}}),this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(const e in this.config.initialVariants)this.config.initialVariants[e]=fh(this.config.initialVariants[e]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new wh(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new Sh(this.config.exposureTrackingProvider)),this.integrationManager=new oh(this.config,this);const l=new Hd(this.config.httpClient||Gd);let u;this.flagApi=new Md(this.apiKey,this.config.flagsServerUrl,l),this.evaluationApi=new Ad(this.apiKey,this.config.serverUrl,l);const c=a?`${this.config.instanceName}-${String(a)}`:this.config.instanceName;if(this.isWebExperiment){const e=null===(s=this.config)||void 0===s?void 0:s.internalCacheStorage;u=null!=e?e:new gh}else u=new dh;this.variants=((e,t,n)=>{const r=e.substring(e.length-6);return new ph(`amp-exp-${t}-${r}`,n,fh)})(this.apiKey,c,u),this.flags=((e,t,n=new dh)=>{const r=e.substring(e.length-6);return new ph(`amp-exp-${t}-${r}-flags`,n)})(this.apiKey,c,u),this.fetchVariantsOptions=((e,t,n=new dh)=>{const r=e.substring(e.length-6);return new hh(`amp-exp-${t}-${r}-variants-options`,n)})(this.apiKey,c,u);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch(e){}this.mergeInitialFlagsWithStorage()}start(e){return zd(this,void 0,void 0,function*(){var t;if(!this.isRunning){this.isRunning=!0,this.setUser(e);try{const n=this.doFlags();null===(t=this.config.fetchOnStart)||void 0===t||t?yield Promise.all([this.fetch(e),n]):yield n}catch(e){if(this.config.throwOnError)throw e}this.config.pollOnStart&&this.poller.start()}})}stop(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)}fetch(){return zd(this,arguments,void 0,function*(e=this.user,t){this.setUser(e||{});try{yield this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)}catch(e){if(this.config.throwOnError)throw e;e instanceof Rd?this.logger.debug(e):this.logger.error(e)}return this})}variant(e,t){var n,r;if(!this.apiKey)return{value:void 0};const i=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,i),this.logger.debug(`[Experiment] variant for ${e} is ${(null===(n=i.variant)||void 0===n?void 0:n.key)||(null===(r=i.variant)||void 0===r?void 0:r.value)}`),i.variant||{}}exposure(e){const t=this.variantAndSource(e);this.exposureInternal(e,t)}all(){if(!this.apiKey)return{};const e=this.evaluate();for(const t in e){const n=this.flags.get(t);ih(n)||delete e[t]}return Object.assign(Object.assign(Object.assign({},this.secondaryVariants()),this.sourceVariants()),e)}clear(){this.variants.clear();try{this.variants.store()}catch(e){}}getUser(){var e;if(!this.user)return this.user;if(null===(e=this.user)||void 0===e?void 0:e.user_properties){const e=Object.assign({},this.user.user_properties);return Object.assign(Object.assign({},this.user),{user_properties:e})}return Object.assign({},this.user)}setUser(e){var t;if(e)if(null===(t=this.user)||void 0===t?void 0:t.user_properties){const t=Object.assign({},e.user_properties);this.user=Object.assign(Object.assign({},e),{user_properties:t})}else this.user=Object.assign({},e);else this.user=null}getUserProvider(){return this.userProvider}setUserProvider(e){return this.userProvider=e,this}mergeInitialFlagsWithStorage(){if(this.config.initialFlags){JSON.parse(this.config.initialFlags).forEach(e=>{this.flags.get(e.key)||this.flags.put(e.key,e)})}}evaluate(e){const t=this.addContext(this.user),n=ad(this.flags.getAll(),e),r=mh(t),i=this.engine.evaluate(r,n),o={};for(const e of Object.keys(i))o[e]=bh(i[e]);return o}getEvaluationTraces(e){const t=this.addContext(this.user),n=ad(this.flags.getAll(),e),r=mh(t),{traces:i}=this.engine.evaluateWithTraces(r,n);return i}variantAndSource(e,t){let n={};this.config.source===Yd.LocalStorage?n=this.localStorageVariantAndSource(e,t):this.config.source===Yd.InitialVariants&&(n=this.initialVariantsVariantAndSource(e,t));const r=this.flags.get(e);return(ih(r)||!n.variant&&r)&&(n=this.localEvaluationVariantAndSource(e,r,t)),n}localEvaluationVariantAndSource(e,t,n){var r;let i={};const o=this.evaluate([t.key])[e],s=Xd.LocalEvaluation,a=null===(r=null==o?void 0:o.metadata)||void 0===r?void 0:r.default;if(!th(o)&&!a)return{variant:yh(o),source:s,hasDefaultVariant:!1};if(a&&(i={variant:yh(o),source:s,hasDefaultVariant:!0}),!th(n))return{variant:yh(n),source:Xd.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};const l=this.config.initialVariants[e];if(!th(l))return{variant:yh(l),source:Xd.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};const u=yh(this.config.fallbackVariant),c={variant:u,source:Xd.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return nh(u)?i:c}localStorageVariantAndSource(e,t){var n;let r={};const i=this.variants.get(e),o=null===(n=null==i?void 0:i.metadata)||void 0===n?void 0:n.default;if(!th(i)&&!o)return{variant:yh(i),source:Xd.LocalStorage,hasDefaultVariant:!1};if(o&&(r={variant:yh(i),source:Xd.LocalStorage,hasDefaultVariant:!0}),!th(t))return{variant:yh(t),source:Xd.FallbackInline,hasDefaultVariant:r.hasDefaultVariant};const s=this.config.initialVariants[e];if(!th(s))return{variant:yh(s),source:Xd.SecondaryInitialVariants,hasDefaultVariant:r.hasDefaultVariant};const a=yh(this.config.fallbackVariant),l={variant:a,source:Xd.FallbackConfig,hasDefaultVariant:r.hasDefaultVariant};return nh(a)?r:l}initialVariantsVariantAndSource(e,t){var n;let r={};const i=this.config.initialVariants[e];if(!th(i))return{variant:yh(i),source:Xd.InitialVariants,hasDefaultVariant:!1};const o=this.variants.get(e),s=null===(n=null==o?void 0:o.metadata)||void 0===n?void 0:n.default;if(!th(o)&&!s)return{variant:yh(o),source:Xd.LocalStorage,hasDefaultVariant:!1};if(s&&(r={variant:yh(o),source:Xd.LocalStorage,hasDefaultVariant:!0}),!th(t))return{variant:yh(t),source:Xd.FallbackInline,hasDefaultVariant:r.hasDefaultVariant};const a=yh(this.config.fallbackVariant),l={variant:a,source:Xd.FallbackConfig,hasDefaultVariant:r.hasDefaultVariant};return nh(a)?r:l}fetchInternal(e,t,n,r){return zd(this,void 0,void 0,function*(){var i;if(!this.apiKey)throw Error("Experiment API key is empty");this.logger.debug(`[Experiment] Fetch all: retry=${String(n)}`),n&&this.stopRetries();try{const n=yield this.doFetch(e,t,Object.assign({trackingOption:null===(i=this.fetchVariantsOptions.get())||void 0===i?void 0:i.trackingOption},r));return yield this.storeVariants(n,r),n}catch(t){throw n&&this.shouldRetryFetch(t)&&this.startRetries(e,r),t}})}setTracksAssignment(e){return zd(this,void 0,void 0,function*(){this.fetchVariantsOptions.put(Object.assign(Object.assign({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"})),this.fetchVariantsOptions.store()})}cleanUserPropsForFetch(e){const t=Object.assign({},e);return delete t.cookie,t}doFetch(e,t,n){return zd(this,void 0,void 0,function*(){e=yield this.addContextOrWait(e),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e);const r=yield this.evaluationApi.getVariants(e,Object.assign({timeoutMillis:t},n)),i={};for(const e of Object.keys(r))i[e]=bh(r[e]);return this.logger.debug("[Experiment] Received variants: ",i),i})}doFlags(){return zd(this,void 0,void 0,function*(){try{let e;this.isWebExperiment&&(e=yield this.addContextOrWait(this.getUser()));const t=yield this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:eh,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});this.flags.clear(),this.flags.putAll(t)}catch(e){if(!(e instanceof Rd))throw e;if(this.logger.debug(e),this.config.throwOnError)throw e}try{this.flags.store()}catch(e){}this.mergeInitialFlagsWithStorage()})}storeVariants(e,t){return zd(this,void 0,void 0,function*(){let n=t&&t.flagKeys?t.flagKeys:[];0===n.length&&this.variants.clear();for(const t in e)n=n.filter(e=>e!==t),this.variants.put(t,e[t]);for(const e of n)this.variants.remove(e);try{this.variants.store()}catch(e){}this.logger.debug("[Experiment] Stored variants: ",e)})}startRetries(e,t){return zd(this,void 0,void 0,function*(){this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new vh(8,500,1e4,1.5),this.retriesBackoff.start(()=>zd(this,void 0,void 0,function*(){yield this.fetchInternal(e,1e4,!1,t)}))})}stopRetries(){this.retriesBackoff&&this.retriesBackoff.cancel()}addContext(e){var t;const n=null===(t=this.userProvider)||void 0===t?void 0:t.getUser(),r=this.integrationManager.getUser(),i=Object.assign(Object.assign(Object.assign({},null==n?void 0:n.user_properties),r.user_properties),null==e?void 0:e.user_properties);return Object.assign(Object.assign(Object.assign(Object.assign({library:`experiment-js-client/${eh}`},n),r),e),{user_properties:i})}addContextOrWait(e){return zd(this,void 0,void 0,function*(){return yield this.integrationManager.ready(),this.addContext(e)})}sourceVariants(){return this.config.source==Yd.LocalStorage?this.variants.getAll():this.config.source==Yd.InitialVariants?this.config.initialVariants:void 0}secondaryVariants(){return this.config.source==Yd.LocalStorage?this.config.initialVariants:this.config.source==Yd.InitialVariants?this.variants.getAll():void 0}exposureInternal(e,t){var n,r,i,o,s,a,l,u,c;if(!(null===(i=null===(r=null===(n=t.variant)||void 0===n?void 0:n.metadata)||void 0===r?void 0:r.trackExposure)||void 0===i||i))return;this.legacyExposureInternal(e,t.variant,t.source);const d={flag_key:e},h=Qd(t.source);if(h&&!t.hasDefaultVariant)return;(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);const 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){const e=_d();if(null==e?void 0:e.location)try{const t=e.location.href;d.metadata.url=t.split("?")[0]||""}catch(e){}}const f=this.addContext(this.getUser()),g=Object.assign(Object.assign({},f),{groups:this.exposureGroups(f)});null===(c=this.userSessionExposureTracker)||void 0===c||c.track(d,g),this.integrationManager.track(d,g)}exposureGroups(e){if(nh(e.groups))return;const t=Object.values(e.groups).reduce((e,t)=>e+t.length,0);if(!(t>10))return e.groups;this.logger.warn(`[Experiment] User has ${t} group values, more than the limit of 10. Exposures will not include groups.`)}legacyExposureInternal(e,t,n){var r,i,o,s,a;if(this.analyticsProvider){const l=((e,t,n,r)=>{const i=null==n?void 0:n.value,o=`[Experiment] ${t}`;return{name:"[Experiment] Exposure",user:e,key:t,variant:n,userProperty:o,properties:{key:t,variant:i,source:r},userProperties:{[o]:i}}})(this.addContext(this.getUser()),e,t,n);Qd(n)||!(null==t?void 0:t.value)?null===(i=null===(r=this.analyticsProvider)||void 0===r?void 0:r.unsetUserProperty)||void 0===i||i.call(r,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))}}static getLogLevel(e){var t;return!0===e.debug?Jd.Debug:null!==(t=e.logLevel)&&void 0!==t?t:Jd.Error}shouldRetryFetch(e){return!(e instanceof Pd)||(e.statusCode<400||e.statusCode>=500||429===e.statusCode)}addPlugin(e){"integration"===e.type&&this.integrationManager.setIntegration(e)}}class xh{constructor(e,t,n){var r,i,o;this.globalScope=_d(),this.userAgent=void 0!==(null===(r=this.globalScope)||void 0===r?void 0:r.navigator)?null===(i=this.globalScope)||void 0===i?void 0:i.navigator.userAgent:void 0,this.ua=new Bd.UAParser(this.userAgent).getResult(),this.localStorage=new dh,this.sessionStorage=new gh,this.userProvider=e,this.apiKey=t,this.persistenceAllowed=n,this.storageKey=`EXP_${null===(o=this.apiKey)||void 0===o?void 0:o.slice(0,10)}_DEFAULT_USER_PROVIDER`}canPersist(){return!this.persistenceAllowed||this.persistenceAllowed()}getUser(){var e,t,n,r,i;const o=(null===(e=this.userProvider)||void 0===e?void 0:e.getUser())||{};return Object.assign({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!==(n=null===(t=this.ua.device)||void 0===t?void 0:t.type)&&void 0!==n?n:"desktop",referring_url:null===(i=null===(r=this.globalScope)||void 0===r?void 0:r.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)}getLanguage(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""}getOs(e){var t,n;return[null===(t=e.browser)||void 0===t?void 0:t.name,null===(n=e.browser)||void 0===n?void 0:n.major].filter(e=>null!=e).join(" ")}getDeviceModel(e){var t;return null===(t=e.os)||void 0===t?void 0:t.name}getBrowser(e){var t;let n=null===(t=e.browser)||void 0===t?void 0:t.name;return(null==n?void 0:n.includes("Chrom"))&&(n="Chrome"),(null==n?void 0:n.includes("Firefox"))&&(n="Firefox"),(null==n?void 0:n.includes("Safari"))&&(n="Safari"),(null==n?void 0:n.includes("Edge"))&&(n="Edge"),(null==n?void 0:n.includes("Opera"))&&(n="Opera"),n}getCookie(){var e,t,n,r,i;if(this.canPersist()&&(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===(r=null===(n=this.globalScope)||void 0===n?void 0:n.document)||void 0===r?void 0:r.cookie)||void 0===i?void 0:i.split("; ").map(e=>e.split("=")))}getLandingUrl(){var e,t;if(!this.canPersist())return null!==(e=this.gatedLandingUrl)&&void 0!==e||(this.gatedLandingUrl=this.getCurrentUrl()),this.gatedLandingUrl;try{const e=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return e.landing_url||(e.landing_url=null!==(t=this.gatedLandingUrl)&&void 0!==t?t:this.getCurrentUrl(),this.sessionStorage.put(this.storageKey,JSON.stringify(e))),e.landing_url}catch(e){return}}getCurrentUrl(){var e,t;return null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.location)||void 0===t?void 0:t.href.replace(/\/$/,"")}getFirstSeen(){if(!this.canPersist())return(Date.now()/1e3).toString();try{const 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}}getUrlParam(){var e;if(!this.globalScope)return;const t={};try{const n=new URL(this.globalScope.location.href);for(const[r,i]of n.searchParams)t[r]=[...null!==(e=t[r])&&void 0!==e?e:[],...i.split(",")]}catch(e){return}return Object.entries(t).reduce((e,[t,n])=>(e[t]=1==n.length?n[0]:n,e),{})}}var Ch;const Eh=_d();Eh&&(Eh.experimentInstances={});const Ih=null!==(Ch=null==Eh?void 0:Eh.experimentInstances)&&void 0!==Ch?Ch:{},Oh=e=>(null==e?void 0:e.instanceName)||Zd.instanceName,Th=(e,t,n)=>{const r=((e,t)=>{const n=Oh(t),r=null==t?void 0:t.internalInstanceNameSuffix;return r?`${n}.${e}.${String(r)}`:`${n}.${e}`})(e,t);let i=Ih[r];return i||(i=((e,t)=>new kh(e,Object.assign(Object.assign({},t),{userProvider:new xh(null==t?void 0:t.userProvider,e,null==t?void 0:t.internalPersistenceAllowed)})))(e,t),n&&i.addPlugin(n()),Ih[r]=i,i)};var Ph=function(){function e(t){this.name=e.pluginName,this.config=t}return e.prototype.setup=function(e,t){var n,r;return l(this,void 0,void 0,function(){var t;return u(this,function(i){return t=void 0!==(null===(n=this.config)||void 0===n?void 0:n.instanceName)||void 0===e.instanceName?this.config:s(s({},this.config),{instanceName:e.instanceName}),this.experiment=((e,t)=>Th(e,t,()=>new $d(e,Pe.getInstance(Oh(t)),1e4)))((null===(r=this.config)||void 0===r?void 0:r.deploymentKey)||e.apiKey,t),[2]})})},e.pluginName="@amplitude/experiment-analytics-plugin",e}(),Rh=function(e){return new Ph(e)},Ah=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Mh(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),Mh=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},_h=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}(),Nh=function(){return Nh=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Nh.apply(this,arguments)};function Dh(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Lh(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}var Fh=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=Dh(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next()){if(s.value===i)return e===t}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(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(!Fh(u,c))return!1;var d=!0;return Object.keys(e).forEach(function(n){Fh(e[n],t[n])||(d=!1)}),d}for(var h=0;h<e.length;h++)if(!Fh(e[h],t[h]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var Uh=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=Nh({},this.identity.userProperties),n=Nh(Nh({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,i,o,s,a,l=n.userProperties||{};try{for(var u=Dh(Object.entries(e)),c=u.next();!c.done;c=u.next()){var d=Lh(c.value,2),h=d[0],p=d[1];switch(h){case"$set":try{for(var f=(i=void 0,Dh(Object.entries(p))),g=f.next();!g.done;g=f.next()){var v=Lh(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,Dh(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&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return n.userProperties=l,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return Nh({},this.identity)},e.prototype.setIdentity=function(e){var t=Nh({},this.identity);this.identity=Nh({},e),Fh(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}(),jh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:self,Bh=function(){function e(){this.identityStore=new Uh,this.eventBridge=new _h,this.applicationContextProvider=new Ah}return e.getInstance=function(t){return jh.analyticsConnectorInstances||(jh.analyticsConnectorInstances={}),jh.analyticsConnectorInstances[t]||(jh.analyticsConnectorInstances[t]=new e),jh.analyticsConnectorInstances[t]},e}(),qh=["boot"],zh=Symbol.for("amplitude-engagement-plugin-caller");var Wh=(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))(Wh||{});var Vh=((e=>{if(typeof window<"u"&&window.opener)for(let t of Object.values(Wh))window.opener.postMessage({message:e},t)})("ENGAGEMENT_SNIPPET"),function(e){var t,n,r,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!=(r=null==(n=null==d?void 0:d._configuration)?void 0:n.apiKey)?r:"",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,n){var r,i,o,s;if(p._configuration.apiKey)return void console.log("Engagement SDK has already been initialized. Ignoring additional init call.");if(!0===(null==n?void 0:n.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!=n&&n.useEngagementDomain){let e="EU"===(null!=(r=n.serverZone)?r:p._configuration.serverZone),t="amplitudeengagement.com";n.serverUrl||(n.serverUrl=e?`https://gs.eu.${t}`:`https://gs.${t}`),n.chatUrl||(n.chatUrl=e?`https://houston-chat.eu.${t}`:`https://houston-chat.${t}`),n.mediaUrl||(n.mediaUrl=e?`https://engagement-static.eu.${t}`:`https://engagement-static.${t}`),n.cdnUrl||(n.cdnUrl=e?`https://cdn.eu.${t}`:`https://cdn.${t}`)}let a;if(p._configuration={...p._configuration,...n,apiKey:t,options:{splitting:!0,...p._configuration.options,...null==n?void 0:n.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!=n&&n.cdnUrl)a=p._configuration.options.splitting?`${n.cdnUrl}/engagement-browser/prod/split/index.js`:n.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],n=qh.includes(t);if(console.warn(`Engagement SDK method '${t}' still in queue (isAsyncMethod=${n}); attempting to resolve as no-op.`),n&&e[1]instanceof Function&&e[2]instanceof Function){let n=e[1];console.warn(`Engagement SDK method '${t}' resolved as no-op due to script loading failure`),n(void 0)}}};e(a,p._configuration.options.splitting?"module":void 0,null==n?void 0:n.nonce,u);let c=1e4;l=setTimeout(()=>{u()},c)},plugin(e){let t=p.init,n=null==e?void 0:e.token,r=!0===(null==e?void 0:e.skip),i=(e,t)=>{let r=t.getIdentity(),i="function"==typeof n?n():n;return{user_id:e.getUserId(),device_id:e.getDeviceId(),user_properties:r.userProperties,getSessionId:e.getSessionId,...i?{token:i}:{}}};return{name:"@amplitude/engagement-browser",type:"enrichment",async setup(n,o){var s;if(r)return void t(n.apiKey,{skip:!0});let a=null!=(s=n.instanceName)?s:"$default_instance",l=Bh.getInstance(a).identityStore;p._configuration._installedViaPlugin=!0,t(n.apiKey,{serverZone:n.serverZone,...e,options:{logLevel:n.logLevel,logger:n.loggerProvider,...null==e?void 0:e.options}});let u=[{track:e=>{o.track(e)}}];await window.engagement.boot({user:()=>i(o,l),integrations:u},zh),l.addIdentityListener(e=>{var t,n,r,s;null!=(t=window.engagement)&&t._.user&&null!=(n=window.engagement)&&n._analytics.hasBooted?(null==(s=null==(r=window.engagement)?void 0:r._.user)?void 0:s.user_id)!==e.userId?(window.engagement.shutdown(zh),window.engagement.boot({user:()=>i(o,l),integrations:u},zh)):window.engagement._setUserProperties(e.userProperties):console.warn("Engagement SDK not booted. Ignoring identity change.")})},execute:async e=>(r||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,n){return function(){let e=Array.from(arguments),r=`${t}.${n}`;e.unshift(r),p._q.push(e)}}}):qh.includes(t)?function(){let e=Array.prototype.slice.call(arguments);return new Promise((n,r)=>{e.unshift(t,n,r),p._q.push(e),h&&n(void 0)})}:function(){let e=Array.prototype.slice.call(arguments);e.unshift(t),p._q.push(e)}:void 0}})}((e,t,n,r)=>function(e,t,n,r){for(let i of e){let e=document.createElement("script");e.src=i,e.id="engagement-sdk-bundle",n&&e.setAttribute("nonce",n),t&&e.setAttribute("type",t),r&&(e.onerror=r);let o=document.getElementsByTagName("head")[0];o&&o.appendChild(e)}}([e||"https://cdn.amplitude.com/engagement-browser/prod/index.min.js.gz"],t,n,r))),$h=e=>(typeof window<"u"&&!window.engagement&&(window.engagement=Vh),Vh.plugin(e)),Kh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(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,n){return l(this,void 0,void 0,function(){var r=this;return u(this,function(i){return this._initAllPromise||(this._initAllPromise=l(r,void 0,void 0,function(){var r,i;return u(this,function(o){switch(o.label){case 0:return r={serverZone:null==n?void 0:n.serverZone,instanceName:null==n?void 0:n.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(n){return e.library="".concat("amplitude-ts-unified","/").concat("1.1.43","-").concat(null!==(t=e.library)&&void 0!==t?t:""),[2,e]})})}}),[4,e.prototype.init.call(this,t,s(s({},null==n?void 0:n.analytics),r)).promise];case 1:return o.sent(),[4,e.prototype.add.call(this,(a=s(s({},null==n?void 0:n.sessionReplay),r),new Pc(a))).promise];case 2:return o.sent(),[4,e.prototype.add.call(this,Rh(s(s({},null==n?void 0:n.experiment),r))).promise];case 3:return o.sent(),void 0===(i=this.plugin(Pc.pluginName))?this.config.loggerProvider.debug("".concat(Pc.pluginName," plugin is not found.")):this._sessionReplay=i.sessionReplay,[4,e.prototype.add.call(this,$h(s(s({},null==n?void 0:n.engagement),r))).promise];case 4:return o.sent(),[2]}var a})}).finally(function(){r._initAllPromise=void 0})),[2,this._initAllPromise]})})},t.prototype.init=function(t,n,r){return void 0===t&&(t=""),e.prototype.init.call(this,t,n,r)},t}(Ma),Hh=function(){var e=new Kh;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"]))}},Gh=Hh(),Jh=Gh._setDiagnosticsSampleRate,Yh=Gh.initAll,Xh=Gh.experiment,Qh=Gh.sessionReplay,Zh=Gh.add,ep=Gh.extendSession,tp=Gh.flush,np=Gh.getDeviceId,rp=Gh.getIdentity,ip=Gh.getOptOut,op=Gh.getSessionId,sp=Gh.getUserId,ap=Gh.groupIdentify,lp=Gh.identify,up=Gh.logEvent,cp=Gh.remove,dp=Gh.reset,hp=Gh.revenue,pp=Gh.setDeviceId,fp=Gh.setGroup,gp=Gh.setIdentity,vp=Gh.setOptOut,mp=Gh.setSessionId,yp=Gh.setTransport,bp=Gh.setUserId,wp=Gh.track,Sp=function(e,t){return Sp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Sp(e,t)};var kp=function(){return kp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},kp.apply(this,arguments)};function xp(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}"function"==typeof SuppressedError&&SuppressedError;var Cp="is",Ep="is not",Ip="contains",Op="does not contain",Tp="less",Pp="less or equal",Rp="greater",Ap="greater or equal",Mp="version less",_p="version less or equal",Np="version greater",Dp="version greater or equal",Lp="set is",Fp="set is not",Up="set contains",jp="set does not contain",Bp="set contains any",qp="set does not contain any",zp="regex match",Wp="regex does not match",Vp=-862048943,$p=461845907,Kp=function(e,t){void 0===t&&(t=0);for(var n=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296==(64512&i)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return Uint8Array.from(t)}(e),r=n.length,i=r>>2,o=t,s=0;s<i;s++){var a=Yp(n,s<<2);o=Hp(a,o)}var l=i<<2,u=0;switch(r-l){case 3:u^=n[l+2]<<16,u^=n[l+1]<<8,u^=n[l],u=Math.imul(u,Vp),u=Jp(u,15),o^=u=Math.imul(u,$p);break;case 2:u^=n[l+1]<<8,u^=n[l],u=Math.imul(u,Vp),u=Jp(u,15),o^=u=Math.imul(u,$p);break;case 1:u^=n[l],u=Math.imul(u,Vp),u=Jp(u,15),o^=u=Math.imul(u,$p)}return Gp(o^=r)>>>0},Hp=function(e,t){var n=e,r=t;return n=Math.imul(n,Vp),n=Jp(n,15),n=Math.imul(n,$p),r=Jp(r^=n,13),(r=Math.imul(r,5))+-430675100|0},Gp=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},Jp=function(e,t,n){return void 0===n&&(n=32),t>n&&(t%=n),(e<<t|(e&4294967295<<n-t>>>0)>>>0>>>n-t>>>0)>>>0},Yp=function(e,t){void 0===t&&(t=0);var n=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return Xp(n)},Xp=function(e){return(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24},Qp=function(e,t){var n,r;if(t&&0!==t.length){try{for(var i=xp(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){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e||void 0}},Zp="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),ef=function(){function e(e,t,n,r){void 0===r&&(r=void 0),this.major=e,this.minor=t,this.patch=n,this.preRelease=r}return e.parse=function(t){if(t){var n=new RegExp(Zp).exec(t);if(n){var r=Number(n[1]),i=Number(n[2]);if(!isNaN(r)&&!isNaN(i))return new e(r,i,Number(n[4])||0,n[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}(),tf=function(){function e(){}return e.prototype.evaluate=function(e,t){var n,r,i={},o={context:e,result:i};try{for(var s=xp(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){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i},e.prototype.evaluateFlag=function(e,t){var n,r,i;try{for(var o=xp(t.segments),s=o.next();!s.done;s=o.next()){var a=s.value;if(i=this.evaluateSegment(e,t,a)){var l=kp(kp(kp({},t.metadata),a.metadata),i.metadata);i=kp(kp({},i),{metadata:l});break}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},e.prototype.evaluateSegment=function(e,t,n){var r,i,o,s;if(!n.conditions)return void 0!==(u=this.bucket(e,n))?t.variants[u]:void 0;try{for(var a=xp(n.conditions),l=a.next();!l.done;l=a.next()){var u,c=l.value,d=!0;try{for(var h=(o=void 0,xp(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,n))?t.variants[u]:void 0}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}},e.prototype.matchCondition=function(e,t){var n=Qp(e,t.selector);if(n){if(this.isSetOperator(t.op)){var r=this.coerceStringArray(n);return!!r&&this.matchSet(r,t.op,t.values)}var i=this.coerceString(n);return void 0!==i&&this.matchString(i,t.op,t.values)}return this.matchNull(t.op,t.values)},e.prototype.getHash=function(e){return Kp(e)},e.prototype.bucket=function(e,t){var n,r,i,o;if(!t.bucket)return t.variant;var s=this.coerceString(Qp(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=xp(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,xp(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){n={error:e}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return t.variant},e.prototype.matchNull=function(e,t){var n=this.containsNone(t);switch(e){case Cp:case Ip:case Tp:case Pp:case Rp:case Ap:case Mp:case _p:case Np:case Dp:case Lp:case Up:case Bp:return n;case Ep:case Op:case jp:case qp:return!n;default:return!1}},e.prototype.matchSet=function(e,t,n){switch(t){case Lp:return this.setEquals(e,n);case Fp:return!this.setEquals(e,n);case Up:return this.matchesSetContainsAll(e,n);case jp:return!this.matchesSetContainsAll(e,n);case Bp:return this.matchesSetContainsAny(e,n);case qp:return!this.matchesSetContainsAny(e,n);default:return!1}},e.prototype.matchString=function(e,t,n){var r=this;switch(t){case Cp:return this.matchesIs(e,n);case Ep:return!this.matchesIs(e,n);case Ip:return this.matchesContains(e,n);case Op:return!this.matchesContains(e,n);case Tp:case Pp:case Rp:case Ap:return this.matchesComparable(e,t,n,function(e){return r.parseNumber(e)},this.comparator);case Mp:case _p:case Np:case Dp:return this.matchesComparable(e,t,n,function(e){return ef.parse(e)},this.versionComparator);case zp:return this.matchesRegex(e,n);case Wp:return!this.matchesRegex(e,n);default:return!1}},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var n=e.toLowerCase();if("true"===n||"false"===n)return t.some(function(e){return e.toLowerCase()===n})}return t.some(function(t){return e===t})},e.prototype.matchesContains=function(e,t){var n,r;try{for(var i=xp(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.toLowerCase().includes(s.toLowerCase()))return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},e.prototype.matchesComparable=function(e,t,n,r,i){var o=this,s=r(e),a=n.map(function(e){return r(e)}).filter(function(e){return void 0!==e});return void 0===s||0===a.length?n.some(function(n){return o.comparator(e,t,n)}):a.some(function(e){return i(s,t,e)})},e.prototype.comparator=function(e,t,n){switch(t){case Tp:case Mp:return e<n;case Pp:case _p:return e<=n;case Rp:case Np:return e>n;case Ap:case Dp:return e>=n;default:return!1}},e.prototype.versionComparator=function(e,t,n){var r=e.compareTo(n);switch(t){case Tp:case Mp:return r<0;case Pp:case _p:return r<=0;case Rp:case Np:return r>0;case Ap:case Dp:return r>=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 n=String(e);try{var r=JSON.parse(n);return Array.isArray(r)?e.map(function(e){return t.coerceString(e)}).filter(Boolean):void 0}catch(e){return}},e.prototype.isSetOperator=function(e){switch(e){case Lp:case Fp:case Up:case jp:case Bp:case qp:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var n=new Set(e),r=new Set(t);return n.size===r.size&&function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}(r),!1).every(function(e){return n.has(e)})},e.prototype.matchesSetContainsAll=function(e,t){var n,r;if(e.length<t.length)return!1;try{for(var i=xp(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!this.matchesIs(s,e))return!1}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0},e.prototype.matchesSetContainsAny=function(e,t){var n,r;try{for(var i=xp(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(this.matchesIs(s,e))return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},e}();"function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder;(e=>{let t={};e.forEach((e,n)=>t[e]=n)})(Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")),String.fromCharCode.bind(String),"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),function(e){function t(n,r){var i=e.call(this,r)||this;return i.statusCode=n,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 n(){this.constructor=e}Sp(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)})(t,e)}(Error);var nf,rf=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,Xl(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,n;return u(this,function(r){switch(r.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 n=r.sent(),this.dbs[t]=n,[2,n]}})})},this.updateEventListForSession=function(t){var n=t.sessionId,r=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(n),[4,a.store.get(e)];case 1:return t=u.sent(),l=t?t.eventTypes:{},c=l[r]||{},d=s(s({},l),((f={})[r]=s(s({},c),((g={})[i]={event_type:r},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(n,": ").concat(p)),[3,4];case 4:return[2,void 0]}})})},this.deleteOldSessionEventTypes=function(t){var n=t.currentSessionId,r=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(n),[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(),r.warn("Failed to clear old session event types for targeting: ".concat(l)),[3,7];case 7:return[2]}})})},this.storeEventTypeForSession=function(t){var n=t.loggerProvider,r=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:r,tx:t,loggerProvider:n,eventType:i,eventTime:o})]:[2];case 2:return a=u.sent(),[4,this.deleteOldSessionEventTypes({currentSessionId:r,tx:t,loggerProvider:n})];case 3:return u.sent(),[4,t.done];case 4:return u.sent(),[2,a];case 5:return l=u.sent(),n.warn("Failed to store events for targeting ".concat(r,": ").concat(l)),[3,6];case 6:return[2,void 0]}})})}},of=new rf,sf=function(){var e=this;this.evaluateTargeting=function(t){var n=t.apiKey,r=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,of.storeEventTypeForSession({loggerProvider:r,apiKey:n,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 tf},af=function(){var e=new sf;return{evaluateTargeting:e.evaluateTargeting.bind(e)}}().evaluateTargeting,lf=Object.freeze({__proto__:null,evaluateTargeting:af}),uf=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,h,y,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())h=v.value,d.set(h,p),p+=h.length}catch(e){y={error:e}}finally{try{v&&!v.done&&(b=f.return)&&b.call(f)}finally{if(y)throw y.error}}return[2,d];case 4:return m.sent(),[2,null];case 5:return[2]}})})}function l(e){for(var t=e.length,r=0;r<t&&!(e.charCodeAt(r)>127);r++);if(r===t)return t;for(var n=r;r<t;r++){var s=e.charCodeAt(r);if(s<=127)n++;else if(s<=2047)n+=2;else if(s>=55296&&s<=56319){var o=r+1<t?e.charCodeAt(r+1):NaN;o>=56320&&o<=57343?(n+=4,r++):n+=3}else n+=3}return n}var d=0,p=new Map,f=function(e,t){return fetch(e,t)},v=function(e,t){var r="".concat(++d);return new Promise(function(n,s){var o=t.signal,a=function(){p.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}),p.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 h(e,t,o){var d,p,f,v,h,y,b,g;return n(this,void 0,void 0,function(){var n,m,w,S,T,E,k,R,C,x,A,I,M,O,U;return s(this,function(s){switch(s.label){case 0:n=null!==(d=t.sendTimeoutMs)&&void 0!==d?d: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 w=s.sent(),[3,4];case 3:w=null,s.label=4;case 4:m=w,S="".concat(null!==(f=null===(p=t.version)||void 0===p?void 0:p.type)&&void 0!==f?f:"standalone","/").concat(null!==(h=null===(v=t.version)||void 0===v?void 0:v.version)&&void 0!==h?h:t.sdkVersion),T=new URLSearchParams({device_id:t.deviceId,session_id:"".concat(t.sessionId),type:t.eventType}),E="".concat((P=t.serverZone,_=t.trackServerUrl,_||("STAGING"===P?"https://api-sr.stag2.amplitude.com/sessions/v2/track":"EU"===P?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track")),"?").concat(T.toString()),k=r({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(t.apiKey),"X-Client-Version":t.sdkVersion,"X-Client-Library":S,"X-Client-Url":t.currentUrl.substring(0,1e3),"X-Client-Sample-Rate":"".concat(t.sampleRate),"X-Sampling-Hash-Alg":"xxhash32"},m?{"Content-Encoding":"gzip"}:{}),R=m?m.byteLength:l(e),C=new AbortController,x=n>0?setTimeout(function(){C.abort()},n):void 0,A=void 0,s.label=5;case 5:return s.trys.push([5,,7,8]),[4,o(E,{method:"POST",headers:k,body:null!=m?m:e,keepalive:R<=65536,signal:C.signal})];case 6:return A=s.sent(),[3,8];case 7:return x&&clearTimeout(x),[7];case 8:if(null===A)return[2,{shouldRetry:!1,success:!1,message:"Unexpected error occurred"}];if(A.status>=200&&A.status<300)return I=Math.round(function(e){for(var t=0,r=0;r<e.length;r++)t+=l(e[r]);return t}(t.events)/1024),M=null!==(g=null===(b=null===(y=A.headers)||void 0===y?void 0:y.get)||void 0===b?void 0:b.call(y,i))&&void 0!==g?g: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:M}];if(413!==A.status)return[3,13];O="",s.label=9;case 9:return s.trys.push([9,11,,12]),[4,A.text()];case 10:return O=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(O)}];case 13:return A.status>=500||408===A.status||429===A.status||499===A.status?[2,{shouldRetry:!0,success:!1,message:"HTTP ".concat(A.status)}]:[2,{shouldRetry:!1,success:!1,message:u}];case 14:return(U=s.sent())&&"object"==typeof U&&"AbortError"===U.name?[2,{shouldRetry:!0,success:!1,message:"Session replay worker request timed out after ".concat(n,"ms")}]:[2,{shouldRetry:!1,success:!1,message:String(U)}];case 15:return[2]}var 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,h(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=p.get(t.requestId))&&(p.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?v:f)]);case 1:s.sent(),s.label=2;case 2:return[2]}})})};var b=onmessage;return e.trackDestinationOnMessage=b,Object.defineProperty(e,"__esModule",{value:!0}),e}({});\n'}),cf=Object.defineProperty,df=(e,t,n)=>((e,t,n)=>t in e?cf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),hf=Object.defineProperty,pf=(e,t,n)=>((e,t,n)=>t in e?hf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),ff=Object.defineProperty,gf=(e,t,n)=>((e,t,n)=>t in e?ff(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const vf={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},mf={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},yf={};function bf(e){if(yf[e])return yf[e];const t=function(e){var t,n;const r=null==(n=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:n.call(t,e);return r&&globalThis[r]?globalThis[r]:void 0}(e)||globalThis[e],n=t.prototype,r=e in vf?vf[e]:void 0,i=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),o=e in mf?mf[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return yf[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(r),o?yf[e]=o:n}catch{return n}}const wf={};function Sf(e,t,n){var r;const i=`${e}.${String(n)}`;if(wf[i])return wf[i].call(t);const o=bf(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(wf[i]=s,s.call(t)):t[n]}const kf={};function xf(e,t,n){const r=`${e}.${String(n)}`;if(kf[r])return kf[r].bind(t);const i=bf(e)[n];return"function"!=typeof i?t[n]:(kf[r]=i,i.bind(t))}const Cf={childNodes:function(e){return Sf("Node",e,"childNodes")},parentNode:function(e){return Sf("Node",e,"parentNode")},parentElement:function(e){return Sf("Node",e,"parentElement")},textContent:function(e){return Sf("Node",e,"textContent")},contains:function(e,t){return xf("Node",e,"contains")(t)},getRootNode:function(e){return xf("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Sf("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Sf("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Sf("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Sf("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return bf("MutationObserver").constructor}};class Ef{constructor(){gf(this,"idNodeMap",new Map),gf(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 n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function If(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&If(Cf.parentNode(e),t,n);for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!!n&&If(Cf.parentNode(e),t,n)}function Of(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Tf(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Pf,Rf={exports:{}};function Af(){if(Pf)return Rf.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 Rf.exports=t(),Rf.exports.createColors=t,Rf.exports}const Mf=Tf(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var _f,Nf;function Df(){if(Nf)return _f;Nf=1;let e=Af(),t=Mf;class n extends Error{constructor(e,t,r,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!==r&&("number"==typeof t?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}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(n){if(!this.source)return"";let r=this.source;null==n&&(n=e.isColorSupported),t&&n&&(r=t(r));let i,o,s=r.split(/\r?\n/),a=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;if(n){let{bold:t,gray:n,red:r}=e.createColors(!0);i=e=>t(r(e)),o=e=>n(e)}else i=o=e=>e;return s.slice(a,l).map((e,t)=>{let n=a+1+t,r=" "+(" "+n).slice(-u)+" | ";if(n===this.line){let t=o(r.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+o(r)+e+"\n "+t+i("^")}return" "+o(r)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return _f=n,n.default=n,_f}var Lf,Ff,Uf,jf,Bf,qf,zf,Wf,Vf,$f,Kf,Hf,Gf,Jf,Yf,Xf,Qf,Zf,eg,tg,ng,rg,ig,og,sg,ag,lg,ug,cg,dg,hg,pg,fg,gg,vg,mg,yg,bg,wg,Sg,kg,xg,Cg,Eg,Ig,Og,Tg,Pg,Rg,Ag,Mg,_g,Ng,Dg={};function Lg(){return Lf||(Lf=1,Dg.isClean=Symbol("isClean"),Dg.my=Symbol("my")),Dg}function Fg(){if(Uf)return Ff;Uf=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 n="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:r&&(n+=" "),e.nodes)this.block(e,n+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,e)}}beforeAfter(e,t){let n;n="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 r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)n+=t}return n}block(e,t){let n,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==r||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),r=e.prop+n+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],void 0!==i))return i;let o=t.parent;if("before"===r){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[r];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[r])return s.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(t,r);{let e="raw"+((a=r)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[n],void 0!==i)return!1})}var a;return void 0===i&&(i=e[r]),s.rawCache[r]=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 n;return e.walkComments(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}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(n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.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(n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==n.raws.before){let e=n.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 n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}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 Ff=t,t.default=t,Ff}function Ug(){if(Bf)return jf;Bf=1;let e=Fg();function t(t,n){new e(n).stringify(t)}return jf=t,t.default=t,jf}function jg(){if(zf)return qf;zf=1;let{isClean:e,my:t}=Lg(),n=Df(),r=Fg(),i=Ug();function o(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],s=typeof i;"parent"===r&&"object"===s?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>o(e,n)):("object"===s&&null!==i&&(i=o(i)),n[r]=i)}return n}class s{constructor(n={}){this.raws={},this[e]=!1,this[t]=!0;for(let e in n)if("nodes"===e){this.nodes=[];for(let t of n[e])"function"==typeof t.clone?this.append(t.clone()):this.append(t)}else this[e]=n[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 n in e)t[n]=e[n];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:n,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:n.column,line:n.line},t)}return new n(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"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 n=this.source.start;if(e.index)n=this.positionInside(e.index,t);else if(e.word){let r=(t=this.toString()).indexOf(e.word);-1!==r&&(n=this.positionInside(r,t))}return n}positionInside(e,t){let n=t||this.toString(),r=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===n[t]?(r=1,i+=1):r+=1;return{column:r,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},n=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 r=this.toString(),i=r.indexOf(e.word);-1!==i&&(t=this.positionInside(i,r),n=this.positionInside(i+e.word.length,r))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?n={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?n=this.positionInside(e.endIndex):e.index&&(n=this.positionInside(e.index+1));return(n.line<t.line||n.line===t.line&&n.column<=t.column)&&(n={column:t.column+1,line:t.line}),{end:n,start:t}}raw(e,t){return(new r).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,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},r=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 r=this[e];if(Array.isArray(r))n[e]=r.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof r&&r.toJSON)n[e]=r.toJSON(null,t);else if("source"===e){let o=t.get(r.input);null==o&&(o=i,t.set(r.input,i),i++),n[e]={end:r.end,inputId:o,start:r.start}}else n[e]=r}return r&&(n.inputs=[...t.keys()].map(e=>e.toJSON())),n}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,n){let r={node:this};for(let e in n)r[e]=n[e];return e.warn(t,r)}get proxyOf(){return this}}return qf=s,s.default=s,qf}function Bg(){if(Vf)return Wf;Vf=1;let e=jg();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 Wf=t,t.default=t,Wf}function qg(){if(Kf)return $f;Kf=1;return $f={nanoid:(e=21)=>{let t="",n=e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r}},$f}function zg(){if(Gf)return Hf;Gf=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Mf,{existsSync:n,readFileSync:r}=Mf,{dirname:i,join:o}=Mf;class s{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let n=t.map?t.map.prev:void 0,r=this.loadMap(t.from,n);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=i(this.mapFile)),r&&(this.text=r)}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 n=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+n)}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 n=e.lastIndexOf(t.pop()),r=e.indexOf("*/",n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(e){if(this.root=i(e),n(e))return this.mapFile=e,r(e,"utf-8").toString().trim()}loadMap(n,r){if(!1===r)return!1;if(r){if("string"==typeof r)return r;if("function"!=typeof r){if(r instanceof e)return t.fromSourceMap(r).toString();if(r instanceof t)return r.toString();if(this.isMap(r))return JSON.stringify(r);throw new Error("Unsupported previous source map format: "+r.toString())}{let e=r(n);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 n&&(e=o(i(n),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 Hf=s,s.default=s,Hf}function Wg(){if(Yf)return Jf;Yf=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Mf,{fileURLToPath:n,pathToFileURL:r}=Mf,{isAbsolute:i,resolve:o}=Mf,{nanoid:s}=qg(),a=Mf,l=Df(),u=zg(),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,n,i={}){let o,s,a;if(t&&"object"==typeof t){let e=t,r=n;if("number"==typeof e.offset){let r=this.fromOffset(e.offset);t=r.line,n=r.col}else t=e.line,n=e.column;if("number"==typeof r.offset){let e=this.fromOffset(r.offset);s=e.line,a=e.col}else s=r.line,a=r.column}else if(!n){let e=this.fromOffset(t);t=e.line,n=e.col}let u=this.origin(t,n,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:n,line:t},void 0===s?n:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:n,endColumn:a,endLine:s,line:t,source:this.css},this.file&&(r&&(o.input.url=r(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,n;if(this[c])n=this[c];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)n[r]=t,t+=e[r].length+1;this[c]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t,i=n.length-2;for(;r<i;)if(t=r+(i-r>>1),e<n[t])i=t-1;else{if(!(e>=n[t+1])){r=t;break}r=t+1}}return{col:e-n[r]+1,line:r+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)?r(c.source):new URL(c.source,this.map.consumer().sourceRoot||r(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(!n)throw new Error("file: protocol is not available in this PostCSS build");d.file=n(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 Jf=p,p.default=p,a&&a.registerInput&&a.registerInput(p),Jf}function Vg(){if(Qf)return Xf;Qf=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Mf,{dirname:n,relative:r,resolve:i,sep:o}=Mf,{pathToFileURL:s}=Mf,a=Wg(),l=Boolean(e&&t),u=Boolean(n&&i&&r&&o);return Xf=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,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 r,i=this.toUrl(this.path(t.file)),o=t.root||n(t.file);!1===this.mapOpts.sourcesContent?(r=new e(t.text),r.sourcesContent&&(r.sourcesContent=null)):r=t.consumer(),this.map.applySourceMap(r,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,n,r=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=r,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?(r+=e.length,n=t.lastIndexOf("\n"),i=t.length-n):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=r,s.generated.column=i-2,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=r,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?n(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=n(i(o,this.mapOpts.annotation)));let s=r(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 n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,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 n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},Xf}function $g(){if(eg)return Zf;eg=1;let e=jg();class t extends e{constructor(e){super(e),this.type="comment"}}return Zf=t,t.default=t,Zf}function Kg(){if(ng)return tg;ng=1;let e,t,n,r,{isClean:i,my:o}=Lg(),s=Bg(),a=$g(),l=jg();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,n,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[r]+=1;return delete this.indexes[r],n}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")?(...n)=>e[t](...n.map(e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e)):"every"===t||"some"===t?n=>e[t]((e,...t)=>n(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,n)=>(e[t]===n||(e[t]=n,"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 n,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)n=this.indexes[e],r<n&&(this.indexes[e]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of o)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)n=this.indexes[e],r<=n&&(this.indexes[e]=n+o.length);return this.markDirty(),this}normalize(r,l){if("string"==typeof r)r=u(e(r).nodes);else if(void 0===r)r=[];else if(Array.isArray(r)){r=r.slice(0);for(let e of r)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===r.type&&"document"!==this.type){r=r.nodes.slice(0);for(let e of r)e.parent&&e.parent.removeChild(e,"ignore")}else if(r.type)r=[r];else if(r.prop){if(void 0===r.value)throw new Error("Value field is missed in node creation");"string"!=typeof r.value&&(r.value=String(r.value)),r=[new s(r)]}else if(r.selector)r=[new t(r)];else if(r.name)r=[new n(r)];else{if(!r.text)throw new Error("Unknown node type in node creation");r=[new a(r)]}return r.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 n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,n)=>{let r;try{r=e(t,n)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("atrule"===n.type&&e.test(n.name))return t(n,r)}):this.walk((n,r)=>{if("atrule"===n.type&&n.name===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("atrule"===e.type)return t(e,n)}))}walkComments(e){return this.walk((t,n)=>{if("comment"===t.type)return e(t,n)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("decl"===n.type&&e.test(n.prop))return t(n,r)}):this.walk((n,r)=>{if("decl"===n.type&&n.prop===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("decl"===e.type)return t(e,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("rule"===n.type&&e.test(n.selector))return t(n,r)}):this.walk((n,r)=>{if("rule"===n.type&&n.selector===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("rule"===e.type)return t(e,n)}))}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=>{n=e},d.registerRoot=e=>{r=e},tg=d,d.default=d,d.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,n.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,r.prototype),e[o]=!0,e.nodes&&e.nodes.forEach(e=>{d.rebuild(e)})},tg}function Hg(){if(ig)return rg;ig=1;let e,t,n=Kg();class r extends n{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},rg=r,r.default=r,rg}function Gg(){if(sg)return og;sg=1;let e={};return og=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function Jg(){if(lg)return ag;lg=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 ag=e,e.default=e,ag}function Yg(){if(cg)return ug;cg=1;let e=Jg();class t{constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new e(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}}return ug=t,t.default=t,ug}function Xg(){if(fg)return pg;fg=1;let e=Kg();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 pg=t,t.default=t,e.registerAtRule(t),pg}function Qg(){if(vg)return gg;vg=1;let e,t,n=Kg();class r extends n{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let r=super.normalize(e);if(t)if("prepend"===n)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 r)e.raws.before=t.raws.before;return r}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},gg=r,r.default=r,n.registerRoot(r),gg}function Zg(){if(yg)return mg;yg=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,n){let r=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let n of e)u?u=!1:"\\"===n?u=!0:a?n===l&&(a=!1):'"'===n||"'"===n?(a=!0,l=n):"("===n?s+=1:")"===n?s>0&&(s-=1):0===s&&t.includes(n)&&(o=!0),o?(""!==i&&r.push(i.trim()),i="",o=!1):i+=n;return(n||""!==i)&&r.push(i.trim()),r}};return mg=e,e.default=e,mg}function ev(){if(wg)return bg;wg=1;let e=Kg(),t=Zg();class n 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,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}}return bg=n,n.default=n,e.registerRule(n),bg}function tv(){if(kg)return Sg;kg=1;let e=Bg(),t=function(){if(hg)return dg;hg=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),n="\\".charCodeAt(0),r="/".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 dg=function(x,C={}){let E,I,O,T,P,R,A,M,_,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(M=j.length?j.pop()[1]:"",_=D.charCodeAt(U+1),"url"===M&&_!==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(A=I;D.charCodeAt(A-1)===n;)A-=1,R=!R}while(R);N=["brackets",D.slice(U,I+1),U,I],U=I}else I=D.indexOf(")",U+1),T=D.slice(U,I+1),-1===I||S.test(T)?N=["(","(",U]:(N=["brackets",T,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(A=I;D.charCodeAt(A-1)===n;)A-=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 n:for(I=U,P=!0;D.charCodeAt(I+1)===n;)I+=1,P=!P;if(E=D.charCodeAt(I+1),P&&E!==r&&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===r&&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}}}}(),n=$g(),r=Xg(),i=Qg(),o=ev();const s={empty:!0,space:!0};return Sg=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,n,i,o=new r;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,n=l[i];n&&"space"===n[0];)n=l[--i];n&&(o.source.end=this.getPosition(n[3]||n[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 n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[o,s]of e.entries()){if(t=s,n=t[0],"("===n&&(i+=1),")"===n&&(i-=1),0===i&&":"===n){if(r){if("word"===r[0]&&"progid"===r[1])continue;return o}this.doubleColon(t)}r=t}return!1}comment(e){let t=new n;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let e=r.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,n){let r=new e;this.init(r,t[0][2]);let i,o=t[t.length-1];for(";"===o[0]&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}(t)),r.source.end.offset++;"word"!==t[0][0];)1===t.length&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let e=t[0][0];if(":"===e||"space"===e||"comment"===e)break;r.prop+=t.shift()[1]}for(r.raws.between="";t.length;){if(i=t.shift(),":"===i[0]){r.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),r.raws.between+=i[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.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()){r.important=!0;let n=this.stringFrom(t,e);n=this.spacesFromEnd(t)+n," !important"!==n&&(r.raws.important=n);break}if("important"===i[1].toLowerCase()){let n=t.slice(0),i="";for(let t=e;t>0;t--){let e=n[t][0];if(0===i.trim().indexOf("!")&&"space"!==e)break;i=n.pop()[1]+i}0===i.trim().indexOf("!")&&(r.important=!0,r.raws.important=i,t=n)}if("space"!==i[0]&&"comment"!==i[0])break}t.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(r.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(r,"value",a.concat(t),n),r.value.includes(":")&&!n&&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,n=null,r=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)i||(i=l),o.push("("===n?")":"]");else if(s&&r&&"{"===n)i||(i=l),o.push("}");else if(0===o.length){if(";"===n){if(r)return void this.decl(a,s);break}if("{"===n)return void this.rule(a);if("}"===n){this.tokenizer.back(a.pop()),t=!0;break}":"===n&&(r=!0)}else n===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&&r){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,n,r){let i,o,a,l,u=n.length,c="",d=!0;for(let e=0;e<u;e+=1)i=n[e],o=i[0],"space"!==o||e!==u-1||r?"comment"===o?(l=n[e-1]?n[e-1][0]:"empty",a=n[e+1]?n[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let r=n.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,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,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}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})}},Sg}function nv(){if(Cg)return xg;Cg=1;let e=Kg(),t=tv(),n=Wg();function r(e,r){let i=new n(e,r),o=new t(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&r&&r.from&&(/\.scss$/i.test(r.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(r.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(r.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 xg=r,r.default=r,e.registerParse(r),xg}function rv(){if(Ig)return Eg;Ig=1;let{isClean:e,my:t}=Lg(),n=Vg(),r=Ug(),i=Kg(),o=Hg(),s=Gg(),a=Yg(),l=nv(),u=Qg();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,n=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,0,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,0,n+"Exit"]:[n,n+"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,n,r){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof y||n instanceof a)o=v(n.root),n.map&&(void 0===r.map&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let e=l;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{o=e(n,r)}catch(e){this.processed=!0,this.error=e}o&&!o[t]&&i.rebuild(o)}else o=v(n);this.result=new a(e,o,r),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 n=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(n.postcssVersion&&"production"!==process.env.NODE_ENV){let e=n.postcssPlugin,t=n.postcssVersion,r=this.result.processor.version,i=t.split("."),o=r.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=n.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!d[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[n])if("object"==typeof t[n])for(let r in t[n])e(t,"*"===r?n:n+"-"+r.toLowerCase(),t[n][r]);else"function"==typeof t[n]&&e(t,n,t[n])}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],n=this.runOnRoot(t);if(p(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];){t[e]=!0;let n=[g(t)];for(;n.length>0;){let e=this.visitTick(n);if(p(e))try{await e}catch(e){let t=n[n.length-1].node;throw this.handleError(e,t)}}}if(this.listeners.OnceExit)for(let[e,n]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map(e=>n(e,this.helpers));await Promise.all(e)}else await n(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=r;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new n(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[n,r]of e){let e;this.result.lastPlugin=n;try{e=r(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 n=t[t.length-1],{node:r,visitors:i}=n;if("root"!==r.type&&"document"!==r.type&&!r.parent)return void t.pop();if(i.length>0&&n.visitorIndex<i.length){let[e,t]=i[n.visitorIndex];n.visitorIndex+=1,n.visitorIndex===i.length&&(n.visitors=[],n.visitorIndex=0),this.result.lastPlugin=e;try{return t(r.toProxy(),this.helpers)}catch(e){throw this.handleError(e,r)}}if(0!==n.iterator){let i,o=n.iterator;for(;i=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!i[e])return i[e]=!0,void t.push(g(i));n.iterator=0,delete r.indexes[o]}let o=n.events;for(;n.eventIndex<o.length;){let t=o[n.eventIndex];if(n.eventIndex+=1,0===t)return void(r.nodes&&r.nodes.length&&(r[e]=!0,n.iterator=r.getIterator()));if(this.listeners[t])return void(n.visitors=this.listeners[t])}t.pop()}walkSync(t){t[e]=!0;let n=f(t);for(let r of n)if(0===r)t.nodes&&t.each(t=>{t[e]||this.walkSync(t)});else{let e=this.listeners[r];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},Eg=y,y.default=y,u.registerLazyResult(y),o.registerLazyResult(y),Eg}function iv(){if(Rg)return Pg;Rg=1;let e=function(){if(Tg)return Og;Tg=1;let e=Vg(),t=Ug(),n=Gg(),r=nv();const i=Yg();class o{constructor(n,r,o){let s;r=r.toString(),this.stringified=!1,this._processor=n,this._css=r,this._opts=o,this._map=void 0;let a=t;this.result=new i(this._processor,s,this._opts),this.result.css=r;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,r);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||n("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=r;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 Og=o,o.default=o,Og}(),t=rv(),n=Hg(),r=Qg();class i{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else{if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" 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(n,r={}){return this.plugins.length||r.parser||r.stringifier||r.syntax?new t(this,n,r):new e(this,n,r)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return Pg=i,i.default=i,r.registerProcessor(i),n.registerProcessor(i),Pg}const ov=Of(function(){if(Ng)return _g;Ng=1;let e=Df(),t=Bg(),n=rv(),r=Kg(),i=iv(),o=Ug(),s=function(){if(Mg)return Ag;Mg=1;let e=Bg(),t=zg(),n=$g(),r=Xg(),i=Wg(),o=Qg(),s=ev();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 n={...e,__proto__:i.prototype};n.map&&(n.map={...n.map,__proto__:t.prototype}),u.push(n)}}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 n(d);if("atrule"===d.type)return new r(d);throw new Error("Unknown node type: "+l.type)}return Ag=a,a.default=a,Ag}(),a=Hg(),l=Jg(),u=$g(),c=Xg(),d=Yg(),h=Wg(),p=nv(),f=Zg(),g=ev(),v=Qg(),m=jg();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new i(e)}return y.plugin=function(e,t){let n,r=!1;function o(...n){console&&console.warn&&!r&&(r=!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(...n);return o.postcssPlugin=e,o.postcssVersion=(new i).version,o}return Object.defineProperty(o,"postcss",{get:()=>(n||(n=o()),n)}),o.process=function(e,t,n){return y([o(n)]).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=r,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,n.registerPostcss(y),_g=y,y.default=y,_g}());ov.stringify,ov.fromJSON,ov.plugin,ov.parse,ov.list,ov.document,ov.comment,ov.atRule,ov.rule,ov.decl,ov.root,ov.CssSyntaxError,ov.Declaration,ov.Container,ov.Processor,ov.Document,ov.Comment,ov.Warning,ov.AtRule,ov.Result,ov.Input,ov.Rule,ov.Root,ov.Node;var sv=Object.defineProperty,av=(e,t,n)=>((e,t,n)=>t in e?sv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);function lv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function uv(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var cv,dv={exports:{}};function hv(){if(cv)return dv.exports;cv=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 dv.exports=t(),dv.exports.createColors=t,dv.exports}const pv=uv(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var fv,gv;function vv(){if(gv)return fv;gv=1;let e=hv(),t=pv;class n extends Error{constructor(e,t,r,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!==r&&("number"==typeof t?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}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(n){if(!this.source)return"";let r=this.source;null==n&&(n=e.isColorSupported),t&&n&&(r=t(r));let i,o,s=r.split(/\r?\n/),a=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;if(n){let{bold:t,gray:n,red:r}=e.createColors(!0);i=e=>t(r(e)),o=e=>n(e)}else i=o=e=>e;return s.slice(a,l).map((e,t)=>{let n=a+1+t,r=" "+(" "+n).slice(-u)+" | ";if(n===this.line){let t=o(r.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+o(r)+e+"\n "+t+i("^")}return" "+o(r)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return fv=n,n.default=n,fv}var mv,yv,bv,wv,Sv,kv,xv,Cv,Ev,Iv,Ov,Tv,Pv,Rv,Av,Mv,_v,Nv,Dv,Lv,Fv,Uv,jv,Bv,qv,zv,Wv,Vv,$v,Kv,Hv,Gv,Jv,Yv,Xv,Qv,Zv,em,tm,nm,rm,im,om,sm,am,lm,um,cm,dm,hm,pm,fm,gm,vm={};function mm(){return mv||(mv=1,vm.isClean=Symbol("isClean"),vm.my=Symbol("my")),vm}function ym(){if(bv)return yv;bv=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 n="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:r&&(n+=" "),e.nodes)this.block(e,n+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,e)}}beforeAfter(e,t){let n;n="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 r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)n+=t}return n}block(e,t){let n,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==r||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),r=e.prop+n+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],void 0!==i))return i;let o=t.parent;if("before"===r){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[r];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[r])return s.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(t,r);{let e="raw"+((a=r)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[n],void 0!==i)return!1})}var a;return void 0===i&&(i=e[r]),s.rawCache[r]=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 n;return e.walkComments(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}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(n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.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(n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==n.raws.before){let e=n.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 n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}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 yv=t,t.default=t,yv}function bm(){if(Sv)return wv;Sv=1;let e=ym();function t(t,n){new e(n).stringify(t)}return wv=t,t.default=t,wv}function wm(){if(xv)return kv;xv=1;let{isClean:e,my:t}=mm(),n=vv(),r=ym(),i=bm();function o(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],s=typeof i;"parent"===r&&"object"===s?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>o(e,n)):("object"===s&&null!==i&&(i=o(i)),n[r]=i)}return n}class s{constructor(n={}){this.raws={},this[e]=!1,this[t]=!0;for(let e in n)if("nodes"===e){this.nodes=[];for(let t of n[e])"function"==typeof t.clone?this.append(t.clone()):this.append(t)}else this[e]=n[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 n in e)t[n]=e[n];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:n,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:n.column,line:n.line},t)}return new n(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"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 n=this.source.start;if(e.index)n=this.positionInside(e.index,t);else if(e.word){let r=(t=this.toString()).indexOf(e.word);-1!==r&&(n=this.positionInside(r,t))}return n}positionInside(e,t){let n=t||this.toString(),r=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===n[t]?(r=1,i+=1):r+=1;return{column:r,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},n=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 r=this.toString(),i=r.indexOf(e.word);-1!==i&&(t=this.positionInside(i,r),n=this.positionInside(i+e.word.length,r))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?n={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?n=this.positionInside(e.endIndex):e.index&&(n=this.positionInside(e.index+1));return(n.line<t.line||n.line===t.line&&n.column<=t.column)&&(n={column:t.column+1,line:t.line}),{end:n,start:t}}raw(e,t){return(new r).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,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},r=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 r=this[e];if(Array.isArray(r))n[e]=r.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof r&&r.toJSON)n[e]=r.toJSON(null,t);else if("source"===e){let o=t.get(r.input);null==o&&(o=i,t.set(r.input,i),i++),n[e]={end:r.end,inputId:o,start:r.start}}else n[e]=r}return r&&(n.inputs=[...t.keys()].map(e=>e.toJSON())),n}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,n){let r={node:this};for(let e in n)r[e]=n[e];return e.warn(t,r)}get proxyOf(){return this}}return kv=s,s.default=s,kv}function Sm(){if(Ev)return Cv;Ev=1;let e=wm();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 Cv=t,t.default=t,Cv}function km(){if(Ov)return Iv;Ov=1;return Iv={nanoid:(e=21)=>{let t="",n=e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r}},Iv}function xm(){if(Pv)return Tv;Pv=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=pv,{existsSync:n,readFileSync:r}=pv,{dirname:i,join:o}=pv;class s{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let n=t.map?t.map.prev:void 0,r=this.loadMap(t.from,n);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=i(this.mapFile)),r&&(this.text=r)}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 n=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+n)}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 n=e.lastIndexOf(t.pop()),r=e.indexOf("*/",n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(e){if(this.root=i(e),n(e))return this.mapFile=e,r(e,"utf-8").toString().trim()}loadMap(n,r){if(!1===r)return!1;if(r){if("string"==typeof r)return r;if("function"!=typeof r){if(r instanceof e)return t.fromSourceMap(r).toString();if(r instanceof t)return r.toString();if(this.isMap(r))return JSON.stringify(r);throw new Error("Unsupported previous source map format: "+r.toString())}{let e=r(n);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 n&&(e=o(i(n),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 Tv=s,s.default=s,Tv}function Cm(){if(Av)return Rv;Av=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=pv,{fileURLToPath:n,pathToFileURL:r}=pv,{isAbsolute:i,resolve:o}=pv,{nanoid:s}=km(),a=pv,l=vv(),u=xm(),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,n,i={}){let o,s,a;if(t&&"object"==typeof t){let e=t,r=n;if("number"==typeof e.offset){let r=this.fromOffset(e.offset);t=r.line,n=r.col}else t=e.line,n=e.column;if("number"==typeof r.offset){let e=this.fromOffset(r.offset);s=e.line,a=e.col}else s=r.line,a=r.column}else if(!n){let e=this.fromOffset(t);t=e.line,n=e.col}let u=this.origin(t,n,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:n,line:t},void 0===s?n:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:n,endColumn:a,endLine:s,line:t,source:this.css},this.file&&(r&&(o.input.url=r(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,n;if(this[c])n=this[c];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)n[r]=t,t+=e[r].length+1;this[c]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t,i=n.length-2;for(;r<i;)if(t=r+(i-r>>1),e<n[t])i=t-1;else{if(!(e>=n[t+1])){r=t;break}r=t+1}}return{col:e-n[r]+1,line:r+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)?r(c.source):new URL(c.source,this.map.consumer().sourceRoot||r(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(!n)throw new Error("file: protocol is not available in this PostCSS build");d.file=n(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 Rv=p,p.default=p,a&&a.registerInput&&a.registerInput(p),Rv}function Em(){if(_v)return Mv;_v=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=pv,{dirname:n,relative:r,resolve:i,sep:o}=pv,{pathToFileURL:s}=pv,a=Cm(),l=Boolean(e&&t),u=Boolean(n&&i&&r&&o);return Mv=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,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 r,i=this.toUrl(this.path(t.file)),o=t.root||n(t.file);!1===this.mapOpts.sourcesContent?(r=new e(t.text),r.sourcesContent&&(r.sourcesContent=null)):r=t.consumer(),this.map.applySourceMap(r,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,n,r=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=r,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?(r+=e.length,n=t.lastIndexOf("\n"),i=t.length-n):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=r,s.generated.column=i-2,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=r,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?n(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=n(i(o,this.mapOpts.annotation)));let s=r(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 n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,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 n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},Mv}function Im(){if(Dv)return Nv;Dv=1;let e=wm();class t extends e{constructor(e){super(e),this.type="comment"}}return Nv=t,t.default=t,Nv}function Om(){if(Fv)return Lv;Fv=1;let e,t,n,r,{isClean:i,my:o}=mm(),s=Sm(),a=Im(),l=wm();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,n,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[r]+=1;return delete this.indexes[r],n}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")?(...n)=>e[t](...n.map(e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e)):"every"===t||"some"===t?n=>e[t]((e,...t)=>n(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,n)=>(e[t]===n||(e[t]=n,"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 n,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)n=this.indexes[e],r<n&&(this.indexes[e]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of o)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)n=this.indexes[e],r<=n&&(this.indexes[e]=n+o.length);return this.markDirty(),this}normalize(r,l){if("string"==typeof r)r=u(e(r).nodes);else if(void 0===r)r=[];else if(Array.isArray(r)){r=r.slice(0);for(let e of r)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===r.type&&"document"!==this.type){r=r.nodes.slice(0);for(let e of r)e.parent&&e.parent.removeChild(e,"ignore")}else if(r.type)r=[r];else if(r.prop){if(void 0===r.value)throw new Error("Value field is missed in node creation");"string"!=typeof r.value&&(r.value=String(r.value)),r=[new s(r)]}else if(r.selector)r=[new t(r)];else if(r.name)r=[new n(r)];else{if(!r.text)throw new Error("Unknown node type in node creation");r=[new a(r)]}return r.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 n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,n)=>{let r;try{r=e(t,n)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("atrule"===n.type&&e.test(n.name))return t(n,r)}):this.walk((n,r)=>{if("atrule"===n.type&&n.name===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("atrule"===e.type)return t(e,n)}))}walkComments(e){return this.walk((t,n)=>{if("comment"===t.type)return e(t,n)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("decl"===n.type&&e.test(n.prop))return t(n,r)}):this.walk((n,r)=>{if("decl"===n.type&&n.prop===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("decl"===e.type)return t(e,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("rule"===n.type&&e.test(n.selector))return t(n,r)}):this.walk((n,r)=>{if("rule"===n.type&&n.selector===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("rule"===e.type)return t(e,n)}))}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=>{n=e},d.registerRoot=e=>{r=e},Lv=d,d.default=d,d.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,n.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,r.prototype),e[o]=!0,e.nodes&&e.nodes.forEach(e=>{d.rebuild(e)})},Lv}function Tm(){if(jv)return Uv;jv=1;let e,t,n=Om();class r extends n{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},Uv=r,r.default=r,Uv}function Pm(){if(qv)return Bv;qv=1;let e={};return Bv=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function Rm(){if(Wv)return zv;Wv=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 zv=e,e.default=e,zv}function Am(){if($v)return Vv;$v=1;let e=Rm();class t{constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new e(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}}return Vv=t,t.default=t,Vv}function Mm(){if(Jv)return Gv;Jv=1;let e=Om();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 Gv=t,t.default=t,e.registerAtRule(t),Gv}function _m(){if(Xv)return Yv;Xv=1;let e,t,n=Om();class r extends n{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let r=super.normalize(e);if(t)if("prepend"===n)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 r)e.raws.before=t.raws.before;return r}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},Yv=r,r.default=r,n.registerRoot(r),Yv}function Nm(){if(Zv)return Qv;Zv=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,n){let r=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let n of e)u?u=!1:"\\"===n?u=!0:a?n===l&&(a=!1):'"'===n||"'"===n?(a=!0,l=n):"("===n?s+=1:")"===n?s>0&&(s-=1):0===s&&t.includes(n)&&(o=!0),o?(""!==i&&r.push(i.trim()),i="",o=!1):i+=n;return(n||""!==i)&&r.push(i.trim()),r}};return Qv=e,e.default=e,Qv}function Dm(){if(tm)return em;tm=1;let e=Om(),t=Nm();class n 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,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}}return em=n,n.default=n,e.registerRule(n),em}function Lm(){if(rm)return nm;rm=1;let e=Sm(),t=function(){if(Hv)return Kv;Hv=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),n="\\".charCodeAt(0),r="/".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 Kv=function(x,C={}){let E,I,O,T,P,R,A,M,_,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(M=j.length?j.pop()[1]:"",_=D.charCodeAt(U+1),"url"===M&&_!==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(A=I;D.charCodeAt(A-1)===n;)A-=1,R=!R}while(R);N=["brackets",D.slice(U,I+1),U,I],U=I}else I=D.indexOf(")",U+1),T=D.slice(U,I+1),-1===I||S.test(T)?N=["(","(",U]:(N=["brackets",T,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(A=I;D.charCodeAt(A-1)===n;)A-=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 n:for(I=U,P=!0;D.charCodeAt(I+1)===n;)I+=1,P=!P;if(E=D.charCodeAt(I+1),P&&E!==r&&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===r&&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}}}}(),n=Im(),r=Mm(),i=_m(),o=Dm();const s={empty:!0,space:!0};return nm=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,n,i,o=new r;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,n=l[i];n&&"space"===n[0];)n=l[--i];n&&(o.source.end=this.getPosition(n[3]||n[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 n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[o,s]of e.entries()){if(t=s,n=t[0],"("===n&&(i+=1),")"===n&&(i-=1),0===i&&":"===n){if(r){if("word"===r[0]&&"progid"===r[1])continue;return o}this.doubleColon(t)}r=t}return!1}comment(e){let t=new n;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let e=r.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,n){let r=new e;this.init(r,t[0][2]);let i,o=t[t.length-1];for(";"===o[0]&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}(t)),r.source.end.offset++;"word"!==t[0][0];)1===t.length&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let e=t[0][0];if(":"===e||"space"===e||"comment"===e)break;r.prop+=t.shift()[1]}for(r.raws.between="";t.length;){if(i=t.shift(),":"===i[0]){r.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),r.raws.between+=i[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.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()){r.important=!0;let n=this.stringFrom(t,e);n=this.spacesFromEnd(t)+n," !important"!==n&&(r.raws.important=n);break}if("important"===i[1].toLowerCase()){let n=t.slice(0),i="";for(let t=e;t>0;t--){let e=n[t][0];if(0===i.trim().indexOf("!")&&"space"!==e)break;i=n.pop()[1]+i}0===i.trim().indexOf("!")&&(r.important=!0,r.raws.important=i,t=n)}if("space"!==i[0]&&"comment"!==i[0])break}t.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(r.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(r,"value",a.concat(t),n),r.value.includes(":")&&!n&&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,n=null,r=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)i||(i=l),o.push("("===n?")":"]");else if(s&&r&&"{"===n)i||(i=l),o.push("}");else if(0===o.length){if(";"===n){if(r)return void this.decl(a,s);break}if("{"===n)return void this.rule(a);if("}"===n){this.tokenizer.back(a.pop()),t=!0;break}":"===n&&(r=!0)}else n===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&&r){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,n,r){let i,o,a,l,u=n.length,c="",d=!0;for(let e=0;e<u;e+=1)i=n[e],o=i[0],"space"!==o||e!==u-1||r?"comment"===o?(l=n[e-1]?n[e-1][0]:"empty",a=n[e+1]?n[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let r=n.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,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,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}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})}},nm}function Fm(){if(om)return im;om=1;let e=Om(),t=Lm(),n=Cm();function r(e,r){let i=new n(e,r),o=new t(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&r&&r.from&&(/\.scss$/i.test(r.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(r.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(r.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 im=r,r.default=r,e.registerParse(r),im}function Um(){if(am)return sm;am=1;let{isClean:e,my:t}=mm(),n=Em(),r=bm(),i=Om(),o=Tm(),s=Pm(),a=Am(),l=Fm(),u=_m();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,n=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,0,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,0,n+"Exit"]:[n,n+"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,n,r){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof y||n instanceof a)o=v(n.root),n.map&&(void 0===r.map&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let e=l;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{o=e(n,r)}catch(e){this.processed=!0,this.error=e}o&&!o[t]&&i.rebuild(o)}else o=v(n);this.result=new a(e,o,r),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 n=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(n.postcssVersion&&"production"!==process.env.NODE_ENV){let e=n.postcssPlugin,t=n.postcssVersion,r=this.result.processor.version,i=t.split("."),o=r.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=n.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!d[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[n])if("object"==typeof t[n])for(let r in t[n])e(t,"*"===r?n:n+"-"+r.toLowerCase(),t[n][r]);else"function"==typeof t[n]&&e(t,n,t[n])}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],n=this.runOnRoot(t);if(p(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];){t[e]=!0;let n=[g(t)];for(;n.length>0;){let e=this.visitTick(n);if(p(e))try{await e}catch(e){let t=n[n.length-1].node;throw this.handleError(e,t)}}}if(this.listeners.OnceExit)for(let[e,n]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map(e=>n(e,this.helpers));await Promise.all(e)}else await n(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=r;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new n(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[n,r]of e){let e;this.result.lastPlugin=n;try{e=r(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 n=t[t.length-1],{node:r,visitors:i}=n;if("root"!==r.type&&"document"!==r.type&&!r.parent)return void t.pop();if(i.length>0&&n.visitorIndex<i.length){let[e,t]=i[n.visitorIndex];n.visitorIndex+=1,n.visitorIndex===i.length&&(n.visitors=[],n.visitorIndex=0),this.result.lastPlugin=e;try{return t(r.toProxy(),this.helpers)}catch(e){throw this.handleError(e,r)}}if(0!==n.iterator){let i,o=n.iterator;for(;i=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!i[e])return i[e]=!0,void t.push(g(i));n.iterator=0,delete r.indexes[o]}let o=n.events;for(;n.eventIndex<o.length;){let t=o[n.eventIndex];if(n.eventIndex+=1,0===t)return void(r.nodes&&r.nodes.length&&(r[e]=!0,n.iterator=r.getIterator()));if(this.listeners[t])return void(n.visitors=this.listeners[t])}t.pop()}walkSync(t){t[e]=!0;let n=f(t);for(let r of n)if(0===r)t.nodes&&t.each(t=>{t[e]||this.walkSync(t)});else{let e=this.listeners[r];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},sm=y,y.default=y,u.registerLazyResult(y),o.registerLazyResult(y),sm}function jm(){if(dm)return cm;dm=1;let e=function(){if(um)return lm;um=1;let e=Em(),t=bm(),n=Pm(),r=Fm();const i=Am();class o{constructor(n,r,o){let s;r=r.toString(),this.stringified=!1,this._processor=n,this._css=r,this._opts=o,this._map=void 0;let a=t;this.result=new i(this._processor,s,this._opts),this.result.css=r;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,r);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||n("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=r;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 lm=o,o.default=o,lm}(),t=Um(),n=Tm(),r=_m();class i{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else{if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" 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(n,r={}){return this.plugins.length||r.parser||r.stringifier||r.syntax?new t(this,n,r):new e(this,n,r)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return cm=i,i.default=i,r.registerProcessor(i),n.registerProcessor(i),cm}const Bm=lv(function(){if(gm)return fm;gm=1;let e=vv(),t=Sm(),n=Um(),r=Om(),i=jm(),o=bm(),s=function(){if(pm)return hm;pm=1;let e=Sm(),t=xm(),n=Im(),r=Mm(),i=Cm(),o=_m(),s=Dm();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 n={...e,__proto__:i.prototype};n.map&&(n.map={...n.map,__proto__:t.prototype}),u.push(n)}}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 n(d);if("atrule"===d.type)return new r(d);throw new Error("Unknown node type: "+l.type)}return hm=a,a.default=a,hm}(),a=Tm(),l=Rm(),u=Im(),c=Mm(),d=Am(),h=Cm(),p=Fm(),f=Nm(),g=Dm(),v=_m(),m=wm();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new i(e)}return y.plugin=function(e,t){let n,r=!1;function o(...n){console&&console.warn&&!r&&(r=!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(...n);return o.postcssPlugin=e,o.postcssVersion=(new i).version,o}return Object.defineProperty(o,"postcss",{get:()=>(n||(n=o()),n)}),o.process=function(e,t,n){return y([o(n)]).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=r,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,n.registerPostcss(y),fm=y,y.default=y,fm}());Bm.stringify,Bm.fromJSON,Bm.plugin,Bm.parse,Bm.list,Bm.document,Bm.comment,Bm.atRule,Bm.rule,Bm.decl,Bm.root,Bm.CssSyntaxError,Bm.Declaration,Bm.Container,Bm.Processor,Bm.Document,Bm.Comment,Bm.Warning,Bm.AtRule,Bm.Result,Bm.Input,Bm.Rule,Bm.Root,Bm.Node;class qm{constructor(...e){av(this,"parentElement",null),av(this,"parentNode",null),av(this,"ownerDocument"),av(this,"firstChild",null),av(this,"lastChild",null),av(this,"previousSibling",null),av(this,"nextSibling",null),av(this,"ELEMENT_NODE",1),av(this,"TEXT_NODE",3),av(this,"nodeType"),av(this,"nodeName"),av(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 qm))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 zm={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Wm={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Vm={};function $m(e){if(Vm[e])return Vm[e];const t=function(e){var t,n;const r=null==(n=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:n.call(t,e);return r&&globalThis[r]?globalThis[r]:void 0}(e)||globalThis[e],n=t.prototype,r=e in zm?zm[e]:void 0,i=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),o=e in Wm?Wm[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return Vm[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(r),o?Vm[e]=o:n}catch{return n}}const Km={};function Hm(e,t,n){var r;const i=`${e}.${String(n)}`;if(Km[i])return Km[i].call(t);const o=$m(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(Km[i]=s,s.call(t)):t[n]}const Gm={};function Jm(e,t,n){const r=`${e}.${String(n)}`;if(Gm[r])return Gm[r].bind(t);const i=$m(e)[n];return"function"!=typeof i?t[n]:(Gm[r]=i,i.bind(t))}const Ym={childNodes:function(e){return Hm("Node",e,"childNodes")},parentNode:function(e){return Hm("Node",e,"parentNode")},parentElement:function(e){return Hm("Node",e,"parentElement")},textContent:function(e){return Hm("Node",e,"textContent")},contains:function(e,t){return Jm("Node",e,"contains")(t)},getRootNode:function(e){return Jm("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Hm("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Hm("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Hm("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Hm("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return $m("MutationObserver").constructor}};const Xm="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 Qm={map:{},getId:()=>(console.error(Xm),-1),getNode:()=>(console.error(Xm),null),removeNodeFromMap(){console.error(Xm)},has:()=>(console.error(Xm),!1),reset(){console.error(Xm)}};"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Qm=new Proxy(Qm,{get:(e,t,n)=>("map"===t&&console.error(Xm),Reflect.get(e,t,n))}));let Zm=Date.now;function ey(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:Ym.parentElement(e)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Zm=()=>(new Date).getTime());function ty(e){var t;let n=null;return"getRootNode"in e&&(null==(t=Ym.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Ym.host(Ym.getRootNode(e))&&(n=Ym.host(Ym.getRootNode(e))),n}function ny(e){let t,n=e;for(;t=ty(n);)n=t;return n}function ry(e){const t=e.ownerDocument;if(!t)return!1;const n=ny(e);return Ym.contains(t,n)}const iy=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:class{constructor(){pf(this,"id",1),pf(this,"styleIDMap",new WeakMap),pf(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 n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}},get _mirror(){return Qm},closestElementOfNode:ey,getBaseDimension:function e(t,n){var r,i;const o=null==(i=null==(r=t.ownerDocument)?void 0:r.defaultView)?void 0:i.frameElement;if(!o||o===n)return{x:0,y:0,relativeScale:1,absoluteScale:1};const s=o.getBoundingClientRect(),a=e(o,n),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,n){const r=t[n[0]];return 1===n.length?r:e(r.cssRules[n[1]].cssRules,n.slice(2))},getPositionsAndIndex:function(e){const t=[...e],n=t.pop();return{positions:t,index:n}},getRootShadowHost:ny,getShadowHost:ty,getWindowHeight:function(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight},getWindowScroll:function(e){var t,n,r,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=Ym.parentElement(o.body))?void 0:t.scrollLeft)||(null==(n=null==o?void 0:o.body)?void 0:n.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==(r=Ym.parentElement(o.body))?void 0:r.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 qm&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Ym.shadowRoot(e)))},hookSetter:function e(t,n,r,i,o=window){const s=o.Object.getOwnPropertyDescriptor(t,n);return o.Object.defineProperty(t,n,i?r:{set(e){setTimeout(()=>{r.set.call(this,e)},0),s&&s.set&&s.set.call(this,e)}}),()=>e(t,n,s||{},!0)},inDom:function(e){const t=e.ownerDocument;return!!t&&(Ym.contains(t,e)||ry(e))},isAncestorRemoved:function e(t,n){if(function(e){const t=e&&"host"in e&&"mode"in e&&Cf.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Cf.shadowRoot(t)===e)}(t))return!1;const r=n.getId(t);if(!n.has(r))return!0;const i=Ym.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||e(i,n))},isBlocked:function(e,t,n,r){if(!e)return!1;const i=ey(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(If(i,t,r))return!0}catch(e){}if(n){if(i.matches(n))return!0;if(r&&null!==i.closest(n))return!0}return!1},isIgnored:function(e,t,n){return!("TITLE"!==e.tagName||!n.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,n){n(t.value);for(let r=t.children.length-1;r>=0;r--)e(t.children[r],n)},legacy_isTouchEvent:function(e){return Boolean(e.changedTouches)},get nowTimestamp(){return Zm},on:function(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)},patch:function(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{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={},n=(e,n)=>{const r={value:e,parent:n,children:[]};return t[e.node.id]=r,r},r=[];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,n(i,o.parent))}else{const e=r.indexOf(o);r.splice(e,0,n(i,null))}continue}if(o in t){const e=t[o];e.children.push(n(i,e));continue}r.push(n(i,null))}return r},shadowHostInDom:ry,throttle:function(e,t,n={}){let r=null,i=0;return function(...o){const s=Date.now();i||!1!==n.leading||(i=s);const a=t-(s-i),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=s,e.apply(l,o)):r||!1===n.trailing||(r=setTimeout(()=>{i=!1===n.leading?0:Date.now(),r=null,e.apply(l,o)},a))}},uniqueTextMutations:function(e){const t=new Set,n=[];for(let r=e.length;r--;){const i=e[r];t.has(i.id)||(n.push(i),t.add(i.id))}return n}},Symbol.toStringTag,{value:"Module"}));for(var oy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",sy="undefined"==typeof Uint8Array?[]:new Uint8Array(256),ay=0;ay<64;ay++)sy[oy.charCodeAt(ay)]=ay;"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==(nf=e.contentWindow)?void 0:nf.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var ly,uy;new Ef,(uy=ly||(ly={}))[uy.NotStarted=0]="NotStarted",uy[uy.Running=1]="Running",uy[uy.Stopped=2]="Stopped";class cy{constructor(e){df(this,"fileName"),df(this,"functionName"),df(this,"lineNumber"),df(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 dy=/(^|@)\S+:\d+/,hy=/^\s*at .*(\S+:\d+|\(native\))/m,py=/^(eval@)?(\[native code])?$/,fy={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(hy)?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(hy)},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 n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const r=t.split(/\s+/).slice(1),i=this.extractLocation(n?n[1]:r.pop()),o=r.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new cy({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(py)},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 cy({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,""));return new cy({functionName:r,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,n=e.message.split("\n"),r=[];for(let e=2,i=n.length;e<i;e+=2){const i=t.exec(n[e]);i&&r.push(new cy({fileName:i[2],lineNumber:parseFloat(i[1])}))}return r},parseOpera10:function(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),r=[];for(let e=0,i=n.length;e<i;e+=2){const i=t.exec(n[e]);i&&r.push(new cy({functionName:i[3]||void 0,fileName:i[2],lineNumber:parseFloat(i[1])}))}return r},parseOpera11:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(dy)&&!e.match(/^Error created at/)},this).map(function(e){const t=e.split("@"),n=this.extractLocation(t.pop()),r=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new cy({functionName:r,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})},this)}};function gy(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();const r=e.parentElement,i=[];if(r.children&&r.children.length>0)for(let e=0;e<r.children.length;e++){const t=r.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===n&&i.push(t)}i.length>1&&(n+=`:eq(${i.indexOf(e)})`),t=n+(t?">"+t:""),e=r}return t}function vy(e){return"[object Object]"===Object.prototype.toString.call(e)}function my(e,t){if(0===t)return!0;const n=Object.keys(e);for(const r of n)if(vy(e[r])&&my(e[r],t-1))return!0;return!1}function yy(e,t){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);const r=[],i=[];return JSON.stringify(e,function(e,t){if(r.length>0){const n=r.indexOf(this);~n?r.splice(n+1):r.push(this),~n?i.splice(n,1/0,e):i.push(e),~r.indexOf(t)&&(t=r[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,r.indexOf(t)).join(".")+"]")}else r.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(function(e){if(vy(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(vy(e)&&my(e,n.depthOfLimit))return!0;return!1}(t))return function(e){let t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t=`${t.slice(0,n.stringLengthLimit)}...`);return t}(t);if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const n in t){const r=t[n];Array.isArray(r)?e[n]=gy(r.length?r[0]:null):e[n]=r}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 by={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 wy(e,t,n){const r=n?Object.assign({},by,n):by,i=r.logger;if(!i)return()=>{};let o;o="string"==typeof i?t[i]:i;let s=0,a=!1;const l=[];if(r.level.includes("error")){const n=t=>{const n=t.message,i=t.error,o=fy.parse(i).map(e=>e.toString()),s=[yy(n,r.stringifyOptions)];e({level:"error",trace:o,payload:s})};t.addEventListener("error",n),l.push(()=>{t.removeEventListener("error",n)});const i=t=>{let n,i;t.reason instanceof Error?(n=t.reason,i=[yy(`Uncaught (in promise) ${n.name}: ${n.message}`,r.stringifyOptions)]):(n=new Error,i=[yy("Uncaught (in promise)",r.stringifyOptions),yy(t.reason,r.stringifyOptions)]);const o=fy.parse(n).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 r.level)l.push(u(o,e));return()=>{l.forEach(e=>e())};function u(t,n){return t[n]?iy.patch(t,n,t=>(...i)=>{if(t.apply(this,i),!("assert"===n&&i[0]||a)){a=!0;try{const t=fy.parse(new Error).map(e=>e.toString()).splice(1),o=("assert"===n?i.slice(1):i).map(e=>yy(e,r.stringifyOptions));s++,s<r.lengthThreshold?e({level:n,trace:t,payload:o}):s===r.lengthThreshold&&e({level:"warn",trace:[],payload:[yy("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...i)}finally{a=!1}}}):()=>{}}}const Sy="rrweb/console@1";var ky,xy=Object.freeze({__proto__:null,PLUGIN_NAME:Sy,getRecordConsolePlugin:e=>({name:Sy,observer:wy,options:e})}),Cy=Object.defineProperty,Ey=(e,t,n)=>((e,t,n)=>t in e?Cy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Iy=Object.defineProperty,Oy=(e,t,n)=>((e,t,n)=>t in e?Iy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Ty=(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))(Ty||{});const Py={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Ry={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ay={};function My(e){if(Ay[e])return Ay[e];const t=function(e){var t,n;const r=null==(n=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:n.call(t,e);return r&&globalThis[r]?globalThis[r]:void 0}(e)||globalThis[e],n=t.prototype,r=e in Py?Py[e]:void 0,i=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),o=e in Ry?Ry[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return Ay[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(r),o?Ay[e]=o:n}catch{return n}}const _y={};function Ny(e,t,n){var r;const i=`${e}.${String(n)}`;if(_y[i])return _y[i].call(t);const o=My(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(_y[i]=s,s.call(t)):t[n]}const Dy={};function Ly(e,t,n){const r=`${e}.${String(n)}`;if(Dy[r])return Dy[r].bind(t);const i=My(e)[n];return"function"!=typeof i?t[n]:(Dy[r]=i,i.bind(t))}const Fy={childNodes:function(e){return Ny("Node",e,"childNodes")},parentNode:function(e){return Ny("Node",e,"parentNode")},parentElement:function(e){return Ny("Node",e,"parentElement")},textContent:function(e){return Ny("Node",e,"textContent")},contains:function(e,t){return Ly("Node",e,"contains")(t)},getRootNode:function(e){return Ly("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Ny("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Ny("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Ny("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Ny("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return My("MutationObserver").constructor}};function Uy(e){return e.nodeType===e.ELEMENT_NODE}function jy(e){const t=e&&"host"in e&&"mode"in e&&Fy.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Fy.shadowRoot(t)===e)}function By(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function qy(e){try{const n=e.rules||e.cssRules;if(!n)return null;let r=e.href;!r&&e.ownerNode&&e.ownerNode.ownerDocument&&(r=e.ownerNode.ownerDocument.location.href);const i=Array.from(n,e=>zy(e,r)).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 zy(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=qy(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(n){t=e.cssText}return e.styleSheet.href?Zy(t,e.styleSheet.href):t}{let n=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(n=function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(n)),t?Zy(n,t):n}}class Wy{constructor(){Oy(this,"idNodeMap",new Map),Oy(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 n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Vy({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:o}){let s=i||"";const a=r&&$y(r);return(t[n.toLowerCase()]||a&&t[a])&&(s=o?o(s,e):"*".repeat(s.length)),s}function $y(e){return e.toLowerCase()}const Ky="__rrweb_original__";function Hy(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?$y(t):null}function Gy(e,t){let n;try{n=new URL(e,t??window.location.href)}catch(e){return null}const r=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(null==r?void 0:r[1])??null}const Jy=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Yy=/^(?:[a-z+]+:)?\/\//i,Xy=/^www\..*/i,Qy=/^(data:)([^,]*),(.*)/i;function Zy(e,t){return(e||"").replace(Jy,(e,n,r,i,o,s)=>{const a=r||o||s,l=n||i||"";if(!a)return e;if(Yy.test(a)||Xy.test(a))return`url(${l}${a}${l})`;if(Qy.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 eb(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function tb(e,t){return function(e,t,n=!1){const r=Array.from(t.childNodes),i=[];let o=0;if(r.length>1&&e&&"string"==typeof e){let t=eb(e,n);const s=t.length/e.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&"string"==typeof r[a].textContent){const l=eb(r[a].textContent,n),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]&&""!==r[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=r[a-1].textContent;if(e&&"string"==typeof e){const n=eb(e).length;p=t.indexOf(d,n)}-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*r.length)return i.push(e),i;const l=eb(e.substring(0,a),n);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 nb="lightgrey";let rb=1;const ib=new RegExp("[^a-z0-9-_:]");function ob(){return rb++}let sb,ab;const lb=/^[^ \t\n\r\u000c]+/,ub=/^[, \t\n\r\u000c]+/;const cb=new WeakMap;function db(e,t){return t&&""!==t.trim()?pb(e,t):t}function hb(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function pb(e,t){let n=cb.get(e);if(n||(n=e.createElement("a"),cb.set(e,n)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return n.setAttribute("href",t),n.href}function fb(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?db(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):""}const i=[];for(;r(ub),!(n>=t.length);){let o=r(lb);if(","===o.slice(-1))o=db(e,o.substring(0,o.length-1)),i.push(o);else{let r="";o=db(e,o);let s=!1;for(;;){const e=t.charAt(n);if(""===e){i.push((o+r).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){n+=1,i.push((o+r).trim());break}"("===e&&(s=!0)}r+=e,n+=1}}}return i.join(", ")}(e,r):"style"===n?Zy(r,pb(e)):"object"===t&&"data"===n?db(e,r):r:db(e,r):r}function gb(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function vb(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&vb(Fy.parentNode(e),t,n);for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!!n&&vb(Fy.parentNode(e),t,n)}function mb(e,t,n,r){let i;if(Uy(e)){if(i=e,!Fy.childNodes(i).length)return!1}else{if(null===Fy.parentElement(e))return!1;i=Fy.parentElement(e)}try{if("string"==typeof t){if(r){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(vb(i,t,r))return!0;if(n)if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}catch(e){}return!1}function yb(e,t){const{doc:n,mirror:r,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 n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Ty.Document,childNodes:[],compatMode:e.compatMode}:{type:Ty.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Ty.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return function(e,t){const{doc:n,blockClass:r,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,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,i),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=$y(e.tagName);return ib.test(t)?"div":t}(e);let y={};const b=e.attributes.length;for(let t=0;t<b;t++){const r=e.attributes[t];if(!gb(m,r.name,r.value)){const t=fb(n,m,$y(r.name),r.value);if(l&&null!==t){const n=l(r.name,t,e);null!==n&&(y[r.name]=n)}else y[r.name]=t}}if("link"===m&&o){const t=Array.from(n.styleSheets).find(t=>t.href===e.href);let r=null;t&&(r=qy(t)),r&&(delete y.rel,delete y.href,y._cssText=r)}if("style"===m&&e.sheet){let t=qy(e.sheet);t&&(e.childNodes.length>1&&(t=tb(t,e)),y._cssText=t)}if("input"===m||"textarea"===m||"select"===m){const t=e.value,n=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=Vy({element:e,type:Hy(e),tagName:m,value:t,maskInputOptions:s,maskInputFn:a}):n&&(y.checked=n)}"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 n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const i=t.getImageData,o=Ky in i?i[Ky]:i;if(new Uint32Array(o.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).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),r=n.createElement("canvas");r.width=e.width,r.height=e.height;t!==r.toDataURL(u.type,u.quality)&&(y.rr_dataURL=t)}if("img"===m&&c){sb||(sb=n.createElement("canvas"),ab=sb.getContext("2d"));const t=e,r=t.currentSrc||t.getAttribute("src")||"<unknown-src>",i=t.crossOrigin,o=()=>{t.removeEventListener("load",o);try{sb.width=t.naturalWidth,sb.height=t.naturalHeight,ab.drawImage(t,0,0),y.rr_dataURL=sb.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=${r}! 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:n}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${n}px`,...g?{rr_background_color:nb}:{}}}"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:Ty.Element,tagName:m,attributes:y,childNodes:[],isSVG:hb(e)||void 0,needBlock:v,rootId:f,isCustom:w}}(e,{doc:n,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:n,maskTextFn:r,rootId:i,cssCaptured:o}=t,s=Fy.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=Fy.textContent(e),u&&l&&(l=Zy(l,pb(t.doc))));!u&&!c&&l&&n&&(l=r?r(l,Fy.parentElement(e)):l.replace(/[\S]/g,"*"));return{type:Ty.Text,textContent:l||"",rootId:i}}(e,{doc:n,needsMask:s,maskTextFn:u,rootId:b,cssCaptured:m});case e.CDATA_SECTION_NODE:return{type:Ty.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:Ty.Comment,textContent:Fy.textContent(e)||"",rootId:b};default:return!1}}function bb(e){return null==e?"":e.toLowerCase()}function wb(e,t,n){return Array.from(e).map(e=>{const r=t(e);let i=[];if(!n.has(r)){n.add(r);try{i=Array.from(e.cssRules,(t,n)=>({rule:zy(t,e.href),index:n}))}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}return{styleId:r,rules:i}})}function Sb(e,t){var n,r;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:T=!1,applyBackgroundColorToBlockedElements:P=!1}=t,R=t._emittedStyleIds??new Set;let{needsMask:A}=t,{preserveWhiteSpace:M=!0}=t;if(!A){A=mb(e,l,u,void 0===A)}const _=yb(e,{doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:A,inlineStylesheet:d,maskInputOptions:h,maskTextFn:p,maskInputFn:f,maskAttributeFn:g,dataURLOptions:m,inlineImages:y,recordCanvas:b,keepIframeSrcFn:I,newlyAddedElement:O,cssCaptured:T,applyBackgroundColorToBlockedElements:P});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===Ty.Comment)return!0;if(e.type===Ty.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"===Gy(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(bb(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===bb(e.attributes.name)||"icon"===bb(e.attributes.rel)||"apple-touch-icon"===bb(e.attributes.rel)||"shortcut icon"===bb(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&bb(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(bb(e.attributes.property).match(/^(og|twitter|fb):/)||bb(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===bb(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===bb(e.attributes.name)||"googlebot"===bb(e.attributes.name)||"bingbot"===bb(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===bb(e.attributes.name)||"generator"===bb(e.attributes.name)||"framework"===bb(e.attributes.name)||"publisher"===bb(e.attributes.name)||"progid"===bb(e.attributes.name)||bb(e.attributes.property).match(/^article:/)||bb(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===bb(e.attributes.name)||"yandex-verification"===bb(e.attributes.name)||"csrf-token"===bb(e.attributes.name)||"p:domain_verify"===bb(e.attributes.name)||"verify-v1"===bb(e.attributes.name)||"verification"===bb(e.attributes.name)||"shopify-checkout-api-token"===bb(e.attributes.name)))return!0}}return!1}(_,v)||!M&&_.type===Ty.Text&&!_.textContent.replace(/^\s+|\s+$/gm,"").length?-2:ob();const D=Object.assign(_,{id:N});if(o.add(e,D),-2===N)return null;w&&w(e);let L=!c;if(D.type===Ty.Element){L=L&&!D.needBlock,delete D.needBlock;const t=Fy.shadowRoot(e);t&&By(t)&&(D.isShadowHost=!0,S&&(null==(n=t.adoptedStyleSheets)?void 0:n.length)&&(D.adoptedStyleSheets=wb(t.adoptedStyleSheets,S,R)))}if(D.type===Ty.Document&&S){const t=e;(null==(r=t.adoptedStyleSheets)?void 0:r.length)&&(D.adoptedStyleSheets=wb(t.adoptedStyleSheets,S,R))}if((D.type===Ty.Document||D.type===Ty.Element)&&L){v.headWhitespace&&D.type===Ty.Element&&"head"===D.tagName&&(M=!1);const t={doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:A,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:M,onSerialize:w,onAdoptedStyleSheet:S,_emittedStyleIds:R,onIframeLoad:k,iframeLoadTimeout:x,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I,cssCaptured:!1,applyBackgroundColorToBlockedElements:P};if(D.type===Ty.Element&&"textarea"===D.tagName&&void 0!==D.attributes.value);else{D.type===Ty.Element&&void 0!==D.attributes._cssText&&"string"==typeof D.attributes._cssText&&(t.cssCaptured=!0);for(const n of Array.from(Fy.childNodes(e))){const e=Sb(n,t);e&&D.childNodes.push(e)}}let n=null;if(Uy(e)&&(n=Fy.shadowRoot(e)))for(const e of Array.from(Fy.childNodes(n))){const r=Sb(e,t);r&&(By(n)&&(r.isShadow=!0),D.childNodes.push(r))}}const F=Fy.parentNode(e);return F&&jy(F)&&By(F)&&(D.isShadow=!0),D.type===Ty.Element&&"iframe"===D.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let i,o=!1;try{i=r.document.readyState}catch(e){return}if("complete"!==i){const r=setTimeout(()=>{o||(t(),o=!0)},n);return void e.addEventListener("load",()=>{clearTimeout(r),o=!0,t()})}const s="about:blank";if(r.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 n=Sb(t,{doc:t,mirror:o,blockClass:s,blockSelector:a,needsMask:A,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:M,onSerialize:w,onAdoptedStyleSheet:S,onIframeLoad:k,iframeLoadTimeout:x,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I});n&&k(e,n)}},x),D.type===Ty.Element&&"link"===D.tagName&&"string"==typeof D.attributes.rel&&("stylesheet"===D.attributes.rel||"preload"===D.attributes.rel&&"string"==typeof D.attributes.href&&"css"===Gy(D.attributes.href))&&function(e,t,n){let r,i=!1;try{r=e.sheet}catch(e){return}if(r)return;const o=setTimeout(()=>{i||(t(),i=!0)},n);e.addEventListener("load",()=>{clearTimeout(o),i=!0,t()})}(e,()=>{if(C){const t=Sb(e,{doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:A,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:M,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:x,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I});t&&C(e,t)}},E),D}function kb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function xb(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Cb,Eb={exports:{}};function Ib(){if(Cb)return Eb.exports;Cb=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 Eb.exports=t(),Eb.exports.createColors=t,Eb.exports}const Ob=xb(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Tb,Pb;function Rb(){if(Pb)return Tb;Pb=1;let e=Ib(),t=Ob;class n extends Error{constructor(e,t,r,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!==r&&("number"==typeof t?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}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(n){if(!this.source)return"";let r=this.source;null==n&&(n=e.isColorSupported),t&&n&&(r=t(r));let i,o,s=r.split(/\r?\n/),a=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;if(n){let{bold:t,gray:n,red:r}=e.createColors(!0);i=e=>t(r(e)),o=e=>n(e)}else i=o=e=>e;return s.slice(a,l).map((e,t)=>{let n=a+1+t,r=" "+(" "+n).slice(-u)+" | ";if(n===this.line){let t=o(r.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+o(r)+e+"\n "+t+i("^")}return" "+o(r)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return Tb=n,n.default=n,Tb}var Ab,Mb,_b,Nb,Db,Lb,Fb,Ub,jb,Bb,qb,zb,Wb,Vb,$b,Kb,Hb,Gb,Jb,Yb,Xb,Qb,Zb,ew,tw,nw,rw,iw,ow,sw,aw,lw,uw,cw,dw,hw,pw,fw,gw,vw,mw,yw,bw,ww,Sw,kw,xw,Cw,Ew,Iw,Ow,Tw,Pw,Rw={};function Aw(){return Ab||(Ab=1,Rw.isClean=Symbol("isClean"),Rw.my=Symbol("my")),Rw}function Mw(){if(_b)return Mb;_b=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 n="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:r&&(n+=" "),e.nodes)this.block(e,n+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,e)}}beforeAfter(e,t){let n;n="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 r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)n+=t}return n}block(e,t){let n,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==r||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),r=e.prop+n+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],void 0!==i))return i;let o=t.parent;if("before"===r){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[r];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[r])return s.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(t,r);{let e="raw"+((a=r)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[n],void 0!==i)return!1})}var a;return void 0===i&&(i=e[r]),s.rawCache[r]=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 n;return e.walkComments(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}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(n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.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(n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==n.raws.before){let e=n.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 n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}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 Mb=t,t.default=t,Mb}function _w(){if(Db)return Nb;Db=1;let e=Mw();function t(t,n){new e(n).stringify(t)}return Nb=t,t.default=t,Nb}function Nw(){if(Fb)return Lb;Fb=1;let{isClean:e,my:t}=Aw(),n=Rb(),r=Mw(),i=_w();function o(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],s=typeof i;"parent"===r&&"object"===s?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>o(e,n)):("object"===s&&null!==i&&(i=o(i)),n[r]=i)}return n}class s{constructor(n={}){this.raws={},this[e]=!1,this[t]=!0;for(let e in n)if("nodes"===e){this.nodes=[];for(let t of n[e])"function"==typeof t.clone?this.append(t.clone()):this.append(t)}else this[e]=n[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 n in e)t[n]=e[n];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:n,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:n.column,line:n.line},t)}return new n(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"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 n=this.source.start;if(e.index)n=this.positionInside(e.index,t);else if(e.word){let r=(t=this.toString()).indexOf(e.word);-1!==r&&(n=this.positionInside(r,t))}return n}positionInside(e,t){let n=t||this.toString(),r=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===n[t]?(r=1,i+=1):r+=1;return{column:r,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},n=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 r=this.toString(),i=r.indexOf(e.word);-1!==i&&(t=this.positionInside(i,r),n=this.positionInside(i+e.word.length,r))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?n={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?n=this.positionInside(e.endIndex):e.index&&(n=this.positionInside(e.index+1));return(n.line<t.line||n.line===t.line&&n.column<=t.column)&&(n={column:t.column+1,line:t.line}),{end:n,start:t}}raw(e,t){return(new r).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,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},r=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 r=this[e];if(Array.isArray(r))n[e]=r.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof r&&r.toJSON)n[e]=r.toJSON(null,t);else if("source"===e){let o=t.get(r.input);null==o&&(o=i,t.set(r.input,i),i++),n[e]={end:r.end,inputId:o,start:r.start}}else n[e]=r}return r&&(n.inputs=[...t.keys()].map(e=>e.toJSON())),n}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,n){let r={node:this};for(let e in n)r[e]=n[e];return e.warn(t,r)}get proxyOf(){return this}}return Lb=s,s.default=s,Lb}function Dw(){if(jb)return Ub;jb=1;let e=Nw();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 Ub=t,t.default=t,Ub}function Lw(){if(qb)return Bb;qb=1;return Bb={nanoid:(e=21)=>{let t="",n=e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r}},Bb}function Fw(){if(Wb)return zb;Wb=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Ob,{existsSync:n,readFileSync:r}=Ob,{dirname:i,join:o}=Ob;class s{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let n=t.map?t.map.prev:void 0,r=this.loadMap(t.from,n);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=i(this.mapFile)),r&&(this.text=r)}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 n=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+n)}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 n=e.lastIndexOf(t.pop()),r=e.indexOf("*/",n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(e){if(this.root=i(e),n(e))return this.mapFile=e,r(e,"utf-8").toString().trim()}loadMap(n,r){if(!1===r)return!1;if(r){if("string"==typeof r)return r;if("function"!=typeof r){if(r instanceof e)return t.fromSourceMap(r).toString();if(r instanceof t)return r.toString();if(this.isMap(r))return JSON.stringify(r);throw new Error("Unsupported previous source map format: "+r.toString())}{let e=r(n);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 n&&(e=o(i(n),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 zb=s,s.default=s,zb}function Uw(){if($b)return Vb;$b=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Ob,{fileURLToPath:n,pathToFileURL:r}=Ob,{isAbsolute:i,resolve:o}=Ob,{nanoid:s}=Lw(),a=Ob,l=Rb(),u=Fw(),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,n,i={}){let o,s,a;if(t&&"object"==typeof t){let e=t,r=n;if("number"==typeof e.offset){let r=this.fromOffset(e.offset);t=r.line,n=r.col}else t=e.line,n=e.column;if("number"==typeof r.offset){let e=this.fromOffset(r.offset);s=e.line,a=e.col}else s=r.line,a=r.column}else if(!n){let e=this.fromOffset(t);t=e.line,n=e.col}let u=this.origin(t,n,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:n,line:t},void 0===s?n:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:n,endColumn:a,endLine:s,line:t,source:this.css},this.file&&(r&&(o.input.url=r(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,n;if(this[c])n=this[c];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)n[r]=t,t+=e[r].length+1;this[c]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t,i=n.length-2;for(;r<i;)if(t=r+(i-r>>1),e<n[t])i=t-1;else{if(!(e>=n[t+1])){r=t;break}r=t+1}}return{col:e-n[r]+1,line:r+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)?r(c.source):new URL(c.source,this.map.consumer().sourceRoot||r(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(!n)throw new Error("file: protocol is not available in this PostCSS build");d.file=n(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 Vb=p,p.default=p,a&&a.registerInput&&a.registerInput(p),Vb}function jw(){if(Hb)return Kb;Hb=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=Ob,{dirname:n,relative:r,resolve:i,sep:o}=Ob,{pathToFileURL:s}=Ob,a=Uw(),l=Boolean(e&&t),u=Boolean(n&&i&&r&&o);return Kb=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,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 r,i=this.toUrl(this.path(t.file)),o=t.root||n(t.file);!1===this.mapOpts.sourcesContent?(r=new e(t.text),r.sourcesContent&&(r.sourcesContent=null)):r=t.consumer(),this.map.applySourceMap(r,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,n,r=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=r,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?(r+=e.length,n=t.lastIndexOf("\n"),i=t.length-n):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=r,s.generated.column=i-2,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=r,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?n(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=n(i(o,this.mapOpts.annotation)));let s=r(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 n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,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 n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},Kb}function Bw(){if(Jb)return Gb;Jb=1;let e=Nw();class t extends e{constructor(e){super(e),this.type="comment"}}return Gb=t,t.default=t,Gb}function qw(){if(Xb)return Yb;Xb=1;let e,t,n,r,{isClean:i,my:o}=Aw(),s=Dw(),a=Bw(),l=Nw();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,n,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[r]+=1;return delete this.indexes[r],n}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")?(...n)=>e[t](...n.map(e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e)):"every"===t||"some"===t?n=>e[t]((e,...t)=>n(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,n)=>(e[t]===n||(e[t]=n,"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 n,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)n=this.indexes[e],r<n&&(this.indexes[e]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of o)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)n=this.indexes[e],r<=n&&(this.indexes[e]=n+o.length);return this.markDirty(),this}normalize(r,l){if("string"==typeof r)r=u(e(r).nodes);else if(void 0===r)r=[];else if(Array.isArray(r)){r=r.slice(0);for(let e of r)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===r.type&&"document"!==this.type){r=r.nodes.slice(0);for(let e of r)e.parent&&e.parent.removeChild(e,"ignore")}else if(r.type)r=[r];else if(r.prop){if(void 0===r.value)throw new Error("Value field is missed in node creation");"string"!=typeof r.value&&(r.value=String(r.value)),r=[new s(r)]}else if(r.selector)r=[new t(r)];else if(r.name)r=[new n(r)];else{if(!r.text)throw new Error("Unknown node type in node creation");r=[new a(r)]}return r.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 n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,n)=>{let r;try{r=e(t,n)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("atrule"===n.type&&e.test(n.name))return t(n,r)}):this.walk((n,r)=>{if("atrule"===n.type&&n.name===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("atrule"===e.type)return t(e,n)}))}walkComments(e){return this.walk((t,n)=>{if("comment"===t.type)return e(t,n)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("decl"===n.type&&e.test(n.prop))return t(n,r)}):this.walk((n,r)=>{if("decl"===n.type&&n.prop===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("decl"===e.type)return t(e,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("rule"===n.type&&e.test(n.selector))return t(n,r)}):this.walk((n,r)=>{if("rule"===n.type&&n.selector===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("rule"===e.type)return t(e,n)}))}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=>{n=e},d.registerRoot=e=>{r=e},Yb=d,d.default=d,d.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,n.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,r.prototype),e[o]=!0,e.nodes&&e.nodes.forEach(e=>{d.rebuild(e)})},Yb}function zw(){if(Zb)return Qb;Zb=1;let e,t,n=qw();class r extends n{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},Qb=r,r.default=r,Qb}function Ww(){if(tw)return ew;tw=1;let e={};return ew=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function Vw(){if(rw)return nw;rw=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 nw=e,e.default=e,nw}function $w(){if(ow)return iw;ow=1;let e=Vw();class t{constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new e(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}}return iw=t,t.default=t,iw}function Kw(){if(uw)return lw;uw=1;let e=qw();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 lw=t,t.default=t,e.registerAtRule(t),lw}function Hw(){if(dw)return cw;dw=1;let e,t,n=qw();class r extends n{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let r=super.normalize(e);if(t)if("prepend"===n)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 r)e.raws.before=t.raws.before;return r}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},cw=r,r.default=r,n.registerRoot(r),cw}function Gw(){if(pw)return hw;pw=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,n){let r=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let n of e)u?u=!1:"\\"===n?u=!0:a?n===l&&(a=!1):'"'===n||"'"===n?(a=!0,l=n):"("===n?s+=1:")"===n?s>0&&(s-=1):0===s&&t.includes(n)&&(o=!0),o?(""!==i&&r.push(i.trim()),i="",o=!1):i+=n;return(n||""!==i)&&r.push(i.trim()),r}};return hw=e,e.default=e,hw}function Jw(){if(gw)return fw;gw=1;let e=qw(),t=Gw();class n 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,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}}return fw=n,n.default=n,e.registerRule(n),fw}function Yw(){if(mw)return vw;mw=1;let e=Dw(),t=function(){if(aw)return sw;aw=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),n="\\".charCodeAt(0),r="/".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 sw=function(x,C={}){let E,I,O,T,P,R,A,M,_,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(M=j.length?j.pop()[1]:"",_=D.charCodeAt(U+1),"url"===M&&_!==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(A=I;D.charCodeAt(A-1)===n;)A-=1,R=!R}while(R);N=["brackets",D.slice(U,I+1),U,I],U=I}else I=D.indexOf(")",U+1),T=D.slice(U,I+1),-1===I||S.test(T)?N=["(","(",U]:(N=["brackets",T,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(A=I;D.charCodeAt(A-1)===n;)A-=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 n:for(I=U,P=!0;D.charCodeAt(I+1)===n;)I+=1,P=!P;if(E=D.charCodeAt(I+1),P&&E!==r&&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===r&&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}}}}(),n=Bw(),r=Kw(),i=Hw(),o=Jw();const s={empty:!0,space:!0};return vw=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,n,i,o=new r;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,n=l[i];n&&"space"===n[0];)n=l[--i];n&&(o.source.end=this.getPosition(n[3]||n[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 n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[o,s]of e.entries()){if(t=s,n=t[0],"("===n&&(i+=1),")"===n&&(i-=1),0===i&&":"===n){if(r){if("word"===r[0]&&"progid"===r[1])continue;return o}this.doubleColon(t)}r=t}return!1}comment(e){let t=new n;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let e=r.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,n){let r=new e;this.init(r,t[0][2]);let i,o=t[t.length-1];for(";"===o[0]&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}(t)),r.source.end.offset++;"word"!==t[0][0];)1===t.length&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let e=t[0][0];if(":"===e||"space"===e||"comment"===e)break;r.prop+=t.shift()[1]}for(r.raws.between="";t.length;){if(i=t.shift(),":"===i[0]){r.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),r.raws.between+=i[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.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()){r.important=!0;let n=this.stringFrom(t,e);n=this.spacesFromEnd(t)+n," !important"!==n&&(r.raws.important=n);break}if("important"===i[1].toLowerCase()){let n=t.slice(0),i="";for(let t=e;t>0;t--){let e=n[t][0];if(0===i.trim().indexOf("!")&&"space"!==e)break;i=n.pop()[1]+i}0===i.trim().indexOf("!")&&(r.important=!0,r.raws.important=i,t=n)}if("space"!==i[0]&&"comment"!==i[0])break}t.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(r.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(r,"value",a.concat(t),n),r.value.includes(":")&&!n&&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,n=null,r=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)i||(i=l),o.push("("===n?")":"]");else if(s&&r&&"{"===n)i||(i=l),o.push("}");else if(0===o.length){if(";"===n){if(r)return void this.decl(a,s);break}if("{"===n)return void this.rule(a);if("}"===n){this.tokenizer.back(a.pop()),t=!0;break}":"===n&&(r=!0)}else n===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&&r){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,n,r){let i,o,a,l,u=n.length,c="",d=!0;for(let e=0;e<u;e+=1)i=n[e],o=i[0],"space"!==o||e!==u-1||r?"comment"===o?(l=n[e-1]?n[e-1][0]:"empty",a=n[e+1]?n[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let r=n.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,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,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}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})}},vw}function Xw(){if(bw)return yw;bw=1;let e=qw(),t=Yw(),n=Uw();function r(e,r){let i=new n(e,r),o=new t(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&r&&r.from&&(/\.scss$/i.test(r.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(r.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(r.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 yw=r,r.default=r,e.registerParse(r),yw}function Qw(){if(Sw)return ww;Sw=1;let{isClean:e,my:t}=Aw(),n=jw(),r=_w(),i=qw(),o=zw(),s=Ww(),a=$w(),l=Xw(),u=Hw();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,n=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,0,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,0,n+"Exit"]:[n,n+"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,n,r){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof y||n instanceof a)o=v(n.root),n.map&&(void 0===r.map&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let e=l;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{o=e(n,r)}catch(e){this.processed=!0,this.error=e}o&&!o[t]&&i.rebuild(o)}else o=v(n);this.result=new a(e,o,r),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 n=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(n.postcssVersion&&"production"!==process.env.NODE_ENV){let e=n.postcssPlugin,t=n.postcssVersion,r=this.result.processor.version,i=t.split("."),o=r.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=n.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!d[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[n])if("object"==typeof t[n])for(let r in t[n])e(t,"*"===r?n:n+"-"+r.toLowerCase(),t[n][r]);else"function"==typeof t[n]&&e(t,n,t[n])}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],n=this.runOnRoot(t);if(p(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];){t[e]=!0;let n=[g(t)];for(;n.length>0;){let e=this.visitTick(n);if(p(e))try{await e}catch(e){let t=n[n.length-1].node;throw this.handleError(e,t)}}}if(this.listeners.OnceExit)for(let[e,n]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map(e=>n(e,this.helpers));await Promise.all(e)}else await n(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=r;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new n(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[n,r]of e){let e;this.result.lastPlugin=n;try{e=r(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 n=t[t.length-1],{node:r,visitors:i}=n;if("root"!==r.type&&"document"!==r.type&&!r.parent)return void t.pop();if(i.length>0&&n.visitorIndex<i.length){let[e,t]=i[n.visitorIndex];n.visitorIndex+=1,n.visitorIndex===i.length&&(n.visitors=[],n.visitorIndex=0),this.result.lastPlugin=e;try{return t(r.toProxy(),this.helpers)}catch(e){throw this.handleError(e,r)}}if(0!==n.iterator){let i,o=n.iterator;for(;i=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!i[e])return i[e]=!0,void t.push(g(i));n.iterator=0,delete r.indexes[o]}let o=n.events;for(;n.eventIndex<o.length;){let t=o[n.eventIndex];if(n.eventIndex+=1,0===t)return void(r.nodes&&r.nodes.length&&(r[e]=!0,n.iterator=r.getIterator()));if(this.listeners[t])return void(n.visitors=this.listeners[t])}t.pop()}walkSync(t){t[e]=!0;let n=f(t);for(let r of n)if(0===r)t.nodes&&t.each(t=>{t[e]||this.walkSync(t)});else{let e=this.listeners[r];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},ww=y,y.default=y,u.registerLazyResult(y),o.registerLazyResult(y),ww}function Zw(){if(Ew)return Cw;Ew=1;let e=function(){if(xw)return kw;xw=1;let e=jw(),t=_w(),n=Ww(),r=Xw();const i=$w();class o{constructor(n,r,o){let s;r=r.toString(),this.stringified=!1,this._processor=n,this._css=r,this._opts=o,this._map=void 0;let a=t;this.result=new i(this._processor,s,this._opts),this.result.css=r;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,r);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||n("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=r;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 kw=o,o.default=o,kw}(),t=Qw(),n=zw(),r=Hw();class i{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else{if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" 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(n,r={}){return this.plugins.length||r.parser||r.stringifier||r.syntax?new t(this,n,r):new e(this,n,r)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return Cw=i,i.default=i,r.registerProcessor(i),n.registerProcessor(i),Cw}var eS=function(){if(Pw)return Tw;Pw=1;let e=Rb(),t=Dw(),n=Qw(),r=qw(),i=Zw(),o=_w(),s=function(){if(Ow)return Iw;Ow=1;let e=Dw(),t=Fw(),n=Bw(),r=Kw(),i=Uw(),o=Hw(),s=Jw();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 n={...e,__proto__:i.prototype};n.map&&(n.map={...n.map,__proto__:t.prototype}),u.push(n)}}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 n(d);if("atrule"===d.type)return new r(d);throw new Error("Unknown node type: "+l.type)}return Iw=a,a.default=a,Iw}(),a=zw(),l=Vw(),u=Bw(),c=Kw(),d=$w(),h=Uw(),p=Xw(),f=Gw(),g=Jw(),v=Hw(),m=Nw();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new i(e)}return y.plugin=function(e,t){let n,r=!1;function o(...n){console&&console.warn&&!r&&(r=!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(...n);return o.postcssPlugin=e,o.postcssVersion=(new i).version,o}return Object.defineProperty(o,"postcss",{get:()=>(n||(n=o()),n)}),o.process=function(e,t,n){return y([o(n)]).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=r,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,n.registerPostcss(y),Tw=y,y.default=y,Tw}();const tS=kb(eS);tS.stringify,tS.fromJSON,tS.plugin,tS.parse,tS.list,tS.document,tS.comment,tS.atRule,tS.rule,tS.decl,tS.root,tS.CssSyntaxError,tS.Declaration,tS.Container,tS.Processor,tS.Document,tS.Comment,tS.Warning,tS.AtRule,tS.Result,tS.Input,tS.Rule,tS.Root,tS.Node;var nS=Object.defineProperty,rS=(e,t,n)=>((e,t,n)=>t in e?nS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);function iS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function oS(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var sS,aS={exports:{}};function lS(){if(sS)return aS.exports;sS=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 aS.exports=t(),aS.exports.createColors=t,aS.exports}const uS=oS(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var cS,dS;function hS(){if(dS)return cS;dS=1;let e=lS(),t=uS;class n extends Error{constructor(e,t,r,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!==r&&("number"==typeof t?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}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(n){if(!this.source)return"";let r=this.source;null==n&&(n=e.isColorSupported),t&&n&&(r=t(r));let i,o,s=r.split(/\r?\n/),a=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;if(n){let{bold:t,gray:n,red:r}=e.createColors(!0);i=e=>t(r(e)),o=e=>n(e)}else i=o=e=>e;return s.slice(a,l).map((e,t)=>{let n=a+1+t,r=" "+(" "+n).slice(-u)+" | ";if(n===this.line){let t=o(r.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+o(r)+e+"\n "+t+i("^")}return" "+o(r)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return cS=n,n.default=n,cS}var pS,fS,gS,vS,mS,yS,bS,wS,SS,kS,xS,CS,ES,IS,OS,TS,PS,RS,AS,MS,_S,NS,DS,LS,FS,US,jS,BS,qS,zS,WS,VS,$S,KS,HS,GS,JS,YS,XS,QS,ZS,ek,tk,nk,rk,ik,ok,sk,ak,lk,uk,ck,dk,hk={};function pk(){return pS||(pS=1,hk.isClean=Symbol("isClean"),hk.my=Symbol("my")),hk}function fk(){if(gS)return fS;gS=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 n="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:r&&(n+=" "),e.nodes)this.block(e,n+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,e)}}beforeAfter(e,t){let n;n="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 r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)n+=t}return n}block(e,t){let n,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==r||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),r=e.prop+n+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],void 0!==i))return i;let o=t.parent;if("before"===r){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[r];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[r])return s.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(t,r);{let e="raw"+((a=r)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[n],void 0!==i)return!1})}var a;return void 0===i&&(i=e[r]),s.rawCache[r]=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 n;return e.walkComments(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}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(n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.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(n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==n.raws.before){let e=n.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 n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}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 fS=t,t.default=t,fS}function gk(){if(mS)return vS;mS=1;let e=fk();function t(t,n){new e(n).stringify(t)}return vS=t,t.default=t,vS}function vk(){if(bS)return yS;bS=1;let{isClean:e,my:t}=pk(),n=hS(),r=fk(),i=gk();function o(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],s=typeof i;"parent"===r&&"object"===s?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>o(e,n)):("object"===s&&null!==i&&(i=o(i)),n[r]=i)}return n}class s{constructor(n={}){this.raws={},this[e]=!1,this[t]=!0;for(let e in n)if("nodes"===e){this.nodes=[];for(let t of n[e])"function"==typeof t.clone?this.append(t.clone()):this.append(t)}else this[e]=n[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 n in e)t[n]=e[n];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:n,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:n.column,line:n.line},t)}return new n(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"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 n=this.source.start;if(e.index)n=this.positionInside(e.index,t);else if(e.word){let r=(t=this.toString()).indexOf(e.word);-1!==r&&(n=this.positionInside(r,t))}return n}positionInside(e,t){let n=t||this.toString(),r=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)"\n"===n[t]?(r=1,i+=1):r+=1;return{column:r,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},n=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 r=this.toString(),i=r.indexOf(e.word);-1!==i&&(t=this.positionInside(i,r),n=this.positionInside(i+e.word.length,r))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?n={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?n=this.positionInside(e.endIndex):e.index&&(n=this.positionInside(e.index+1));return(n.line<t.line||n.line===t.line&&n.column<=t.column)&&(n={column:t.column+1,line:t.line}),{end:n,start:t}}raw(e,t){return(new r).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,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},r=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 r=this[e];if(Array.isArray(r))n[e]=r.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof r&&r.toJSON)n[e]=r.toJSON(null,t);else if("source"===e){let o=t.get(r.input);null==o&&(o=i,t.set(r.input,i),i++),n[e]={end:r.end,inputId:o,start:r.start}}else n[e]=r}return r&&(n.inputs=[...t.keys()].map(e=>e.toJSON())),n}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,n){let r={node:this};for(let e in n)r[e]=n[e];return e.warn(t,r)}get proxyOf(){return this}}return yS=s,s.default=s,yS}function mk(){if(SS)return wS;SS=1;let e=vk();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 wS=t,t.default=t,wS}function yk(){if(xS)return kS;xS=1;return kS={nanoid:(e=21)=>{let t="",n=e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r}},kS}function bk(){if(ES)return CS;ES=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=uS,{existsSync:n,readFileSync:r}=uS,{dirname:i,join:o}=uS;class s{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let n=t.map?t.map.prev:void 0,r=this.loadMap(t.from,n);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=i(this.mapFile)),r&&(this.text=r)}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 n=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+n)}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 n=e.lastIndexOf(t.pop()),r=e.indexOf("*/",n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(e){if(this.root=i(e),n(e))return this.mapFile=e,r(e,"utf-8").toString().trim()}loadMap(n,r){if(!1===r)return!1;if(r){if("string"==typeof r)return r;if("function"!=typeof r){if(r instanceof e)return t.fromSourceMap(r).toString();if(r instanceof t)return r.toString();if(this.isMap(r))return JSON.stringify(r);throw new Error("Unsupported previous source map format: "+r.toString())}{let e=r(n);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 n&&(e=o(i(n),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 CS=s,s.default=s,CS}function wk(){if(OS)return IS;OS=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=uS,{fileURLToPath:n,pathToFileURL:r}=uS,{isAbsolute:i,resolve:o}=uS,{nanoid:s}=yk(),a=uS,l=hS(),u=bk(),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,n,i={}){let o,s,a;if(t&&"object"==typeof t){let e=t,r=n;if("number"==typeof e.offset){let r=this.fromOffset(e.offset);t=r.line,n=r.col}else t=e.line,n=e.column;if("number"==typeof r.offset){let e=this.fromOffset(r.offset);s=e.line,a=e.col}else s=r.line,a=r.column}else if(!n){let e=this.fromOffset(t);t=e.line,n=e.col}let u=this.origin(t,n,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:n,line:t},void 0===s?n:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:n,endColumn:a,endLine:s,line:t,source:this.css},this.file&&(r&&(o.input.url=r(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,n;if(this[c])n=this[c];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)n[r]=t,t+=e[r].length+1;this[c]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t,i=n.length-2;for(;r<i;)if(t=r+(i-r>>1),e<n[t])i=t-1;else{if(!(e>=n[t+1])){r=t;break}r=t+1}}return{col:e-n[r]+1,line:r+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)?r(c.source):new URL(c.source,this.map.consumer().sourceRoot||r(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(!n)throw new Error("file: protocol is not available in this PostCSS build");d.file=n(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 IS=p,p.default=p,a&&a.registerInput&&a.registerInput(p),IS}function Sk(){if(PS)return TS;PS=1;let{SourceMapConsumer:e,SourceMapGenerator:t}=uS,{dirname:n,relative:r,resolve:i,sep:o}=uS,{pathToFileURL:s}=uS,a=wk(),l=Boolean(e&&t),u=Boolean(n&&i&&r&&o);return TS=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,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 r,i=this.toUrl(this.path(t.file)),o=t.root||n(t.file);!1===this.mapOpts.sourcesContent?(r=new e(t.text),r.sourcesContent&&(r.sourcesContent=null)):r=t.consumer(),this.map.applySourceMap(r,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,n,r=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=r,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?(r+=e.length,n=t.lastIndexOf("\n"),i=t.length-n):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=r,s.generated.column=i-2,this.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=r,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?n(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=n(i(o,this.mapOpts.annotation)));let s=r(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 n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,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 n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},TS}function kk(){if(AS)return RS;AS=1;let e=vk();class t extends e{constructor(e){super(e),this.type="comment"}}return RS=t,t.default=t,RS}function xk(){if(_S)return MS;_S=1;let e,t,n,r,{isClean:i,my:o}=pk(),s=mk(),a=kk(),l=vk();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,n,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[r]+=1;return delete this.indexes[r],n}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")?(...n)=>e[t](...n.map(e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e)):"every"===t||"some"===t?n=>e[t]((e,...t)=>n(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,n)=>(e[t]===n||(e[t]=n,"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 n,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)n=this.indexes[e],r<n&&(this.indexes[e]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of o)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)n=this.indexes[e],r<=n&&(this.indexes[e]=n+o.length);return this.markDirty(),this}normalize(r,l){if("string"==typeof r)r=u(e(r).nodes);else if(void 0===r)r=[];else if(Array.isArray(r)){r=r.slice(0);for(let e of r)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===r.type&&"document"!==this.type){r=r.nodes.slice(0);for(let e of r)e.parent&&e.parent.removeChild(e,"ignore")}else if(r.type)r=[r];else if(r.prop){if(void 0===r.value)throw new Error("Value field is missed in node creation");"string"!=typeof r.value&&(r.value=String(r.value)),r=[new s(r)]}else if(r.selector)r=[new t(r)];else if(r.name)r=[new n(r)];else{if(!r.text)throw new Error("Unknown node type in node creation");r=[new a(r)]}return r.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 n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,n)=>{let r;try{r=e(t,n)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("atrule"===n.type&&e.test(n.name))return t(n,r)}):this.walk((n,r)=>{if("atrule"===n.type&&n.name===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("atrule"===e.type)return t(e,n)}))}walkComments(e){return this.walk((t,n)=>{if("comment"===t.type)return e(t,n)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("decl"===n.type&&e.test(n.prop))return t(n,r)}):this.walk((n,r)=>{if("decl"===n.type&&n.prop===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("decl"===e.type)return t(e,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("rule"===n.type&&e.test(n.selector))return t(n,r)}):this.walk((n,r)=>{if("rule"===n.type&&n.selector===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("rule"===e.type)return t(e,n)}))}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=>{n=e},d.registerRoot=e=>{r=e},MS=d,d.default=d,d.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,n.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,r.prototype),e[o]=!0,e.nodes&&e.nodes.forEach(e=>{d.rebuild(e)})},MS}function Ck(){if(DS)return NS;DS=1;let e,t,n=xk();class r extends n{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},NS=r,r.default=r,NS}function Ek(){if(FS)return LS;FS=1;let e={};return LS=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function Ik(){if(jS)return US;jS=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 US=e,e.default=e,US}function Ok(){if(qS)return BS;qS=1;let e=Ik();class t{constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new e(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}}return BS=t,t.default=t,BS}function Tk(){if($S)return VS;$S=1;let e=xk();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 VS=t,t.default=t,e.registerAtRule(t),VS}function Pk(){if(HS)return KS;HS=1;let e,t,n=xk();class r extends n{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let r=super.normalize(e);if(t)if("prepend"===n)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 r)e.raws.before=t.raws.before;return r}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},KS=r,r.default=r,n.registerRoot(r),KS}function Rk(){if(JS)return GS;JS=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,n){let r=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let n of e)u?u=!1:"\\"===n?u=!0:a?n===l&&(a=!1):'"'===n||"'"===n?(a=!0,l=n):"("===n?s+=1:")"===n?s>0&&(s-=1):0===s&&t.includes(n)&&(o=!0),o?(""!==i&&r.push(i.trim()),i="",o=!1):i+=n;return(n||""!==i)&&r.push(i.trim()),r}};return GS=e,e.default=e,GS}function Ak(){if(XS)return YS;XS=1;let e=xk(),t=Rk();class n 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,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}}return YS=n,n.default=n,e.registerRule(n),YS}function Mk(){if(ZS)return QS;ZS=1;let e=mk(),t=function(){if(WS)return zS;WS=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),n="\\".charCodeAt(0),r="/".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 zS=function(x,C={}){let E,I,O,T,P,R,A,M,_,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(M=j.length?j.pop()[1]:"",_=D.charCodeAt(U+1),"url"===M&&_!==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(A=I;D.charCodeAt(A-1)===n;)A-=1,R=!R}while(R);N=["brackets",D.slice(U,I+1),U,I],U=I}else I=D.indexOf(")",U+1),T=D.slice(U,I+1),-1===I||S.test(T)?N=["(","(",U]:(N=["brackets",T,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(A=I;D.charCodeAt(A-1)===n;)A-=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 n:for(I=U,P=!0;D.charCodeAt(I+1)===n;)I+=1,P=!P;if(E=D.charCodeAt(I+1),P&&E!==r&&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===r&&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}}}}(),n=kk(),r=Tk(),i=Pk(),o=Ak();const s={empty:!0,space:!0};return QS=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,n,i,o=new r;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,n=l[i];n&&"space"===n[0];)n=l[--i];n&&(o.source.end=this.getPosition(n[3]||n[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 n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[o,s]of e.entries()){if(t=s,n=t[0],"("===n&&(i+=1),")"===n&&(i-=1),0===i&&":"===n){if(r){if("word"===r[0]&&"progid"===r[1])continue;return o}this.doubleColon(t)}r=t}return!1}comment(e){let t=new n;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let e=r.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,n){let r=new e;this.init(r,t[0][2]);let i,o=t[t.length-1];for(";"===o[0]&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}(t)),r.source.end.offset++;"word"!==t[0][0];)1===t.length&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let e=t[0][0];if(":"===e||"space"===e||"comment"===e)break;r.prop+=t.shift()[1]}for(r.raws.between="";t.length;){if(i=t.shift(),":"===i[0]){r.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),r.raws.between+=i[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.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()){r.important=!0;let n=this.stringFrom(t,e);n=this.spacesFromEnd(t)+n," !important"!==n&&(r.raws.important=n);break}if("important"===i[1].toLowerCase()){let n=t.slice(0),i="";for(let t=e;t>0;t--){let e=n[t][0];if(0===i.trim().indexOf("!")&&"space"!==e)break;i=n.pop()[1]+i}0===i.trim().indexOf("!")&&(r.important=!0,r.raws.important=i,t=n)}if("space"!==i[0]&&"comment"!==i[0])break}t.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(r.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(r,"value",a.concat(t),n),r.value.includes(":")&&!n&&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,n=null,r=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)i||(i=l),o.push("("===n?")":"]");else if(s&&r&&"{"===n)i||(i=l),o.push("}");else if(0===o.length){if(";"===n){if(r)return void this.decl(a,s);break}if("{"===n)return void this.rule(a);if("}"===n){this.tokenizer.back(a.pop()),t=!0;break}":"===n&&(r=!0)}else n===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&&r){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,n,r){let i,o,a,l,u=n.length,c="",d=!0;for(let e=0;e<u;e+=1)i=n[e],o=i[0],"space"!==o||e!==u-1||r?"comment"===o?(l=n[e-1]?n[e-1][0]:"empty",a=n[e+1]?n[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let r=n.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,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,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}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})}},QS}function _k(){if(tk)return ek;tk=1;let e=xk(),t=Mk(),n=wk();function r(e,r){let i=new n(e,r),o=new t(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&r&&r.from&&(/\.scss$/i.test(r.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(r.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(r.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 ek=r,r.default=r,e.registerParse(r),ek}function Nk(){if(rk)return nk;rk=1;let{isClean:e,my:t}=pk(),n=Sk(),r=gk(),i=xk(),o=Ck(),s=Ek(),a=Ok(),l=_k(),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,n=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,0,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,0,n+"Exit"]:[n,n+"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,n,r){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof y||n instanceof a)o=v(n.root),n.map&&(void 0===r.map&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let e=l;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{o=e(n,r)}catch(e){this.processed=!0,this.error=e}o&&!o[t]&&i.rebuild(o)}else o=v(n);this.result=new a(e,o,r),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 n=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(n.postcssVersion&&"production"!==process.env.NODE_ENV){let e=n.postcssPlugin,t=n.postcssVersion,r=this.result.processor.version,i=t.split("."),o=r.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=n.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!d[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[n])if("object"==typeof t[n])for(let r in t[n])e(t,"*"===r?n:n+"-"+r.toLowerCase(),t[n][r]);else"function"==typeof t[n]&&e(t,n,t[n])}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],n=this.runOnRoot(t);if(p(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[e];){t[e]=!0;let n=[g(t)];for(;n.length>0;){let e=this.visitTick(n);if(p(e))try{await e}catch(e){let t=n[n.length-1].node;throw this.handleError(e,t)}}}if(this.listeners.OnceExit)for(let[e,n]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map(e=>n(e,this.helpers));await Promise.all(e)}else await n(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=r;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new n(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[n,r]of e){let e;this.result.lastPlugin=n;try{e=r(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 n=t[t.length-1],{node:r,visitors:i}=n;if("root"!==r.type&&"document"!==r.type&&!r.parent)return void t.pop();if(i.length>0&&n.visitorIndex<i.length){let[e,t]=i[n.visitorIndex];n.visitorIndex+=1,n.visitorIndex===i.length&&(n.visitors=[],n.visitorIndex=0),this.result.lastPlugin=e;try{return t(r.toProxy(),this.helpers)}catch(e){throw this.handleError(e,r)}}if(0!==n.iterator){let i,o=n.iterator;for(;i=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!i[e])return i[e]=!0,void t.push(g(i));n.iterator=0,delete r.indexes[o]}let o=n.events;for(;n.eventIndex<o.length;){let t=o[n.eventIndex];if(n.eventIndex+=1,0===t)return void(r.nodes&&r.nodes.length&&(r[e]=!0,n.iterator=r.getIterator()));if(this.listeners[t])return void(n.visitors=this.listeners[t])}t.pop()}walkSync(t){t[e]=!0;let n=f(t);for(let r of n)if(0===r)t.nodes&&t.each(t=>{t[e]||this.walkSync(t)});else{let e=this.listeners[r];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},nk=y,y.default=y,u.registerLazyResult(y),o.registerLazyResult(y),nk}function Dk(){if(ak)return sk;ak=1;let e=function(){if(ok)return ik;ok=1;let e=Sk(),t=gk(),n=Ek(),r=_k();const i=Ok();class o{constructor(n,r,o){let s;r=r.toString(),this.stringified=!1,this._processor=n,this._css=r,this._opts=o,this._map=void 0;let a=t;this.result=new i(this._processor,s,this._opts),this.result.css=r;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,r);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||n("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=r;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 ik=o,o.default=o,ik}(),t=Nk(),n=Ck(),r=Pk();class i{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else{if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" 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(n,r={}){return this.plugins.length||r.parser||r.stringifier||r.syntax?new t(this,n,r):new e(this,n,r)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return sk=i,i.default=i,r.registerProcessor(i),n.registerProcessor(i),sk}var Lk=function(){if(dk)return ck;dk=1;let e=hS(),t=mk(),n=Nk(),r=xk(),i=Dk(),o=gk(),s=function(){if(uk)return lk;uk=1;let e=mk(),t=bk(),n=kk(),r=Tk(),i=wk(),o=Pk(),s=Ak();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 n={...e,__proto__:i.prototype};n.map&&(n.map={...n.map,__proto__:t.prototype}),u.push(n)}}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 n(d);if("atrule"===d.type)return new r(d);throw new Error("Unknown node type: "+l.type)}return lk=a,a.default=a,lk}(),a=Ck(),l=Ik(),u=kk(),c=Tk(),d=Ok(),h=wk(),p=_k(),f=Rk(),g=Ak(),v=Pk(),m=vk();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new i(e)}return y.plugin=function(e,t){let n,r=!1;function o(...n){console&&console.warn&&!r&&(r=!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(...n);return o.postcssPlugin=e,o.postcssVersion=(new i).version,o}return Object.defineProperty(o,"postcss",{get:()=>(n||(n=o()),n)}),o.process=function(e,t,n){return y([o(n)]).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=r,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,n.registerPostcss(y),ck=y,y.default=y,ck}();const Fk=iS(Lk);Fk.stringify,Fk.fromJSON,Fk.plugin,Fk.parse,Fk.list,Fk.document,Fk.comment,Fk.atRule,Fk.rule,Fk.decl,Fk.root,Fk.CssSyntaxError,Fk.Declaration,Fk.Container,Fk.Processor,Fk.Document,Fk.Comment,Fk.Warning,Fk.AtRule,Fk.Result,Fk.Input,Fk.Rule,Fk.Root,Fk.Node;class Uk{constructor(...e){rS(this,"parentElement",null),rS(this,"parentNode",null),rS(this,"ownerDocument"),rS(this,"firstChild",null),rS(this,"lastChild",null),rS(this,"previousSibling",null),rS(this,"nextSibling",null),rS(this,"ELEMENT_NODE",1),rS(this,"TEXT_NODE",3),rS(this,"nodeType"),rS(this,"nodeName"),rS(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 Uk))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 jk={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Bk={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},qk={};function zk(e){if(qk[e])return qk[e];const t=function(e){var t,n;const r=null==(n=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:n.call(t,e);return r&&globalThis[r]?globalThis[r]:void 0}(e)||globalThis[e],n=t.prototype,r=e in jk?jk[e]:void 0,i=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),o=e in Bk?Bk[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return qk[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(r),o?qk[e]=o:n}catch{return n}}const Wk={};function Vk(e,t,n){var r;const i=`${e}.${String(n)}`;if(Wk[i])return Wk[i].call(t);const o=zk(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(Wk[i]=s,s.call(t)):t[n]}const $k={};function Kk(e,t,n){const r=`${e}.${String(n)}`;if($k[r])return $k[r].bind(t);const i=zk(e)[n];return"function"!=typeof i?t[n]:($k[r]=i,i.bind(t))}function Hk(){return zk("MutationObserver").constructor}const Gk={childNodes:function(e){return Vk("Node",e,"childNodes")},parentNode:function(e){return Vk("Node",e,"parentNode")},parentElement:function(e){return Vk("Node",e,"parentElement")},textContent:function(e){return Vk("Node",e,"textContent")},contains:function(e,t){return Kk("Node",e,"contains")(t)},getRootNode:function(e){return Kk("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Vk("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Vk("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Vk("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Vk("Element",e,"querySelectorAll")(t)},mutationObserver:Hk};function Jk(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const Yk="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 Xk={map:{},getId:()=>(console.error(Yk),-1),getNode:()=>(console.error(Yk),null),removeNodeFromMap(){console.error(Yk)},has:()=>(console.error(Yk),!1),reset(){console.error(Yk)}};function Qk(e,t,n={}){let r=null,i=0;return function(...o){const s=Date.now();i||!1!==n.leading||(i=s);const a=t-(s-i),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=s,e.apply(l,o)):r||!1===n.trailing||(r=setTimeout(()=>{i=!1===n.leading?0:Date.now(),r=null,e.apply(l,o)},a))}}function Zk(e,t,n,r,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),o&&o.set&&o.set.call(this,e)}}),()=>Zk(e,t,o||{},!0)}function ex(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Xk=new Proxy(Xk,{get:(e,t,n)=>("map"===t&&console.error(Yk),Reflect.get(e,t,n))}));let tx=Date.now;function nx(e){var t,n,r,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=Gk.parentElement(o.body))?void 0:t.scrollLeft)||(null==(n=null==o?void 0:o.body)?void 0:n.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==(r=Gk.parentElement(o.body))?void 0:r.scrollTop)||(null==(i=null==o?void 0:o.body)?void 0:i.scrollTop)||0}}function rx(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ix(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ox(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:Gk.parentElement(e)}function sx(e,t,n,r){if(!e)return!1;const i=ox(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(vb(i,t,r))return!0}catch(e){}if(n){if(i.matches(n))return!0;if(r&&null!==i.closest(n))return!0}return!1}function ax(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||-2===t.getId(e)}function lx(e,t){if(jy(e))return!1;const n=t.getId(e);if(!t.has(n))return!0;const r=Gk.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||lx(r,t))}function ux(e){return Boolean(e.changedTouches)}function cx(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function dx(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function hx(e){return!!e&&(e instanceof Uk&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Gk.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(tx=()=>(new Date).getTime());class px{constructor(){Ey(this,"id",1),Ey(this,"styleIDMap",new WeakMap),Ey(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 n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function fx(e){var t;let n=null;return"getRootNode"in e&&(null==(t=Gk.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Gk.host(Gk.getRootNode(e))&&(n=Gk.host(Gk.getRootNode(e))),n}function gx(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=fx(n);)n=t;return n}(e);return Gk.contains(t,n)}function vx(e){const t=e.ownerDocument;return!!t&&(Gk.contains(t,e)||gx(e))}var mx=(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))(mx||{}),yx=(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))(yx||{}),bx=(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))(bx||{}),wx=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(wx||{}),Sx=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Sx||{}),kx=(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))(kx||{}),xx=(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))(xx||{});function Cx(e){return"__ln"in e}class Ex{constructor(){Ey(this,"length",0),Ey(this,"head",null),Ey(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)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&&Cx(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&Cx(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.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 Ix=(e,t)=>`${e}@${t}`;class Ox{constructor(){Ey(this,"frozen",!1),Ey(this,"locked",!1),Ey(this,"texts",[]),Ey(this,"attributes",[]),Ey(this,"attributeMap",new WeakMap),Ey(this,"removes",[]),Ey(this,"mapRemoves",[]),Ey(this,"movedMap",{}),Ey(this,"addedSet",new Set),Ey(this,"movedSet",new Set),Ey(this,"droppedSet",new Set),Ey(this,"removesSubTreeCache",new Set),Ey(this,"mutationCb"),Ey(this,"blockClass"),Ey(this,"blockSelector"),Ey(this,"maskTextClass"),Ey(this,"maskTextSelector"),Ey(this,"inlineStylesheet"),Ey(this,"maskInputOptions"),Ey(this,"maskTextFn"),Ey(this,"maskInputFn"),Ey(this,"maskAttributeFn"),Ey(this,"keepIframeSrcFn"),Ey(this,"recordCanvas"),Ey(this,"inlineImages"),Ey(this,"slimDOMOptions"),Ey(this,"dataURLOptions"),Ey(this,"doc"),Ey(this,"mirror"),Ey(this,"iframeManager"),Ey(this,"stylesheetManager"),Ey(this,"shadowDomManager"),Ey(this,"canvasManager"),Ey(this,"processedNodeManager"),Ey(this,"unattachedDoc"),Ey(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),Ey(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new Ex,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},i=i=>{const o=Gk.parentNode(i);if(!o||!vx(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=jy(o)?this.mirror.getId(fx(i)):this.mirror.getId(o),l=r(i);if(-1===a||-1===l)return n.addNode(i);const u=Sb(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=>{cx(e,this.mirror)&&this.iframeManager.addIframe(e),dx(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),hx(i)&&this.shadowDomManager.addShadowRoot(Gk.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(Gk.parentNode(e))||i(e);for(const e of this.addedSet)Rx(this.droppedSet,e)||Px(this.removesSubTreeCache,e,this.mirror)?Rx(this.movedSet,e)?i(e):this.droppedSet.add(e):i(e);let o=null;for(;n.length;){let e=null;if(o){const t=this.mirror.getId(Gk.parentNode(o.value)),n=r(o.value);-1!==t&&-1!==n&&(e=o)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(Gk.parentNode(n.value));if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value,r=Gk.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=Gk.host(r);if(-1!==this.mirror.getId(t)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}o=e.previous,n.removeNode(e.value),i(e.value)}const s={texts:this.texts.map(e=>{const t=e.node,n=Gk.parentNode(t);return n&&"TEXTAREA"===n.tagName&&this.genTextAreaValueMutation(n),{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 n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).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))}),Ey(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 n=Array.from(Gk.childNodes(e),e=>Gk.textContent(e)||"").join("");t.attributes.value=Vy({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Hy(e),value:n,maskInputFn:this.maskInputFn})}),Ey(this,"processMutation",e=>{if(!ax(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=Gk.textContent(e.target);sx(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:mb(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,ox(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,r=e.target.getAttribute(n);if("value"===n){const e=Hy(t);r=Vy({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(sx(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;n="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!gb(t.tagName,n)){if(i.attributes[n]=fb(this.doc,$y(t.tagName),$y(n),r),this.maskAttributeFn&&"string"==typeof i.attributes[n]){const e=this.maskAttributeFn(n,i.attributes[n],t);null!==e?i.attributes[n]=e:delete i.attributes[n]}if("style"===n){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const n=this.unattachedDoc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const r=t.style.getPropertyValue(e),o=t.style.getPropertyPriority(e);r!==n.style.getPropertyValue(e)||o!==n.style.getPropertyPriority(e)?i.styleDiff[e]=""===o?r:[r,o]:i._unchangedStyles[e]=[r,o]}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}else"open"===n&&"DIALOG"===t.tagName&&(t.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal")}break}case"childList":if(sx(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 n=this.mirror.getId(t),r=jy(e.target)?this.mirror.getId(Gk.host(e.target)):this.mirror.getId(e.target);sx(e.target,this.blockClass,this.blockSelector,!1)||ax(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Tx(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||lx(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ix(n,r)]?Tx(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:!(!jy(e.target)||!By(e.target))||void 0}),function(e,t){const n=[e];for(;n.length;){const e=n.pop();t.has(e)||(t.add(e),Gk.childNodes(e).forEach(e=>n.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),Ey(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(ax(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Ix(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);sx(e,this.blockClass,this.blockSelector,!1)||(Gk.childNodes(e).forEach(e=>this.genAdds(e)),hx(e)&&Gk.childNodes(Gk.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 Tx(e,t){e.delete(t),Gk.childNodes(t).forEach(t=>Tx(e,t))}function Px(e,t,n){return 0!==e.size&&function(e,t){const n=Gk.parentNode(t);return!!n&&e.has(n)}(e,t)}function Rx(e,t){return 0!==e.size&&Ax(e,t)}function Ax(e,t){const n=Gk.parentNode(t);return!!n&&(!!e.has(n)||Ax(e,n))}let Mx;const _x=e=>{if(!Mx)return e;return(...t)=>{try{return e(...t)}catch(e){if(Mx&&!0===Mx(e))return;throw e}}};function Nx(e){return(...t)=>{try{return e(...t)}catch(e){try{e._external_=!0}catch{}throw e}}}const Dx=[];function Lx(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 Fx(e,t){const n=new Ox;Dx.push(n),n.init(e);const r=new(Hk())(_x(n.processMutations.bind(n)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Ux({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,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(bx).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(o=>{let s=$y(o);const u=(t=>o=>{const s=Lx(o);if(sx(s,r,i,!0))return;let a=null,u=t;if("pointerType"in o){switch(o.pointerType){case"mouse":a=wx.Mouse;break;case"touch":a=wx.Touch;break;case"pen":a=wx.Pen}a===wx.Touch?bx[t]===bx.MouseDown?u="TouchStart":bx[t]===bx.MouseUp&&(u="TouchEnd"):wx.Pen}else ux(o)&&(a=wx.Touch);null!==a?(l=a,(u.startsWith("Touch")&&a===wx.Touch||u.startsWith("Mouse")&&a===wx.Mouse)&&(a=null)):bx[t]===bx.Click&&(a=l,l=null);const c=ux(o)?o.changedTouches[0]:o;if(!c)return;const d=n.getId(s),{clientX:h,clientY:p}=c;_x(e)({type:bx[u],id:d,x:h,y:p,...null!==a&&{pointerType:a}})})(o);if(window.PointerEvent)switch(bx[o]){case bx.MouseDown:case bx.MouseUp:s=s.replace("mouse","pointer");break;case bx.TouchStart:case bx.TouchEnd:return}a.push(Jk(s,u,t))}),_x(()=>{a.forEach(e=>e())})}function jx({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){const s=_x(Qk(_x(o=>{const s=Lx(o);if(!s||sx(s,r,i,!0))return;const a=n.getId(s);if(s===t&&t.defaultView){const n=nx(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})}),o.scroll||100));return Jk("scroll",s,t)}const Bx=["INPUT","TEXTAREA","SELECT"],qx=new WeakMap;function zx(e){return function(e,t){if(Kx("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Kx("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Kx("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Kx("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function Wx(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function Vx({mirror:e,stylesheetManager:t},n){var r,i,o;let s=null;s="#document"===n.nodeName?e.getId(n):e.getId(Gk.host(n));const a="#document"===n.nodeName?null==(r=n.defaultView)?void 0:r.Document:null==(o=null==(i=n.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(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var n;const r=null==(n=l.set)?void 0:n.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(e){}return r}}),_x(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function $x(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,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),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),o(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),s(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),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&&(r=Fx(e,e.doc));const i=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){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=Qk(_x(t=>{const n=Date.now()-s;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],s=null}),o),u=_x(Qk(_x(e=>{const t=Lx(e),{clientX:n,clientY:i}=ux(e)?e.changedTouches[0]:e;s||(s=tx()),a.push({x:n,y:i,id:r.getId(t),timeOffset:tx()-s}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?yx.Drag:e instanceof MouseEvent?yx.MouseMove:yx.TouchMove)}),i,{trailing:!1})),c=[Jk("mousemove",u,n),Jk("touchmove",u,n),Jk("drag",u,n)];return _x(()=>{c.forEach(e=>e())})}(e),o=Ux(e),s=jx(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return Jk("resize",_x(Qk(_x(()=>{const t=rx(),i=ix();n===t&&r===i||(e({width:Number(i),height:Number(t)}),n=t,r=i)}),200)),t)}(e,{win:n}),l=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:u,userTriggeredOnInput:c}){function d(e){let n=Lx(e);const u=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=Gk.parentElement(n)),!n||!d||Bx.indexOf(d)<0||sx(n,r,i,!0))return;if(n.classList.contains(o)||s&&n.matches(s))return;let p=n.value,f=!1;const g=Hy(n)||"";"radio"===g||"checkbox"===g?f=n.checked:(a[d.toLowerCase()]||a[g])&&(p=Vy({element:n,maskInputOptions:a,tagName:d,type:g,value:p,maskInputFn:l})),h(n,c?{text:p,isChecked:f,userTriggered:u}:{text:p,isChecked:f});const v=n.name;"radio"===g&&v&&f&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach(e=>{if(e!==n){const t=e.value;h(e,c?{text:t,isChecked:!f,userTriggered:!1}:{text:t,isChecked:!f})}})}function h(t,r){const i=qx.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){qx.set(t,r);const i=n.getId(t);_x(e)({...r,id:i})}}const p=("last"===u.input?["change"]:["input","change"]).map(e=>Jk(e,_x(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=>Zk(e[0],e[1],{set(){_x(d)({target:this,isTrusted:!1})}},!1,f))),_x(()=>{p.forEach(e=>e())})}(e),u=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){const s=_x(o=>Qk(_x(i=>{const s=Lx(i);if(!s||sx(s,t,n,!0))return;const{currentTime:a,volume:l,muted:u,playbackRate:c,loop:d}=s;e({type:o,id:r.getId(s),currentTime:a,volume:l,muted:u,playbackRate:c,loop:d})}),i.media||500)),a=[Jk("play",s(kx.Play),o),Jk("pause",s(kx.Pause),o),Jk("seeked",s(kx.Seeked),o),Jk("volumechange",s(kx.VolumeChange),o),Jk("ratechange",s(kx.RateChange),o)];return _x(()=>{a.forEach(e=>e())})}(e);let c=()=>{},d=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(c=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:_x((r,i,o)=>{const[s,a]=o,{id:l,styleId:u}=Wx(i,t,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,adds:[{rule:s,index:a}]}),Nx(()=>r.apply(i,o))()})}),r.CSSStyleSheet.prototype.addRule=function(e,t,n=this.cssRules.length){const i=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[i,n])};const o=r.CSSStyleSheet.prototype.deleteRule;let s,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:_x((r,i,o)=>{const[s]=o,{id:a,styleId:l}=Wx(i,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:s}]}),Nx(()=>r.apply(i,o))()})}),r.CSSStyleSheet.prototype.removeRule=function(e){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:_x((r,i,o)=>{const[s]=o,{id:a,styleId:l}=Wx(i,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replace:s}),r.apply(i,o)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:_x((r,i,o)=>{const[s]=o,{id:a,styleId:l}=Wx(i,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replaceSync:s}),r.apply(i,o)})}));const l={};Hx("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(Hx("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),Hx("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),Hx("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const u={};return Object.entries(l).forEach(([r,i])=>{u[r]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(u[r].insertRule,{apply:_x((r,i,o)=>{const[s,a]=o,{id:l,styleId:u}=Wx(i.parentStyleSheet,t,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,adds:[{rule:s,index:[...zx(i),a||0]}]}),r.apply(i,o)})}),i.prototype.deleteRule=new Proxy(u[r].deleteRule,{apply:_x((r,i,o)=>{const[s]=o,{id:a,styleId:l}=Wx(i.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:[...zx(i),s]}]}),r.apply(i,o)})})}),_x(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})})}(e,{win:n}),d=Vx(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:_x((i,s,a)=>{var l;const[u,c,d]=a;if(n.has(u))return o.apply(s,[u,c,d]);const{id:h,styleId:p}=Wx(null==(l=s.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||p&&-1!==p)&&e({id:h,styleId:p,set:{property:u,value:c,priority:d},index:zx(s.parentRule)}),i.apply(s,a)})});const s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:_x((i,o,a)=>{var l;const[u]=a;if(n.has(u))return s.apply(o,[u]);const{id:c,styleId:d}=Wx(null==(l=o.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(c&&-1!==c||d&&-1!==d)&&e({id:c,styleId:d,remove:{property:u},index:zx(o.parentRule)}),i.apply(o,a)})}),_x(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}(e,{win:n}),e.collectFonts&&(p=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(e,t,n){const r=new o(e,t,n);return i.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const s=ex(t.fonts,"add",function(t){return function(n){return setTimeout(_x(()=>{const t=i.get(n);t&&(e(t),i.delete(n))}),0),t.apply(this,[n])}});return r.push(()=>{n.FontFace=o}),r.push(s),_x(()=>{r.forEach(e=>e())})}(e)));const f=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e;let s=!0;const a=_x(()=>{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;sx(s,r,i,!0)||sx(u,r,i,!0)||a.push({start:n.getId(s),startOffset:l,end:n.getId(u),endOffset:c})}o({ranges:a})});return a(),Jk("selectionchange",a)}(e),g=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?ex(n.customElements,"define",function(e){return function(n,r,i){try{t({define:{name:n}})}catch(e){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,r,i])}}):()=>{}}(e),v=[];for(const t of e.plugins)v.push(t.observer(t.callback,n,t.options));return _x(()=>{Dx.forEach(e=>e.reset()),null==r||r.disconnect(),i(),o(),s(),a(),l(),u(),c(),d(),h(),p(),f(),g(),v.forEach(e=>e())})}function Kx(e){return void 0!==window[e]}function Hx(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Gx{constructor(e){Ey(this,"iframeIdToRemoteIdMap",new WeakMap),Ey(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,n,r){const i=n||this.getIdToRemoteIdMap(e),o=r||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 n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,r))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const i=r.get(t);return i||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}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 Jx{constructor(e){Ey(this,"iframes",new WeakMap),Ey(this,"crossOriginIframeMap",new WeakMap),Ey(this,"crossOriginIframeMirror",new Gx(ob)),Ey(this,"crossOriginIframeStyleMirror"),Ey(this,"crossOriginIframeRootIdMap",new WeakMap),Ey(this,"mirror"),Ey(this,"mutationCb"),Ey(this,"wrappedEmit"),Ey(this,"loadListener"),Ey(this,"stylesheetManager"),Ey(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Gx(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n,r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(n=e.contentWindow)||n.addEventListener("message",this.handleMessage.bind(this))),null==(r=this.loadListener)||r.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 n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case mx.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:mx.IncrementalSnapshot,data:{source:yx.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case mx.Meta:case mx.Load:case mx.DomContentLoaded:return!1;case mx.Plugin:return t;case mx.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case mx.IncrementalSnapshot:switch(t.data.source){case yx.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case yx.Drag:case yx.TouchMove:case yx.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case yx.ViewportResize:return!1;case yx.MediaInteraction:case yx.MouseInteraction:case yx.Scroll:case yx.CanvasMutation:case yx.Input:return this.replaceIds(t.data,e,["id"]),t;case yx.StyleSheetRule:case yx.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case yx.Font:return t;case yx.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case yx.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(n=t.data.styles)||n.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,n,r){for(const i of r)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===xx.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}}class Yx{constructor(e){Ey(this,"shadowDoms",new WeakSet),Ey(this,"mutationCb"),Ey(this,"scrollCb"),Ey(this,"bypassOptions"),Ey(this,"mirror"),Ey(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(!By(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=Fx({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(jx({...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(Gk.host(e))),this.restoreHandlers.push(Vx({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 n=this;this.restoreHandlers.push(ex(e.prototype,"attachShadow",function(e){return function(r){const i=e.call(this,r),o=Gk.shadowRoot(this);return o&&vx(this)&&n.addShadowRoot(o,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var Xx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qx="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Zx=0;Zx<64;Zx++)Qx[Xx.charCodeAt(Zx)]=Zx;const eC=new Map;const tC=(e,t,n)=>{if(!e||!iC(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=eC.get(e);return n||(n=new Map,eC.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let i=r.indexOf(e);return-1===i&&(i=r.length,r.push(e)),i};function nC(e,t,n){if(e instanceof Array)return e.map(e=>nC(e,t,n));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,n=new Uint8Array(e),r=n.length,i="";for(t=0;t<r;t+=3)i+=Xx[n[t]>>2],i+=Xx[(3&n[t])<<4|n[t+1]>>4],i+=Xx[(15&n[t+1])<<2|n[t+2]>>6],i+=Xx[63&n[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[nC(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[nC(e.data,t,n),e.width,e.height]}}if(iC(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:tC(e,t,n)}}return e}const rC=(e,t,n)=>e.map(e=>nC(e,t,n)),iC=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(n.find(n=>e instanceof t[n]))};function oC(e,t,n,r){const i=[];try{const o=ex(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(i,...o){if(!sx(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=e),r&&["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 sC(e,t,n,r,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=ex(e,l,function(e){return function(...s){const a=e.apply(this,s);if(tC(a,o,this),"tagName"in this.canvas&&!sx(this.canvas,r,i,!0)){const e=rC(s,o,this),r={type:t,property:l,args:e};n(this.canvas,r)}return a}});s.push(a)}catch{const r=Zk(e,l,{set(e){n(this.canvas,{type:t,property:l,args:[e],setter:!0})}});s.push(r)}return s}const aC='(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',lC="undefined"!=typeof self&&self.Blob&&new Blob([aC],{type:"text/javascript;charset=utf-8"});function uC(e){let t;try{if(t=lC&&(self.URL||self.webkitURL).createObjectURL(lC),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(aC),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class cC{constructor(e){Ey(this,"pendingCanvasMutations",new Map),Ey(this,"rafStamps",{latestId:0,invokeId:null}),Ey(this,"mirror"),Ey(this,"mutationCb"),Ey(this,"resetObservers"),Ey(this,"frozen",!1),Ey(this,"locked",!1),Ey(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:n,blockClass:r,blockSelector:i,recordCanvas:o,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(n,r,i),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,i,{dataURLOptions:s})}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,n,r,i){const o=oC(t,n,r,!0),s=new Map,a=new uC;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:i,height:o}=e.data;this.mutationCb({id:t,type:Sx["2D"],commands:[{property:"clearRect",args:[0,0,i,o]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};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=>{sx(t,n,r,!0)||e.push(t)}),e})().forEach(async e=>{var t;const n=this.mirror.getId(e);if(s.get(n))return;if(0===e.width||0===e.height)return;if(s.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null==(t=null==n?void 0:n.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=await createImageBitmap(e);a.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[r])})),u=requestAnimationFrame(d)};u=requestAnimationFrame(d),this.resetObservers=()=>{o(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=oC(e,t,n,!1),i=function(e,t,n,r){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const o=ex(t.CanvasRenderingContext2D.prototype,s,function(i){return function(...o){return sx(this.canvas,n,r,!0)||setTimeout(()=>{const n=rC(o,t,this);e(this.canvas,{type:Sx["2D"],property:s,args:n})},0),i.apply(this,o)}});i.push(o)}catch{const n=Zk(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:Sx["2D"],property:s,args:[t],setter:!0})}});i.push(n)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n),o=function(e,t,n,r){const i=[];return i.push(...sC(t.WebGLRenderingContext.prototype,Sx.WebGL,e,n,r,t)),void 0!==t.WebGL2RenderingContext&&i.push(...sC(t.WebGL2RenderingContext.prototype,Sx.WebGL2,e,n,r,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n);this.resetObservers=()=>{r(),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 n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map(e=>{const{type:t,...n}=e;return n}),{type:i}=n[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}}class dC{constructor(e){Ey(this,"trackedLinkElements",new WeakSet),Ey(this,"mutationCb"),Ey(this,"adoptedStyleSheetCb"),Ey(this,"styleMirror",new px),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 n={id:t,styleIds:[]},r=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);let n=[];try{n=Array.from(t.cssRules,(e,n)=>({rule:zy(e,t.href),index:n}))}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}r.push({styleId:e,rules:n})}n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class hC{constructor(){Ey(this,"nodeMap",new WeakMap),Ey(this,"active",!1)}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).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 pC,fC,gC,vC=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(ky=e.contentWindow)?void 0:ky.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const mC=new Wy;function yC(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,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:T=!1,captureAdoptedStyleSheets:P=!0,plugins:R,keepIframeSrcFn:A=()=>!1,ignoreCSSAttributes:M=new Set([]),errorHandler:_,applyBackgroundColorToBlockedElements:N=!1}=e;Mx=_;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),mC.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};pC=(e,i)=>{var o;const s=e;if(s.timestamp=tx(),!(null==(o=Dx[0])?void 0:o.isFrozen())||s.type===mx.FullSnapshot||s.type===mx.IncrementalSnapshot&&s.data.source===yx.Mutation||Dx.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===mx.FullSnapshot)j=s,B=0;else if(s.type===mx.IncrementalSnapshot){if(s.data.source===yx.Mutation&&s.data.isAttachIframe)return;B++;const e=r&&B>=r,t=n&&s.timestamp-j.timestamp>n;(e||t)&&fC(!0)}};const z=e=>{pC({type:mx.IncrementalSnapshot,data:{source:yx.Mutation,...e}})},W=e=>pC({type:mx.IncrementalSnapshot,data:{source:yx.Scroll,...e}}),V=e=>pC({type:mx.IncrementalSnapshot,data:{source:yx.CanvasMutation,...e}}),$=new dC({mutationCb:z,adoptedStyleSheetCb:e=>pC({type:mx.IncrementalSnapshot,data:{source:yx.AdoptedStyleSheet,...e}})}),K=new Jx({mirror:mC,mutationCb:z,stylesheetManager:$,recordCrossOriginIframes:C,wrappedEmit:pC});for(const e of R||[])e.getMirror&&e.getMirror({nodeMirror:mC,crossOriginIframeMirror:K.crossOriginIframeMirror,crossOriginIframeStyleMirror:K.crossOriginIframeStyleMirror});const H=new hC;gC=new cC({recordCanvas:x,mutationCb:V,win:window,blockClass:i,blockSelector:o,mirror:mC,sampling:b.canvas,dataURLOptions:w});const G=new Yx({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:T,sampling:b,slimDOMOptions:U,iframeManager:K,stylesheetManager:$,canvasManager:gC,keepIframeSrcFn:A,processedNodeManager:H},mirror:mC});fC=(e=!1)=>{if(!k)return;pC({type:mx.Meta,data:{href:window.location.href,width:ix(),height:rx()}},e),$.reset(),G.init(),Dx.forEach(e=>e.lock());const t=function(e,t){const{mirror:n=new Wy,blockClass:r="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 Sb(e,{doc:e,mirror:n,blockClass:r,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:mC,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:T,applyBackgroundColorToBlockedElements:N,onSerialize:e=>{cx(e,mC)&&K.addIframe(e),dx(e,mC)&&$.trackLinkElement(e),hx(e)&&G.addShadowRoot(Gk.shadowRoot(e),document)},onAdoptedStyleSheet:P?e=>$.styleMirror.add(e):void 0,onIframeLoad:(e,t)=>{K.attachIframe(e,t),G.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{$.attachLinkElement(e,t)},keepIframeSrcFn:A});if(!t)return console.warn("Failed to snapshot the document");pC({type:mx.FullSnapshot,data:{node:t,initialOffset:nx(window)}},e),Dx.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,mC.getId(document))};try{const e=[],t=e=>{var t;return _x($x)({mutationCb:z,mousemoveCb:(e,t)=>pC({type:mx.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>pC({type:mx.IncrementalSnapshot,data:{source:yx.MouseInteraction,...e}}),scrollCb:W,viewportResizeCb:e=>pC({type:mx.IncrementalSnapshot,data:{source:yx.ViewportResize,...e}}),inputCb:e=>pC({type:mx.IncrementalSnapshot,data:{source:yx.Input,...e}}),mediaInteractionCb:e=>pC({type:mx.IncrementalSnapshot,data:{source:yx.MediaInteraction,...e}}),styleSheetRuleCb:e=>pC({type:mx.IncrementalSnapshot,data:{source:yx.StyleSheetRule,...e}}),styleDeclarationCb:e=>pC({type:mx.IncrementalSnapshot,data:{source:yx.StyleDeclaration,...e}}),canvasMutationCb:V,fontCb:e=>pC({type:mx.IncrementalSnapshot,data:{source:yx.Font,...e}}),selectionCb:e=>{pC({type:mx.IncrementalSnapshot,data:{source:yx.Selection,...e}})},customElementCb:e=>{pC({type:mx.IncrementalSnapshot,data:{source:yx.CustomElement,...e}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:u,maskInputOptions:F,inlineStylesheet:c,sampling:b,recordDOM:k,recordCanvas:x,inlineImages:T,userTriggeredOnInput:I,collectFonts:O,doc:e,maskInputFn:f,maskTextFn:g,maskAttributeFn:v,keepIframeSrcFn:A,blockSelector:o,slimDOMOptions:U,dataURLOptions:w,mirror:mC,iframeManager:K,stylesheetManager:$,shadowDomManager:G,processedNodeManager:H,canvasManager:gC,ignoreCSSAttributes:M,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=>pC({type:mx.Plugin,data:{plugin:e.name,payload:t}})})))||[]},m)};K.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}});const n=()=>{fC(),e.push(t(document)),vC=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(Jk("DOMContentLoaded",()=>{pC({type:mx.DomContentLoaded,data:{}}),"DOMContentLoaded"===E&&n()})),e.push(Jk("load",()=>{pC({type:mx.Load,data:{}}),"load"===E&&n()},window))),()=>{e.forEach(e=>e()),H.destroy(),vC=!1,Mx=void 0}}catch(e){console.warn(e)}}var bC;yC.addCustomEvent=(e,t)=>{if(!vC)throw new Error("please add custom event after start recording");pC({type:mx.Custom,data:{tag:e,payload:t}})},yC.freezePage=()=>{Dx.forEach(e=>e.freeze())},yC.takeFullSnapshot=e=>{if(!vC)throw new Error("please take full snapshot after start recording");fC(e)},yC.mirror=mC,function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(bC||(bC={}));var wC=Object.freeze({__proto__:null,record:yC}),SC=function(e){return void 0!==e&&("boolean"==typeof e?e:!1!==e.enabled)},kC=function(e,t,n,r){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,n){if(0===t.length&&0===n.length)return e;var r=t.length>0?t:["/**"];try{var i=JSON.parse(e);return jt(i,r,n),JSON.stringify(i)}catch(t){return e}}(e,i.allowlist,i.excludelist);return r(o,n)},xC=["image/","audio/","video/","application/octet-stream","font/"];function CC(e,t){return function(e,t){t<0&&(t=0);for(var n=e.length,r=0,i=0;i<n;i++){var o=e.charCodeAt(i),s=1,a=1;if(o<=127)s=1;else if(o<=2047)s=2;else if(o>=55296&&o<=56319){var l=i+1<n?e.charCodeAt(i+1):NaN;l>=56320&&l<=57343?(s=4,a=2):s=3}else s=3;if(r+s>t)break;r+=s,2===a&&i++}return i>=n?{value:e,truncated:!1}:{value:e.slice(0,i),truncated:!0}}(e,t)}var EC=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 n=t.fetch;n&&(t.fetch=function(t,r){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==r?void 0:r.method)||"GET",url:t.toString(),requestHeaders:null==r?void 0:r.headers},(o=null===(f=this.networkConfig)||void 0===f?void 0:f.body)&&SC(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,n){t.push("".concat(n,"=").concat("string"==typeof e?e:"[File]"))}),t.join("&")}}}(null==r?void 0:r.body))&&(a=null!==(g=o.maxBodySizeBytes)&&void 0!==g?g:10240,i.requestBody=kC(s,o.request,a,CC).value),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,n(t,r)];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&&SC(o.response)?!function(e){return!!e&&xC.some(function(t){return e.toLowerCase().startsWith(t)})}(c["content-type"]||null)?l.clone().text().then(function(e){var t,n=null!==(t=o.maxBodySizeBytes)&&void 0!==t?t:10240,r=kC(e,o.response,n,CC),s=r.value,a=r.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=n})}},e}(),IC=Object.freeze({__proto__:null,NetworkObservers:EC});e.Identify=F,e.Revenue=ie,e.Types=Dr,e._setDiagnosticsSampleRate=Jh,e.add=Zh,e.createInstance=Hh,e.experiment=Xh,e.extendSession=ep,e.flush=tp,e.getDeviceId=np,e.getIdentity=rp,e.getOptOut=ip,e.getSessionId=op,e.getUserId=sp,e.groupIdentify=ap,e.identify=lp,e.initAll=Yh,e.logEvent=up,e.remove=cp,e.reset=dp,e.revenue=hp,e.sessionReplay=Qh,e.setDeviceId=pp,e.setGroup=fp,e.setIdentity=gp,e.setOptOut=vp,e.setSessionId=mp,e.setTransport=yp,e.setUserId=bp,e.track=wp,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(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};function r(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}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i,o,s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function l(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})}function u(e,t){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=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++,r=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],r=0}finally{n=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,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function h(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||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 f,p="AMP",g="".concat(p,"_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",T="rdt_cid",P="ttclid",A="twclid",M="wbraid",R={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"],L=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!D(t,n))return!1}return!0},D=function(e,t){var n,r;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&&L(a);else if(!["number","string"].includes(typeof a))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return L(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(f.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(f.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(f.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(f.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(f.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(f.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(f.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(f.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(f.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[f.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[f.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===f.ADD?"number"==typeof n:e===f.UNSET||e===f.REMOVE||D(t,n)))},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"}(f||(f={}));var U,j=[f.CLEAR_ALL,f.UNSET,f.SET,f.SET_ONCE,f.ADD,f.APPEND,f.PREPEND,f.PREINSERT,f.POSTINSERT,f.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,n){return void 0===t&&(t=0),void 0===n&&(n=U.Unknown),{event:e,code:t,message:n}},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,n=z();if(!(null===(t=null==n?void 0:n.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 r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,h([],d(r.entries()),!1).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(W[r]):W[r]}).join("")},$="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},K={},H={get exports(){return K},set exports(e){K=e}},G=Object.prototype.hasOwnProperty;function J(e){return"[Throws: "+(e?e.message:"?")+"]"}function Y(e){var t=[];return function e(n){if(null===n||"object"!=typeof n)return n;if(-1!==t.indexOf(n))return"[Circular]";if(t.push(n),"function"==typeof n.toJSON)try{var r=e(n.toJSON());return t.pop(),r}catch(e){return J(e)}if(Array.isArray(n)){var i=n.map(e);return t.pop(),i}var o=Object.keys(n).reduce(function(t,r){return t[r]=e(function(e,t){if(G.call(e,t))try{return e[t]}catch(e){return J(e)}return e[t]}(n,r)),t},{});return t.pop(),o}(e)}H.exports=function(e,t,n){return JSON.stringify(Y(e),t,n)};var X,Q=K.ensureProperties=Y,Z=K||t({__proto__:null,ensureProperties:Q,get default(){return K}},[K]),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 n,r;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!==(n=e.type)&&void 0!==n?n:"enrichment",this.pluginStatus.set(i,"locked"),[4,null===(r=e.setup)||void 0===r?void 0:r.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 n;return l(this,void 0,void 0,function(){var r,i;return u(this,function(o){switch(o.label){case 0:return this.pluginStatus.delete(e),r=this.plugins.findIndex(function(t){return t.name===e}),-1===r?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(i=this.plugins[r],this.plugins.splice(r,1),[4,null===(n=i.teardown)||void 0===n?void 0:n.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(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return l(this,void 0,void 0,function(){var t,n,r,i,o,a,l,h,f,p,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),n=t[0],r=d(e,2),i=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),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({},n))]:[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(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(v.name),"', event: ").concat(Z(n))),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:f=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]),p=c(f),g=p.next(),u.label=10;case 10:return g.done?[3,13]:(v=g.value).execute?[4,v.execute(s({},n))]:[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(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(v.name),"', event: ").concat(Z(n))),u.label=12;case 12:return g=p.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=p.return)&&C.call(p)}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(n))),w=b.map(function(e){var t=s({},n);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(n,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,n,r=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 r.apply(e)}))];case 1:return i.sent(),t=this.plugins.filter(function(e){return"destination"===e.type}),n=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(n)];case 2:return i.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return l(this,void 0,void 0,function(){var t,n,r,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),n=t.next(),l.label=1;case 1:if(n.done)return[3,6];r=n.value,l.label=2;case 2:return l.trys.push([2,4,,5]),[4,r(e)];case 3:return l.sent(),[3,5];case 4:return i=l.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return o=l.sent(),s={error:o},[3,9];case 8:try{n&&!n.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()})},ne=function(e){return{promise:e||Promise.resolve()}},re=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(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return t.isReady=!0})];case 1:return n.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return l(this,void 0,void 0,function(){var n,r,i,o,s,a,l,d;return u(this,function(u){switch(u.label){case 0:n=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),r=c(n),i=r.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=r.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=r.return)&&d.call(r)}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,n){var r=function(e,t,n){return s(s(s({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ne(this.dispatch(r))},e.prototype.identify=function(e,t){var n=te(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),ne(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=function(e,t,n,r){var i;return s(s({},r),{event_type:o.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,n,r);return ne(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,i=new F;return i.set(e,t),s(s({},n),{event_type:o.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ne(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return s(s({},t),{event_type:o.REVENUE,event_properties:e.getEventProperties()})}(e,t);return ne(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),ne())},e.prototype._addPlugin=function(e){return ne(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)),ne())},e.prototype._removePlugin=function(e){return ne(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(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,n=null!==(t=this.userProperties)&&void 0!==t?t:{},r=s({},n);if(void 0===e)return r;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 n=e[t];switch(t){case i.CLEAR_ALL:Object.keys(r).forEach(function(e){delete r[e]});break;case i.UNSET:Object.keys(n).forEach(function(e){delete r[e]});break;case i.SET:Object.assign(r,n)}}}),Object.assign(r,o),r},e.prototype.process=function(e){return l(this,void 0,void 0,function(){var t,n,r,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 n=s.sent(),r=String(n),this.config.loggerProvider.error(r),[2,i=q(e,0,r)];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 ne(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));L(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?s({},this.properties):{};return e[X.REVENUE_PRODUCT_ID]=this.productId,e[X.REVENUE_QUANTITY]=this.quantity,e[X.REVENUE_PRICE]=this.price,e[X.REVENUE_TYPE]=this.revenueType,e[X.REVENUE_CURRENCY]=this.currency,e[X.REVENUE]=this.revenue,e[X.RECEIPT]=this.receipt,e[X.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"}(X||(X={}));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,n,r,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!==(n=e.logLevel)&&void 0!==n?n: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!==(r=e.optOut)&&void 0!==r?r: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,n){if(void 0===e&&(e=""),void 0===t&&(t=ue().serverZone),void 0===n&&(n=ue().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:ue().serverZone;return{serverZone:r,serverUrl:de(r,n)}},fe=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function pe(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 n,r;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){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ye=function(e,t){return function(){var n,r,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){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},be=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=n(),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:{}};r&&c.states&&(c.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&c.states&&(c.states.after=r()),c.time&&(c.time.end=(new Date).toISOString()),l.debug(JSON.stringify(c,null,2))}):(r&&c.states&&(c.states.after=r()),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 ke=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 n,r=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(n=i.sent())&&n.length>0&&Promise.all(n.map(function(e){return r.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=V()),new Promise(function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"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,n,r,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=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),s=t,a=this.config.flushQueueSize,c=Math.max(a,1),r=s.reduce(function(e,t,n){var r=Math.floor(n/c);return e[r]||(e[r]=[]),e[r].push(t),e},[]),[4,r.reduce(function(t,n){return l(i,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}})})},Promise.resolve())]);case 1:return o.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var s,a,c})})},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),l(this,void 0,void 0,function(){var r,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")];r={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 fe,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,r,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===(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: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 n;pe(e.statusCode)||null===(n=this.diagnosticsClient)||void 0===n||n.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 r=e.status;switch(r){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(r,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=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(r),o=t.filter(function(t,r){if(!i.has(r))return!0;n.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 n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(r),a=new Set(i),l=new Set(o),u=t.filter(function(t,r){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)))return l.has(r)&&(t.timeout=n.throttleTimeout),!0;n.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,n=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){var r,i,o;pe(t)?null===(o=this.diagnosticsClient)||void 0===o||o.increment("analytics.events.sent",e.length):(null===(r=this.diagnosticsClient)||void 0===r||r.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:n,stack_trace:ge()})),this.removeEvents(e),e.forEach(function(e){return e.callback(q(e.event,t,n))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(e){return e.event});this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){var t=new Set(e);this.queue=this.queue.filter(function(e){return!t.has(e)}),this.saveEvents()},e}();class xe{getApplicationContext(){return{versionName:this.versionName,language:Ce(),platform:"Web",os:void 0,deviceModel:void 0}}}const Ce=()=>"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||"";class Ee{constructor(){this.queue=[]}logEvent(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)}setEventReceiver(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(t=>{e(t)}),this.queue=[])}}const Ie=(e,t)=>{const n=["string","number","boolean","undefined"],r=typeof e;if(r!==typeof t)return!1;for(const i of n)if(i===r)return e===t;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;const i=Array.isArray(e),o=Array.isArray(t);if(i!==o)return!1;if(!i||!o){const n=Object.keys(e).sort(),r=Object.keys(t).sort();if(!Ie(n,r))return!1;let i=!0;return Object.keys(e).forEach(n=>{Ie(e[n],t[n])||(i=!1)}),i}for(let n=0;n<e.length;n++)if(!Ie(e[n],t[n]))return!1;return!0};Object.entries||(Object.entries=function(e){const t=Object.keys(e);let n=t.length;const r=new Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r});class Oe{constructor(){this.identity={userProperties:{}},this.listeners=new Set}editIdentity(){const e=this,t=Object.assign({},this.identity.userProperties),n=Object.assign(Object.assign({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut(e){return n.optOut=e,this},updateUserProperties:function(e){let t=n.userProperties||{};for(const[n,r]of Object.entries(e))switch(n){case"$set":for(const[e,n]of Object.entries(r))t[e]=n;break;case"$unset":for(const e of Object.keys(r))delete t[e];break;case"$clearAll":t={}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}}getIdentity(){return Object.assign({},this.identity)}setIdentity(e){const t=Object.assign({},this.identity);this.identity=Object.assign({},e),Ie(t,this.identity)||this.listeners.forEach(t=>{t(e)})}addIdentityListener(e){this.listeners.add(e)}removeIdentityListener(e){this.listeners.delete(e)}}const Te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self;class Pe{constructor(){this.identityStore=new Oe,this.eventBridge=new Ee,this.applicationContextProvider=new xe}static getInstance(e){return Te.analyticsConnectorInstances||(Te.analyticsConnectorInstances={}),Te.analyticsConnectorInstances[e]||(Te.analyticsConnectorInstances[e]=new Pe),Te.analyticsConnectorInstances[e]}}var Ae=function(e){return Pe.getInstance(le(e))},Me=function(){function e(){this.name="identity",this.type="before",this.identityStore=Ae().identityStore}return e.prototype.execute=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(n){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=Ae(e.instanceName).identityStore),[2]})})},e}(),Re=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},_e=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[p,t,e.substring(0,n)].filter(Boolean).join("_")},Ne=function(){var e,t,n,r;if("undefined"==typeof navigator)return"";var i=navigator.userLanguage;return null!==(r=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:i)&&void 0!==r?r:""},Le=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 n=t.split("=",2),r=De(n[0]),i=De(n[1]);return i?(e[r]=i,e):e},{}):{}},De=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Fe="AMP_PAGE_VIEW",Ue=Symbol.for("@amplitude/page-view-state"),je=function(e){return e||""},Be=function(){return z()},qe=function(e){var t;void 0===e&&(e=Be());try{var n=null===(t=null==e?void 0:e.sessionStorage)||void 0===t?void 0:t.getItem(Fe);if(!n)return;var r=JSON.parse(n);if(!r||"object"!=typeof r)return;return r}catch(e){return}},ze=function(e,t,n){var r;try{var i=e.sessionStorage;if(!i)return;var o=function(e){var t,n,r={};if(!e||"object"!=typeof e)return r;try{for(var i=c(Object.entries(e)),o=i.next();!o.done;o=i.next()){var s=d(o.value,2),a=s[0],l=s[1];"string"==typeof l&&(r[a]=l)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(null===(r=qe(e))||void 0===r?void 0:r.byApiKey),a=je(t);a&&(o[a]=n),i.setItem(Fe,JSON.stringify(s({pageViewId:n},Object.keys(o).length>0?{byApiKey:o}:{})))}catch(e){}},We=function(e,t){var n,r=Be();if(r){var i=je(e),o=null!==(n=r[Ue])&&void 0!==n?n:{byApiKey:{}},s=o.byApiKey[i];if(s&&s.href===t)return ze(r,e,s.pageViewId),s.pageViewId;var a=V();return o.byApiKey[i]={pageViewId:a,href:t},r[Ue]=o,ze(r,e,a),a}},Ve=function(e){var t,n,r=null===(n=null===(t=function(){var e;return null===(e=Be())||void 0===e?void 0:e[Ue]}())||void 0===t?void 0:t.byApiKey[je(e)])||void 0===n?void 0:n.pageViewId;return r||function(e){var t=qe();if(t){var n=je(e);if(n&&t.byApiKey&&"object"==typeof t.byApiKey){var r=t.byApiKey[n];return"string"==typeof r?r:void 0}return"string"==typeof t.pageViewId?t.pageViewId:void 0}}(e)},$e="[Amplitude] SDK Initialization Offset",Ke=Symbol.for("@amplitude/sdk-initialization-offset"),He=function(e){var t=z();if(!t)return 0;var n=t[Ke];n||(n={byApiKey:{}},t[Ke]=n);var r=function(e){return e||""}(e),i=n.byApiKey[r];if("number"==typeof i)return i;var o=Ge(t);return n.byApiKey[r]=o,o},Ge=function(e){var t,n;try{var r=null===(n=null===(t=e.performance)||void 0===t?void 0:t.now)||void 0===n?void 0:n.call(t);return"number"==typeof r&&Number.isFinite(r)?Math.max(0,Math.floor(r)):0}catch(e){return 0}},Je=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},Ye=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},Xe=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},Qe=function(e,t){var n=Xe(e.toString());return 31*Math.abs(n)%1e5/1e5<t},Ze=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},et=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(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return l(this,void 0,void 0,function(){return u(this,function(n){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}(),tt=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,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return t="AMP_TEST",n=s({},this.options),r=new e(n),i=String(Date.now()),[4,r.transaction(t,function(e){var n,r;try{e.set(i);var s=e.get()===i;return!s&&o.config.diagnosticsClient&&(null===(n=o.config.diagnosticsClient)||void 0===n||n.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===(r=o.config.diagnosticsClient)||void 0===r||r.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(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:return t=n.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var n=nt(t);return void 0===n?void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t)):JSON.parse(n)}catch(n){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,n;return l(this,void 0,void 0,function(){var r,i,o,s,a,l,d,h,f;return u(this,function(u){switch(u.label){case 0:r=z(),i=r,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===(n=this.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(a=c(s),l=a.next();!l.done;l=a.next())if(d=l.value,rt(d.domain,this.options.domain))return[2,d.value]}catch(e){h={error:e}}finally{try{l&&!l.done&&(f=a.return)&&f.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,n,r=this,i=z(),o=(null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[]).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 n;try{var i=a(t.substring(e.length+1));return i||null===(n=r.config.diagnosticsClient)||void 0===n||n.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(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var n;try{var r=z();if(!r||!r.document||"function"!=typeof r.btoa||"function"!=typeof r.encodeURIComponent)return;var i=null!==(n=this.options.expirationDays)&&void 0!==n?n: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(r.btoa(r.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)),r.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 n,r;return u(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];n="AMP_TLDTEST",r=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.transaction(n,function(n){if(e.cachedTlds[t])return!0;try{n.set(1);var r=!!n.get();return r&&(e.cachedTlds[t]=!0),r}finally{n.set(null)}})];case 2:return[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 n,r,i=this;return u(this,function(o){switch(o.label){case 0:if(n=function(){var e,t=z();return null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.locks}(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(e),r)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),nt=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)},rt=function(e,t){if(""===e&&""===t)return!0;if(!e||!t)return!1;var n=e.startsWith(".")?e.substring(1):e,r=t.startsWith(".")?t.substring(1):t;return n.toLowerCase()===r.toLowerCase()},it=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[p,t,e.substring(0,n)].filter(Boolean).join("_")},ot=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];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(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return l(this,void 0,void 0,function(){return u(this,function(r){try{null===(n=this.storage)||void 0===n||n.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(n){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}(),st="tags",at="counters",lt="histograms",ut="events",ct="internal",dt="last_flush_timestamp",ht=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,n){var r=indexedDB.open(e.dbName,1);r.onerror=function(){e.dbPromise=null,n(new Error("Failed to open IndexedDB"))},r.onsuccess=function(){var n=r.result;n.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},n.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),n.close()},t(n)},r.onupgradeneeded=function(){var t=r.result;t?e.createTables(t):e.logger.debug("DiagnosticsStorage: Missing DB during upgrade.")}})},e.prototype.createTables=function(e){(e.objectStoreNames.contains(st)||e.createObjectStore(st,{keyPath:"key"}),e.objectStoreNames.contains(at)||e.createObjectStore(at,{keyPath:"key"}),e.objectStoreNames.contains(lt)||e.createObjectStore(lt,{keyPath:"key"}),e.objectStoreNames.contains(ut))||e.createObjectStore(ut,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(ct)||e.createObjectStore(ct,{keyPath:"key"})},e.prototype.setTags=function(e){return l(this,void 0,void 0,function(){var t,n,r,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(),n=t.transaction([st],"readwrite"),r=n.objectStore(st),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tags",e),t()},i.forEach(function(e){var t=d(e,2),n=t[0],i=t[1];r.put({key:n,value:i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tag",n,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,n,r,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(),n=t.transaction([at],"readwrite"),r=n.objectStore(at),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to increment counters",e),t()},i.forEach(function(e){var t=d(e,2),n=t[0],i=t[1],s=r.get(n);s.onsuccess=function(){var e=s.result,t=e?e.value:0;r.put({key:n,value:t+i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},s.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}})})];case 2:return 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,n,r,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(),n=t.transaction([lt],"readwrite"),r=n.objectStore(lt),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),t()},i.forEach(function(e){var t=d(e,2),n=t[0],i=t[1],s=r.get(n);s.onsuccess=function(){var e,t=s.result;e=t?{key:n,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:n,count:i.count,min:i.min,max:i.max,sum:i.sum},r.put(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},s.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}})})];case 2:return 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,n,r,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(),n=t.transaction([ut],"readwrite"),r=n.objectStore(ut),[2,new Promise(function(t){n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event records",e),t()};var i=r.count();i.onsuccess=function(){var t=i.result,n=Math.max(0,10-t);n<e.length&&o.logger.debug("DiagnosticsStorage: Only added ".concat(n," of ").concat(e.length," events due to storage limit")),e.slice(0,n).forEach(function(e){r.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 n,r,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 n=s.sent(),r=n.transaction([ct],"readwrite"),i=r.objectStore(ct),[2,new Promise(function(n,o){r.onabort=function(){return o(new Error("Failed to set internal value"))};var s=i.put({key:e,value:t});s.onsuccess=function(){return n()},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,n,r,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(),n=t.transaction([ct],"readonly"),r=n.objectStore(ct),[2,new Promise(function(t,i){n.onabort=function(){return i(new Error("Failed to get internal value"))};var o=r.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(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(dt)];case 1:return[2,(e=n.sent())?parseInt(e.value,10):void 0];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(dt,e.toString())];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).clear();i.onsuccess=function(){return n()},i.onerror=function(){return r(new Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return l(this,void 0,void 0,function(){var e,t,n,r,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([st,at,lt,ut],"readwrite"),[4,Promise.all([this.getAllFromStore(t,st),this.getAllFromStore(t,at),this.getAllFromStore(t,lt),this.getAllFromStore(t,ut)])];case 2:return n=d.apply(void 0,[l.sent(),4]),r=n[0],i=n[1],o=n[2],s=n[3],[4,Promise.all([this.clearTable(t,at),this.clearTable(t,lt),this.clearTable(t,ut)])];case 3:return l.sent(),[2,{tags:r,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(n,r){var i=e.objectStore(t).getAll();i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r(new Error("Failed to get all from ".concat(t)))}})},e}(),ft=function(e){var t,n,r=function(){var e=z();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]}();if(0!==r.length)try{for(var i=c(r),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&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},pt=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},gt=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},vt=3e5,mt=1e4,yt=function(){function e(e,t,n,r,i){void 0===n&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===n?"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(r,null,2)),this.config=s({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=Qe(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:ht.isSupported()?this.storage=new ht(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 n=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,r=null==t?void 0:t.stack,i=ft({filename:e.filename,stack:r});i&&n({type:"error",message:e.message,stack:r,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,r=e.reason instanceof Error?e.reason:void 0,i=null==r?void 0:r.stack,o=pt(i),s=ft({filename:o,stack:i});s&&n({type:"unhandledrejection",message:null!==(t=null==r?void 0:r.message)&&void 0!==t?t:gt(e.reason),stack:i,filename:o,errorName:null==r?void 0:r.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>=mt?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>=mt?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>=mt)this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");else{var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){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})},vt))},e.prototype.saveAllDataToStorage=function(){return l(this,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){switch(i.label){case 0:return this.storage?(e=s({},this.inMemoryTags),t=s({},this.inMemoryCounters),n=s({},this.inMemoryHistograms),r=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(n),this.storage.addEventRecords(r)])]):[2];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return l(this,void 0,void 0,function(){var e,t,n,r,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,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),s={},n.forEach(function(e){s[e.key]=e.value}),a={},r.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(n){switch(n.label){case 0:if(n.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 n.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=n.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,n;return u(this,function(r){switch(r.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return-1===(t=r.sent()||-1)?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(vt),[2]):(n=e-t)>=vt?(this._flush(),[2]):(this._setFlushTimer(vt-n),[2])}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=Qe(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),bt=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,s,a,l,u,c,d,h,f,p,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!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r: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!==(f=e.throttled_devices)&&void 0!==f?f:{},throttledEvents:null!==(p=e.throttled_events)&&void 0!==p?p:[]}};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 pe(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}(),wt=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.customHeaders=t,n}return r(t,e),t.prototype.send=function(e,t){return l(this,void 0,void 0,function(){var n,r,i;return u(this,function(o){switch(o.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:s({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,(r=o.sent()).text()];case 2:i=o.sent();try{return[2,this.buildResponse(JSON.parse(i))]}catch(e){return[2,this.buildResponse({code:r.status})]}return[2]}})})},t}(bt);function St(){return"undefined"!=typeof CompressionStream}function kt(e){return l(this,void 0,void 0,function(){var t,n;return u(this,function(r){switch(r.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];r.label=1;case 1:return r.trys.push([1,3,,4]),n=new Blob([e]).stream().pipeThrough(new t("gzip")),[4,new Response(n).arrayBuffer()];case 2:return[2,r.sent()];case 3:return r.sent(),[2,void 0];case 4:return[2]}})})}var xt=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 n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(Z(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){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 Ct=401,Et=403,It=429,Ot=function(){function e(t,n,r,i,o,s,a){void 0===r&&(r="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"===r?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=n,this.storage=a||new xt(t,n),this.customFetch=o}return e.prototype.subscribe=function(e,t,n){var r=V(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return-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(n){switch(n.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=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(n){t.sendCallback(n,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,n,r,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)}),n=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),null!==r.remoteConfig?this.sendCallback(e,r,"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 n,r;return u(this,function(i){switch(i.label){case 0:n=new Promise(function(e,n){setTimeout(function(){n("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=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(r,n,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 n,r,i,o,s,a,l=this;return u(this,function(c){switch(c.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,s,a,c,d,h,f,p,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 n=function(){var e=new Error("Remote config custom fetch aborted by timeout");e.name="AbortError",t(e)};m.addEventListener("abort",n,{once:!0}),v.then(function(t){m.removeEventListener("abort",n),e(t)},function(e){m.removeEventListener("abort",n),t(e)})}))]:[3,3];case 2:return f=u.sent(),[3,5];case 3:return[4,fetch(c,{method:"GET",headers:d,signal:s.signal})];case 4:f=u.sent(),u.label=5;case 5:return(h=f).ok||h.status>=200&&h.status<300?[3,7]:[4,h.text()];case 6:return p=u.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(h.status,": ").concat(p)),h.status===Ct||h.status===Et?(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!==It&&(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?r<e-1?[4,new Promise(function(e){return setTimeout(e,l.getJitterDelay(n))})]:[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,r]}})})},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}(),Tt=z(),Pt=null==Tt?void 0:Tt.console,At={},Mt={},Rt=!1;var _t,Nt={addListener:function(e,t){var n,r=(n=e,!!Pt&&"function"==typeof Pt[n]&&(Mt[n]||(Mt[n]=Pt[n],Pt[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(At[n]&&!Rt){Rt=!0;var r=At[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return Rt=!1,Mt[n].apply(Pt,e)}),!0));if(!r)return new Error("Console override failed");At[e]?At[e].push(t):At[e]=[t]},removeListener:function(e){var t,n;try{for(var r=c(Object.values(At)),i=r.next();!i.done;i=r.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&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var n=c(Object.entries(Mt)),r=n.next();!r.done;r=n.next()){var i=d(r.value,2),o=i[0],s=i[1];s&&(Pt[o]=s)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}Mt={},At={}}};!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(_t||(_t={}));var Lt=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Dt="data-amp-track-",Ft=["div","span","h1","h2","h3","h4","h5","h6"],Ut=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),jt=Ut,Bt=Ut,qt=["*"];function zt(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function Wt(e,t,n){e&&Vt({json:e,allowlist:t.map($t),excludelist:n.map($t),ancestors:[]})}function Vt(e){var t,n,r=e.json,i=e.targetObject,o=e.allowlist,s=e.excludelist,a=e.ancestors,l=e.parentObject,u=e.targetKey;i||(i=r);var f=Object.keys(i);try{for(var p=c(f),g=p.next();!g.done;g=p.next()){var v=g.value,m=h(h([],d(a),!1),[v],!1);zt(i[v])?Ht(m,o)&&!Ht(m,s)||delete i[v]:Vt({json:r,targetObject:i[v],allowlist:o,excludelist:s,ancestors:m,parentObject:i,targetKey:v})}}catch(e){t={error:e}}finally{try{g&&!g.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}0===Object.keys(i).length&&l&&u&&delete l[u]}function $t(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function Kt(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&"**"===t[r];)r++;return r===t.length}var i=t[r];if("**"===i){if(r+1===t.length)return!0;for(var o=n;o<=e.length;o++)if(Kt(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&Kt(e,t,n+1,r+1)}function Ht(e,t){return t.some(function(t){return Kt(e,t)})}var Gt=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;void 0===e&&(e=[]);var r=this.request.headers,i={};if(Array.isArray(r))r.forEach(function(e){var t=d(e,2),n=t[0],r=t[1];i[n]=r});else if(r instanceof Headers)r.forEach(function(e,t){i[t]=e});else if("object"==typeof r&&null!==r)try{for(var o=c(Object.entries(r)),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&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return nn(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=Yt(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(n){return 0===e.length?[2,null]:[2,en(this.body,e,t)]})})},e}(),Jt=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),nn(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return Yt(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(n){return 0===e.length?[2,null]:[2,en(this.body,e,t)]})})},e}();function Yt(e,t){var n,r,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 f=c(l.entries()),p=f.next();!p.done;p=f.next()){var g=d(p.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){n={error:e}}finally{try{p&&!p.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}i=u}else if("undefined"!=typeof ReadableStream&&e instanceof ReadableStream)return void(a=e);return i}}var Xt,Qt=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 n=this.response.headers,r={};return null===(t=null==n?void 0:n.forEach)||void 0===t||t.call(n,function(e,t){r[t]=e}),nn(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},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(n){switch(n.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),n.label=1;case 1:return n.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,n.sent()];case 3:return n.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(n){switch(n.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,en(n.sent(),e,t)]}})})},e}(),Zt=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(void 0===e&&(e=[]),!this.headersString)return{};var r={},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&&(r[l]=u)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return nn(r,{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 n;return u(this,function(r){return 0===e.length?[2,null]:(n=this.getJson())?(Wt(n,e,t),[2,n]):[2,null]})})},e}();function en(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return Wt(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(Xt||(Xt={}));var tn="[REDACTED]",nn=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,s=t.strategy,a=void 0===s?Xt.REMOVE:s,l=h([],d(N),!1),u={},f=function(t){var n=t.toLowerCase();l.find(function(e){return e.toLowerCase()===n})?a===Xt.REDACT&&(u[t]=tn):o.find(function(e){return e.toLowerCase()===n})?u[t]=e[t]:a===Xt.REDACT&&(u[t]=tn)};try{for(var p=c(Object.keys(e)),g=p.next();!g.done;g=p.next()){f(g.value)}}catch(e){n={error:e}}finally{try{g&&!g.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return u},rn=function(){function e(e,t,n,r,i,o,s,a,l,u,c){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,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,n,r,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===(n=this.responseWrapper)||void 0===n?void 0:n.headers(h([],d(_),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter(function(e){var t=d(e,2);return t[0],void 0!==t[1]}))},e}();var on=function(e,t){void 0===t&&(t=V()),this.callback=e,this.id=t};function sn(e){try{e()}catch(e){}}var an=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=z();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=z();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,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===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,f=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,p=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&&f&&p&&this.observeXhr(h,f,p);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(n){try{n.callback(e)}catch(e){sn(function(){var n;null===(n=t.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,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==n?void 0:n.method)||d,r&&(u=r.status),i&&(c={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},u=0);var f=Math.floor(performance.now()-s),p=Math.floor(o+f),g=new rn(e,d,o,o,l,n,u,f,r,c,p);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(n,r){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){sn(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(n,r)];case 2:return i=l.sent(),[3,4];case 3:return s=l.sent(),o=s,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new Gt(r):void 0,i?new Qt(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){sn(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 n;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&"InvalidStateError"===n.name&&sn(function(){var n;return null===(n=t.logger)||void 0===n?void 0:n.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))}),null}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=d(n,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){sn(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,n)},i.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];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"),n=new Zt(i.status,e,t?parseInt(t,10):void 0,s),r=i.$$AmplitudeAnalyticsEvent.headers,u=new Jt(a,r);l.status=i.status,o.handleNetworkRequestEvent("xhr",{url:l.url,method:l.method},u,n,void 0,l.startTime,l.durationStart)}catch(e){sn(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),n.apply(i,t)},i.setRequestHeader=function(e,t){try{var n=this.$$AmplitudeAnalyticsEvent;n&&(n.headers[e]=t)}catch(e){sn(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}r.apply(this,[e,t])}}},e}(),ln=new an,un=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({},R),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=Le();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=Le();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[T]=t[T],e[P]=t[P],e[A]=t[A],e[M]=t[M],e},e}(),cn="data-amp-mask",dn="*****",hn=/\b(?:\d[ -]*?){13,16}\b/,fn=/(\d{3}-?\d{2}-?\d{4})/g,pn=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,gn=function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var i=e;i=(i=(i=i.replace(hn,dn)).replace(fn,dn)).replace(pn,dn);try{for(var o=c(t),s=o.next();!s.done;s=o.next()){var a=s.value;try{i=i.replace(a,dn)}catch(e){}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},vn=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(cn)?dn:e?e(document.title):document.title},mn={};Object.defineProperty(mn,"__esModule",{value:!0}),mn.Observable=void 0;const yn=e=>Boolean(Symbol[e]),bn=e=>yn(e)?Symbol[e]:"@@"+e,wn=bn("iterator"),Sn=bn("observable"),kn=bn("species");function xn(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function Cn(e){let t=e.constructor;return void 0!==t&&(t=t[kn],null===t&&(t=void 0)),void 0!==t?t:Rn}function En(e){En.log?En.log(e):setTimeout(()=>{throw e})}function In(e){Promise.resolve().then(()=>{try{e()}catch(e){En(e)}})}function On(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=xn(t,"unsubscribe");e&&e.call(t)}}catch(e){En(e)}}function Tn(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function Pn(e,t,n){e._state="running";let r=e._observer;try{let i=xn(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(Tn(e),!i)throw n;i.call(r,n);break;case"complete":Tn(e),i&&i.call(r)}}catch(e){En(e)}"closed"===e._state?On(e):"running"===e._state&&(e._state="ready")}function An(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void In(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(Pn(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void Pn(e,t,n);e._queue.push({type:t,value:n})}}class Mn{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){An(n,"next",e)},error(e){An(n,"error",e)},complete(){An(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(Tn(this),On(this))}}class Rn{constructor(e){if(!(this instanceof Rn))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 Mn(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(new TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(Cn(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(Cn(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=Cn(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let s=!r;if(r=!0,!s||n)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!r&&!n)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=Cn(this);return new t(n=>{let r,i=0;return function o(s){r=s.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=Cn(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let s=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(s);e>=0&&r.splice(e,1),o()}});r.push(s)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[Sn](){return this}static from(e){let t="function"==typeof this?this:Rn;if(null==e)throw new TypeError(e+" is not an object");let n=xn(e,Sn);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof Rn}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(yn("iterator")&&(n=xn(e,wn),n))return new t(t=>{In(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{In(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:Rn)(t=>{In(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[kn](){return this}}mn.Observable=Rn,Object.defineProperty(Rn,Symbol("extensions"),{value:{symbol:Sn,hostReportError:En},configurable:!0});var _n=mn.Observable;function Nn(e,t){return new _n(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function Ln(e,t){return new _n(function(n){var r=!1,i=new Set,o=function(){var e,t;r=!0;try{for(var n=c(i),o=n.next();!o.done;o=n.next()){var s=o.value;try{s.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},s=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),o())},complete:function(){i.delete(t),r||0!==i.size||(n.complete(),o(),r=!0)}});i.add(t)};return s(e),s(t),o})}function Dn(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new _n(function(i){return t.add(i),null===n&&(n=e.subscribe({next:function(e){var n,r,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){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},error:function(e){var n,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){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,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&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var Fn,Un="https://app.amplitude.com",jn={US:Un,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var Bn="__AMPLITUDE_MESSENGER_INSTANCE__",qn="__AMPLITUDE_MESSENGER__",zn=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?Un:t;this[Fn]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,s){r.requestCallbacks[i]={resolve:t,reject:s},r.notify(o),n.timeout>0&&setTimeout(function(){s(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.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 n,r,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){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return l(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.scriptLoadPromises.delete(e),r;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,s=i.endpoint;o&&(this.logger=o),s&&this.endpoint===Un&&(this.endpoint=s),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,s;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.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=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(a);else{if("ping"===l)return void r.notify({action:"pong"});var u=r.actionHandlers.get(l);if(u)u(a.data);else{var c=null!==(s=r.pendingMessages.get(l))&&void 0!==s?s:[];c.push(a.data),r.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[qn])===this&&delete e[qn]},e}();function Wn(e){var t,n=z(),r=null==n?void 0:n[qn];if("object"==typeof(t=r)&&null!==t&&Bn in t&&!0===t[Bn])return r;var i=new zn(e);return n&&(n[qn]=i),i}Fn=Bn;var Vn=["desktop","tablet","mobile"],$n="__AMPLITUDE_BACKGROUND_CAPTURE__";function Kn(e,t){var n,r=e;if(!0!==r[$n]){r[$n]=!0;var i=null!==(n=null==t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.1.0.js.gz",o=null,a=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(t){var n,r;null===(r=null===(n=e.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Initializing background capture (external script)");var l=new URL(i,e.endpoint).toString(),u=t&&"object"==typeof t?function(e){if("string"==typeof e)return Vn.includes(e)?e:void 0}(t.deviceMode):void 0;e.loadScriptOnce(l).then(function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),o=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,s({messenger:e,onBackgroundCapture:a},void 0!==u?{initialDeviceMode:u}:{})),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 Hn={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function Gn(e,t,n){var r,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){n.warn("Invalid regex pattern: ".concat(l),e)}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return e.concat(o)}function Jn(e){var t,n,r,i,o,s,a,l,u,f,p,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),Jn(S)}catch(e){}}}catch(e){t={error:e}}finally{try{b&&!b.done&&(n=y.return)&&n.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,T=null!==(f=C[O])&&void 0!==f?f:{},P=T.captureSafeHeaders,A=T.allowlist;(P||A)&&(void 0===A||Array.isArray(A)?C[O]=h(h([],d(P?_:[]),!1),d(null!=A?A:[]),!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){r={error:e}}finally{try{x&&!x.done&&(i=k.return)&&i.call(k)}finally{if(r)throw r.error}}}catch(e){}void 0!==(null===(p=e.autocapture)||void 0===p?void 0:p.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),M.errorClick&&(M.errorClicks=M.errorClick,delete M.errorClick));try{var R=null===(v=e.autocapture)||void 0===v?void 0:v.elementInteractions;if(R&&"object"==typeof R&&(!0===R.viewportContentUpdated&&(R.viewportContentUpdated={}),!1===R.viewportContentUpdated&&(R.viewportContentUpdated={enabled:!1}),void 0!==R.exposureDuration)){var N=R.viewportContentUpdated;void 0===N?R.viewportContentUpdated={exposureDuration:R.exposureDuration}:"object"==typeof N&&void 0===N.exposureDuration&&!1!==N.enabled&&(N.exposureDuration=R.exposureDuration),delete R.exposureDuration}}catch(e){}}}var Yn=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])&&(!function(){var e,t,n=z();return"string"==typeof(null===(t=null===(e=null==n?void 0:n.chrome)||void 0===e?void 0:e.runtime)||void 0===t?void 0:t.id)}()||!!(null==e?void 0:e[t]))},Xn=function(e){return Yn(e,"attribution")},Qn=function(e){return Yn(e,"formInteractions")},Zn=function(e){return Yn(e,"pageViews")},er=function(e){return Yn(e,"sessions")},tr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},nr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},rr=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.webVitals;return"object"==typeof t&&null!==t?t:void 0}},ir=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},or=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}},sr=function(e){if(nr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},ar=function(e){if(ir(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},lr=function(e){if(tr(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:(n=null==t?void 0:t.captureRules,r=e.loggerProvider,null==n?void 0:n.map(function(e){var t,n;if((null===(t=e.urls)||void 0===t?void 0:t.length)&&(null===(n=e.hosts)||void 0===n?void 0:n.length)){var i=JSON.stringify(e.hosts),o=JSON.stringify(e.urls);return null==r||r.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 n,r},ur=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return Zn(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}},cr=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,s=r.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},dr=function(e){return e&&void 0!==e._q};var hr="2.48.2-codexsemantic-review-integration.0",fr="amplitude-ts",pr=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(fr,"/").concat(hr),"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,n;return l(this,void 0,void 0,function(){var r,i,o;return u(this,function(a){return r=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,o=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=r),[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:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Ne()}),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}(),gr=1e3,vr=function(e){function t(t){var n,r,i,o=this;try{i=null===(n=z())||void 0===n?void 0:n.localStorage}catch(e){null===(r=null==t?void 0:t.loggerProvider)||void 0===r||r.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 r(t,e),t.prototype.set=function(t,n){var r;return l(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>gr?(i=n.length-gr,[4,e.prototype.set.call(this,t,n.slice(0,gr))]):[3,2];case 1:return o.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(gr,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(ot),mr=function(e){function t(){var t;return e.call(this,null===(t=z())||void 0===t?void 0:t.sessionStorage)||this}return r(t,e),t}(ot),yr=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return r(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),l(this,void 0,void 0,function(){var r=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===r.state.done){var e=a.responseText;try{i(r.buildResponse(JSON.parse(e)))}catch(e){i(r.buildResponse({code:a.status}))}}};var h={"Content-Type":"application/json",Accept:"*/*"},f=JSON.stringify(t),p=n&&f.length>=2048&&St(),g=function(e){var t,n;h=s(s({},r.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],f=l[1];a.setRequestHeader(u,f)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}a.send(e)};l(r,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return p?[4,kt(f)]:[3,2];case 1:return(e=t.sent())?(h["Content-Encoding"]="gzip",g(e)):g(f),[3,3];case 2:g(f),t.label=3;case 3:return[2]}})}).catch(o)})]})})},t}(bt),br=function(e){function t(t,n,r){void 0===t&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=!1!==n,i.referrerPolicy=r,i}return r(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),l(this,void 0,void 0,function(){var r,i,o,a,l,c,d,h,f;return u(this,function(u){switch(u.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return r=JSON.stringify(t),i=n&&r.length>=2048&&St(),o=r,a={"Content-Type":"application/json",Accept:"*/*"},i?[4,kt(r)]:[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:f=u.sent();try{return[2,this.buildResponse(JSON.parse(f))]}catch(e){return[2,this.buildResponse({code:h.status})]}return[2]}})})},t}(bt),wr=function(e){function t(){return e.call(this)||this}return r(t,e),t.prototype.send=function(e,t,n){return l(this,void 0,void 0,function(){var n=this;return u(this,function(r){return[2,new Promise(function(r,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 r(o.navigator.sendBeacon(e,s)?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(bt),Sr=function(e,t,n){return void 0===n&&(n=!0),l(void 0,void 0,void 0,function(){var r,i,o,s,a,l,c,h,f;return u(this,function(u){switch(u.label){case 0:return r=function(e){return"".concat(p.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=u.sent())?n?[4,t.remove(r)]:[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],f=o[5],[2,{deviceId:s,userId:xr(a),sessionId:kr(c),lastEventId:kr(f),lastEventTime:kr(h),optOut:Boolean(l)}]}})})},kr=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},xr=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Cr="[Amplitude]",Er="".concat(Cr," Form Started"),Ir="".concat(Cr," Form Submitted"),Or="".concat(Cr," File Downloaded"),Tr="session_start",Pr="session_end",Ar="".concat(Cr," File Extension"),Mr="".concat(Cr," File Name"),Rr="".concat(Cr," Link ID"),_r="".concat(Cr," Link Text"),Nr="".concat(Cr," Link URL"),Lr="".concat(Cr," Form ID"),Dr="".concat(Cr," Form Name"),Fr="".concat(Cr," Form Destination"),Ur="cookie",jr=Object.freeze({__proto__:null,get IdentifyOperation(){return i},get SpecialEventType(){return o},get RevenueProperty(){return X},get LogLevel(){return oe},get ServerZone(){return _t},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:Lt,DEFAULT_DATA_ATTRIBUTE_PREFIX:Dt,DEFAULT_ACTION_CLICK_ALLOWLIST:Ft,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Hn}),Br=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},qr=function(e,t,n,r,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,f=a(c,["referrer","referring_domain"]),p=n.excludeInternalReferrers;if(p){var g=Wr(p,r);if(!(g instanceof TypeError)&&e.referring_domain&&Hr(e.referring_domain,o)){if("always"===g)return Vr(g,e.referring_domain,r),!1;if("ifEmptyCampaign"===g&&(d=s(s({},e),{referring_domain:void 0,referrer:void 0}),Object.values(d).every(function(e){return!e})))return Vr(g,e.referring_domain,r),!1}}if(zr(n.excludeReferrers,e.referring_domain))return r.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 r.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(f),m=Br(l||"")!==Br(h||""),y=!t||v||m;return y?r.debug("This is a new campaign. An $identify event will be sent."):r.debug("This is not a new campaign because it's the same as the previous one."),y},zr=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})},Wr=function(e,t){if(!0===e)return Hn.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(Hn).includes(n))return n;if(void 0===n)return Hn.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),new TypeError(r)};function Vr(e,t,n){var r="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?n.debug(r):"ifEmptyCampaign"===e&&n.debug("".concat(r," with empty campaign parameters"))}var $r=["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"],Kr=function(e){var t,n,r=e||(null===(n=null===(t=z())||void 0===t?void 0:t.location)||void 0===n?void 0:n.hostname);if(!r)return"";var i=r.split("."),o=i[i.length-1],s=i[i.length-2];return $r.find(function(e){return r.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],s=i[i.length-3]),s?"".concat(s,".").concat(o):o},Hr=function(e,t){var n=z();if(!n)return!1;var r,i,o,s=(t||"").trim()||Kr(n.location.hostname);return r=e,o=(i=s).startsWith(".")?i:".".concat(i),!!(r.startsWith(".")?r:".".concat(r)).endsWith(o)},Gr=function(e){function t(t,n,r,i,o,s,a,l,u,c,d,h,f,p,g,v,m,y,b,w,S,k,x,C,E,I,O,T,P,A,M,R,_,N,L,D,F,U,j,B,q,z,W,V){void 0===r&&(r=new et),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=Ur),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="US"),void 0===O&&(O=18e5),void 0===T&&(T=new vr({loggerProvider:v})),void 0===P&&(P={ipAddress:!0,language:!0,platform:!0}),void 0===A&&(A="fetch"),void 0===M&&(M=!1),void 0===R&&(R=!0),void 0===U&&(U=!0),void 0===j&&(j=0),void 0===W&&(W=!1);var $,K=this;(K=e.call(this,{apiKey:t,instanceName:f,storageProvider:T,transportProvider:Xr(A)})||this).apiKey=t,K.appVersion=n,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=T,K.trackingOptions=P,K.transport=A,K.useBatch=M,K.fetchRemoteConfig=R,K.networkTrackingOptions=D,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.version=hr,K._optOut=!1,K._cookieStorage=r,K.deviceId=a,K.lastEventId=p,K.lastEventTime=g,K.optOut=w,K.deferredSessionId=I,K.sessionId=E,K.pageCounter=N,K.userId=_,K.debugLogsEnabled=L,K.loggerProvider.enable(L?oe.Debug:K.logLevel),K.networkTrackingOptions=D,K.identify=F,K.enableDiagnostics=U,K.diagnosticsSampleRate=j,K.diagnosticsClient=B;var H=null!==($=null==q?void 0:q.fetchRemoteConfig)&&void 0!==$?$:R;return K.remoteConfig=K.remoteConfig||{},K.remoteConfig.fetchRemoteConfig=H,K.fetchRemoteConfig=H,K.topLevelDomain=z||Kr(),K}return r(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 tt&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(_e(this.apiKey),e)},t}(ce),Jr=function(e,t,n,r,i){return void 0===t&&(t={}),l(void 0,void 0,void 0,function(){var o,a,l,c,d,h,f,p,g,v,m,y,b,w,S,k,x,C,E,I,O,T,P,A,M,R,_,N,L,D,F,U,j,B,q,z,W,$,K,H,G,J,Y,X,Q,Z,ee,te,ne,re,ie;return u(this,function(u){switch(u.label){case 0:return o=t.identityStorage||Ur,a="",o!==Ur||(null===(T=t.cookieOptions)||void 0===T?void 0:T.domain)||""===(null===(P=t.cookieOptions)||void 0===P?void 0:P.domain)?[3,2]:[4,Qr(void 0,r)];case 1:a=u.sent(),u.label=2;case 2:return l=s({domain:null!==(M=null===(A=t.cookieOptions)||void 0===A?void 0:A.domain)&&void 0!==M?M:a,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},t.cookieOptions),c={duplicateResolverFn:function(e){var t=nt(e);if(!t)return!1;var n=JSON.parse(t);return rt(n.cookieDomain,l.domain)},diagnosticsClient:r},d=Yr(t.identityStorage,l,c),[4,Sr(e,d,null===(_=null===(R=t.cookieOptions)||void 0===R?void 0:R.upgrade)||void 0===_||_)];case 3:return h=u.sent(),[4,d.get(_e(e))];case 4:return f=u.sent(),p=Le(),g=p.ampTimestamp?Number(p.ampTimestamp):void 0,v=!g||Date.now()<g,m=null!==(U=null!==(F=null!==(D=null!==(N=t.deviceId)&&void 0!==N?N:v?null!==(L=p.ampDeviceId)&&void 0!==L?L:p.deviceId:void 0)&&void 0!==D?D:null==f?void 0:f.deviceId)&&void 0!==F?F:h.deviceId)&&void 0!==U?U:V(),y=null!==(j=null==f?void 0:f.lastEventId)&&void 0!==j?j:h.lastEventId,b=null!==(B=null==f?void 0:f.lastEventTime)&&void 0!==B?B:h.lastEventTime,w=null!==(z=null!==(q=t.optOut)&&void 0!==q?q:null==f?void 0:f.optOut)&&void 0!==z?z:h.optOut,S=null!==(W=null==f?void 0:f.sessionId)&&void 0!==W?W:h.sessionId,k=null==f?void 0:f.deferredSessionId,x=null!==(K=null!==($=t.userId)&&void 0!==$?$:null==f?void 0:f.userId)&&void 0!==K?K:h.userId,n.previousSessionDeviceId=null!==(H=null==f?void 0:f.deviceId)&&void 0!==H?H:h.deviceId,n.previousSessionUserId=null!==(G=null==f?void 0:f.userId)&&void 0!==G?G:h.userId,C={ipAddress:null===(Y=null===(J=t.trackingOptions)||void 0===J?void 0:J.ipAddress)||void 0===Y||Y,language:null===(Q=null===(X=t.trackingOptions)||void 0===X?void 0:X.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==f?void 0:f.pageCounter,I=null==f?void 0:f.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(O=new Gr(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!==(ne=null==i?void 0:i.serverZone)&&void 0!==ne?ne:t.serverZone,S,k,t.sessionTimeout,t.storageProvider,C,t.transport,t.useBatch,t.fetchRemoteConfig,x,E,I,t.networkTrackingOptions,t.identify,null!==(re=null==i?void 0:i.enableDiagnostics)&&void 0!==re?re:t.enableDiagnostics,null!==(ie=null==i?void 0:i.diagnosticsSampleRate)&&void 0!==ie?ie:n._diagnosticsSampleRate,r,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 et),[2,O]}})})},Yr=function(e,t,n){switch(void 0===e&&(e=Ur),void 0===t&&(t={}),e){case"localStorage":return new vr;case"sessionStorage":return new mr;case"none":return new et;default:return new tt(s(s({},t),{expirationDays:t.expiration}),n)}},Xr=function(e){var t="object"==typeof e?e.type:e,n="object"==typeof e?e.headers:void 0,r="object"==typeof e?e.enableKeepalive:void 0,i="object"==typeof e?e.referrerPolicy:void 0;return"xhr"===t?new yr(n):"beacon"===t?new wr:new br(n,r,i)},Qr=function(e,t){return l(void 0,void 0,void 0,function(){var n,r,i,o,s,a,l;return u(this,function(u){switch(u.label){case 0:return[4,new tt(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!u.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];if(n=null!=e?e:location.hostname,1===(r=n.split(".")).length)return[2,""];for(i=[],o=1,$r.find(function(e){return n.endsWith(".".concat(e))})&&(o=2),s=r.length-o-1;s>=0;--s)i.push(r.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,tt.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(n)}),[2,""]}})})},Zr=function(e){var t;void 0===e&&(e={});var n,r,i=z(),o=void 0,a=!1,c=e.trackOn,h=e.trackHistoryChanges,f=e.eventType,p=void 0===f?"[Amplitude] Page Viewed":f,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,i,o,a,l,c;return u(this,function(u){switch(u.label){case 0:return t=ti(),r=ni(),i=He(n.apiKey),o=g("undefined"!=typeof location&&location.href||""),l={event_type:p},a=[{}],[4,ri()];case 1:return[2,(l.event_properties=s.apply(void 0,[s.apply(void 0,a.concat([u.sent()])),(c={"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":"undefined"!=typeof location&&g(location.pathname)||"","[Amplitude] Page Title":vn(gn),"[Amplitude] Page URL":o.split("?")[0],"[Amplitude] Min Page Y":t,"[Amplitude] Viewport Width":r},c[$e]=i,c["[Amplitude] Page View ID"]=e,c)]),l)]}})})},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,i,s,a,l;return u(this,function(u){switch(u.label){case 0:return e=location.href,i=oi(h,e,y||"")&&m(),y=e,i?(s=void 0,r&&(s=We(n.apiKey,ei())),null==o||o.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return l=(a=t).track,[4,v(s)];case 2:l.apply(a,[u.sent()]),u.label=3;case 3:u.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,n=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),a=!0,He(n.apiKey),i){try{r=new ot(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,n){var r=d(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),a&&b()}})}return m()?(o.log("Tracking page view event"),l=void 0,r&&(l=We(n.apiKey,ei())),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;return u(this,function(a){switch(a.label){case 0:return"attribution"===c&&ii(e)?(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,r&&(t=Ve(n.apiKey)),[4,v(t)]):[3,2];case 1:i=a.sent(),e.event_type=i.event_type,e.event_properties=s(s({},e.event_properties),i.event_properties),a.label=2;case 2:return n&&e.event_type===p&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=s(s({},e.event_properties),{"[Amplitude] Page Counter":n.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},ei=function(){return"undefined"!=typeof location&&location.href||""},ti=function(){var e,t,n=z();if(!n)return 0;var r=null!==(t=null!==(e=n.scrollY)&&void 0!==e?e:n.pageYOffset)&&void 0!==t?t:0;return Math.floor(r)},ni=function(){var e,t=z();return t&&null!==(e=t.innerWidth)&&void 0!==e?e:0},ri=function(){return l(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return e=Ze,[4,(new un).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},ii=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[i.SET]||{},r=t[i.UNSET]||{},o=h(h([],d(Object.keys(n)),!1),d(Object.keys(r)),!1);return Object.keys(R).every(function(e){return o.includes(e)})}return!1},oi=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname}return t!==n},si=function(){var e,t,n=[],r=function(e,t,r){e.addEventListener(t,r),n.push({element:e,type:t,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(n,i){return l(void 0,void 0,void 0,function(){var o,s;return u(this,function(a){return t=function(e){if(Qn(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions}(n),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;r(e,"change",function(){var t,n=li(e);s||i.track(Er,((t={})[Lr]=ai(e.id),t[Dr]=ai(e.name),t[Fr]=n,t)),s=!0}),r(e,"submit",function(r){var o,a,l=li(e);if(s||i.track(Er,((o={})[Lr]=ai(e.id),o[Dr]=ai(e.name),o[Fr]=l,o)),s=!0,void 0!==(null==t?void 0:t.shouldTrackSubmit))if("function"==typeof t.shouldTrackSubmit&&"undefined"!=typeof SubmitEvent&&r instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(r))return}catch(e){n.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else n.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(Ir,((a={})[Lr]=ai(e.id),a[Dr]=ai(e.name),a[Fr]=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){n.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(e)))}})})}),e.observe(document.body,{subtree:!0,childList:!0}))}}else n.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):n.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(),n.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),n=[],[2]})})}}},ai=function(e){if("string"==typeof e)return e},li=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},ui=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return l(void 0,void 0,void 0,function(){var i,o;return u(this,function(s){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(n.href),s=null==i?void 0:i[1];s&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",function(){var t;s&&r.track(Or,((t={})[Ar]=s,t[Mr]=n.pathname,t[Rr]=e.id,t[_r]=e.text,t[Nr]=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){n.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(e)))}})})}),e.observe(document.body,{subtree:!0,childList:!0}))}}else n.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):n.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(n){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),t=[],[2]})})}}},ci=!1,di=function(){var e=z(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))};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(r){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,n("online",function(){!1!==e.offline&&(e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),n("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2])})})},teardown:function(){return l(void 0,void 0,void 0,function(){return u(this,function(n){return t.forEach(function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)}),t=[],[2]})})}}};function hi(e,t){var n,r;if(e){Jn(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===(n=i.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===n?void 0:n.length)){o.elementInteractions=s({},i.autocapture.elementInteractions);var a=o.elementInteractions,l=null!==(r=a.pageUrlAllowlist)&&void 0!==r?r:[],u=i.autocapture.elementInteractions.pageUrlAllowlistRegex;a.pageUrlAllowlist=Gn(l,u,t.loggerProvider),delete a.pageUrlAllowlistRegex}var d=function(e,t){var n,r,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 f=h.value;f.urls=Gn(null!==(a=f.urls)&&void 0!==a?a:[],f.urlsRegex,t),delete f.urlsRegex}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.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 fi="1.31.0-codexsemantic-review-integration.0",pi="[Amplitude] Element Clicked",gi="[Amplitude] Element Tag",vi="[Amplitude] Element Text",mi="[Amplitude] Page URL",yi="[Amplitude] Viewport Height",bi="[Amplitude] Viewport Width",wi="[Amplitude] Page View ID",Si="data-amp-mask-attributes",ki="data-amp-internal-shadow";function xi(e,t){var n=e.getAttribute(t.explicitTrackingAttribute);if(null!==n&&""===n)return null;var r=e.getAttribute("id");return null===r||""===r?null:function(e,t){var n,r;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){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0}(r,t.autogeneratedIdPatterns)?r:null}function Ci(e,t){return t.map(Ei).join(" > ")}function Ei(e){var t=e.tagName.toLowerCase(),n=e.parentElement;if(null===n)return t;var r=function(e,t){for(var n=0,r=0;r<t.children.length;r++){var i=t.children[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}(e,n);return"".concat(t,":nth-of-type(").concat(r,")")}var Ii=":scope > ";function Oi(e){var t;return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot||null!=e&&11===e.nodeType&&1===(null===(t=e.host)||void 0===t?void 0:t.nodeType)}function Ti(e){var t,n=e.getRootNode();return Oi(n)?n:null!==(t=e.ownerDocument)&&void 0!==t?t:document}function Pi(e,t){var n,r,i,o;return u(this,function(s){switch(s.label){case 0:n=e,r=0,i=0,s.label=1;case 1:return null!==n&&i<1024?(i+=1,[4,n]):[3,3];case 2:return s.sent(),n.parentElement?(n=n.parentElement,[3,1]):r<t&&"function"==typeof n.getRootNode&&(o=function(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return Oi(t)?t.host:null}(n),o&&o!==n)?(r+=1,n=o,[3,1]):[3,3];case 3:return[2]}})}function Ai(e,t){var n=[];if(t<=0)return n;for(var r=[[e,0]],i=0;r.length&&i<5e4;){i+=1;var o=d(r.pop(),2),s=o[0],a=o[1],l=s.shadowRoot;if(l&&a+1<=t){n.push({root:l,depth:a+1});for(var u=l.children,c=0;c<u.length;c++)r.push([u[c],a+1])}var h=s.children;for(c=0;c<h.length;c++)r.push([h[c],a])}return n}function Mi(e,t){for(var n=[],r=e,i=0;null!==r&&i<1024;){i+=1;var o=Ti(r);n.push({root:o,target:r});var s=r.getRootNode();if(!Oi(s))break;r=s.host}var a=n.length-1,l=!1,u=n;return a>t&&(u=n.slice(a-t),l=!0),{segments:u.reverse(),truncated:l}}function Ri(e,t){var n=e.tagName.toLowerCase(),r=e.parentElement;if(null===r){var i=e.getRootNode();return t&&Oi(i)?"".concat(n,":nth-of-type(").concat(_i(e,i.children),")"):n}return"".concat(n,":nth-of-type(").concat(_i(e,r.children),")")}function _i(e,t){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}var Ni={name:"explicitTrackingAttribute",try:function(e,t){var n=t.config.explicitTrackingAttribute,r=e.getAttribute(n);return null===r||""===r?null:"[".concat(n,"=").concat(JSON.stringify(r),"]")}};function Li(e){var t=globalThis.CSS;if(t&&"function"==typeof t.escape)return t.escape(e);for(var n=String(e),r=n.length,i="",o=0;o<r;o++){var s=n.charCodeAt(o);0!==s?s>=1&&s<=31||127===s||0===o&&s>=48&&s<=57||1===o&&s>=48&&s<=57&&45===n.charCodeAt(0)?i+="\\".concat(s.toString(16)," "):i+=0!==o||1!==r||45!==s?s>=128||45===s||95===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?n.charAt(o):"\\".concat(n.charAt(o)):"\\-":i+="�"}return i}function Di(e){return Li(e)}var Fi={name:"stableId",try:function(e,t){var n=xi(e,t.config);return null===n?null:"".concat(e.tagName.toLowerCase(),"#").concat(Di(n))}},Ui=!1,ji=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:Ui,maxShadowDomDepth:1});function Bi(e){var t;return s(s({},e),{shadowDomEnabled:null!==(t=e.shadowDomEnabled)&&void 0!==t?t:Ui,maxShadowDomDepth:zi(e.maxShadowDomDepth)})}function qi(e,t){if(!e)return Wi();var n,r=Wi();return"boolean"==typeof e.enabled&&(r.enabled=e.enabled),"string"==typeof e.explicitTrackingAttribute&&""!==e.explicitTrackingAttribute&&(r.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(r.autogeneratedIdPatterns=function(e,t){var n,r,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){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(r.unstableClassPatterns=function(e,t){var n,r,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){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.unstableClassPatterns,t)),r.maxAncestorWalkDepth="number"!=typeof(n=e.maxAncestorWalkDepth)?void 0:Number.isFinite(n)?n<=0?void 0:Math.floor(n):void 0,"boolean"==typeof e.shadowDomEnabled&&(r.shadowDomEnabled=e.shadowDomEnabled),r.maxShadowDomDepth=zi(e.maxShadowDomDepth),Bi(r)}function zi(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}function Wi(){return{enabled:ji.enabled,explicitTrackingAttribute:ji.explicitTrackingAttribute,autogeneratedIdPatterns:h([],d(ji.autogeneratedIdPatterns),!1),unstableClassPatterns:h([],d(ji.unstableClassPatterns),!1),maxAncestorWalkDepth:ji.maxAncestorWalkDepth,shadowDomEnabled:ji.shadowDomEnabled,maxShadowDomDepth:ji.maxShadowDomDepth}}var Vi=[Ni,Fi];function $i(e,t,n){var r,i,o,s,a;void 0===n&&(n={});var l=Bi(t),u=null!==(o=n.strategies)&&void 0!==o?o:Vi,d=null!==(a=null!==(s=n.scope)&&void 0!==s?s:e.ownerDocument)&&void 0!==a?a:document,h={scope:d,config:l},f=function(e,t){var n=[],r=e;for(;null!==r&&(n.push(r),!(void 0!==t&&n.length>t));)r=r.parentElement;return n}(e,l.maxAncestorWalkDepth);try{for(var p=c(u),g=p.next();!g.done;g=p.next())for(var v=g.value,m=0;m<f.length;m++){var y=f[m],b=v.try(y,h);if(null!==b)if(0!==m){var w=Ci(0,f.slice(0,m).reverse()),S="".concat(b," > ").concat(w);if(Ki(d,S,e,v.name,n.logger))return S}else if(Ki(d,b,e,v.name,n.logger))return b}}catch(e){r={error:e}}finally{try{g&&!g.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}return null}function Ki(e,t,n,r,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(r,'" emitted a malformed selector "').concat(t,'" (').concat(s,")")),!1}return 1===o.length&&o[0]===n}function Hi(e,t,n){var r;try{r=e.querySelectorAll(t)}catch(e){return!1}return 1===r.length&&r[0]===n}var Gi=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),Ji=function(e,t,n){var r,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute("id");if(t){if(o)return new Gi(Xi(o),!0);var s=e.tagName.toLowerCase();if("body"===s||"head"===s||"html"===s)return new Gi(s,!0)}var a=e.tagName.toLowerCase();if(o)return new Gi(a+Xi(o),!0);var l=e.parentNode;if(!l||l.nodeType===Node.DOCUMENT_NODE)return new Gi(a,!0);for(var u=Yi(e),d=!1,h=!1,f=-1,p=-1,g=l.children,v=0;g&&(-1===f||!h)&&v<g.length;++v){var m=g[v];if(m.nodeType===Node.ELEMENT_NODE)if(p+=1,m!==e){if(!h&&m.tagName.toLowerCase()===a){d=!0;var y=new Set(u);if(y.size)for(var b=Yi(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 f=p}var k=a;if(n&&"input"===a.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(k+="[type="+Li(e.getAttribute("type")||"")+"]"),h)k+=":nth-child("+String(f+1)+")";else if(d)try{for(var x=c(u),C=x.next();!C.done;C=x.next()){k+="."+Li(C.value.slice(1))}}catch(e){r={error:e}}finally{try{C&&!C.done&&(i=x.return)&&i.call(x)}finally{if(r)throw r.error}}return new Gi(k,!1)},Yi=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},Xi=function(e){return"#"+Li(e)};function Qi(e,t){try{return function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=Ji(r,Boolean(t),r===e);if(!i)break;if(n.push(i),i.optimized)break;r=r.parentElement}return n.reverse(),n.join(" > ")}(e)}catch(e){var n=e instanceof Error?e.message:String(e);return null==t||t.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(n)),""}}function Zi(e,t){void 0===t&&(t={});var n=Bi(e),r=new Set,i=t.logger,o=function(e){return Qi(e,i)},s=function(e,r){var o;return null!==(o=$i(e,n,{strategies:t.strategies,scope:r,logger:i}))&&void 0!==o?o:function(e,t,n){var r,i;void 0===n&&(n={});for(var o=Bi(t),s=null!==(i=null!==(r=n.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==i?i:document,a=Oi(s),l=[],u=e,c=0,f=!(o.shadowDomEnabled&&a);null!==u&&!(f&&void 0!==o.maxAncestorWalkDepth&&c>o.maxAncestorWalkDepth);){var p=xi(u,o);if(null!==p){var g=h(["".concat(u.tagName.toLowerCase(),"#").concat(Di(p))],d(l),!1).join(" > ");if(Hi(s,g,e))return g}l.unshift(Ri(u,o.shadowDomEnabled)),u=u.parentElement,c+=1}var v=l.join(" > ");return o.shadowDomEnabled&&a&&null===u?"".concat(Ii).concat(v):v}(e,n,{scope:r})},a=function(e,t){return function(e,t,n){return e&&n&&Oi(t)?"".concat(Ii).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 r,l;try{return n.shadowDomEnabled?function(e,t){var r=Mi(e,n.maxShadowDomDepth),o=r.segments;return r.truncated&&(null==i||i.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(n.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host"))),o.map(function(e){var n=e.target,r=e.root;return t(n,r)}).join(" >>> ")}(e,n.enabled?s:a):(n.enabled?s:o)(e,null!==(l=null!==(r=t.scope)&&void 0!==r?r: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 n},updateConfig:function(e){var t,o;n=Bi(e);try{for(var s=c(r),a=s.next();!a.done;a=s.next()){var l=a.value;try{l(n)}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 r.add(e),function(){r.delete(e)}}}}var eo,to,no=Object.freeze({enabled:!1,maxDepth:0}),ro=function(){var e=no,t=new Set;return{get:function(){return e},arm:function(n){return e.enabled||!n.enabled||(e=n,function(e){var n,r;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){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.clear()}(n)),e},onArm:function(n){if(e.enabled){var r=e;try{n(r)}catch(e){}return function(){}}return t.add(n),function(){t.delete(n)}}}},io=["input","select","textarea"],oo=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&Je(window.location.href,n))&&!!Je(window.location.href,t)},so=function(e,t){return function(n,r){var i,o,s=e.shouldTrackEventResolver,a=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!a)return!1;if(s)return s(n,r);if(!oo(e))return!1;var l=String(null==r?void 0:r.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==r?void 0:r.matches)||void 0===t?void 0:t.call(r,e))});if(!u)return!1}switch(a){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:return"click"===n}}},ao=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},lo=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t},{})},uo=function(e,t,n){return void 0===n&&(n=no),n.enabled?ho(e,t,n.maxDepth):co(e,t)},co=function(e,t){return e?t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)})?e:co(null==e?void 0:e.parentElement,t):null},ho=function(e,t,n){var r,i;if(!e)return null;var o=function(e){if(t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))return{value:e}};try{for(var s=c(Pi(e,n)),a=s.next();!a.done;a=s.next()){var l=o(a.value);if("object"==typeof l)return l.value}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return null},fo=function(e,t,n){return void 0===n&&(n=no),n.enabled?go(e,t,n.maxDepth):po(e,t)},po=function(e,t){var n=[];return t?(e.querySelectorAll(t).forEach(function(e){return n.push(e)}),n):n},go=function(e,t,n){var r=po(e,t),i=e instanceof Document?e.documentElement:e;return i?(Ai(i,n).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return r.push(e)})}),r):r},vo=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};function mo(e){if(!e)return"";try{var t=new URL(e);return t.search="",Ye(t.href)}catch(t){return Ye(e)}}function yo(e){var t,n;return void 0===e&&(e=z()),mo(null!==(n=null===(t=null==e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==n?n:"")}!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(to||(to={}));var bo="__AMPLITUDE_VISUAL_TAGGING__";var wo=function(){var e,t,n,r,i=z();return{x:Math.floor(null!==(t=null!==(e=null==i?void 0:i.scrollX)&&void 0!==e?e:null==i?void 0:i.pageXOffset)&&void 0!==t?t:0),y:Math.floor(null!==(r=null!==(n=null==i?void 0:i.scrollY)&&void 0!==n?n:null==i?void 0:i.pageYOffset)&&void 0!==r?r:0)}};var So=z(),ko=function(e){return e.get()},xo={childList:!0,attributes:!0,characterData:!0,subtree:!0},Co=function(e){return new _n(e?function(t){var n,r=new WeakSet,i=new WeakMap,o=function(e,t){r.has(e)||(r.add(e),Oi(e)&&i.set(e,t),a.observe(e,xo))},s=function(e,t,n){var r=n-t;r<=0||Ai(e,r).forEach(function(e){var n=e.root,r=e.depth;return o(n,t+r)})},a=new MutationObserver(function(n){var r,o;t.next(n);try{var a=ko(e);if(!a.enabled)return;var l=function(e){var t=function(e){var t=e.getRootNode();if(!Oi(t))return 0;var n=i.get(t);return null!=n?n:0}(e.target);e.addedNodes.forEach(function(e){e instanceof Element&&s(e,t,a.maxDepth)})};try{for(var u=c(n),d=u.next();!d.done;d=u.next()){l(d.value)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}}catch(e){}});if(document.body){var l=document.body;o(l,0),n=e.onArm(function(e){s(l,0,e.maxDepth)})}return function(){null==n||n(),a.disconnect()}}:function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,xo),function(){return t.disconnect()}})},Eo=function(e){return void 0===e&&(e="click"),new _n(function(t){var n,r=function(e){t.next(e)};return null===(n=z())||void 0===n||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null===(t=z())||void 0===t||t.document.removeEventListener(e,r,{capture:!0})}})},Io=function(){var e=Ln(new _n(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?n=s(s({},n),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(n.message=t.error),e.next(n)}};return So.addEventListener("error",t),function(){So.removeEventListener("error",t)}}),new _n(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return So.addEventListener("unhandledrejection",t),function(){So.removeEventListener("unhandledrejection",t)}}));return Ln(e,new _n(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return Nt.addListener("error",t),function(){Nt.removeListener(t)}}))},Oo=function(e,t,n){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})},To={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},Po=function(e){var t,n,r,i,o=Object.values(To).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=(r=void 0,c(l.definition)),d=u.next();!d.done;d=u.next()){var h=d.value,f=To[h.event_type];f&&o[f].add(l.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==l?void 0:l.id,e)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},Ao=function(e){var t,n,r,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=(r=void 0,c(l.conditions)),d=u.next();!d.done;d=u.next()){var h=d.value;if("LABELED_EVENT"===h.type){var f=h.match.eventId,p=o.get(f);p||(p=[],o.set(f,p)),p.push(l)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},Mo=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return To[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)})})})},Ro=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=Mo(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),o=function(e,t){var n,r,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)),f=h.next();!f.done;f=h.next()){var p=f.value;s.add(p)}}catch(e){i={error:e}}finally{try{f&&!f.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.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;Oo(l.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}(),_o=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",Si,cn,ki]),No=["type"],Lo=["svg","path","g"],Do=["password","hidden"];function Fo(e,t,n){var r,i,o,a,l;if(void 0===n&&(n=no),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 n=e.getRootNode();return t&&Oi(n)?n.children:[]}(e,n.enabled));h.length&&(d.index=h.indexOf(e),d.indexOfType=h.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var f=null===(l=null===(a=e.previousElementSibling)||void 0===a?void 0:a.tagName)||void 0===l?void 0:l.toLowerCase();f&&(d.prevSib=String(f));var p=e.getAttribute("id");p&&(d.id=String(p));var g=Array.from(e.classList);g.length&&(d.classes=g);var v={},m=Array.from(e.attributes).filter(function(e){return!_o.has(e.name)}),y=!function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!io.includes(i)&&!o}(e);if(!Do.includes(String(e.getAttribute("type")))&&!Lo.includes(u))try{for(var b=c(m),w=b.next();!w.done;w=b.next()){var S=w.value;y&&!No.includes(S.name)||(t.has(S.name)?v[S.name]=dn:v[S.name]=String(S.value).substring(0,128))}}catch(e){r={error:e}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(r)throw r.error}}return Object.keys(v).length&&(d.attrs=v),e.shadowRoot&&(d.attrs=s(s({},d.attrs||{}),((o={})[ki]="true",o)),d.shadow=!0),d}function Uo(e,t){return void 0===t&&(t=no),e?t.enabled?function(e,t){var n,r,i=[];try{for(var o=c(Pi(e,t)),s=o.next();!s.done;s=o.next()){var a=s.value;if("HTML"===a.tagName)break;i.push(a)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e,t.maxDepth):function(e){var t=[];t.push(e);var n=e.parentElement;for(;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e):[]}var jo;var Bo=function(e,t){var n,r,i,o=this;this.setPageViewApiKey=function(e){o.pageViewApiKey=e},this.replaceSensitiveString=function(e){return gn(e,o.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,i,s,a=performance.now();if(!e)return[];for(var l=o.getShadowMode(),u=Uo(e,l),f=new Map,p=u.length-1;p>=0;p--){var g=u[p];if(g){var v=ao(g.getAttribute(Si)),m=p===u.length-1?[]:null!==(r=f.get(u[p+1]))&&void 0!==r?r:new Set,y=new Set(h(h([],d(m),!1),d(v),!1));f.set(g,y)}}s=u.map(function(e){var t;return Fo(e,null!==(t=f.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 n=d(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=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&&(n=w.return)&&n.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,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?o.getText(t):o.getNearestLabel(n)},this.getElementPath=function(e){var t;if(!e)return"";var n=performance.now(),r=o.selectorEngine.generate(e),i=performance.now();return null===(t=o.diagnosticsClient)||void 0===t||t.recordHistogram("autocapturePlugin.getElementPath",i-n),r},this.updateRemoteConfig=function(e,t){var n;if(null!=e){var r=e.elementSelector,i=null!==(n=e.elementInteractions)&&void 0!==n?n:{};return"boolean"==typeof i.shadowDomEnabled&&(r=s(s({},null!=r?r:{}),{shadowDomEnabled:i.shadowDomEnabled})),"number"==typeof i.maxShadowDomDepth&&(r=s(s({},null!=r?r:{}),{maxShadowDomDepth:i.maxShadowDomDepth})),o.updateSelectorConfig(r,t)}},this.updateSelectorConfig=function(e,t){var n;if(null!=e){var r="boolean"==typeof e.enabled,i="boolean"==typeof e.shadowDomEnabled;if(r||i){var a=qi(e,t),l=o.selectorEngine.getConfig().enabled,u=o.shadowGate.get().enabled,c=o.shadowGate.arm(function(e){var t,n=null!==(t=e.maxShadowDomDepth)&&void 0!==t?t:1;return!e.shadowDomEnabled||n<=0?no:Object.freeze({enabled:!0,maxDepth:n})}(a));o.selectorEngine.updateConfig(s(s(s({},r?a:o.selectorEngine.getConfig()),{shadowDomEnabled:c.enabled}),c.enabled&&{maxShadowDomDepth:c.maxDepth})),r&&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===(n=o.diagnosticsClient)||void 0===n||n.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,n){var r,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},f=o.getHierarchy(t),p=null===(a=f[0])||void 0===a?void 0:a.attrs,g=o.getNearestLabel(t),v=(l=null!=p?p:{},u=n,Object.entries(l).reduce(function(e,t){var n=d(t,2),r=n[0],i=n[1];if(r.startsWith(u)){var o=r.replace(u,"");o&&(e[o]=i||"")}return e},{})),m=((r={})["[Amplitude] Element Hierarchy"]=f,r[gi]=c,r[vi]=o.getText(t),r["[Amplitude] Element Position Left"]=null==h.left?null:Math.round(h.left),r["[Amplitude] Element Position Top"]=null==h.top?null:Math.round(h.top),r["[Amplitude] Element Attributes"]=v,r["[Amplitude] Element Path"]=o.getElementPath(t),r["[Amplitude] Element Parent Label"]=g,r[mi]=Ye(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=vn(o.replaceSensitiveString),r[yi]=window.innerHeight,r[bi]=window.innerWidth,r),y=Ve(o.pageViewApiKey);if(y&&(m[wi]=y),m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===c&&"click"===e&&t instanceof HTMLAnchorElement){var b=t.href.substring(0,128);m["[Amplitude] Element Href"]=o.replaceSensitiveString(b)}return lo(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,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 n,r;if(void 0===t&&(t=no),!t.enabled)return e.target;var i=null===(n=e.composedPath)||void 0===n?void 0:n.call(e),o=null!==(r=e.target)&&void 0!==r?r:null;if(!i||0===i.length)return o;var s=i[0];if(!(s instanceof Element))return null!=s?s:o;var a=Mi(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 n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===t}(l,s.type);if(u)return s.closestTrackedAncestor=l,s.targetElementProperties=o.getEventProperties(s.type,s.closestTrackedAncestor,r),s}var c=uo(l,n,a);c&&(s.closestTrackedAncestor=c,s.targetElementProperties=o.getEventProperties(s.type,c,r))}}catch(e){}return s},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?o.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(cn,"], [contenteditable]");if(!e.querySelector(r))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(cn)||u.hasAttribute("contenteditable")?i+=dn:i+=o.getTextWithMaskedDescendants(u)):i+=u.textContent||""}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.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 n,r;return!!Uo(e,t).some(function(e){return e.hasAttribute(cn)})||null!==(r=null===(n=document.documentElement)||void 0===n?void 0:n.hasAttribute(cn))&&void 0!==r&&r}(e,t):function(e){return null!==e.closest("[".concat(cn,"]"))}(e)},this.getText=function(e){if(o.hasMaskedAncestor(e))return dn;var t="";return t=e.querySelector("[".concat(cn,"], [contenteditable]"))?o.getTextWithMaskedDescendants(e):e.innerText||"",o.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var i=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),s=((t={})[gi]=i,t[vi]=o.getText(e),t[mi]=window.location.href.split("?")[0],t);return lo(s)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(jo||(jo=Zi(qi())),jo),this.shadowGate=(eo||(eo=ro()),eo);var a=null!==(i=e.maskTextRegex)&&void 0!==i?i:[],l=[];try{for(var u=c(a),f=u.next();!f.done;f=u.next()){var p=f.value;if(l.length>=25)break;if(p instanceof RegExp)l.push(p);else if("pattern"in p&&"string"==typeof p.pattern)try{l.push(new RegExp(p.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=l};function qo(e,t){var n=e.remoteConfigClient;if(e.fetchRemoteConfig&&n){var r=n.subscribe("configs.analyticsSDK.browserSDK.autocapture","all",function(n,r){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(r),") ").concat(JSON.stringify(n))),t.updateRemoteConfig(n,e.loggerProvider)});return function(){n.unsubscribe(r)}}}var zo,Wo=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 Vo(e){var t=e.allObservables,n=e.onExposure,r=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(),n=t.document.documentElement.clientHeight||t.innerHeight,r=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,r);if(o<-1||o>n+1||s>=a||i.width<=0)return!1;for(var l=Wo(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=Wo(l,u.position)}return!0}(e)){if(!s.get(e)&&!a.get(e)){var t=setTimeout(function(){s.set(e,!0);var t=r.getElementPath(e);n(t),a.set(e,null)},o);a.set(e,t)}}else u(e)},d=t.exposureObservable,h=t.scrollObservable,f=d.subscribe(function(e){var t=e,n=t.target;t.isIntersecting?(l.add(n),c(n)):(l.delete(n),u(n))}),p=h.subscribe(function(){l.forEach(c)}),g=function(){a.forEach(function(e){e&&clearTimeout(e)}),a.clear(),s.clear()};return{unsubscribe:function(){f.unsubscribe(),p.unsubscribe(),g(),l.clear()},reset:function(){g(),l.forEach(c)}}}function $o(e){var t,n,r,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,f=void 0===h?4e3:h,p=!1,g=function(){t&&(clearTimeout(t),t=void 0),n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=void 0)},v=function(){o&&(document.removeEventListener("DOMContentLoaded",o),o=void 0)},m=function(){p||("undefined"!=typeof document&&"loading"!==document.readyState?(p=!0,g(),v(),a(),r=setTimeout(function(){r=void 0,l()},u+50)):o||(o=function(){o=void 0,y()},document.addEventListener("DOMContentLoaded",o)))},y=function(){p||(t&&clearTimeout(t),t=setTimeout(m,d))},b=function(){g(),v(),p=!1,y(),n=setTimeout(m,f)};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"}(zo||(zo={}));var Ko=function(e,t){var n,r,i,o,a,f,p,g,v,m,y,b;void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",fi);var w=e.dataAttributePrefix,S=void 0===w?Dt:w,k=e.visualTaggingOptions,x=void 0===k?{enabled:!0}:k;e.cssSelectorAllowlist=null!==(n=e.cssSelectorAllowlist)&&void 0!==n?n:Lt,e.actionClickAllowlist=null!==(r=e.actionClickAllowlist)&&void 0!==r?r:Ft,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!==(p=null!==(f=null===(a=e.viewportContentUpdated)||void 0===a?void 0:a.exposureDuration)&&void 0!==f?f:e.exposureDuration)&&void 0!==p?p: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(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e},[]);var I,O,T="@amplitude/plugin-autocapture-browser",P=[],A=new Bo(e,t),M=new Set,R=new Set,_=new Set,N=function(){var t,n,r=Dn(Eo().map(function(t){return A.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,S)})),i=Dn(new _n(function(t){var n,r=function(n){var r=A.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,S);t.next(r)};return null===(n=z())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=z())||void 0===e?void 0:e.document.removeEventListener("change",r,{capture:!0})}}));window.navigation&&(n=Dn(new _n(function(t){var n=function(n){var r=A.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,S);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=A.shadowGate,s=Dn(Co(o).map(function(t){return A.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,S)})),a=new _n(function(e){var t,n,r=function(t){e.next(t)};return null===(t=z())||void 0===t||t.addEventListener("scroll",r,{capture:!0,passive:!0}),null===(n=z())||void 0===n||n.addEventListener("resize",r,{passive:!0}),function(){var e,t;null===(e=z())||void 0===e||e.removeEventListener("scroll",r,{capture:!0}),null===(t=z())||void 0===t||t.removeEventListener("resize",r)}}),l=function(e,t,n,r){var i="function"==typeof n?n:void 0,o="function"==typeof n?r:n;return new _n(function(n){var r=z();if(!(null==r?void 0:r.IntersectionObserver))return function(){};var s=new IntersectionObserver(function(e){e.forEach(function(e){n.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{fo(e,a,ko(o)).forEach(function(e){s.observe(e)})}catch(e){}},c=function(){var e=null==r?void 0:r.document;if(e){var t=[];try{t=o&&ko(o).enabled?fo(e,a,ko(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==r?void 0:r.document)&&u(r.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&&ko(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={})[zo.ChangeObservable]=i,t[zo.ClickObservable]=r,t[zo.MutationObservable]=s,t[zo.NavigateObservable]=n,t[zo.ScrollObservable]=a,t[zo.ExposureObservable]=l,t},L=Po(Object.values(null!==(m=null===(v=e.pageActions)||void 0===v?void 0:v.labeledEvents)&&void 0!==m?m:{})),D=Ao(null!==(b=null===(y=e.pageActions)||void 0===y?void 0:y.triggers)&&void 0!==b?b:[]),F=function(e,t,n,r){return new Ro(e,t,n,r)}(L,D,A,e);return{name:T,type:"enrichment",setup:function(t,n){return l(void 0,void 0,void 0,function(){var r,i,o,a,l,c,f,p,g,v,m,y,b,w,k,U,j,B,q,W,V,$,K,H,G,J,Y,X,Q,Z,ee,te,ne,re,ie,oe,se,ae,le,ue,ce,de,he;return u(this,function(u){return"undefined"==typeof document||(A.setPageViewApiKey(t.apiKey),He(t.apiKey),r=!1,t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(t){!function(t){var n,r;t&&(e.pageActions=s(s({},e.pageActions),t),L=Po(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),D=Ao(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),F.update(L,D,e))}(t)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),!0===e.shadowDomEnabled&&("number"!=typeof(i=e.maxShadowDomDepth)&&(i=1),A.updateSelectorConfig({shadowDomEnabled:!0,maxShadowDomDepth:i})),(o=qo(t,A))&&P.push({unsubscribe:o}),a=so(e,e.cssSelectorAllowlist),l=so(e,e.actionClickAllowlist),c=N(),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(vo).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(pi,e.targetElementProperties)})}({allObservables:c,amplitude:n,shouldTrackEvent:a,evaluateTriggers:F.evaluate.bind(F)}),P.push(f),p=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(vo).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))})}({allObservables:c,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return A.getEventProperties.apply(A,h(h([],d(e),!1),[S],!1))},amplitude:n,shouldTrackEvent:a,evaluateTriggers:F.evaluate.bind(F)}),P.push(p),g=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,s=e.shouldTrackActionClick,a=n.clickObservable,l=n.mutationObservable,u=n.navigateObservable,c=a.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=uo(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(vo).filter(function(e){return s("click",e.closestTrackedAncestor)}),d=u?Ln(l,u):l,h=Ln(c,d),f=null,p=null;return Nn(h,function(e){if(f&&(clearTimeout(f),f=null),"click"===e.type)return p=e,f=setTimeout(function(){f=null,p=null},500),Promise.resolve(null);if(p){var t=p;return p=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==t||t.track(pi,i("click",e.closestTrackedAncestor)))})}({allObservables:c,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return A.getEventProperties.apply(A,h(h([],d(e),!1),[S],!1))},amplitude:n,shouldTrackEvent:a,shouldTrackActionClick:l}),g&&P.push(g),v=function(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0,minY:0},r=!0,i=function(){var e=wo(),t=e.x,i=e.y;n.maxX=t,n.maxY=i,n.minY=i,r=!1};i();var o=t.subscribe(function(){var e=wo(),t=e.x,i=e.y;if(r)return n.maxX=t,n.maxY=i,n.minY=i,void(r=!1);n.maxX=Math.max(n.maxX,t),n.maxY=Math.max(n.maxY,i),n.minY=Math.min(n.minY,i)});return{unsubscribe:function(){o.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0,n.minY=0,r=!0},isAwaitingSeed:function(){return r},seed:function(){return!!r&&(i(),!0)}}}({allObservables:c,amplitude:n}),P.push(v),m=s({},v.getState()),y=function(){v.seed();var e=v.getState();m.maxX=e.maxX,m.maxY=e.maxY,m.minY=e.minY},b=!1,w=!1,k=!1,j={},B=z(),W=function(){var e;v.reset();var t=v.getState();m.maxX=t.maxX,m.maxY=t.maxY,m.minY=t.minY,_.clear(),M.clear(),R.clear(),null===(e=j.exposure)||void 0===e||e.reset(),null==q||q.reset()},V=function(){b=!0},$=function(e){if(b)return e?void W():void(w=!0);e&&(null==q||q.reset()),e&&r?W():(e&&(r=!0,setTimeout(function(){r=!1},100)),function(e){var t,n,r,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=e.apiKey,f=o.getState(),p=z(),g=null!==(n=null==p?void 0:p.innerWidth)&&void 0!==n?n:0,v=null!==(r=null==p?void 0:p.innerHeight)&&void 0!==r?r:0,m=Array.from(s).filter(function(e){return!l.has(e)}),y=((t={})[mi]=yo(p),t["[Amplitude] Max Page X"]=f.maxX+g,t["[Amplitude] Max Page Y"]=f.maxY+v,t["[Amplitude] Min Page Y"]=f.minY,t[yi]=v,t[bi]=g,t[$e]=He(h),t["[Amplitude] Element Exposed"]=m,t),b=Ve(h);b&&(y[wi]=b);var w=function(){o.reset();var e=o.getState();d.maxX=e.maxX,d.maxY=e.maxY,d.minY=e.minY,a.clear(),l.clear(),null==u||u.reset()};0!==m.length||f.maxX!==d.maxX||f.maxY!==d.maxY||f.minY!==d.minY?(null==i||i.track("[Amplitude] Viewport Content Updated",y),d.maxX=f.maxX,d.maxY=f.maxY,d.minY=f.minY,m.forEach(function(e){l.add(e)}),s.clear(),c&&w()):c&&w()}({amplitude:n,scrollTracker:v,currentElementExposed:_,elementExposedForPage:M,elementExposedInSentEvents:R,exposureTracker:j.exposure,isPageEnd:e,lastScroll:m,apiKey:t.apiKey}))},H=function(){K&&(clearTimeout(K),K=void 0)},G=function(){H(),K=setTimeout(function(){K=void 0,J()},0)},J=function(){if(H(),null==U||U.removeEventListener("abort",G),U=void 0,b){b=!1,v.reset(),y();var e=w,t=k;w=!1,k=!1,e&&$(t)}},Y=function(){H(),null==U||U.removeEventListener("abort",G),U=void 0,w=!1,k=!1},X=function(){U&&!U.aborted||J()},Q=function(e){H(),null==U||U.removeEventListener("abort",G),U=void 0,e&&(e.aborted?J():(U=e,e.addEventListener("abort",G,{once:!0})))},Z=yo(B),ee=function(e){var t=yo(B);return t!==Z&&(b&&e&&e.deferScrollBaseline?(Y(),W(),Z=t,!0):(Z=t,$(!0),(null==e?void 0:e.deferScrollBaseline)?(V(),!0):(y(),!1)))},te=function(e,t){var n=yo(B),r=function(e,t){var n;if(void 0===t&&(t=z()),null==e||""===e)return yo(t);var r=(null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.href)||"http://localhost/";try{return mo(new URL(e,r).href)}catch(e){return yo(t)}}(t,B);n!==r?(Z=r,$(!0),e(),y()):e()},ne=function(e){!function(e,t,n,r,i){if(!t.has(e)&&!n.has(e)){t.add(e),r.add(e);var o=Array.from(r);JSON.stringify(o).length>=18e3&&i(!1)}}(e,M,R,_,$)},C&&(j.exposure=Vo({allObservables:c,onExposure:ne,dataExtractor:A,exposureDuration:E}),j.exposure&&P.push(j.exposure),q=$o({mutationObservable:c[zo.MutationObservable],onRescan:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),null==O||O()},onFlush:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),$(!1)},exposureDuration:E}),q.start(),P.push({unsubscribe:function(){null==q||q.stop()}}),re=function(){if(b)return k=!0,w=!0,void J();$(!0)},null==B||B.addEventListener("beforeunload",re),I=function(){null==B||B.removeEventListener("beforeunload",re)},P.push({unsubscribe:function(){return I()}}),(ie=c[zo.NavigateObservable])?(P.push(ie.subscribe(function(e){var t,n,r,i=null===(n=null===(t=e.event)||void 0===t?void 0:t.destination)||void 0===n?void 0:n.url;if(i){var o=mo(i);if(o===Z)return;return b?(w=!1,k=!1,Z=o,$(!0),void Q(e.event.signal)):(Z=o,$(!0),V(),void Q(e.event.signal))}ee({deferScrollBaseline:!0})&&Q(null===(r=e.event)||void 0===r?void 0:r.signal)})),(oe=window.navigation)&&(oe.addEventListener("navigatesuccess",J),oe.addEventListener("navigateerror",X),P.push({unsubscribe:function(){Y(),b=!1,oe.removeEventListener("navigatesuccess",J),oe.removeEventListener("navigateerror",X)}}))):B&&(se=function(){ee()},B.addEventListener("popstate",se),ae=B.history.pushState,le=B.history.replaceState,B.history&&ae&&(B.history.pushState=new Proxy(ae,{apply:function(e,t,n){te(function(){e.apply(t,n)},n[2])}})),B.history&&le&&(B.history.replaceState=new Proxy(le,{apply:function(e,t,n){te(function(){e.apply(t,n)},n[2])}})),P.push({unsubscribe:function(){B.removeEventListener("popstate",se),B.history&&ae&&(B.history.pushState=ae),B.history&&le&&(B.history.replaceState=le)}}))),null===(he=null==t?void 0:t.loggerProvider)||void 0===he||he.log("".concat(T," has been successfully added.")),window.opener&&x.enabled&&(ue=e.cssSelectorAllowlist,ce=e.actionClickAllowlist,function(e,t){var n=e;if(!0!==n[bo]){n[bo]=!0;var r=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,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};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 n;a=null===(n=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===n?void 0:n.call(window,{getEventTagProps:r.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:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:fi}}}),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)})}}(de=Wn(),{dataExtractor:A,isElementSelectable:so(e,h(h([],d(ue),!1),d(ce),!1)),cssSelectorAllowlist:ue,actionClickAllowlist:ce}),Kn(de),de.setup(s({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:jn[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,n,r;return u(this,function(i){try{for(e=c(P),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]})})}}},Ho=["mutation","navigate"];function Go(e,t){var n,r,i,o,s=t.event,a=s.pageX,l=s.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:l,l),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r: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 Jo(e){if(0===e.length)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:s({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function Yo(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.pointerDownObservable,s=r.selectionObservable,a=[],c={},d=null;function h(e){a=[],c={},e&&(Go(c,e),a.push(e))}var f=Nn(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(n){return Go(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 n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(a,e)||c.isOutOfBounds?(d&&(t=Jo(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(Jo(a))},1e3)}})]:[2,null]})})}),p=null==s?void 0:s.subscribe(function(){h()}),g=f.subscribe(function(e){null!==e&&n.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){g.unsubscribe(),null==p||p.unsubscribe()}}}var Xo,Qo;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(Xo||(Xo={})),function(e){e.X="x",e.Y="y"}(Qo||(Qo={}));function Zo(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function es(e){e.changes=[],e.startTime=void 0}function ts(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length;r++){if(i-t[r]<n)break}0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var ns=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?20:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new _n(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},s=void 0,a=null;function l(){void 0!==s&&(e.next(s),s=void 0,null!==a&&clearTimeout(a),es(n),es(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),function(e){var t=+Date.now();e.startTime=e.startTime||t;var n=e.changes,r=e.changesThreshold;n.push(t),n.length>r&&n.shift()}(e===Qo.X?n:i);var t=function(e,t){var n=void 0;if(Zo(e)&&(n=e.startTime),Zo(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return t?(s=s||t,a=setTimeout(function(){l(),a=null},o)):l(),ts(n),ts(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},rs=function(e){var t=e.amplitude,n=e.options,r=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 _n(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==n?(o.x>n.x?(r===Xo.DECREASING&&e.next(Qo.X),r=Xo.INCREASING):o.x<n.x&&(r===Xo.INCREASING&&e.next(Qo.X),r=Xo.DECREASING),o.y>n.y?(i===Xo.DECREASING&&e.next(Qo.Y),i=Xo.INCREASING):o.y<n.y&&(i===Xo.INCREASING&&e.next(Qo.Y),i=Xo.DECREASING),n=o):n=o})})}({allWindowObservables:r});return ns({mouseDirectionChangeObservable:l,directionChanges:o,thresholdMs:a}).subscribe(function(e){oo(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function is(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var os=4e3,ss=function(e){var t;void 0===e&&(e={});var n="@amplitude/plugin-frustration-browser",r=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var o=!1!==e.deadClicks&&null!==e.deadClicks,a=!1!==e.rageClicks&&null!==e.rageClicks,f=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(f=!1);var p=is(e,"rageClicks",qt,a),g=is(e,"deadClicks",jt,o),v=is(e,"errorClicks",Bt,i),m=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:Dt,y=new Bo(e),b=h([],d(new Set(h(h(h([],d(p),!1),d(g),!1),d(v),!1))),!1),w=function(){var e,t,n=function(e){return Dn(Eo(e).map(function(e){return y.addAdditionalEventProperties(e,"click",b,m,!0)}))},r=n("click"),i=n("pointerdown"),o=Dn(Io().map(function(e){return y.addTypeAndTimestamp(e,"error")})),a=Dn(Co(y.shadowGate).map(function(e){return y.addAdditionalEventProperties(e,"mutation",b,m)}));window.navigation&&(t=Dn(new _n(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=Dn(new _n(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 n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),u=Dn(new _n(function(e){var t=function(t){e.next(t)},n={capture:!0};return So.document.addEventListener("mousemove",t,n),function(){So.document.removeEventListener("mousemove",t,n)}}));return(e={})[zo.ClickObservable]=r,e[zo.PointerDownObservable]=i,e[zo.MutationObservable]=a,e[zo.NavigateObservable]=t,e[zo.BrowserErrorObservable]=o,e[zo.SelectionObservable]=l,e[zo.MouseMoveObservable]=u,e};return{name:n,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,T;return u(this,function(u){return"undefined"==typeof document||(y.setPageViewApiKey(t.apiKey),l=w(),(d=qo(t,y))&&r.push({unsubscribe:d}),a&&(h=so(e,p),b=Yo({allObservables:l,amplitude:c,shouldTrackRageClick:h}),r.push(b)),o&&(S=so(e,g),k=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,o=n.clickObservable,a=n.mutationObservable,l=n.navigateObservable,u=o.filter(function(e){return vo(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===to.LEFT_OR_TOUCH_CONTACT}),c=l?Ln(a,l):a,d=Ln(u,c),h=null;return Nn(d,function(e){return h&&Ho.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 n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",s(s({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}})}({amplitude:c,allObservables:l,getEventProperties:function(e,t){return y.getEventProperties(e,t,m)},shouldTrackDeadClick:S}),r.push(k)),i&&(x=so(e,v),C=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackErrorClick,i=n.pointerDownObservable,o=n.browserErrorObservable,a=i.filter(function(e){return vo(e)&&r("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===to.LEFT_OR_TOUCH_CONTACT}),l=null,u=null,c=function(){null!==l&&(clearTimeout(l),l=null),u=null};return Ln(a,o).subscribe(function(e){var n;if("click"===e.type)return c(),u=e,void(l=setTimeout(c,2e3));"error"===e.type&&u&&(t.track("[Amplitude] Error Click",s(((n={})["[Amplitude] Kind"]=e.event.kind,n["[Amplitude] Message"]=e.event.message,n["[Amplitude] Stack"]=e.event.stack,n["[Amplitude] Filename"]=e.event.filename,n["[Amplitude] Line Number"]=e.event.lineNumber,n["[Amplitude] Column Number"]=e.event.columnNumber,n),u.targetElementProperties)),c())})}({amplitude:c,allObservables:l,shouldTrackErrorClick:x}),r.push(C)),f&&(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>os&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(I," is above the maximum of ").concat(os,", setting to ").concat(os)),I=os)),O=rs({amplitude:c,options:e,allObservables:l,directionChanges:E,thresholdMs:I}),r.push(O)),null===(T=null==t?void 0:t.loggerProvider)||void 0===T||T.log("".concat(n," 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]})})}}};function as(e,t){var n=e.startTime+e.duration;return t.filter(function(t){return t.startTime<n&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}function ls(e,t){var n,r=as(e,t),i=null!==(n=e.scripts)&&void 0!==n?n:[],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},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),{"[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 us(e,t){var n,r=as(e,t),i=null!==(n=e.attribution)&&void 0!==n?n:[];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},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}function cs(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,i=void 0===r?100:r,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,n,r=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&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}for(var l=r-1e4;s.length>0&&s[0].startTime<l;)s.shift()});try{a.observe({entryTypes:["measure"]})}catch(e){}var l=new PerformanceObserver(function(e){var r,a;try{for(var l=c(e.getEntries()),u=l.next();!u.done;u=l.next()){var d=u.value;if(!oo(n))return;if(!(d.duration<i)){var h="long-animation-frame"===o?ls(d,s):us(d,s);t.track("[Amplitude] Main Thread Block",h)}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(r)throw r.error}}});try{l.observe({entryTypes:[o]})}catch(e){return a.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){l.disconnect(),a.disconnect()}}}var ds,hs,fs=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",n=[],r=!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||(r&&(s=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(s=e.mainThreadBlock.durationThreshold),a=cs({amplitude:o,options:e,durationThreshold:s}),n.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,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]})})}}},ps="[Amplitude] Network Request",gs="500-599";function vs(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function ms(e,t){var n,r,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){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function ys(e){var t;if(e)try{var n=null===(t=z())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),s=r.href,a=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:r.href,host:a}}catch(t){try{return function(e){var t,n=e.indexOf("#"),r=n>=0?e.slice(n+1):"",i=n>=0?e.slice(0,n):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:r,href:e,hrefWithoutQueryOrHash:a,host:null!==(t=null==l?void 0:l[1])&&void 0!==t?t:""}}(e)}catch(e){return}}}function bs(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 ws(e){var t,n,r;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null==e?void 0:e.blocklist)||void 0===n?void 0:n.length)&&!(null===(r=null==e?void 0:e.excludelist)||void 0===r?void 0:r.length)}function Ss(e,t){var n;void 0===t&&(t={});var r=ys(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(vs(o,"*.amplitude.com")||vs(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find(function(e){return vs(o,e)}))return!1;if(!t.captureRules&&void 0!==e.status&&!ms(e.status,gs))return!1;if(t.captureRules&&(h([],d(t.captureRules),!1).reverse().find(function(t){if(i=function(e,t,n,r,i){if((!e.hosts||e.hosts.find(function(e){return vs(t,e)}))&&(!r||!e.urls||Je(r,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return!((n||0===n)&&!ms(n,e.statusCodeRange||gs))}(t,o,e.status,e.url,e.method),i){var n=bs(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var s=bs(t.requestHeaders);if(e.requestWrapper&&s){var a=e.requestWrapper.headers(s);a&&(e.requestHeaders=a)}if(e.responseWrapper&&t.responseBody&&!ws(t.responseBody)){var l=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,l)}if(e.requestWrapper&&t.requestBody&&!ws(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 n=t.body;if("string"!=typeof n)return!1;if(JSON.parse(n).events.find(function(e){return e.event_type===ps}))return!0}catch(e){}return!1}(o,e.requestWrapper)}function ks(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return Ss(e.event,n)}).subscribe(function(e){var t,n,o,s=e.event,a=ys(s.url);if(a){var c=null===(n=s.responseWrapper)||void 0===n?void 0:n.bodySize,h=null===(o=s.requestWrapper)||void 0===o?void 0:o.bodySize;!function(e,t,n,r){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==r||r.debug("Failed to stringify request body",e)}if(s)try{e["[Amplitude] Response Body"]=JSON.stringify(s)}catch(e){null==r||r.debug("Failed to stringify response body")}a.label=2;case 2:return null==n||n.track(ps,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,r,i)}})}!function(e){e.NetworkObservable="networkObservable"}(ds||(ds={}));var xs=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new _n(function(e){var n=new on(function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)});return ln.subscribe(n,t),function(){ln.unsubscribe(n)}});return(e={})[ds.NetworkObservable]=n,e};return{name:n,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=r(),t=null==i?void 0:i.loggerProvider,hs=ks({allObservables:s,networkTrackingOptions:e,amplitude:o,loggerProvider:t}),null==t||t.log("".concat(n," 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 hs.unsubscribe(),[2]})})}}},Cs="web-vitals-browser",Es="[Amplitude] Web Vitals",Is={LCP:"[Amplitude] LCP",FCP:"[Amplitude] FCP",INP:"[Amplitude] INP",CLS:"[Amplitude] CLS",TTFB:"[Amplitude] TTFB"};let Os=-1;const Ts=()=>Os,Ps=e=>{addEventListener("pageshow",t=>{t.persisted&&(Os=t.timeStamp,e(t))},!0)},As=(e,t,n,r)=>{let i,o;return s=>{t.value>=0&&(s||r)&&(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,n),e(t)))}},Ms=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Rs=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},_s=()=>Rs()?.activationStart??0;let Ns=-1;const Ls=new Set,Ds=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Fs=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of Ls)e();isFinite(Ns)||(Ns="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Fs,!0))}},Us=(e=!1)=>{if(e&&(Ns=1/0),Ns<0){const e=_s(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;Ns=t??Ds(),addEventListener("visibilitychange",Fs,!0),addEventListener("prerenderingchange",Fs,!0),Ps(()=>{setTimeout(()=>{Ns=Ds()})})}return{get firstHiddenTime(){return Ns},onHidden(e){Ls.add(e)}}},js=(e,t=-1,n,r=0,i,o,s)=>{const a=Rs(),l=a?.navigationId||0;let u="navigate";return n?u=n:Ts()>=0?u="back-forward-cache":a&&(document.prerendering||_s()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:r||l,navigationInteractionId:i,navigationURL:o||a?.name,navigationStartTime:s||0}},Bs=new WeakMap;function qs(e,t){let n=Bs.get(t);return n||(n=new WeakMap,Bs.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}class zs{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const Ws=(e,t,n={})=>{try{const r=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(r.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();r.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of r)e.observe({type:t,buffered:!0,...n});return e}}catch{}},Vs=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,$s=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Ks=e=>{let t=!1;return()=>{t||(e(),t=!0)}};class Hs{l}const Gs=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Js=[1800,3e3],Ys=(e,t={})=>{const n=Vs(t);Gs(()=>{const r=qs(t,Hs),i=Us();let o,s=js("FCP");const a=Ws(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),t.startTime<i.firstHiddenTime&&(s.value=Math.max(t.startTime-_s(),0),s.entries.push(t),s.navigationId=t.navigationId||s.navigationId,o(!0)))});a&&(o=As(e,s,Js,t.reportAllChanges),Ps(n=>{s=js("FCP",-1,"back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Ts()),o=As(e,s,Js,t.reportAllChanges),Ms(()=>{s.value=performance.now()-n.timeStamp,o(!0)})})),n&&Ws(["soft-navigation"],n=>{n.forEach(n=>{r.l&&n.navigationId&&$s(r.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);s=js("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o=As(e,s,Js,t.reportAllChanges),o(!0)})},t)})},Xs=[.1,.25],Qs=(e,t={})=>{const n=Us();Ys(Ks(()=>{let r,i=js("CLS",0);const o=qs(t,zs),s=(n,s,a,l,u)=>{i=js("CLS",0,n,s,a,l,u),o.i=0,r=As(e,i,Xs,t.reportAllChanges)},a=(e=!1)=>{o.i>i.value&&(i.value=o.i,i.entries=o.o),r(e)},l=e=>{a(!0),s("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=e=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):l(t);a()},c=["layout-shift"];Vs(t)&&c.push("soft-navigation");const d=Ws(c,u);d&&(r=As(e,i,Xs,t.reportAllChanges),n.onHidden(()=>{u(d.takeRecords()),r(!0)}),Ps(()=>{s("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,Ts()),Ms(r)}),setTimeout(r))}))};let Zs=0,ea=1/0,ta=0;const na=e=>{for(const t of e)t.interactionId&&(ea=Math.min(ea,t.interactionId),ta=Math.max(ta,t.interactionId),Zs=ta?(ta-ea)/7+1:0)};let ra;const ia=()=>ra?Zs:performance.interactionCount??0;class oa{u=0;v=[];m=new Map;p;T;_(){return ia()-this.u}M(){this.u=ia(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}}const sa=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const i=Ks(e);let o=-1;const s=()=>{r(o),i()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),o=n(()=>{removeEventListener("visibilitychange",s,{capture:!0}),i()},{timeout:t})}},aa=[200,500],la=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=Us();Gs(()=>{"interactionCount"in performance||ra||(ra=Ws(["event"],na,{durationThreshold:0}));let r,i=js("INP");const o=qs(t,oa),s=(n,s,a,l,u)=>{o.M(),i=js("INP",-1,n,s,a,l,u),r=As(e,i,aa,t.reportAllChanges)},a=()=>{const e=o.L(i.navigationType);e&&e.P!==i.value&&(i.value=e.P,i.entries=e.entries,r())},l=e=>{a(),r(!0),s("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{sa(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):l(t);a(),t&&r(!0)})},c=["event","first-input"];Vs(t)&&c.push("soft-navigation");const d=Ws(c,u,{...t,durationThreshold:t.durationThreshold??40});r=As(e,i,aa,t.reportAllChanges),d&&(n.onHidden(()=>{u(d.takeRecords(),!0)}),Ps(()=>{s("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,Ts())}))})};class ua{p;l;h(e){this.p?.(e)}}const ca=[2500,4e3],da=(e,t={})=>{let n=!1;const r=Vs(t);Gs(()=>{let i,o=Us(),s=js("LCP");const a=qs(t,ua),l=(r,a,l,u,c)=>{s=js("LCP",-1,r,a,l,u,c),i=As(e,s,ca,t.reportAllChanges),n=!1,"soft-navigation"===r&&(o=Us(!0))},u=e=>{a.l&&e.navigationId&&$s(a.l,e),n||i(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&c([t])},c=e=>{t.reportAllChanges||r||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){u(t);continue}let e=0,n=[],r=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-_s(),0),a.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const i=t;if(!s.navigationId)continue;if("interactionId"in i&&i.interactionId!=s.navigationInteractionId)continue;r=i.largestContentfulPaint?.renderTime||0,e=Math.max(r-t.startTime,0),i.largestContentfulPaint&&(a.h(i.largestContentfulPaint),n=[i.largestContentfulPaint])}r<o.firstHiddenTime&&(s.value=e,s.entries=n,i())}},d=["largest-contentful-paint"];r&&d.push("interaction-contentful-paint","soft-navigation");const h=Ws(d,c);if(h){i=As(e,s,ca,t.reportAllChanges);const o=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!n){const e=s.id;sa(()=>{if(!n){if(!r){h.disconnect();for(const e of o)removeEventListener(e,a,{capture:!0})}e===s.id&&(n=!0,i(!0))}})}};for(const e of o)addEventListener(e,a,{capture:!0});Ps(r=>{l("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Ts()),i=As(e,s,ca,t.reportAllChanges),Ms(()=>{s.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})},ha=[800,1800],fa=e=>{document.prerendering?Gs(()=>fa(e)):"complete"!==document.readyState?addEventListener("load",()=>fa(e),!0):setTimeout(e)},pa=(e,t={})=>{const n=Vs(t);let r=js("TTFB"),i=As(e,r,ha,t.reportAllChanges);fa(()=>{const o=Rs();if(o){const s=o.responseStart;r.value=Math.max(s-_s(),0),r.entries=[o],i(!0),Ps(()=>{r=js("TTFB",0,"back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Ts()),i=As(e,r,ha,t.reportAllChanges),i(!0)}),n&&Ws(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(r=js("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),r.entries=[n],i=As(e,r,ha,t.reportAllChanges),i(!0))})},t)}})};function ga(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function va(e,t){void 0===t&&(t=!1);var n={value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(ga(e)),navigationStart:t?Math.floor(performance.timeOrigin+(e.navigationStartTime||0)):Math.floor(performance.timeOrigin)};return t&&(n.navigationId=e.navigationId),n}var ma=Object.values(Is);var ya,ba=function(){var e,t=null,n=z(),r=null==n?void 0:n.document,i=null==n?void 0:n.location,o=!1,s=new Set;return{name:Cs,type:"enrichment",setup:function(n,a){return l(void 0,void 0,void 0,function(){var l,d,h,f,p,g,v,m;return u(this,function(u){return void 0===r||(o=!0,l=new Map,d=-1,h=function(e){var t=e.navigationId,o=l.get(t);return o||(o=function(e,t,n){var r="",i="";try{var o=new URL(e);r=o.hostname,i=o.pathname}catch(e){n.debug("Web vitals plugin is unable to parse page URL: ",e)}var s=Ye(e,n);return{"[Amplitude] Page Domain":r,"[Amplitude] Page Location":s,"[Amplitude] Page Path":Ye(i,n),"[Amplitude] Page Title":t,"[Amplitude] Page URL":Ye(s.split("?")[0],n)}}(e.navigationURL||(null==i?void 0:i.href)||"",r.title||"",n.loggerProvider),l.set(t,o)),o},f=function(e){s.add(e);var t=l.get(e);t&&(l.delete(e),function(e){return ma.some(function(t){return t in e})}(t)&&a.track(Es,t))},p=function(){var e,t;try{for(var n=c(Array.from(l.keys())),r=n.next();!r.done;r=n.next()){var i=r.value;f(i)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},g=function(t){void 0!==e&&clearTimeout(e),e=setTimeout(function(){var n,r;e=void 0;try{for(var i=c(Array.from(l.keys())),o=i.next();!o.done;o=i.next()){var s=o.value;s<t&&f(s)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},1e3)},m={reportSoftNavs:!0},da((v=function(e){return function(t){o&&!s.has(t.navigationId)&&(h(t)[e]=va(t,!0),t.navigationId>d&&(-1!==d&&g(t.navigationId),d=t.navigationId))}})(Is.LCP),m),Ys(v(Is.FCP),m),la(v(Is.INP),m),Qs(v(Is.CLS),m),pa(v(Is.TTFB),m),t=function(){"hidden"===r.visibilityState&&t&&p()},r.addEventListener("visibilitychange",t)),[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(n){return o=!1,void 0!==e&&(clearTimeout(e),e=void 0),t&&(null==r||r.removeEventListener("visibilitychange",t),t=null),[2]})})}}},wa=function(e){return void 0===e&&(e={}),!0===e.reportSoftNav&&function(){var e=z();return e&&"PerformanceSoftNavigation"in e}()?ba():function(){var e=null,t=z(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:Cs,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===n||(o=Ye((null==r?void 0:r.href)||"",t.loggerProvider),s={"[Amplitude] Page Domain":(null==r?void 0:r.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":Ye((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":Ye(o.split("?")[0],t.loggerProvider)},da(function(e){s["[Amplitude] LCP"]=va(e)}),Ys(function(e){s["[Amplitude] FCP"]=va(e)}),la(function(e){s["[Amplitude] INP"]=va(e)}),Qs(function(e){s["[Amplitude] CLS"]=va(e)}),pa(function(e){s["[Amplitude] TTFB"]=va(e)}),e=function(){"hidden"===n.visibilityState&&e&&(i.track(Es,s),n.removeEventListener("visibilitychange",e),e=null)},n.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==n||n.removeEventListener("visibilitychange",e)),[2]})})}}}()},Sa=function(){function e(e,t){var n,r,i;this.shouldTrackNewCampaign=!1,this.options=s({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=(null===(n=t.cookieOptions)||void 0===n?void 0:n.domain)||t.topLevelDomain,i=r,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[]),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=it(t.apiKey,"MKTG"),this.webExpStorageKey=it(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=R,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(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return t=d.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||Re(this.sessionTimeout,this.lastEventTime),qr(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return 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 un).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,i,o=(t=this.currentCampaign,n=this.options,r=s(s({},R),t),i=Object.entries(r).reduce(function(e,t){var r,i=d(t,2),o=i[0],s=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=s?s:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),s?e.set(o,s):e.unset(o)},new F),te(i));return e&&(o.event_id=e),o},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),ka=new Set([o.IDENTIFY,o.GROUP_IDENTIFY]),xa=function(e){var t;void 0===e&&(e={});var n,r,i,o,a,c,d=null!==(t=e.fallbackAttributionEvent)&&void 0!==t&&t,h=z(),f={},p=!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 un).parse()];case 1:return e=t.sent(),f=Ze(e),d&&(null==r||r.log("Tracking attribution fallback event."),null==n||n.track("[Amplitude] Attribution",f)),[2]}})})},m=function(){v()},y=function(e){return new Proxy(e,{apply:function(e,t,n){Reflect.apply(e,t,n),p&&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 n=t,r=e.loggerProvider,p=!0,r.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 ka.has(e.event_type)||(e.event_properties=s(s({},f),e.event_properties)),[2,e]})})},teardown:function(){return l(void 0,void 0,void 0,function(){var e,t;return u(this,function(n){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)),p=!1,g=!1,i=void 0,o=void 0,a=void 0,c=void 0,f={},[2]})})}}},Ca="AMP_CURRENT_PAGE",Ea="AMP_PREVIOUS_PAGE",Ia="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(ya||(ya={}));var Oa=new Set([o.IDENTIFY,o.GROUP_IDENTIFY,o.REVENUE]),Ta=function(e){var t=(void 0===e?{}:e).internalDomains,n=void 0===t?[]:t,r=z(),i=void 0,o=!1,a=void 0,c=!1,h=!1,f=function(e){var t;try{t=new URL(e).hostname}catch(e){null==a||a.error("Could not parse URL: ",e)}return t},p=function(e){var t="undefined"!=typeof location&&location.hostname||"",r=e?f(e):void 0;if(!r)return ya.Direct;var i=n.some(function(e){return-1!==t.indexOf(e)}),o=n.some(function(e){return-1!==r.indexOf(e)});return t===r||o&&i?ya.Internal:ya.External},g=function(){return l(void 0,void 0,void 0,function(){var e,t,n,r,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=Ye("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[Ca])||"",r=void 0,r=t===n?(null==e?void 0:e[Ea])||"":n||(document.referrer||""),[4,i.set(Ia,(s={},s[Ca]=t,s[Ea]=r,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,n,s,l,p,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,!r)return[3,7];try{i=new ot(r.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||"",n=t?f(t):void 0,s="undefined"!=typeof location&&location.hostname||"",l=Ye("undefined"!=typeof location&&location.href||""),[4,i.get(Ia)]):[3,6];case 2:return p=u.sent(),m=(null==p?void 0:p[Ca])||"",!!n&&n!==s&&m!==l?[4,i.set(Ia,(y={},y[Ca]=l,y[Ea]=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:r.addEventListener("popstate",v),c||(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=d(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),h&&v()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=d(n,3),i=r[0],o=r[1],s=r[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,n,r;return u(this,function(a){switch(a.label){case 0:return t=Ye("undefined"!=typeof location&&location.href||""),i&&o?[4,i.get(Ia)]:[3,2];case 1:if(n=a.sent(),r=(null==n?void 0:n[Ea])||"",Oa.has(e.event_type))return[2,e];e.event_properties=s(s({},e.event_properties||{}),{"[Amplitude] Page Domain":Pa(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":Pa(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":Pa(e,"[Amplitude] Page Path","undefined"!=typeof location&&Ye(location.pathname)||""),"[Amplitude] Page Title":Pa(e,"[Amplitude] Page Title",vn(gn)),"[Amplitude] Page URL":Pa(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":r,"[Amplitude] Previous Page Type":p(r)}),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 r&&(r.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 Pa(e,t,n){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?n:e.event_properties[t]}var Aa,Ma=function(){var e,t,n;function r(t){if(t)try{var n=new Function("return "+t)();if("function"==typeof n)return n;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){n=e&&function(e){return"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body}(e)?r(e.body||""):r("")}),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 r;return u(this,function(i){if(n)try{return[2,null!==(r=n(t))&&void 0!==r?r:null]}catch(n){return null==e||e.error("Could not execute custom enrichment function",n),[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},Ra="userProperty",_a="eventProperty",Na=function(e){return e===Ra||e===_a},La=[Ra,_a],Da=function(e,t){return function(e){var t=h([],d(new Set((Array.isArray(e)?e:[e]).filter(Na))),!1);return t.length>0?t:h([],d(La),!1)}(e.trackingMethod).includes(t)},Fa=function(e){return Da(e,Ra)},Ua=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return r(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),ne(this._init(s(s({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i,o,c,d,h,f;return l(this,void 0,void 0,function(){var p,g,v,m,y,b,w,S,k,x,C,E,I,O,T,P=this;return u(this,function(A){switch(A.label){case 0:return this.initializing?[2]:(this.initializing=!0,p=function(e){var t,n;return void 0===e&&(e={}),!0===(null===(t=e.remoteConfig)||void 0===t?void 0:t.fetchRemoteConfig)||!1!==(null===(n=e.remoteConfig)||void 0===n?void 0:n.fetchRemoteConfig)&&!1!==e.fetchRemoteConfig}(t),g=null!==(n=t.loggerProvider)&&void 0!==n?n:new ae,t.loggerProvider||g.enable(null!==(r=t.logLevel)&&void 0!==r?r:oe.Warn),v=null!==(i=t.serverZone)&&void 0!==i?i:"US",y=this._diagnosticsSampleRate,b=null===(o=t.enableDiagnostics)||void 0===o||o,p?(m=new Ot(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,n,r){if(g.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},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:A.sent(),A.label=2;case 2:return(w=new yt(t.apiKey,g,v,{enabled:b,sampleRate:y})).setTag("library","".concat(fr,"/").concat(hr)),w.setTag("platform","Web"),w.setTag("web_environment",function(){var e=z();if(!e)return"unknown";var t=function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.chrome)||void 0===t?void 0:t.runtime)||void 0===n?void 0:n.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,n;return"string"==typeof(null===(n=null===(t=e.process)||void 0===t?void 0:t.versions)||void 0===n?void 0:n.node)}(e)?"node":"unknown"}()),"undefined"!=typeof navigator&&w.setTag("user_agent",navigator.userAgent),[4,Jr(t.apiKey,t,this,w,{loggerProvider:g,serverZone:v,enableDiagnostics:b,diagnosticsSampleRate:y})];case 3:return S=A.sent(),p&&m?[4,new Promise(function(e){null==m||m.subscribe("configs.analyticsSDK.browserSDK","all",function(t,n,r){S.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&hi(t,S),e()})})]:[3,5];case 4:A.sent(),A.label=5;case 5:return[4,e.prototype._init.call(this,S)];case 6:return A.sent(),this.logBrowserOptions(S),this.config.remoteConfigClient=m,k=function(e){return Xn(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?s({},e.defaultTracking.attribution):{}}(this.config),Xn(this.config.defaultTracking)&&Fa(k)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return l(P,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[3,2]:(this.webAttribution=new Sa(k,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new Sa(k,this.config),[4,this.webAttribution.init()]):[3,8];case 7:A.sent(),A.label=8;case 8:return x=Le(),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!==(f=null!==(h=null!==(d=t.sessionId)&&void 0!==d?d:I)&&void 0!==h?h:O)&&void 0!==f?f:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return l(P,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]})})}),(T=Ae(this.config.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,10]:[4,this.add(di()).promise];case 9:A.sent(),A.label=10;case 10:return[4,this.add(new ke({diagnosticsClient:w})).promise];case 11:return A.sent(),[4,this.add(new pr).promise];case 12:return A.sent(),[4,this.add(new Me).promise];case 13:return A.sent(),function(e){ci||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."),ci=!0)}(this.config),R=this.config.defaultTracking,Yn(R,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(ui()).promise]):[3,15];case 14:A.sent(),A.label=15;case 15:return Qn(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(si()).promise]):[3,17];case 16:A.sent(),A.label=17;case 17:return Zn(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Zr(ur(this.config))).promise]):[3,20];case 18:return A.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return l(P,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(Zr(ur(this.config))).promise]);case 1:return t.sent(),[2]}})})}),A.label=20;case 20:return Xn(this.config.defaultTracking)&&function(e){return Da(e,_a)}(k)?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(xa(k)).promise]):[3,22];case 21:A.sent(),A.label=22;case 22:return nr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Ko(sr(this.config),{diagnosticsClient:w})).promise]):[3,24];case 23:A.sent(),A.label=24;case 24:return ir(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(ss(ar(this.config))).promise]):[3,26];case 25:A.sent(),A.label=26;case 26:return tr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(xs(lr(this.config))).promise]):[3,28];case 27:A.sent(),A.label=28;case 28:return function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.webVitals||"object"==typeof e.webVitals&&null!==e.webVitals)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(wa(rr(this.config))).promise]):[3,30];case 29:A.sent(),A.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(fs(or(this.config))).promise]):[3,32];case 31:A.sent(),A.label=32;case 32:return function(e){return Yn(e,"pageUrlEnrichment")}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(Ta()).promise]):[3,34];case 33:A.sent(),A.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(Ma()).promise]):[3,36];case 35:A.sent(),A.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return A.sent(),T.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=a(t,["time"]),i=s(s({},"number"==typeof n&&{time:n}),e.groups&&{groups:e.groups});P.track(e.eventType,r,Object.keys(i).length?i:void 0)}),[2]}var M,R})})},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){Ae(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){Ae(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,n,r;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!==(r=e.userProperties)&&void 0!==r?r:{};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&&(n=s.return)&&n.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,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),ne(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,ne(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return ne(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId();r!==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,er(this.config.defaultTracking)&&(r&&i&&n.push(this.track(Pr,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,n);return this.config.identify&&n.push(this.track(te(this.config.identify)).promise),er(this.config.defaultTracking)&&n.push(this.track(Tr,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,ne(Promise.all(n))},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=Xr(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(dr(t)){var r=t._q;t._q=[],t=cr(new F,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(dr(r)){var o=r._q;r._q=[],r=cr(new F,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(dr(t)){var r=t._q;t._q=[],t=cr(new ie,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!Fa(this.webAttribution.options))return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return l(this,void 0,void 0,function(){var n,r,i;return u(this,function(o){return n=Date.now(),r=Re(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===Tr||t.event_type===Pr||t.session_id&&t.session_id!==this.getSessionId()||(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=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}(re),ja="[Amplitude]",Ba="".concat(ja," Session Replay ID"),qa=_t.US,za={enabled:!0},Wa=1e3,Va="".concat(ja," Session Replay Debug"),$a="https://api-sr.amplitude.com/sessions/v2/track",Ka="https://api-sr.eu.amplitude.com/sessions/v2/track",Ha="https://api-sr.stag2.amplitude.com/sessions/v2/track",Ga=9e6,Ja=/payload.*exceed/i,Ya=500,Xa=1e4,Qa=1024,Za="X-Session-Replay-Event-Skipped",el="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"}(Aa||(Aa={}));var tl=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 n=this.logger[e];return"function"==typeof n?(null!==(t=n.__rrweb_original__)&&void 0!==t?t:n).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),nl="medium";function rl(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?t.toLowerCase():null}var il=new Map,ol=function(e){var t=il.get(e);if(t)return t;var n="\0TRAIL\0",r="\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(/\/\*\*$/,n)).replace(/\/\*\*\//g,r)).replace(/\*\*/g,i)).replace(/\*/g,o)).replace(/\?/g,s)).replace(/[.+^${}()|[\]\\]/g,"\\$&")).split(n).join("(/.*)?")).split(r).join("/(.*\\/)?")).split(i).join(".*")).split(o).join(".*")).split(s).join(".");var l=new RegExp("^".concat(a,"$"));return il.set(e,l),l},sl=function(e,t,n){var r;switch(t){case"light":if("input"!==e)return!1;var i=n?rl(n):"";return!!i&&(!!["password","hidden","email","tel"].includes(i)||!!(null===(r=n.autocomplete)||void 0===r?void 0:r.startsWith("cc-")));case"medium":return"input"===e;case"conservative":return!0;default:return sl(e,nl,n)}},al=function(e,t){var n,r,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(ol(a.match).test(e))return a.maskLevel}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null!==(i=t.defaultMaskLevel)&&void 0!==i?i:nl},ll=function(e,t,n,r){var i,o;if(void 0===t&&(t={defaultMaskLevel:nl}),n){if(n.closest(".amp-mask, [data-amp-mask]"))return!0;var s=(null!==(i=t.maskSelector)&&void 0!==i?i:[]).some(function(e){return n.closest(e)});if(s)return!0;if(n.closest(".amp-unmask, [data-amp-unmask]"))return!1;var a=(null!==(o=t.unmaskSelector)&&void 0!==o?o:[]).some(function(e){return n.closest(e)});if(a)return!1}return sl(e,al(r,t),n)},ul=function(e,t,n){return function(r,i){return ll(e,t,i,null==n?void 0:n())?r.replace(/[^\s]/g,"*"):r}},cl=function(e,t){return function(n,r,i){var o;if("style"===n)return r;if(!(null!==(o=null==e?void 0:e.maskAttributes)&&void 0!==o?o:[]).includes(n))return r;var s=["INPUT","SELECT","TEXTAREA"].includes(i.tagName)?"input":"text";return ll(s,e,i,null==t?void 0:t())?r.replace(/[^\s]/g,"*"):r}},dl=function(e){var t=null==e?void 0:e.blockSelector;return h(h([],d("string"==typeof t?t?[t]:[]:null!=t?t:[]),!1),["[data-amp-block]"],!1).join(",")},hl=function(e,t){var n,r;return e&&("conservative"===al(t,e)||"conservative"===e.defaultMaskLevel||(null===(n=e.urlMaskLevels)||void 0===n?void 0:n.some(function(e){return"conservative"===e.maskLevel})))?"*":h(h([],d(null!==(r=null==e?void 0:e.maskSelector)&&void 0!==r?r:[]),!1),["[data-amp-mask]"],!1).join(",")};function fl(e,t){return t||("STAGING"===e?Ha:"EU"===e?Ka:$a)}var pl=function(){var e=z();return(null==e?void 0:e.location)?e.location.href:""},gl=function(e,t){var n,r;try{for(var i=c(t),o=i.next();!o.done;o=i.next()){var s=o.value,a=ol(s.selector);if(a.test(e))return e.replace(a,s.replacement)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},vl=function(){return l(void 0,void 0,void 0,function(){var e,t,n,r,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(),n=t.usage,r=t.quota,i=t.usageDetails,o=n?Math.round(n/Qa):0,s=n&&r?Math.round(1e3*(n/r+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:""}]}})})},ml=function(e){var t=s({},e),n=t.apiKey;return t.apiKey="****".concat(n.substring(n.length-4)),t},yl=function(){return{flushMaxRetries:2,logLevel:oe.Warn,loggerProvider:new ae,transportProvider:new wt}},bl=function(e){function t(t,n){var r,i,o,a,l,u,c,f,p,g,v,m,y,b,w=this,S=yl();(w=e.call(this,s(s({transportProvider:S.transportProvider,loggerProvider:new tl(n.loggerProvider||S.loggerProvider)},n),{apiKey:t}))||this).flushMaxRetries=void 0!==n.flushMaxRetries&&n.flushMaxRetries<=S.flushMaxRetries?n.flushMaxRetries:S.flushMaxRetries,w.apiKey=t,w.sampleRate=n.sampleRate||0,w.semanticCapture=n.semanticCapture,w.semanticAnalyticsContext=n.semanticAnalyticsContext,w.serverZone=n.serverZone||qa,w.configServerUrl=n.configServerUrl,w.trackServerUrl=n.trackServerUrl,w.shouldInlineStylesheet=n.shouldInlineStylesheet,w.inlineImages=n.inlineImages,w.version=n.version,w.performanceConfig=n.performanceConfig||za,w.storeType=null!==(r=n.storeType)&&void 0!==r?r:"memory",w.applyBackgroundColorToBlockedElements=null!==(i=n.applyBackgroundColorToBlockedElements)&&void 0!==i&&i,w.enableUrlChangePolling=null!==(o=n.enableUrlChangePolling)&&void 0!==o&&o,w.urlChangePollingInterval=null!==(a=n.urlChangePollingInterval)&&void 0!==a?a:Wa,w.captureDocumentTitle=null!==(l=n.captureDocumentTitle)&&void 0!==l&&l,void 0!==n.fullSnapshotIntervalMs&&(w.fullSnapshotIntervalMs=n.fullSnapshotIntervalMs),void 0!==n.eagerFullSnapshotSend&&(w.eagerFullSnapshotSend=n.eagerFullSnapshotSend),w.captureFullSnapshotOnFocus=null!==(u=n.captureFullSnapshotOnFocus)&&void 0!==u&&u,void 0!==n.maxPersistedEventsSizeBytes&&(w.maxPersistedEventsSizeBytes=Cl(n.maxPersistedEventsSizeBytes,Sl,kl,"maxPersistedEventsSizeBytes",w.loggerProvider)),void 0!==n.maxSingleEventSizeBytes&&(w.maxSingleEventSizeBytes=Cl(n.maxSingleEventSizeBytes,Sl,xl,"maxSingleEventSizeBytes",w.loggerProvider)),w.privacyConfig=s(s({},null!==(c=n.privacyConfig)&&void 0!==c?c:{}),{unmaskSelector:Array.from(new Set(h([".".concat("amp-unmask")],d(null!==(p=null===(f=n.privacyConfig)||void 0===f?void 0:f.unmaskSelector)&&void 0!==p?p:[]),!1)))}),n.interactionConfig&&(w.interactionConfig=n.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)),n.debugMode&&(w.debugMode=n.debugMode);var k=n;return w.useWebWorker=null===(m=null!==(g=n.useWebWorker)&&void 0!==g?g:null===(v=k.experimental)||void 0===v?void 0:v.useWebWorker)||void 0===m||m,w.enableTransportCompression=null===(y=n.enableTransportCompression)||void 0===y||y,w.sendTimeoutMs=n.sendTimeoutMs,w.captureAdoptedStyleSheets=null===(b=n.captureAdoptedStyleSheets)||void 0===b||b,n.crossOriginIframes&&(w.crossOriginIframes=n.crossOriginIframes),n.flushIntervalConfig?w.flushIntervalConfig=function(e,t){var n,r,i={};void 0!==e.minIntervalMs&&(!Number.isFinite(e.minIntervalMs)||e.minIntervalMs<wl?(t.warn("flushIntervalConfig.minIntervalMs ".concat(e.minIntervalMs," is below floor ").concat(wl,"ms; clamping.")),i.minIntervalMs=wl):i.minIntervalMs=e.minIntervalMs);void 0!==e.maxIntervalMs&&(Number.isNaN(e.maxIntervalMs)||e.maxIntervalMs<wl?(t.warn("flushIntervalConfig.maxIntervalMs ".concat(e.maxIntervalMs," is below floor ").concat(wl,"ms; clamping.")),i.maxIntervalMs=wl):i.maxIntervalMs=e.maxIntervalMs);if(void 0!==i.minIntervalMs||void 0!==i.maxIntervalMs){var o=null!==(n=i.minIntervalMs)&&void 0!==n?n:Ya,s=null!==(r=i.maxIntervalMs)&&void 0!==r?r:Xa;s<o&&(void 0===i.maxIntervalMs?(t.warn("flushIntervalConfig.minIntervalMs (".concat(o,") exceeds the default maxIntervalMs (").concat(Xa,"); raising max to match min.")),i.maxIntervalMs=o):void 0===i.minIntervalMs?(t.warn("flushIntervalConfig.maxIntervalMs (".concat(s,") is below the default minIntervalMs (").concat(Ya,"); 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}(n.flushIntervalConfig,w.loggerProvider):w.flushIntervalConfig={minIntervalMs:1e3,maxIntervalMs:1e4},w.handleSendEvents=n.handleSendEvents,w.handleFetchConfig=n.handleFetchConfig,w}return r(t,e),t}(ce),wl=100,Sl=1e3,kl=8e6,xl=1e7;function Cl(e,t,n,r,i){if(Number.isFinite(e))return e<t?(i.warn("".concat(r," ").concat(e," is below floor ").concat(t,"; clamping.")),t):e>n?(i.warn("".concat(r," ").concat(e," exceeds ceiling ").concat(n,"; clamping.")),n):e;i.warn("".concat(r," value is not a finite number (got ").concat(String(e),"); ignoring."))}var El=new Set(["button","checkbox","combobox","link","listbox","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem","gridcell"]),Il=new Set(["banner","navigation","main","complementary","contentinfo","search","form","region","dialog","alertdialog","list","table","row","group"]),Ol=new Set(["button","cell","checkbox","columnheader","gridcell","heading","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","rowheader","switch","tab","tooltip","treeitem","alert","status","listitem"]),Tl=new Set(["INPUT","SELECT","TEXTAREA"]),Pl=["type","name","href","target","aria-controls","aria-haspopup","data-testid"];function Al(e,t){var n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1)+"…":n}function Ml(e,t){void 0===t&&(t="https://semantic.invalid/");try{var n=new URL(e,t);if("http:"!==n.protocol&&"https:"!==n.protocol)return"/";var r=/^#!?\//.test(n.hash)?"#"+n.hash.slice(1).split(/[?#]/)[0]:"",i=function(e){return e.split("/").map(function(e){var t;try{t=decodeURIComponent(e)}catch(e){return":id"}return/^\d+$/.test(t)||/^[\da-f]{8,}$/i.test(t)||/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/i.test(t)||t.length>=16&&/^[a-z\d]+$/i.test(t)&&/[a-z]/i.test(t)&&/\d/.test(t)?":id":e}).join("/")};return i(n.pathname)+i(r)}catch(e){return"/"}}function Rl(e){var t,n,r,i,o=null===(t=e.getAttribute("role"))||void 0===t?void 0:t.trim().split(/\s+/)[0].toLowerCase();if(o)return"none"===o||"presentation"===o?"generic":o;var s=e.tagName.toLowerCase();if("a"===s||"area"===s)return e.hasAttribute("href")?"link":"generic";if("input"===s){return null!==(r={button:"button",image:"button",reset:"button",submit:"button",file:"button",checkbox:"checkbox",radio:"radio",range:"slider",number:"spinbutton",search:"searchbox",hidden:"generic"}[(null!==(n=e.getAttribute("type"))&&void 0!==n?n:"text").toLowerCase()])&&void 0!==r?r:e.hasAttribute("list")?"combobox":"textbox"}if("select"===s)return e.multiple||e.size>1?"listbox":"combobox";return/^h[1-6]$/.test(s)?"heading":"section"===s?e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")?"region":"generic":null!==(i={button:"button",summary:"button",textarea:"textbox",nav:"navigation",main:"main",form:"form",header:"banner",footer:"contentinfo",aside:"complementary",dialog:"dialog",ul:"list",ol:"list",menu:"list",li:"listitem",table:"table",tr:"row",td:"cell",th:"columnheader",img:"img",option:"option",progress:"progressbar",output:"status",fieldset:"group",details:"group",optgroup:"group"}[s])&&void 0!==i?i:"generic"}function _l(e){var t,n=null===(t=e.getAttribute("aria-invalid"))||void 0===t?void 0:t.trim().toLowerCase();return!!n&&"false"!==n}function Nl(e){var t=function(t){try{var n=e.getPrivacy().blockSelector;return!!t.closest(h([".amp-block","[data-amp-block]"],d("string"==typeof n?[n]:null!=n?n:[]),!1).join(","))}catch(e){return!0}},n=function(n){try{return t(n)||ll(Tl.has(n.tagName)?"input":"text",e.getPrivacy(),n,e.getUrl())}catch(e){return!0}},r=function(e){return!!e.closest('[contenteditable]:not([contenteditable="false"])')},i=function(t,i,o){var s;if(void 0===o&&(o=80),n(t)||r(t)||void 0===i&&Tl.has(t.tagName))return null;if(void 0!==i)return null===i?null:Al(i,o);for(var a,l=e.document.createTreeWalker(t,5),u=0,c="";a=l.nextNode();){if(++u>256)return null;if(1===a.nodeType){var d=a;if(n(d)||r(d)||Tl.has(d.tagName))return null}else c+=null!==(s=a.nodeValue)&&void 0!==s?s:"";if(c.length>2*o)break}return Al(c,o)},o=function(o){var s,a,l,u,d,h=function(e,t){return{name:e||null,source:null===e?"masked":e?t:"unnamed"}};if(t(o))return h(null,"masked");var f=o.getAttribute("aria-labelledby");if(f){var p=f.trim().split(/\s+/).slice(0,20).map(function(t){return e.document.getElementById(t)}).filter(function(e){return!!e}).map(function(e){return i(e)});if(p.some(function(e){return null===e}))return h(null,"masked");var g=Al(p.join(" "),80);if(g)return h(g,"aria-labelledby")}var v=o.getAttribute("aria-label");if(null==v?void 0:v.trim())return h(i(o,v),"aria-label");var m=o.labels;if(null==m?void 0:m.length){var y=m[0],b="";if(n(y))return h(null,"masked");for(var w=!1,S=e.document.createTreeWalker(y,5),k=void 0,x=0;k=S.nextNode();){if(++x>256){w=!0;break}if(1===k.nodeType&&k!==o&&(n(k)||r(k))){w=!0;break}3!==k.nodeType||(null===(l=k.parentElement)||void 0===l?void 0:l.closest('input, select, textarea, [contenteditable]:not([contenteditable="false"])'))||(b+=null!==(u=k.nodeValue)&&void 0!==u?u:"")}return h(w?null:i(y,b),y.htmlFor?"label-for":"label-wrap")}if("IMG"===o.tagName&&o.hasAttribute("alt"))return h(i(o,o.getAttribute("alt")),"alt");if("INPUT"===o.tagName&&/^(button|submit|reset)$/i.test(null!==(d=o.getAttribute("type"))&&void 0!==d?d:"")&&o.hasAttribute("value"))return h(i(o,o.getAttribute("value")),"value");if(Ol.has(Rl(o))){var C=i(o);if(null===C||C)return h(C,"text")}try{for(var E=c(["title","placeholder"]),I=E.next();!I.done;I=E.next()){var O=I.value,T=o.getAttribute(O);if(T)return h(i(o,T),O)}}catch(e){s={error:e}}finally{try{I&&!I.done&&(a=E.return)&&a.call(E)}finally{if(s)throw s.error}}return h("","unnamed")},s=function(n){if(t(n))return null;var r=e.getNodeId(n);return r<0?null:r},a=function(e){var t=o(e);return{id:s(e),role:Rl(e),name:t.name,name_source:t.source}},l=function(t){var n=t;try{return n.checkVisibility?n.checkVisibility({opacityProperty:!0,visibilityProperty:!0}):t.getClientRects().length>0&&"hidden"!==e.window.getComputedStyle(t).visibility}catch(e){return!1}},u=null,f=0,p="";return{id:s,blocked:t,masked:n,text:i,name:o,describe:a,visible:l,role:Rl,url:function(t){return void 0===t&&(t=e.getUrl()),Ml(t,e.getUrl())},actionable:function(e){for(var t=e,n=e,r=0;t&&r<12;r++,t=t.parentElement){var i=Rl(t);if(El.has(i))return t;n===e&&"generic"!==i&&(n=t)}return n},container:function(e){for(var t=e.parentElement,n=0;t&&n<20;n++,t=t.parentElement)if(Il.has(Rl(t))||t.hasAttribute("aria-label")){var r=a(t);return{id:r.id,role:r.role,name:r.name}}return null},states:function(e){var t,n,r=[],i=e,o="INPUT"===e.tagName&&"checkbox"===i.type&&i.indeterminate||"mixed"===e.getAttribute("aria-checked")||"mixed"===e.getAttribute("aria-pressed");try{for(var s=c(Object.entries({disabled:e.matches(":disabled")||"true"===e.getAttribute("aria-disabled"),required:i.required||"true"===e.getAttribute("aria-required"),invalid:_l(e)||i.willValidate&&!i.validity.valid,checked:!o&&(i.checked||"true"===e.getAttribute("aria-checked")),mixed:o,busy:"true"===e.getAttribute("aria-busy"),open:("DETAILS"===e.tagName||"DIALOG"===e.tagName)&&e.hasAttribute("open"),expanded:"true"===e.getAttribute("aria-expanded"),collapsed:"false"===e.getAttribute("aria-expanded"),selected:i.selected||"true"===e.getAttribute("aria-selected"),current:e.hasAttribute("aria-current")&&"false"!==e.getAttribute("aria-current"),pressed:"true"===e.getAttribute("aria-pressed"),readonly:i.readOnly||"true"===e.getAttribute("aria-readonly")})),a=s.next();!a.done;a=s.next()){var l=d(a.value,2),u=l[0];l[1]&&r.push(u)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return r},heading:function(){var t=e.window.performance.now(),n=e.getUrl();if(t<f&&n===p&&(!u||u.isConnected&&l(u)))return u?i(u):null;u=null,f=t+250,p=n;var r=e.document.body;if(!r)return null;for(var o=e.document.createTreeWalker(r,1),s=o.nextNode(),a=0;s&&a++<2e3&&e.window.performance.now()-t<2;){var c="H1"===s.tagName;if((c||s.matches('[role="heading"][aria-level="1"]'))&&l(s)){if(s.closest('main,[role="main"]')){u=s;break}c&&!u&&(u=s)}s=o.nextNode()}return u?i(u):null},invalidateHeading:function(){f=0,u=null},attributes:function(r){var i,o,s,a={};if(t(r))return a;try{for(var l=c(Pl),u=l.next();!u.done;u=l.next()){var d=u.value,h=r.getAttribute(d);null===h||(null===(s=e.getPrivacy().maskAttributes)||void 0===s?void 0:s.includes(d))&&n(r)||(a[d]=Al("href"===d?Ml(h,e.getUrl()):h,60))}}catch(e){i={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}return a}}}var Ll=new WeakMap;function Dl(e){try{return e.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)})}}function Fl(e,t){var n=Ll.get(e);return n||(n=Object.freeze({tab_id:Dl(t),document_id:Dl(t)}),Ll.set(e,n)),n}var Ul={click:2e3,keys:1e3,"resource-error":200,field:1e3,submit:300,notice:300,dialog:300,"amp-event":500,context:200,recording:200,navigation:200,visibility:200,lifecycle:200};function jl(e){return s(s({},e),{families:e.families?s({},e.families):void 0})}var Bl=["valueMissing","typeMismatch","patternMismatch","tooShort","tooLong","rangeUnderflow","rangeOverflow","stepMismatch","badInput","customError"];function ql(e){var t,n=e.target;return 1===(null==n?void 0:n.nodeType)?n:null!==(t=null==n?void 0:n.parentElement)&&void 0!==t?t:null}function zl(e){return["INPUT","SELECT","TEXTAREA"].includes(e.tagName)}function Wl(e){var t;return"INPUT"===e.tagName&&["password","hidden"].includes(null!==(t=rl(e))&&void 0!==t?t:"")}function Vl(e){var t,n,r=[];if(zl(e))try{for(var i=c(Bl),o=i.next();!o.done;o=i.next()){var s=o.value;e.validity[s]&&r.push(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return _l(e)&&r.push("ariaInvalid"),{valid:(!zl(e)||e.validity.valid)&&!r.includes("ariaInvalid"),validity:r}}function $l(e,t){var n=e.helpers.name(t),r=n.name,i=n.source;return{id:e.helpers.id(t),role:e.helpers.role(t),name:"text"===i||"value"===i?null:r,name_source:"text"===i||"value"===i?"masked":i}}function Kl(e,t,n){if(n)return null;if("SELECT"===t.tagName){var r=t.selectedOptions[0];return!r||e.helpers.blocked(r)?null:r.hasAttribute("label")?e.helpers.text(r,r.label):e.helpers.text(r)}return"INPUT"===t.tagName&&["radio","checkbox"].includes(t.type)&&t.checked?$l(e,t).name:null}var Hl={families:["click","field","submit"],setup:function(e){var t,n,r=e.host,i=e.helpers,o=[],a=new Set,l=!0,u=new WeakMap,f=new Map,p=function(e){var t=r.window.setTimeout(function(){a.delete(t),l&&e()},0);return a.add(t),t},g=function(e,t){r.document.addEventListener(e,t,!0),o.push(function(){return r.document.removeEventListener(e,t,!0)})},v=function(t){var n=e.now();if(l&&e.enabled("click")&&("auxclick"!==t.type||1===t.button)){var o=ql(t);if(o&&!i.blocked(o)){var a=i.actionable(o);if(!i.blocked(a)&&e.canEmit("click")){var u=function(e,t){var n,r,i,o=null!==(i=e.host.getPrivacy().maskAttributes)&&void 0!==i?i:[];try{for(var s=c(["data-amp-key","data-testid","data-test","data-cy","id"]),a=s.next();!a.done;a=s.next()){var l=a.value,u=t.getAttribute(l);if(!(!u||o.includes(l)&&e.helpers.masked(t)||"id"===l&&(/^\d+$/.test(u)||/[a-f\d]{8,}/i.test(u)||/:r/.test(u)||/\d{3,}/.test(u))))return u.length>80?"".concat(u.slice(0,79),"…"):u}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return null}(e,a),d=null;if(!u&&r.getSelector)try{d=r.getSelector(a)}catch(e){}e.emit("click",s(s(s(s({},i.describe(a)),{container:i.container(a),states:i.states(a),visible:i.visible(a),key:u}),u?{}:{selector:d}),{attrs:i.attributes(a),url:i.url(),heading:i.heading(),keyboard:0===t.detail,modifiers:[t.altKey?"alt":"",t.ctrlKey?"ctrl":"",t.metaKey?"meta":"",t.shiftKey?"shift":""].filter(Boolean),trusted:t.isTrusted}),n)}}}},m=function(t){var n,o;if(e.enabled("field")){var a=ql(t),l=null==a?void 0:a.closest('input, select, textarea, [contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]');if(l&&("change"!==t.type||zl(l))&&!Wl(l)&&!i.blocked(l)&&e.canEmit("field")){var c=ll("input",r.getPrivacy(),l,r.getUrl()),d=s(s(s(s(s(s({},$l(e,l)),{states:i.states(l),kind:"INPUT"===l.tagName?l.type:zl(l)?l.tagName.toLowerCase():"contenteditable",value_state:(zl(l)?l.value.length>0:(null!==(o=null===(n=l.textContent)||void 0===n?void 0:n.length)&&void 0!==o?o:0)>0)?"filled":"empty"}),"INPUT"===l.tagName&&["checkbox","radio"].includes(l.type)?{checked:l.checked}:{}),function(e,t){if(t)return{};if("TEXTAREA"===e.tagName)return{value:e.value};if("INPUT"!==e.tagName)return{};var n=e;return["checkbox","radio","file","button","submit","reset","image"].includes(n.type)?{}:{value:n.value}}(l,c)),Vl(l)),{masked:c,option_label:Kl(e,l,c)}),h=JSON.stringify(d),f=u.get(l),p=e.now();(null==f?void 0:f.payload)===h&&("focusout"===t.type||p-f.timestamp<500)||e.emit("field",d)&&u.set(l,{payload:h,timestamp:p})}}},y=function(e,t){var n=i.describe(e);if(null===n.name&&"masked"!==n.name_source){var r=null!=t?t:e.querySelector('button:not([type]), button[type="submit"], input[type="submit"], input[type="image"]');r&&!i.blocked(r)&&(n.name=i.name(r).name)}return{id:n.id,role:n.role,name:n.name}};return e.enabled("click")&&(r.externalClicks?o.push(e.on("click",v)):g("click",function(e){return v(e)}),(null!==(t=r.externalAuxClicks)&&void 0!==t?t:r.externalClicks)||g("auxclick",function(e){return v(e)})),e.enabled("field")&&(g("change",m),g("focusout",m)),e.enabled("submit")&&(g("submit",function(t){if(e.enabled("submit")){var n=ql(t);if("FORM"===(null==n?void 0:n.tagName)&&!i.blocked(n)){var r=t.submitter,o=r&&!i.blocked(r)?r:null;p(function(){e.enabled("submit")&&!i.blocked(n)&&e.canEmit("submit")&&e.emit("submit",{form:y(n,o&&!i.blocked(o)?o:null),submitter:o&&!i.blocked(o)?{id:i.id(o),role:i.role(o),name:i.name(o).name}:null,valid:!0,invalid_fields:[],prevented:t.defaultPrevented})})}}}),g("invalid",function(t){if(e.enabled("submit")){var r=ql(t);if(r&&zl(r)){var o=r.form;if(o&&!i.blocked(o)){var s=f.get(o);s||(s=new Set,f.set(o,s)),!Wl(r)&&!i.blocked(r)&&s.size<10&&s.add(r),void 0===n&&(n=p(function(){var t,r;n=void 0;var o=h([],d(f),!1);if(f.clear(),e.enabled("submit"))try{for(var s=c(o),a=s.next();!a.done;a=s.next()){var l=d(a.value,2),u=l[0],p=l[1];i.blocked(u)||e.canEmit("submit")&&e.emit("submit",{form:y(u,null),submitter:null,valid:!1,prevented:!0,invalid_fields:h([],d(p),!1).filter(function(e){return!i.blocked(e)&&!Wl(e)}).map(function(t){var n=$l(e,t);return{id:n.id,name:n.name,validity:Vl(t).validity}})})}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}))}}}})),function(){l=!1,o.forEach(function(e){return e()}),a.forEach(function(e){return r.window.clearTimeout(e)}),a.clear(),f.clear()}}},Gl='dialog,[role="dialog"],[role="alertdialog"],[aria-modal="true"]';function Jl(e,t){var n,r,i,o,s,a;return u(this,function(l){switch(l.label){case 0:n=[{children:[e],index:0,hidden:!1}],l.label=1;case 1:return n.length?(r=n[n.length-1]).index===r.children.length?(n.pop(),[3,1]):(i=r.children[r.index++],o=i.attributes,s=r.hidden||void 0!==(null==o?void 0:o.hidden)||"true"===(null==o?void 0:o["aria-hidden"]),[4,{node:i,baseline:t,hidden:s}]):[3,3];case 2:return l.sent(),(null===(a=i.childNodes)||void 0===a?void 0:a.length)&&n.push({children:i.childNodes,index:0,hidden:s}),[3,1];case 3:return[2]}})}function Yl(e){var t,n,r,i,o,s,a,l,d,h,f,p,g,v,m,y,b,w,S,k,x,C,E,I,O,T;return u(this,function(P){switch(P.label){case 0:return"snapshot"!==e.type?[3,2]:[5,c(Jl(e.node,!0))];case 1:return P.sent(),[3,33];case 2:P.trys.push([2,7,8,9]),t=c(e.texts),n=t.next(),P.label=3;case 3:return n.done?[3,6]:[4,{id:n.value.id,text:!0}];case 4:P.sent(),P.label=5;case 5:return n=t.next(),[3,3];case 6:return[3,9];case 7:return r=P.sent(),S={error:r},[3,9];case 8:try{n&&!n.done&&(k=t.return)&&k.call(t)}finally{if(S)throw S.error}return[7];case 9:i=function(e){return u(this,function(t){switch(t.label){case 0:return[4,{id:e.id,dialogs:["open","hidden","aria-hidden","role","aria-modal"].some(function(t){return t in e.attributes})}];case 1:return t.sent(),[2]}})},P.label=10;case 10:P.trys.push([10,15,16,17]),o=c(e.attributes),s=o.next(),P.label=11;case 11:return s.done?[3,14]:(a=s.value,[5,i(a)]);case 12:P.sent(),P.label=13;case 13:return s=o.next(),[3,11];case 14:return[3,17];case 15:return l=P.sent(),x={error:l},[3,17];case 16:try{s&&!s.done&&(C=o.return)&&C.call(o)}finally{if(x)throw x.error}return[7];case 17:d=new Set,h=function(e){var t=!d.has(e);return d.size<1e3&&d.add(e),{id:e,text:t}},P.label=18;case 18:P.trys.push([18,23,24,25]),f=c(e.removes),p=f.next(),P.label=19;case 19:return p.done?[3,22]:(g=p.value,[4,h(g.parentId)]);case 20:P.sent(),P.label=21;case 21:return p=f.next(),[3,19];case 22:return[3,25];case 23:return v=P.sent(),E={error:v},[3,25];case 24:try{p&&!p.done&&(I=f.return)&&I.call(f)}finally{if(E)throw E.error}return[7];case 25:P.trys.push([25,31,32,33]),m=c(e.adds),y=m.next(),P.label=26;case 26:return y.done?[3,30]:(b=y.value,[4,h(b.parentId)]);case 27:return P.sent(),[5,c(Jl(b.node,!1))];case 28:P.sent(),P.label=29;case 29:return y=m.next(),[3,26];case 30:return[3,33];case 31:return w=P.sent(),O={error:w},[3,33];case 32:try{y&&!y.done&&(T=m.return)&&T.call(m)}finally{if(O)throw O.error}return[7];case 33:return[2]}})}var Xl={families:["notice","dialog"],setup:function(e){var t=e.hasCapacity("notice"),n=e.hasCapacity("dialog"),r=e.host,i=e.helpers,o=r.window;if(!t&&!n||!r.getNode)return function(){};var s,a=!0,l=null,u=!1,h=0,f=[],p=new Set,g=new Set,v=new Set,m=new WeakMap,y=new WeakMap,b=new Map,w=new WeakMap,S=new Set,k=new Set,x=!1,C=!1,E=function(e){var t;if(!k.has(e)){k.add(e);try{null===(t=r.onError)||void 0===t||t.call(r,new Error("Semantic feedback ".concat(e," limit reached; some changes may be omitted.")))}catch(e){}}},I=function(e,n){var r;if(t&&e.isConnected&&!(void 0!==n&&(null!==(r=y.get(e))&&void 0!==r?r:-1)>=n)){if(!g.has(e)&&!b.has(e)){if(g.size+b.size>=256)return void E("notice queue");g.add(e)}void 0!==n&&y.set(e,n)}},O=function(e){n&&!v.has(e)&&v.add(e)},T=e.subscribe(function(e){"click"===e.name&&(l=e.timestamp)}),P=function(){return null!==l&&e.now()-l>=0&&e.now()-l<=3e3?l:null},A=function(){g.clear(),b.forEach(function(e){return o.clearTimeout(e)}),b.clear()},M=function(){a=!1,j(),T(),void 0!==s&&(u?o.clearTimeout(s):o.cancelAnimationFrame(s),s=void 0),A(),f.length=0,p.clear(),v.clear(),S.clear()},R=function(){return t&&!e.hasCapacity("notice")&&(t=!1,A()),n&&!e.hasCapacity("dialog")&&(n=!1,v.clear(),S.clear(),p.clear()),t||n||M(),a},_=function(n){if(g.delete(n),n.isConnected&&!b.has(n)){var r=m.get(n),s=void 0===r?0:500-(e.now()-r);s<=0?function(t){if(a&&t.isConnected&&!i.blocked(t)&&e.canEmit("notice")){var n=i.text(t,void 0,200);if(null===n||n.trim()){var r=t.getAttribute("role"),o=i.container(t);e.emit("notice",{id:i.id(t),role:"alert"===r||"status"===r||"log"===r?r:"live",text:n,visible:i.visible(t),region:o?{role:o.role,name:o.name}:null,cause_click_ts:P()}),m.set(t,e.now())}}}(n):b.set(n,o.setTimeout(function(){b.delete(n),a&&t&&(I(n),g.size&&D())},s))}},N=function(t){if(v.delete(t),i.blocked(t))return S.delete(t),void p.delete(t);var n=w.get(t),r=function(e){return e.isConnected&&e.matches(Gl)&&!e.closest('[hidden],[aria-hidden="true"]')&&("DIALOG"!==e.tagName||e.hasAttribute("open"))}(t);if((null==n?void 0:n.open)!==r&&(n||r)){var o=function(e){var t=w.get(e),n=e.isConnected&&e.matches(Gl)&&!e.closest('[hidden],[aria-hidden="true"]')&&("DIALOG"!==e.tagName||e.hasAttribute("open")),r="true"===e.getAttribute("aria-modal");try{r=r||e.matches(":modal")}catch(e){}var o=!e.isConnected&&t?t.payload:i.describe(e);return{open:n,payload:{id:o.id,role:"alertdialog"===e.getAttribute("role")?"alertdialog":"dialog",name:e.isConnected?o.name:null,name_source:e.isConnected?o.name_source:"masked",state:n?"open":"closed",modal:!e.isConnected&&t?t.payload.modal:r,visible:n&&i.visible(e),cause_click_ts:P()}}}(t);w.set(t,o),r?S.add(t):S.delete(t),e.emit("dialog",o.payload),t.isConnected||p.delete(t)}},L=function(){var e,t,n,r,i,l,u,h;if(s=void 0,a&&R()){var m=o.performance.now();if(x){x=!1;try{for(var y=c(p),w=y.next();!w.done;w=y.next()){var k=w.value;O(k)}}catch(t){e={error:t}}finally{try{w&&!w.done&&(t=y.return)&&t.call(y)}finally{if(e)throw e.error}}try{for(var E=c(g),I=E.next();!I.done;I=E.next()){(k=I.value).isConnected||g.delete(k)}}catch(e){n={error:e}}finally{try{I&&!I.done&&(r=E.return)&&r.call(E)}finally{if(n)throw n.error}}try{for(var T=c(b),P=T.next();!P.done;P=T.next()){var A=d(P.value,2),M=(k=A[0],A[1]);k.isConnected||(o.clearTimeout(M),b.delete(k))}}catch(e){i={error:e}}finally{try{P&&!P.done&&(l=T.return)&&l.call(T)}finally{if(i)throw i.error}}try{for(var L=c(p),F=L.next();!F.done;F=L.next()){(k=F.value).isConnected||S.has(k)||(p.delete(k),v.delete(k))}}catch(e){u={error:e}}finally{try{F&&!F.done&&(h=L.return)&&h.call(L)}finally{if(u)throw u.error}}}var j=0,B=function(e){for(;a&&(g.size||v.size)&&j<50&&o.performance.now()<e;){var t=v.size>0&&(C||!g.size);C=!t,j++,t?N(v.values().next().value):_(g.values().next().value),R()}};B(m+2);for(var q=0;a&&f.length&&q++<1e3&&o.performance.now()-m<4;){var z=f[0],W=z.work.next();W.done?f.shift():U(W.value,z.generation)}B(m+4),a&&(x||f.length||g.size||v.size)&&D()}},D=function(){a&&void 0===s&&(u="function"!=typeof o.requestAnimationFrame,s=u?o.setTimeout(L,16):o.requestAnimationFrame(L))},F=function(e){return!!p.has(e)||(p.size>=256?(E("dialog tracking"),!1):(p.add(e),!0))},U=function(e,o){var s,a,l;if("node"in e){var u=e.node,d=e.baseline,h=e.hidden;if(2!==u.type)return;var f=null!==(l=u.attributes)&&void 0!==l?l:{},g="dialog"===u.tagName||"dialog"===f.role||"alertdialog"===f.role||"true"===f["aria-modal"],v=["alert","status","log"].includes(f.role)||["polite","assertive"].includes(f["aria-live"]);if((!n||!g)&&(!t||!v||d))return;var m=r.getNode(u.id);if(!m||1!==m.nodeType||i.blocked(m))return;var y=m;if(n&&g&&F(y))if(d&&!w.has(y)){var b=!h&&("dialog"!==u.tagName||void 0!==f.open);w.set(y,{open:b,payload:{id:u.id,role:"alertdialog"===f.role?"alertdialog":"dialog",name:null,name_source:"unnamed",state:b?"open":"closed",modal:"true"===f["aria-modal"]||"modal"===f.rr_open_mode,visible:!1,cause_click_ts:null}}),b&&S.add(y)}else{var k=w.get(y);k&&d&&(k.payload.id=u.id),O(y)}t&&v&&!d&&I(y,o)}else if(t&&e.text||n&&e.dialogs){var x=r.getNode(e.id),C=1===(null==x?void 0:x.nodeType)?x:null==x?void 0:x.parentElement;if(C&&C.isConnected&&!i.blocked(C)){if(t&&e.text){var E=C.closest('[role="alert"],[role="status"],[role="log"],[aria-live="polite"],[aria-live="assertive"]');E&&I(E,o)}if(n&&e.dialogs){C.matches(Gl)&&F(C)&&O(C);try{for(var T=c(p),P=T.next();!P.done;P=T.next()){g=P.value;C.contains(g)&&O(g)}}catch(e){s={error:e}}finally{try{P&&!P.done&&(a=T.return)&&a.call(T)}finally{if(s)throw s.error}}}}}},j=e.on("dom",function(e){a&&R()&&(h++,("snapshot"===e.type||e.removes.length)&&(x=!0),f.length>=128?E("replay batch queue"):f.push({work:Yl(e),generation:h}),D())});return M}};var Ql={families:["context","recording","visibility","lifecycle"],setup:function(e){var t=[],n=e.host,r=n.document,i=n.window;if(e.enabled("context")&&t.push(e.on("snapshot",function(){return function(e){var t,n,r,i,o;if(e.canEmit("context")){var a=e.host,l=a.document,u=a.window,d={total:0,inlined:0,unreadable:0};try{for(var h=c(Array.from(l.styleSheets)),f=h.next();!f.done;f=h.next()){var p=f.value;d.total++;try{p.cssRules,!1!==a.inlineStylesheet&&d.inlined++}catch(e){d.unreadable++}}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}var g="function"==typeof u.matchMedia&&u.matchMedia("(pointer:coarse)").matches,v=g&&u.innerWidth<768?"mobile":g&&u.innerWidth<1024?"tablet":"desktop",m=e.dropped();e.emit("context",s({sdk:a.sdk,mask:null!==(r=a.getPrivacy().defaultMaskLevel)&&void 0!==r?r:"medium",css:d,viewport:{w:u.innerWidth,h:u.innerHeight},device:v,language:u.navigator.language,visibility_state:"hidden"===l.visibilityState?"hidden":"visible",focused:l.hasFocus(),user_agent:u.navigator.userAgent,analytics_sdk:null!==(o=null===(i=a.getAnalyticsContext)||void 0===i?void 0:i.call(a))&&void 0!==o?o:{present:!1,autocapture:[]}},Object.keys(m).length?{caps_hit:m}:{}))}}(e)})),e.enabled("recording")&&t.push(e.on("recording",function(t){return e.emit("recording",t)})),e.enabled("visibility")){var o=function(){return"hidden"===r.visibilityState?"hidden":"visible"},a=o(),l=function(){var t=o();t!==a&&(a=t,e.emit("visibility",{state:t}))};r.addEventListener("visibilitychange",l,!0),t.push(function(){return r.removeEventListener("visibilitychange",l,!0)})}if(e.enabled("lifecycle")){var u=function(n,r,i){var o=function(t){e.emit("lifecycle",{type:"pageshow"===r&&t.persisted?"pageshow_bfcache":i})};n.addEventListener(r,o,!0),t.push(function(){return n.removeEventListener(r,o,!0)})};u(i,"pagehide","pagehide"),u(i,"pageshow","pageshow"),u(r,"freeze","freeze"),u(r,"resume","resume")}return function(){return t.forEach(function(e){return e()})}}},Zl=/^(Escape|Enter|Tab|ArrowUp|ArrowDown|ArrowLeft|ArrowRight|Home|End|PageUp|PageDown|F[1-9]|F1[0-2])$/,eu=/^[kpf]$/i,tu={families:["keys"],setup:function(e){var t=e.host.document,n=e.helpers,r=function(t){if(e.enabled("keys")&&!t.repeat&&!t.isComposing&&229!==t.keyCode&&!t.getModifierState("AltGraph")){var r=t.key;if(!Zl.test(r)){if(t.altKey||t.ctrlKey===t.metaKey||!eu.test(r))return;r=r.toUpperCase()}var i=t.composedPath().filter(function(e){return 1===e.nodeType}),o=i[0];if(o&&!i.some(function(e){return n.blocked(e)})&&!o.matches('input[type="password"], input[type="hidden"]')&&e.canEmit("keys")){var s=n.name(o),a="value"===s.source||"text"===s.source&&!!o.closest("input,textarea,select,[contenteditable]");e.emit("keys",{key:[t.ctrlKey?"Ctrl":"",t.metaKey?"Meta":"",t.altKey?"Alt":"",t.shiftKey?"Shift":"",r].filter(Boolean).join("+"),target:{id:n.id(o),role:n.role(o),name:a?null:s.name,name_source:a?"masked":s.source,states:n.states(o)}})}}},i=function(){return t.removeEventListener("keydown",r,!0)};return e.onCleanup(i),t.addEventListener("keydown",r,!0),i}},nu=65535,ru={families:["resource-error"],setup:function(e){var t,n=e.host,r=n.document,i=n.window,o=e.helpers,a=!0,l=[],u=0,d=r.fonts,h=function(){void 0!==t&&i.clearTimeout(t),t=void 0},f=function(){var t,n,r,i;h();var d=l,f=u;if(l=[],u=0,a&&e.enabled("resource-error")){var p=new Map;try{for(var g=c(d),v=g.next();!v.done;v=g.next()){var m=v.value;if(m.element.isConnected&&!o.blocked(m.element)){var y=o.container(m.element),b=s(s({rt:m.rt,count:m.count},m.path?{path:m.path}:{}),y?{container:y}:{}),w=JSON.stringify([b.rt,b.path,b.container]),S=p.get(w);S?S.count=Math.min(nu,S.count+b.count):p.set(w,b)}}}catch(e){t={error:e}}finally{try{v&&!v.done&&(n=g.return)&&n.call(g)}finally{if(t)throw t.error}}f&&e.emit("resource-error",{rt:"font",count:f});try{for(var k=c(p.values()),x=k.next();!x.done;x=k.next()){b=x.value;e.emit("resource-error",b)}}catch(e){r={error:e}}finally{try{x&&!x.done&&(i=k.return)&&i.call(k)}finally{if(r)throw r.error}}}},p=function(){"hidden"===r.visibilityState?f():void 0===t&&(t=i.setTimeout(f,500))},g=function(t){if(a&&e.enabled("resource-error")){var n=t.target;if(n&&1===n.nodeType&&!o.blocked(n)){var i,s;if("IMG"===n.tagName)i="img",s=n.currentSrc||n.getAttribute("src")||"";else if("SCRIPT"===n.tagName&&n.hasAttribute("src"))i="script",s=n.getAttribute("src")||"";else{if("LINK"!==n.tagName||!n.relList.contains("stylesheet"))return;i="css",s=n.getAttribute("href")||""}var u=function(e){if(e)try{var t=new URL(e,r.baseURI);if("http:"!==t.protocol&&"https:"!==t.protocol)return;var n=o.url(t.origin+t.pathname);return n.length<=200?n:void 0}catch(e){return}}(s),c=l.find(function(e){return e.element===n&&e.rt===i&&e.path===u});c?c.count=Math.min(nu,c.count+1):(l.length>=100&&f(),l.push({element:n,rt:i,path:u,count:1})),p()}}},v=function(t){if(a&&e.enabled("resource-error")){var n=t.fontfaces;(null==n?void 0:n.length)&&(u=Math.min(nu,u+n.length),p())}},m=function(){"hidden"===r.visibilityState&&f()},y=function(){a=!1,h(),l=[],u=0,r.removeEventListener("error",g,!0),r.removeEventListener("visibilitychange",m,!0),i.removeEventListener("pagehide",f,!0),null==d||d.removeEventListener("loadingerror",v)};return e.onCleanup(y),r.addEventListener("error",g,!0),r.addEventListener("visibilitychange",m,!0),i.addEventListener("pagehide",f,!0),null==d||d.addEventListener("loadingerror",v),y}},iu=new Set(["[Amplitude] Dead Click","[Amplitude] Rage Click","[Amplitude] Error Click","[Amplitude] Thrashed Cursor"]),ou=["[Amplitude] Clicks","[Amplitude] Begin Time","[Amplitude] End Time"],su="[Amplitude] Element Text",au="[Amplitude] Element Tag",lu="[Amplitude] Page Path",uu={families:["amp-event"],setup:function(e){if(!e.enabled("amp-event"))return function(){};var t,n=e.subscribe(function(e){"click"===e.name&&(t={timestamp:e.timestamp,id:e.payload.id,name:e.payload.name})}),r=e.on("analytics",function(n){var r,i;if(e.enabled("amp-event")&&iu.has(n.eventType)){var o=e.helpers,s=n.element;if((!s||!o.blocked(s))&&e.canEmit("amp-event")){var a=n.properties,l={},u=null,d=a[su];if("string"==typeof d){if(s){var h=o.text(s),f=o.text(s,d);null!==h&&h===f&&(u=f)}l[su]=u}var p=a[au];s?l[au]=s.tagName.toLowerCase():"string"==typeof p&&/^[a-z][a-z0-9-]{0,59}$/i.test(p)&&(l[au]=p.toLowerCase());try{for(var g=c(ou),v=g.next();!v.done;v=g.next()){var m=v.value,y=a[m];"number"==typeof y&&Number.isFinite(y)&&(l[m]=y)}}catch(e){r={error:e}}finally{try{v&&!v.done&&(i=g.return)&&i.call(g)}finally{if(r)throw r.error}}var b=a[lu];"string"==typeof b&&(l[lu]=o.url(b));var w=t?e.now()-t.timestamp:1/0,S=null!==u&&t&&w>=0&&w<=3e3&&t.name===u?t.id:null;e.emit("amp-event",{event_type:n.eventType,insert_id:"string"==typeof n.insertId?n.insertId:null,id:S,props:l})}}});return function(){r(),n(),t=void 0}}},cu=[Hl,Xl,Ql,{families:["navigation"],setup:function(e){return e.on("url",function(t){var n=t.url,r=t.timestamp;n.trim()&&e.canEmit("navigation")&&e.emit("navigation",{url:e.helpers.url(n)},r)})}},uu,tu,ru];function du(e,t,n){return void 0===n&&(n=cu),function(e,t,n){var r,i,o=jl(e),a=!1,l=!1,u=!1,d=[],h={},f={},p=new Map,g=new Set,v=null!==(r=t.now)&&void 0!==r?r:Date.now,m=function(e){var n;try{null===(n=t.onError)||void 0===n||n.call(t,e)}catch(e){}},y=function(e){try{e()}catch(e){m(e)}},b=function(e){var t;return a&&!1!==(null===(t=o.families)||void 0===t?void 0:t[e])},w=function(e){var t;return b(e)&&(null!==(t=h[e])&&void 0!==t?t:0)<Ul[e]},S=function(e){var t;return!(!b(e)||!w(e)&&(f[e]=(null!==(t=f[e])&&void 0!==t?t:0)+1,1))},k={host:t,helpers:Nl(t),now:v,enabled:b,canEmit:S,hasCapacity:w,dropped:function(){return s({},f)},hasSnapshot:function(){return u},emit:function(e,n,r){var i,o,a;if(void 0===r&&(r=v()),!S(e))return!1;try{a=null===(i=t.getIdentity)||void 0===i?void 0:i.call(t)}catch(e){m(e)}null!=a||(a=Fl(t.document,t.window));var l={name:e,payload:s(s({},n),{v:1,tab_id:a.tab_id,document_id:a.document_id}),timestamp:r};h[e]=(null!==(o=h[e])&&void 0!==o?o:0)+1;try{t.emit(l)}catch(e){return m(e),!1}return"context"===e&&(f={}),g.forEach(function(e){return y(function(){return e(l)})}),!0},on:function(e,t){var n=p.get(e);n||(n=new Set,p.set(e,n));var r=function(e){return y(function(){return t(e)})};n.add(r);var i=n;return function(){i.delete(r)}},subscribe:function(e){return g.add(e),function(){g.delete(e)}}},x=function(){a=!1;var e=d;d=[],e.reverse().forEach(function(e){return y(e)}),p.clear(),g.clear()},C=function(){var e,r,u,h;if(!a&&l&&o.enabled){var f=null!==(u=o.sampleRate)&&void 0!==u?u:1;if(!(!Number.isFinite(f)||f<=0||f>1||(void 0===i&&(i=(null!==(h=t.random)&&void 0!==h?h:Math.random)()),i>=f))){a=!0;var p=function(e){if(e.families.some(b)){var t=[],n=s(s({},k),{onCleanup:function(e){t.push(e)},on:function(e,n){var r=k.on(e,n);return t.push(r),r},subscribe:function(e){var n=k.subscribe(e);return t.push(n),n}}),r=function(){t.splice(0).reverse().forEach(function(e){return y(e)})};try{t.push(e.setup(n)),d.push(r)}catch(e){r(),m(e)}}};try{for(var g=c(n),v=g.next();!v.done;v=g.next())p(v.value)}catch(t){e={error:t}}finally{try{v&&!v.done&&(r=g.return)&&r.call(g)}finally{if(e)throw e.error}}}}};return{isActive:function(){return a},start:function(){l=!0,C()},stop:function(){l=!1,u=!1,x()},updateConfig:function(e){x(),o=jl(e),C()},resetSession:function(){x(),i=void 0,u=!1,h={},f={},C()},notify:function(e,t){var n,r,i;"snapshot"===e&&(u=!0),"snapshot"!==e&&"navigation"!==e&&"url"!==e||null===(r=(n=k.helpers).invalidateHeading)||void 0===r||r.call(n),a&&(null===(i=p.get(e))||void 0===i||i.forEach(function(e){return e(t)}))}}}(e,t,n)}var hu,fu,pu,gu=(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))(gu||{}),vu=(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))(vu||{}),mu=(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))(mu||{}),yu=function(){function e(e){this.ready=!1,this.firstSnapshot=!1,this.pendingSnapshots=0,this.pendingEvents=[],this.startSignal={state:"start",reason:"init"},this.resumeReason="focus",this.config={enabled:!1},this.capture=du(this.config,e)}return e.prototype.prepare=function(e,t){var n=this.sessionId!==t,r=void 0===this.sessionId;this.config=e,this.capture.updateConfig(e),n&&this.capture.resetSession(),this.startSignal={state:n?"start":"resume",reason:r?"init":n?"new_session":this.resumeReason},this.sessionId=t,this.ready=!1,this.firstSnapshot=!1,this.pendingSnapshots=0,this.pendingEvents=[]},e.prototype.recordingReady=function(){var e,t;if(this.config.enabled&&!this.ready){this.ready=!0,this.capture.start();var n=this.pendingEvents;this.pendingEvents=[];try{for(var r=c(n),i=r.next();!i.done;i=r.next()){var o=i.value;this.event(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}var s=this.pendingSnapshots;this.pendingSnapshots=0;for(var a=0;a<s;a++)this.snapshot()}},e.prototype.event=function(e){if(this.config.enabled){var t=e.type===gu.FullSnapshot,n=e.type===gu.IncrementalSnapshot&&e.data.source===vu.Mutation,r=e.type===gu.Plugin&&"amplitude/url-tracking@1"===e.data.plugin?e.data.payload:void 0,i=r&&"object"==typeof r&&"url-change-event"===r.type&&"string"==typeof r.href?r.href:void 0;(t||n||void 0!==i)&&(this.ready?this.capture.isActive()&&(void 0!==i?this.capture.notify("url",{url:i,timestamp:e.timestamp}):e.type===gu.FullSnapshot?(this.capture.notify("dom",{type:"snapshot",node:e.data.node}),this.snapshot()):e.type===gu.IncrementalSnapshot&&e.data.source===vu.Mutation&&this.capture.notify("dom",s(s({},e.data),{type:"mutation"}))):this.pendingEvents.length<128&&this.pendingEvents.push(e))}},e.prototype.click=function(e){this.ready&&this.capture.notify("click",e)},e.prototype.snapshot=function(){this.config.enabled&&(this.ready?(this.firstSnapshot||(this.firstSnapshot=!0,this.capture.notify("recording",this.startSignal)),this.capture.notify("snapshot",void 0)):this.pendingSnapshots++)},e.prototype.stop=function(e,t){void 0===e&&(e="targeting"),void 0===t&&(t="stop");var n=this.ready&&this.firstSnapshot;this.ready=!1,this.firstSnapshot=!1,n&&(this.resumeReason=e,this.capture.notify("recording",{state:t,reason:e})),this.capture.stop(),this.pendingEvents=[],this.ready=!1,this.pendingSnapshots=0},e}(),bu="AMP_semantic_tab_v1",wu=new WeakMap,Su=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function ku(e,t){if(pu=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 n={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};hu=s(s({},n),t),fu=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(hu.root,n);var r=xu(e,"all",function(){return xu(e,"two",function(){return xu(e,"one",function(){return xu(e,"none")})})});if(r){var i=_u(Nu(r,e));return i.length>0&&(r=i[0]),Eu(r)}throw new Error("Selector was not found.")}function xu(e,t,n){for(var r=null,i=[],o=e,s=0,a=function(){var e,a,l=(new Date).getTime()-pu.getTime();if(void 0!==hu.timeoutMs&&l>hu.timeoutMs)throw new Error("Timeout: Can't find a unique selector after ".concat(l,"ms"));var u=Au(function(e){var t=e.getAttribute("id");if(t&&hu.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(o))||Au.apply(void 0,h([],d(function(e){var t=Array.from(e.attributes).filter(function(e){return hu.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))||Au.apply(void 0,h([],d(function(e){var t=Array.from(e.classList).filter(hu.className);return t.map(function(e){return{name:"."+CSS.escape(e),penalty:1}})}(o)),!1))||Au(function(e){var t=e.tagName.toLowerCase();if(hu.tagName(t))return{name:t,penalty:2};return null}(o))||[{name:"*",penalty:3}],f=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(o);if("all"==t)f&&(u=u.concat(u.filter(Pu).map(function(e){return Tu(e,f)})));else if("two"==t)u=u.slice(0,1),f&&(u=u.concat(u.filter(Pu).map(function(e){return Tu(e,f)})));else if("one"==t){var p=d(u=u.slice(0,1),1)[0];f&&Pu(p)&&(u=[Tu(p,f)])}else"none"==t&&(u=[{name:"*",penalty:3}],f&&(u=[Tu(u[0],f)]));try{for(var g=(e=void 0,c(u)),v=g.next();!v.done;v=g.next()){(p=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>=hu.seedMinLength&&(r=Cu(i,n)))return"break";o=o.parentElement,s++};o;){if("break"===a())break}return r||(r=Cu(i,n)),!r&&n?n():r}function Cu(e,t){var n,r,i=_u(Ru(e));if(i.length>hu.threshold)return t?t():null;try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(Ou(a))return a}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null}function Eu(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var i=e[r].level||0;n=t.level===i-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function Iu(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function Ou(e){var t=Eu(e);switch(fu.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 Tu(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function Pu(e){return"html"!==e.name&&!e.name.startsWith("#")}function Au(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(Mu);return n.length>0?n:null}function Mu(e){return null!=e}function Ru(e,t){var n,r,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]),n=c(e[0]),r=n.next(),l.label=2;case 2:return r.done?[3,5]:(i=r.value,[5,c(Ru(e.slice(1,e.length),t.concat(i)))]);case 3:l.sent(),l.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return o=l.sent(),s={error:o},[3,8];case 7:try{r&&!r.done&&(a=n.return)&&a.call(n)}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 _u(e){return h([],d(e),!1).sort(function(e,t){return Iu(e)-Iu(t)})}function Nu(e,t,n){var r,i,o;return void 0===n&&(n={counter:0,visited:new Map}),u(this,function(s){switch(s.label){case 0:if(!(e.length>2&&e.length>hu.optimizedMinLength))return[3,5];r=1,s.label=1;case 1:return r<e.length-1?n.counter>hu.maxNumberOfTries?[2]:(n.counter+=1,(i=h([],d(e),!1)).splice(r,1),o=Eu(i),n.visited.has(o)?[2]:Ou(i)&&function(e,t){return fu.querySelector(Eu(e))===t}(i,t)?[4,i]:[3,4]):[3,5];case 2:return s.sent(),n.visited.set(o,!0),[5,c(Nu(i,t,n))];case 3:s.sent(),s.label=4;case 4:return r++,[3,1];case 5:return[2]}})}var Lu=function(e,t){var n=document.createDocumentFragment();return function(e,t,n){var r,i,o=s({},e);try{for(var a=c(["blockSelector","maskSelector","unmaskSelector"]),l=a.next();!l.done;l=a.next()){var u=l.value,d=e[u],h=("string"==typeof d?[d]:null!=d?d:[]).filter(function(e){try{return t(e),!0}catch(t){if(!n)throw new Error("Invalid privacy selector: ".concat(e));return n(e),!1}});o[u]=h.length?h:void 0}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}(e,function(e){n.querySelector(e)},function(e){t.warn('[session-replay-browser] omitting selector "'.concat(e,'" because it is invalid'))})},Du=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){var e,t,n,r,i,o,a,f;return l(this,void 0,void 0,function(){var l,p,g,v,m,y,b,w,S,k,x,C,E,I,O,T,P,A,M=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){M.remoteConfigClient.subscribe("configs.sessionReplay",{timeout:1500},function(n,r){var i;if(M.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(r,":"),JSON.stringify(n,null,2)),n){var o=n,s=o.sr_sampling_config,a=o.sr_privacy_config,u=o.sr_targeting_config,c=o.sr_semantic_config,d=null===(i=l.interactionConfig)||void 0===i?void 0:i.ugcFilterRules;l.interactionConfig=o.sr_interaction_config,l.interactionConfig&&d&&(l.interactionConfig.ugcFilterRules=d),l.loggingConfig=o.sr_logging_config,(s||a||u||c)&&(p={},c&&(p.sr_semantic_config=c),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 g=u.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",g),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(v=p.sr_sampling_config,m=p.sr_privacy_config,y=p.sr_targeting_config,(b=p.sr_semantic_config)&&(l.semanticCapture=s(s(s({enabled:!1},l.semanticCapture),b),{families:s(s({},null===(e=l.semanticCapture)||void 0===e?void 0:e.families),b.families)})),v&&Object.keys(v).length>0?(Object.prototype.hasOwnProperty.call(v,"capture_enabled")?l.captureEnabled=v.capture_enabled:l.captureEnabled=!1,Object.prototype.hasOwnProperty.call(v,"sample_rate")&&(l.sampleRate=v.sample_rate),Object.prototype.hasOwnProperty.call(v,"min_session_duration_ms")&&(l.minSessionDurationMs=this.sanitizeMinSessionDurationMs(v.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.")),m){w=null!==(t=l.privacyConfig)&&void 0!==t?t:{},S={defaultMaskLevel:null!==(r=null!==(n=m.defaultMaskLevel)&&void 0!==n?n:w.defaultMaskLevel)&&void 0!==r?r:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:h([],d(new Set(h(h([],d(null!==(i=w.maskAttributes)&&void 0!==i?i:[]),!1),d(null!==(o=m.maskAttributes)&&void 0!==o?o:[]),!1))),!1),urlMaskLevels:h(h([],d(null!==(a=m.urlMaskLevels)&&void 0!==a?a:[]),!1),d(null!==(f=w.urlMaskLevels)&&void 0!==f?f:[]),!1)},k=function(e){var t,n,r,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:[]),f=h.next();!f.done;f=h.next()){d[f.value]="block"}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}try{for(var p=c(null!==(l=e.maskSelector)&&void 0!==l?l:[]),g=p.next();!g.done;g=p.next()){d[g.value]="mask"}}catch(e){r={error:e}}finally{try{g&&!g.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.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},x=s(s({},k(w)),k(m));try{for(C=c(Object.entries(x)),E=C.next();!E.done;E=C.next())I=d(E.value,2),O=I[0],"mask"===(T=I[1])?S.maskSelector.push(O):"block"===T?S.blockSelector.push(O):"unmask"===T&&S.unmaskSelector.push(O)}catch(e){P={error:e}}finally{try{E&&!E.done&&(A=C.return)&&A.call(C)}finally{if(P)throw P.error}}l.privacyConfig=Lu(S,this.localConfig.loggerProvider)}return y&&Object.keys(y).length>0&&(l.targetingConfig=y),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:ml(l)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:l,remoteConfig:p}]}})})},e.prototype.sanitizeMinSessionDurationMs=function(e){if("number"==typeof e&&Number.isFinite(e)){if(!(e<0))return e>Fu?(this.localConfig.loggerProvider.warn("min_session_duration_ms remote value ".concat(e," exceeds ").concat(Fu,"ms ceiling; clamping.")),Fu):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}(),Fu=6e4,Uu=function(e,t){return l(void 0,void 0,void 0,function(){var n,r;return u(this,function(i){return n=new bl(e,t),r=new Ot(e,n.loggerProvider,n.serverZone,t.configServerUrl,t.handleFetchConfig),[2,new Du(r,n)]})})};function ju(e){for(var t=e.length,n=0;n<t&&!(e.charCodeAt(n)>127);n++);if(n===t)return t;for(var r=n;n<t;n++){var i=e.charCodeAt(n);if(i<=127)r++;else if(i<=2047)r+=2;else if(i>=55296&&i<=56319){var o=n+1<t?e.charCodeAt(n+1):NaN;o>=56320&&o<=57343?(r+=4,n++):r+=3}else r+=3}return r}function Bu(e){for(var t=0,n=0;n<e.length;n++)t+=ju(e[n]);return t}function qu(e,t){if(!(3*e.length<=t)){var n=ju(e);return n>t?n:void 0}}function zu(e){if(e.type!==gu.IncrementalSnapshot)return!1;var t=e.data;return t.source===vu.Mutation&&!t.isAttachIframe}function Wu(e){var t,n,r=new Map;if(e.forEach(function(e,t){if(e.attributes&&"style"in e.attributes){var n=r.get(e.id);n?n.push(t):r.set(e.id,[t])}}),0===r.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,n){var r;("object"!=typeof(r=i(e))||null===r)&&(t=n)});var n=[];if(e.forEach(function(e,r){r!==t&&(o.add(e),r>t&&n.push(e))}),n.length>0){var r=n[n.length-1],s=function(e){var t,n,r,i,o={};try{for(var s=c(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{for(var u=(r=void 0,c(Object.keys(l))),d=u.next();!d.done;d=u.next()){var h=d.value;o[h]=l[h]}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o}(n.map(function(e){return i(e)}));o.delete(r),a.set(r,s)}};try{for(var u=c(r.values()),d=u.next();!d.done;d=u.next()){l(d.value)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(n=u.return)&&n.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 n=a.get(t);if(void 0===n)if(o.has(t)){var r=s({},e.attributes);delete r.style,Object.keys(r).length>0&&h.push(s(s({},e),{attributes:r}))}else h.push(e);else h.push(s(s({},e),{attributes:s(s({},e.attributes),{style:n})}))}),h}function Vu(e){var t,n,r,i,o=e[0],a=new Map,l=new Map,u=new Map,h=new Map,f=new Map;e.forEach(function(e,t){var n,r,i,o,s=e.data;try{for(var d=c(s.adds),p=d.next();!p.done;p=d.next()){var g=p.value;a.has(g.node.id)||a.set(g.node.id,t),l.set(g.node.id,t),f.set(g.node.id,g.parentId)}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.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 p=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?p.add(b):S<w&&g.add(b))}}catch(e){t={error:e}}finally{try{m&&!m.done&&(n=v.return)&&n.call(v)}finally{if(t)throw t.error}}var k=new Set;if(p.size>0||g.size>0)for(var x=!0;x;){x=!1;try{for(var C=(r=void 0,c(f)),E=C.next();!E.done;E=C.next()){var I=d(E.value,2),O=I[0],T=I[1];if(!p.has(O)&&!g.has(O)&&!k.has(O)&&(p.has(T)||g.has(T)||k.has(T))){var P=u.get(O),A=a.get(O);void 0!==P&&void 0!==A&&P<A?g.add(O):void 0!==P&&void 0!==A&&P===A?k.add(O):p.add(O),x=!0}}}catch(e){r={error:e}}finally{try{E&&!E.done&&(i=C.return)&&i.call(C)}finally{if(r)throw r.error}}}var M=p.size>0||g.size>0||k.size>0,R=[];e.forEach(function(e,t){var n,r;try{for(var i=c(e.data.removes),o=i.next();!o.done;o=i.next()){var s=o.value;p.has(s.id)||(g.has(s.id)&&t>=a.get(s.id)||k.has(s.id)&&(p.has(s.parentId)||g.has(s.parentId)||k.has(s.parentId))||R.push(s))}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}});var _=e.flatMap(function(e){return e.data.adds}),N=e.flatMap(function(e){return e.data.texts}),L=e.flatMap(function(e){return e.data.attributes}),D=M?L.filter(function(e){return!p.has(e.id)&&!g.has(e.id)&&!k.has(e.id)}):L,F={source:vu.Mutation,removes:R,adds:M?_.filter(function(e){return!p.has(e.node.id)&&!g.has(e.node.id)&&!k.has(e.node.id)}):_,texts:M?N.filter(function(e){return!p.has(e.id)&&!g.has(e.id)&&!k.has(e.id)}):N,attributes:Wu(D)};return s(s({},o),{data:F})}function $u(e){if(e.length<=1)return e;for(var t=[],n=0;n<e.length;)if(zu(e[n])){for(var r=n+1;r<e.length&&zu(e[r]);)r++;t.push(r>n+1?Vu(e.slice(n,r)):e[n]),n=r}else t.push(e[n]),n++;return t}var Ku=function(){function e(e,t,n,r,i){var o,s=this;this.taskQueue=[],this.pendingQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t=e,n=t.type,r=t.timestamp,i=t.delay,o=t.data;return null!=i?JSON.stringify({type:n,timestamp:r,delay:i,data:o}):JSON.stringify({type:n,timestamp:r,data:o})},this.addCompressedEventToManager=function(e,t){var n,r=qu(e,null!==(n=s.config.maxSingleEventSizeBytes)&&void 0!==n?n:Ga);void 0===r?s.eventsManager&&s.deviceId&&s.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:s.deviceId}):s.config.loggerProvider.warn("Session replay event dropped: serialized size ".concat(Math.round(r/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."))},this.addCompressedEvent=function(e,t){if(s.worker)try{s.worker.postMessage({event:e,sessionId:t})}catch(n){"DataCloneError"===n.name?s.worker.postMessage(JSON.stringify({event:e,sessionId:t})):s.config.loggerProvider.warn("Unexpected error while posting message to worker:",n)}else{var n=s.compressEvent(e);s.addCompressedEventToManager(n,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 n=t.event,r=t.sessionId,i=s.compressEvent(n);s.addCompressedEventToManager(i,r)}}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=n,this.timeout=(null===(o=t.performanceConfig)||void 0===o?void 0:o.timeout)||2e3,this.onFullSnapshotProcessed=i,r){t.loggerProvider.log("Enabling web worker for compression");try{var l=new Blob([r],{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,n=t.compressedEvent,r=t.sessionId;s.addCompressedEventToManager(n,r)},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 n,r,i,o;if(e.type===gu.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,f=this.compressEvent(u.event);this.addCompressedEventToManager(f,u.sessionId)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}this.isProcessing=!1}var p=this.compressEvent(e);return this.addCompressedEventToManager(p,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,n=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 r=this.taskQueue.shift();if(r){var i=r.event,o=r.sessionId;this.addCompressedEvent(i,o)}}this.taskQueue.length>0||this.pendingQueue.length>0?requestIdleCallback(function(e){n.processQueue(e)},{timeout:this.timeout}):this.isProcessing=!1},e.prototype.mergeMutationTasks=function(e){var t,n,r;if(!1===(null===(r=this.config.performanceConfig)||void 0===r?void 0:r.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=$u(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&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}o=a}return i},e}(),Hu="Session replay event batch rejected due to exceeded retry count",Gu="Failed to store session replay events in IndexedDB",Ju="Session replay event batch dropped: server signalled capture disabled or session out of valid range for this session",Yu="1.52.0-codexsemantic-review-integration.0";function Xu(e,t){return l(this,void 0,void 0,function(){var n,r,i,o,s,a,d,h,f,p,g,v,m,y,b=this;return u(this,function(w){switch(w.label){case 0:return w.trys.push([0,4,,5]),n=t.CompressionStream,r=new n("gzip"),i=r.writable.getWriter(),o=r.readable.getReader(),s=[],a=l(b,void 0,void 0,function(){var e,t,n;return u(this,function(r){switch(r.label){case 0:return[4,o.read()];case 1:if(e=r.sent(),t=e.done,n=e.value,t)return[3,3];s.push(n),r.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),f=0;try{for(p=c(s),g=p.next();!g.done;g=p.next())v=g.value,h.set(v,f),f+=v.length}catch(e){m={error:e}}finally{try{g&&!g.done&&(y=p.return)&&y.call(p)}finally{if(m)throw m.error}}return[2,h];case 4:return w.sent(),[2,null];case 5:return[2]}})})}var Qu=function(){function e(e){var t=e.trackServerUrl,n=e.loggerProvider,r=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=n,this.payloadBatcher=r||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),f=new Worker(h);f.onerror=function(e){var t,r;e.preventDefault(),n.error("Track destination worker failed, falling back to main-thread sending: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),f.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),n.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&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}l.pendingWorkerRequests.clear(),l.timedOutWorkerRequests.clear()},f.onmessage=function(e){var t=e.data;if("log"===t.type)n.log(t.message);else if("warn"===t.type)n.warn(t.message);else if("payload_too_large"===t.type){var r=l.pendingWorkerRequests.get(t.id);if(r)r.timeout&&clearTimeout(r.timeout),l.handlePayloadTooLargeResponse(r.context,t.isWaf),r.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(f,t).catch(function(e){n.warn("Failed to handle delegated session replay fetch:",e)})},this.worker=f}catch(e){n.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,n,r=this,i=e.events,o=e.sessionId,s=e.deviceId,a=e.apiKey,l=e.serverZone,u=function(e){return ju(e)},c=i,d=JSON.stringify({version:2,events:c});if(u(d)>65536){for(var h=0,f=c.length;h<f;){var p=Math.floor((h+f+1)/2);u(JSON.stringify({version:2,events:c.slice(0,p)}))<=65536?h=p:f=p-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(fl(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){r.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(fl(l,this.trackServerUrl),"?").concat(y.toString()),w=z();try{var S=new Blob([d],{type:"application/json"});!1===(null===(n=null===(t=null==w?void 0:w.navigator)||void 0===t?void 0:t.sendBeacon)||void 0===n?void 0:n.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=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.filter(function(t){return e.killedSessions.has(t.sessionId)?(e.completeRequest({context:t,err:Ju}),!1):t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:Hu}),!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 n=this.flushPauseUntilMs-Date.now(),r=n>e?n:e;n>0&&(this.mergeOnNextFlush=!0),this.scheduled=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},r)}},e.prototype.flush=function(e){return void 0===e&&(e=!1),l(this,void 0,void 0,function(){var t,n,r,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]),n=c(t),r=n.next(),l.label=2;case 2:return r.done?[3,5]:(i=r.value,[4,this.send(i,e)]);case 3:l.sent(),l.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return o=l.sent(),s={error:o},[3,8];case 7:try{r&&!r.done&&(a=n.return)&&a.call(n)}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,n,r,i,o,a,f,p,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!==(f=k.serverZone)&&void 0!==f?f:"",k.sampleRate,null!==(g=null===(p=k.version)||void 0===p?void 0:p.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&&(n=w.return)&&n.call(w)}finally{if(t)throw t.error}}var E=[],I=function(e){var t,n;if(1===e.length)return E.push(e[0]),"continue";var r=null,i=0,o=function(){r&&E.push(r),r=null,i=0},a=function(e){var t=Bu(e.events);if(null===r)return r=s(s({},e),{events:h([],d(e.events),!1),attempts:0}),i=t,"continue";if(i+t>4e6)return o(),r=s(s({},e),{events:h([],d(e.events),!1),attempts:0}),i=t,"continue";var n=r.onComplete,a=e.onComplete;r.events=r.events.concat(e.events),i+=t,r.onComplete=function(){return l(y,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,Promise.allSettled([n(),a()])];case 1:return e.sent(),[2]}})})}};try{for(var f=(t=void 0,c(e)),p=f.next();!p.done;p=f.next()){a(p.value)}}catch(e){t={error:e}}finally{try{p&&!p.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}o()};try{for(var O=c(b.values()),T=O.next();!T.done;T=O.next()){I(T.value)}}catch(e){r={error:e}}finally{try{T&&!T.done&&(i=O.return)&&i.call(O)}finally{if(r)throw r.error}}return E},e.prototype.send=function(e,t){return void 0===t&&(t=!0),l(this,void 0,void 0,function(){var n,r,i,o;return u(this,function(s){return this.killedSessions.has(e.sessionId)?[2,this.completeRequest({context:e,err:Ju})]:(n=e.apiKey)?(r=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(n,r,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,n,r){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:n,useRetry:r,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:pl(),sdkVersion:Yu,enableTransportCompression:o.enableTransportCompression,sendTimeoutMs:o.sendTimeoutMs}})})]})})},e.prototype.rememberTimedOutRequest=function(e,t){var n,r;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){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},e.prototype.handleDelegatedFetch=function(e,t){var n,r,i;return l(this,void 0,void 0,function(){var o,s,a,l,c,d,h,f,p,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(f=h.status,p=null,g="",f>=200&&f<300&&(p=null!==(i=null===(r=null===(n=h.headers)||void 0===n?void 0:n.get)||void 0===r?void 0:r.call(n,Za))&&void 0!==i?i:null),413!==f)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(f,".")),e.postMessage({type:"fetch-response",requestId:o,status:f,skipHeader:p,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,n,r,i){var o,a,c,d,h,f,p;return l(this,void 0,void 0,function(){var l,g,v,m,y,b,w,S,k,x,C,E,I,O,T,P,A,M,R,_,N,L;return u(this,function(u){switch(u.label){case 0:l=pl(),g=Yu,v=n.sampleRate,m=new URLSearchParams({device_id:t,session_id:"".concat(n.sessionId),type:"".concat(n.type)}),y="".concat(null!==(a=null===(o=n.version)||void 0===o?void 0:o.type)&&void 0!==a?a:"standalone","/").concat(null!==(d=null===(c=n.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(r),w=z(),this.enableTransportCompression&&w&&"CompressionStream"in w?[4,Xu(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:ju(b),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"}:{}),T={headers:E,body:I=null!=S?S:b,method:"POST",keepalive:O=x<=65536,signal:C.signal},P="".concat(fl(n.serverZone,this.trackServerUrl),"?").concat(m.toString()),0===r.events.length)return this.completeRequest({context:n}),[2];A=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,(D=this.handleSendEvents({url:P,method:"POST",headers:E,body:I,keepalive:O}),F=C.signal,new Promise(function(e,t){var n=function(){var e=new Error("Custom session replay transport aborted by send timeout");e.name="AbortError",t(e)};F.addEventListener("abort",n,{once:!0}),D.then(function(t){F.removeEventListener("abort",n),e(t)},function(e){F.removeEventListener("abort",n),t(e)})}))]:[3,7];case 6:return R=u.sent(),[3,9];case 7:return[4,fetch(P,T)];case 8:R=u.sent(),u.label=9;case 9:return M=R,[3,11];case 10:return A&&clearTimeout(A),[7];case 11:if(null===M)return this.completeRequest({context:n,err:"Unexpected error occurred"}),[2];if(M.status>=200&&M.status<300&&(_=null!==(p=null===(f=null===(h=M.headers)||void 0===h?void 0:h.get)||void 0===f?void 0:f.call(h,Za))&&void 0!==p?p:null,this.applyServerDirective(n.sessionId,_)),i)return[3,12];N="";try{N=JSON.stringify(M.body,null,2)}catch(e){}return this.completeRequest({context:n,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,n,N)];case 17:u.sent(),u.label=18;case 18:return[3,23];case 19:return L=u.sent(),!!L&&"object"==typeof L&&"AbortError"===L.name&&i?[4,this.handleOtherResponse(n)]:[3,21];case 20:return u.sent(),[3,22];case 21:this.completeRequest({context:n,err:L}),u.label=22;case 22:return[3,23];case 23:return[2]}var D,F})})},e.prototype.handleReponse=function(e,t,n){return void 0===n&&(n=""),l(this,void 0,void 0,function(){var r;return u(this,function(i){switch(i.label){case 0:switch(r=(new bt).buildStatus(e),r){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,Ja.test(n)),[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 n=t?"WAF (compressed payload too large)":"server (event too large)",r=Math.round(e.events.reduce(function(e,t){return e+t.length},0)/Qa);if(t)if(1!==e.events.length){this.loggerProvider.warn("Session replay event batch rejected by ".concat(n," (").concat(e.events.length," events, ").concat(r," 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(r," KB, 1 event) rejected by ").concat(n," — cannot split further")});else this.completeRequest({context:e,err:"Session replay event batch dropped: ".concat(n," rejected payload (").concat(e.events.length," events, ").concat(r," KB) — not retrying non-WAF 413")})},e.prototype.handleSuccessResponse=function(e){var t=Math.round(Bu(e.events)/Qa);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(n){switch(n.label){case 0:return t=Math.random()*e.attempts*this.retryTimeout,e.attempts++,e.attempts>(e.flushMaxRetries||0)?(this.completeRequest({context:e,err:Hu}),[2]):[4,new Promise(function(e){return setTimeout(e,t)})];case 1:return n.sent(),[4,this.send(e,!0)];case 2:return n.sent(),[2]}})})},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.onComplete(),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e.prototype.applyServerDirective=function(e,t){if(null===t)return this.flushPauseUntilMs=0,void(this.mergeLogFiredThisPause=!1);if("429"===t){var n=this.flushPauseUntilMs>Date.now();return this.flushPauseUntilMs=Date.now()+6e4,void(n||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 n,r,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){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.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 f=h.value;f.sessionId===e?this.completeRequest({context:f,err:Ju}):u.push(f)}}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 Zu=(e,t)=>t.some(t=>e instanceof t);let ec,tc;const nc=new WeakMap,rc=new WeakMap,ic=new WeakMap;let oc={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return nc.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return uc(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function sc(e){oc=e(oc)}function ac(e){return(tc||(tc=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(cc(this),t),uc(this.request)}:function(...t){return uc(e.apply(cc(this),t))}}function lc(e){return"function"==typeof e?ac(e):(e instanceof IDBTransaction&&function(e){if(nc.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});nc.set(e,t)}(e),Zu(e,ec||(ec=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,oc):e)}function uc(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(uc(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return ic.set(t,e),t}(e);if(rc.has(e))return rc.get(e);const t=lc(e);return t!==e&&(rc.set(e,t),ic.set(t,e)),t}const cc=e=>ic.get(e);function dc(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=uc(s);return r&&s.addEventListener("upgradeneeded",e=>{r(uc(s.result),e.oldVersion,e.newVersion,uc(s.transaction),e)}),n&&s.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}const hc=["get","getKey","getAll","getAllKeys","count"],fc=["put","add","delete","clear"],pc=new Map;function gc(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(pc.get(t))return pc.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=fc.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!hc.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;return r&&(s=s.index(t.shift())),(await Promise.all([s[n](...t),i&&o.done]))[0]};return pc.set(t,o),o}sc(e=>({...e,get:(t,n,r)=>gc(t,n)||e.get(t,n,r),has:(t,n)=>!!gc(t,n)||e.has(t,n)}));const vc=["continue","continuePrimaryKey","advance"],mc={},yc=new WeakMap,bc=new WeakMap,wc={get(e,t){if(!vc.includes(t))return e[t];let n=mc[t];return n||(n=mc[t]=function(...e){yc.set(this,bc.get(this)[t](...e))}),n}};async function*Sc(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const n=new Proxy(t,wc);for(bc.set(n,t),ic.set(n,cc(t));t;)yield n,t=await(yc.get(n)||t.continue()),yc.delete(n)}function kc(e,t){return t===Symbol.asyncIterator&&Zu(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&Zu(e,[IDBIndex,IDBObjectStore])}sc(e=>({...e,get:(t,n,r)=>kc(t,n)?Sc:e.get(t,n,r),has:(t,n)=>kc(t,n)||e.has(t,n)}));var xc=function(){function e(e){var t,n,r,i=this;this.minInterval=Ya,this.maxInterval=Xa,this.maxPersistedEventsSize=6e6,this._timeAtLastSplit=Date.now(),this.eventsContentBytes=new WeakMap,this.sequenceContentBytes=new Map,this.shouldSplitEventsList=function(e,t){var n=i.getEventsArraySize(e),r=i.maxPersistedEventsSize-n,o=t.length>=r;return!o&&3*t.length>=r&&(o=ju(t)>=r),!!o||!!(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!==(n=e.maxInterval)&&void 0!==n?n:this.maxInterval,this.maxPersistedEventsSize=null!==(r=e.maxPersistedEventsSize)&&void 0!==r?r:this.maxPersistedEventsSize,this.interval=this.minInterval}return Object.defineProperty(e.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),e.prototype.isPrefixOf=function(e,t){return!(t.length<e.length)&&(0===e.length||t[e.length-1]===e.tail)},e.prototype.measureContentBytes=function(e,t){if(e&&e.length===t.length&&this.isPrefixOf(e,t))return e;var n=0,r=0;e&&this.isPrefixOf(e,t)&&(n=e.contentBytes,r=e.length);for(var i=r;i<t.length;i++)n+=ju(t[i]);return{length:t.length,contentBytes:n,tail:t.length>0?t[t.length-1]:void 0}},e.prototype.getEventsContentBytes=function(e){var t=this.measureContentBytes(this.eventsContentBytes.get(e),e);return this.eventsContentBytes.set(e,t),t.contentBytes},e.prototype.getEventsArraySize=function(e){return this.getEventsContentBytes(e)+(2+Math.max(0,e.length-1)+2*e.length)},e.prototype.recallSequenceContentBytes=function(e,t){var n=this.sequenceContentBytes.get(e);n&&n.length===t.length&&this.isPrefixOf(n,t)&&this.eventsContentBytes.set(t,n)},e.prototype.rememberSequenceContentBytes=function(e,t){var n=this.measureContentBytes(this.sequenceContentBytes.get(e),t);this.sequenceContentBytes.set(e,n),this.eventsContentBytes.set(t,n)},e.prototype.forgetSequenceContentBytes=function(e){this.sequenceContentBytes.delete(e)},e}(),Cc=function(e,t,n){!function(e){return"object"==typeof e&&null!==e&&"AbortError"===e.name}(n)?e.warn(t):e.debug(t)};var Ec="sessionCurrentSequence",Ic="sequencesToSend",Oc=5e3;function Tc(e,t,n){var r=setTimeout(n,t);return e.then(function(){return clearTimeout(r)},function(){return clearTimeout(r)}),function(){return clearTimeout(r)}}var Pc=function(e){var t,n;return e.objectStoreNames.contains(Ec)||(n=e.createObjectStore(Ec,{keyPath:"sessionId"})),e.objectStoreNames.contains(Ic)||(t=e.createObjectStore(Ic,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:n}},Ac=function(e){return l(void 0,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,(n=dc(e,1,{upgrade:Pc}),r=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(r,"ms")))},r);n.then(function(t){clearTimeout(o),e(t)},function(e){clearTimeout(o),t(e)})}))];case 1:return[2,t.sent()]}var n,r,i})})},Mc=function(e){function t(t){var n,r=this;return(r=e.call(this,t)||this).consecutiveFailures=0,r.hasTriggeredFallback=!1,r.emptyFilteredCount=0,r.getSequencesToSend=function(){return l(r,void 0,void 0,function(){var e,t,n,r,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]),n=[],(r=this.db.transaction("sequencesToSend","readwrite")).done.catch(function(n){e||t||(Cc(d.loggerProvider,"".concat(Gu,": ").concat(n),n),d.recordFailure())}),i=Tc(r.done,Oc,function(){e||t||(t=!0,Cc(d.loggerProvider,"".concat(Gu,": transaction timed out")),d.recordFailure())}),[4,r.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:n.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,n];case 9:return c=u.sent(),t||(e=!0,Cc(this.loggerProvider,"".concat(Gu,": ").concat(c),c),this.recordFailure()),[3,10];case 10:return[2,void 0]}})})},r.storeCurrentSequence=function(e){return l(r,void 0,void 0,function(){var t,n,r,i,o,l,c,d,h=this;return u(this,function(u){switch(u.label){case 0:t=!1,n=!1,u.label=1;case 1:return u.trys.push([1,5,,6]),(r=this.db.transaction([Ec,Ic],"readwrite")).done.catch(function(e){t||n||(Cc(h.loggerProvider,"".concat(Gu,": ").concat(e),e),h.recordFailure())}),i=Tc(r.done,Oc,function(){t||n||(n=!0,Cc(h.loggerProvider,"".concat(Gu,": transaction timed out")),h.recordFailure())}),[4,r.objectStore(Ec).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,r.objectStore(Ic).put({sessionId:e,events:o.events,tabId:this.tabId})];case 3:return l=u.sent(),[4,r.objectStore(Ec).put({sessionId:e,events:[],tabId:this.tabId})];case 4:return u.sent(),this.rememberSequenceContentBytes(e,[]),this.recordSuccess(),i(),o.tabId,c=a(o,["tabId"]),[2,s(s({},c),{sessionId:e,sequenceId:l})];case 5:return d=u.sent(),this.forgetSequenceContentBytes(e),n||(t=!0,Cc(this.loggerProvider,"".concat(Gu,": ").concat(d),d),this.recordFailure()),[3,6];case 6:return[2,void 0]}})})},r.addEventToCurrentSequence=function(e,t){return l(r,void 0,void 0,function(){var n,r,i,o,s,a,l,c,d,h,f,p,g,v,m=this;return u(this,function(u){switch(u.label){case 0:n=!1,r=!1,u.label=1;case 1:return u.trys.push([1,15,,16]),(i=this.db.transaction([Ec,Ic],"readwrite")).done.catch(function(e){n||r||(Cc(m.loggerProvider,"".concat(Gu,": ").concat(e),e),m.recordFailure())}),o=Tc(i.done,Oc,function(){n||r||(r=!0,Cc(m.loggerProvider,"".concat(Gu,": transaction timed out")),m.recordFailure())}),[4,i.objectStore(Ec).get(e)];case 2:return(null==(s=u.sent())?void 0:s.tabId)&&s.tabId!==this.tabId?s.events.length>0?[4,i.objectStore(Ic).put({sessionId:e,events:s.events,tabId:s.tabId})]:[3,4]:[3,6];case 3:u.sent(),u.label=4;case 4:return a=[t],[4,i.objectStore(Ec).put({sessionId:e,events:a,tabId:this.tabId})];case 5:return u.sent(),this.rememberSequenceContentBytes(e,a),this.recordSuccess(),o(),[2,void 0];case 6:return(l=s)?[3,8]:(c=[t],[4,i.objectStore(Ec).put({sessionId:e,events:c,tabId:this.tabId})]);case 7:return u.sent(),this.rememberSequenceContentBytes(e,c),this.recordSuccess(),o(),[2,void 0];case 8:return this.recallSequenceContentBytes(e,l.events),this.shouldSplitEventsList(l.events,t)?[3,10]:(d=l.events.concat(t),[4,i.objectStore(Ec).put({sessionId:e,events:d,tabId:this.tabId})]);case 9:return u.sent(),this.rememberSequenceContentBytes(e,d),this.recordSuccess(),o(),[2,void 0];case 10:return 0!==(h=l.events).length?[3,12]:(this.maybeLogEmptyFiltered("addEventToCurrentSequence"),f=[t],[4,i.objectStore(Ec).put({sessionId:e,events:f,tabId:this.tabId})]);case 11:return u.sent(),this.rememberSequenceContentBytes(e,f),this.recordSuccess(),o(),[2,void 0];case 12:return p=[t],[4,i.objectStore(Ec).put({sessionId:e,events:p,tabId:this.tabId})];case 13:return u.sent(),this.rememberSequenceContentBytes(e,p),[4,i.objectStore(Ic).put({sessionId:e,events:h,tabId:this.tabId})];case 14:return g=u.sent(),this.recordSuccess(),o(),[2,{events:h,sessionId:e,sequenceId:g}];case 15:return v=u.sent(),this.forgetSequenceContentBytes(e),r||(n=!0,Cc(this.loggerProvider,"".concat(Gu,": ").concat(v),v),this.recordFailure()),[3,16];case 16:return[2,void 0]}})})},r.storeSendingEvents=function(e,t){return l(r,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.db.put(Ic,{sessionId:e,events:t,tabId:this.tabId})];case 1:return n=i.sent(),this.recordSuccess(),[2,n];case 2:return r=i.sent(),Cc(this.loggerProvider,"".concat(Gu,": ").concat(r),r),this.recordFailure(),[3,3];case 3:return[2,void 0]}})})},r.cleanUpSessionEventsStore=function(e,t){return l(r,void 0,void 0,function(){var e;return u(this,function(n){switch(n.label){case 0:if(!t)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.db.delete(Ic,t)];case 2:return n.sent(),this.recordSuccess(),[3,4];case 3:return e=n.sent(),Cc(this.loggerProvider,"".concat(Gu,": ").concat(e),e),this.recordFailure(),[3,4];case 4:return[2]}})})},r.db=t.db,r.tabId=t.tabId,r.onPersistentFailure=t.onPersistentFailure,r.consecutiveFailureThreshold=null!==(n=t.consecutiveFailureThreshold)&&void 0!==n?n:1,r}return r(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,n){var r;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(n.apiKey.substring(0,10),"_amp_session_replay_events").concat(i),[4,Ac(o)];case 1:return a=u.sent(),l=null!==(r=n.tabId)&&void 0!==r?r: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({},n),{db:a,tabId:l}))];case 2:return c=u.sent(),Cc(n.loggerProvider,"".concat(Gu,": ").concat(c),c),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return l(this,void 0,void 0,function(){var t,n,r,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:n=c.apply(void 0,[u.sent()]),r=n.next(),u.label=5;case 5:if(r.done)return[3,7];if((i=r.value).tabId&&i.tabId!==this.tabId)return[3,6];i.tabId,o=a(i,["tabId"]),t.push(o),u.label=6;case 6:return r=n.next(),[3,5];case 7:return[3,10];case 8:return s=u.sent(),l={error:s},[3,10];case 9:try{r&&!r.done&&(d=n.return)&&d.call(n)}finally{if(l)throw l.error}return[7];case 10:return[2,t]}})})},t}(xc),Rc=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 r(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,n=h([],d(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:n},this.resetCurrentSequence(e),{sequenceId:t,events:n,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,n,r,i,o,s,a,l,h;return u(this,function(u){e=[];try{for(t=c(Object.entries(this.finalizedSequences)),n=t.next();!n.done;n=t.next())r=d(n.value,2),i=r[0],o=r[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{n&&!n.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(n){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 n;return u(this,function(r){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(0===this.sequences[e].length?this.maybeLogEmptyFiltered("addEventToCurrentSequence"):n=this.addSequence(e)),this.sequences[e].push(t),[2,n]})})},t.prototype.storeSendingEvents=function(e,t){return l(this,void 0,void 0,function(){return u(this,function(n){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}(xc),_c=function(e){var t=e.config,n=e.minInterval,r=e.maxInterval,i=e.maxPersistedEventsSize,o=e.type,a=e.payloadBatcher,c=e.storeType,f=e.trackDestinationWorkerScript,p=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,T,P,A,M;return u(this,function(R){switch(R.label){case 0:return g=null!==(M=t.maxSingleEventSizeBytes)&&void 0!==M?M:Ga,v=new Qu(s(s({},t),{loggerProvider:t.loggerProvider,payloadBatcher:a,workerScript:f})),m=function(){return new Rc({loggerProvider:t.loggerProvider,maxInterval:r,minInterval:n,maxPersistedEventsSize:i})},b=!1,S=function(){return l(void 0,void 0,void 0,function(){var e,n,r;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 n=i.sent(),[3,3];case 2:n=void 0,i.label=3;case 3:return e=n,w=m(),e&&y&&(r=y,e.forEach(function(e){O({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r})})),[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,Mc.new(o,{loggerProvider:t.loggerProvider,minInterval:n,maxInterval:r,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=R.sent(),[3,3];case 2:x=m(),R.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){for(var n=e.events,r=e.sessionId,i=e.deviceId,s=e.sequenceId,a=n,c=[],d=0;d<n.length;d++){var h=qu(n[d],g);void 0!==h?(0===c.length&&(a=n.slice(0,d)),c.push(h)):a!==n&&a.push(n[d])}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/1024)," KB")}).join(", "),". If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support.")),0!==a.length?(t.debugMode&&vl().then(function(e){var n=e.totalStorageSize,r=e.percentOfQuota,i=e.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(n," KB, percentage of quota: ").concat(r,"%, usage details: ").concat(i))}).catch(function(){}),v.sendEventsList({events:a,sessionId:r,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(r,s)];case 1:return e.sent(),[2]}})})}})):w.cleanUpSessionEventsStore(r,s).catch(function(e){t.loggerProvider.warn("Failed to clean up session replay events store:",e)})},T=function(e){var n=e.sessionId,r=e.deviceId;if(y=r,!p||p()){var i=E+C.length;w.storeCurrentSequence(n).then(function(e){e&&(I(i),O({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r}))}).catch(function(e){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",e)})}},P=function(e){var n=e.deviceId;return l(void 0,void 0,void 0,function(){var e;return u(this,function(r){switch(r.label){case 0:return y=n,[4,w.getSequencesToSend()];case 1:return(null==(e=r.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:n})}),[2]):[2]}})})},A=function(e){var n=e.event,r=e.sessionId,i=e.deviceId;y=i;var o=!p||p(),s=E+C.length;C.push(n.data),w.addEventToCurrentSequence(r,n.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:T,addEvent:A,sendStoredEvents:P,flush:e,getBeaconEvents:function(){return h([],d(C),!1)},dropPendingBeaconEvents:function(){I(E+C.length)},trackDestination:v}]}})})},Nc=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new Map;e.forEach(function(e){n.set(e.name,e.manager)}),this.managers=n}return e.prototype.sendStoredEvents=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return t=[],this.managers.forEach(function(n){t.push(n.sendStoredEvents(e))}),[4,Promise.all(t)];case 1:return n.sent(),[2]}})})},e.prototype.addEvent=function(e){var t,n=e.sessionId,r=e.event,i=e.deviceId;null===(t=this.managers.get(r.type))||void 0===t||t.addEvent({sessionId:n,event:r,deviceId:i})},e.prototype.sendCurrentSequenceEvents=function(e){var t=e.sessionId,n=e.deviceId;this.managers.forEach(function(e){e.sendCurrentSequenceEvents({sessionId:t,deviceId:n})})},e.prototype.flush=function(e){return l(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return t=[],this.managers.forEach(function(n){t.push(n.flush(e))}),[4,Promise.all(t)];case 1:return n.sent(),[2]}})})},e}(),Lc=function(e){var t=e.version,n=e.events,r=[];return n.forEach(function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&r.push(t)}),{version:t,events:r}},Dc=function(e){var t=e.version,n=e.events,r=[];n.forEach(function(e){var t=JSON.parse(e);"click"===t.type&&r.push(t)});var i=r.reduce(function(e,t){var n=t.x,r=t.y,i=t.selector,o=t.timestamp,a=o-o%36e5,l="".concat(n,":").concat(r,":").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)}},Fc=function(){function e(e,t){var n=this;this.createHook=function(e){var t=e.eventsManager,r=e.sessionId,i=e.deviceIdFn,o=e.mirror,s=e.ugcFilterRules,a=e.performanceOptions;return function(e){var l,u,c,d,h;if(e.type===mu.Click){var f=z();if(f){var p=f.location,g=f.innerHeight,v=f.innerWidth;if(p){var m=e.x,y=e.y;if(void 0!==m&&void 0!==y){var b,w=o.getNode(e.id);if(w)try{b=null!==(l=n.getSelector(w,a))&&void 0!==l?l:void 0}catch(e){n.logger.debug("error resolving selector from finder")}var S=gl(p.href,s),k={x:m+(null!==(c=null===(u=n.scrollWatcher)||void 0===u?void 0:u.currentScrollX)&&void 0!==c?c:0),y:y+(null!==(h=null===(d=n.scrollWatcher)||void 0===d?void 0:d.currentScrollY)&&void 0!==h?h:0),selector:b,viewportHeight:g,viewportWidth:v,pageUrl:S,timestamp:Date.now(),type:"click"},x=i();x&&t.addEvent({sessionId:r,event:{type:"interaction",data:JSON.stringify(k)},deviceId:x})}}}}}},this.logger=e,this.scrollWatcher=t}return e.prototype.getSelector=function(e,t){var n,r,i;if(null===(n=this.clickSelectors)||void 0===n?void 0:n.has(e))return null!==(r=this.clickSelectors.get(e))&&void 0!==r?r:null;var o=ku(e,t);return null===(i=this.clickSelectors)||void 0===i||i.set(e,o),o},e.prototype.createSharedHook=function(e,t){var n=this;return function(r,i){if(r.type===mu.Click){var o=n.clickSelectors;n.clickSelectors=new Map;try{try{null==e||e(r)}catch(e){n.logger.debug("Heatmap click hook failed",e)}if("click"===(null==i?void 0:i.type))try{null==t||t(i)}catch(e){n.logger.debug("Semantic click hook failed",e)}}finally{n.clickSelectors=o}}}},e}();function Uc(){var e=z();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||0}function jc(){var e=z();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||0}var Bc=function(){function e(e,t){var n=z();n&&n.navigator&&"function"==typeof n.navigator.sendBeacon?this.sendBeacon=function(e,t){try{if(n.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch(e){}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(e,t){var n=new XMLHttpRequest;return n.open("POST",e,!0),n.setRequestHeader("Accept","*/*"),n.send(JSON.stringify(t)),!0},this.basePageUrl=fl(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 n,r=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=r.loggerProvider)||void 0===t||t.warn("Custom transport failed to send session replay interaction beacon:",e)})}catch(e){null===(n=this.loggerProvider)||void 0===n||n.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}(),qc=function(){function e(e,t){var n=this;this.timestamp=Date.now(),this.hook=function(e){n.update(e)},this.send=function(e){return function(t){var r,i,o,s,a=e(),l=z();if(l&&a){var u=null!==(r=l.scrollX)&&void 0!==r?r:0,c=null!==(i=l.scrollY)&&void 0!==i?i:0;(u>0||c>0)&&n.update({id:1,x:u,y:c}),n.transport.send(a,{version:1,events:[{maxScrollX:n._maxScrollX,maxScrollY:n._maxScrollY,maxScrollWidth:n._maxScrollWidth,maxScrollHeight:n._maxScrollHeight,viewportHeight:Uc(),viewportWidth:jc(),pageUrl:gl(l.location.href,null!==(s=null===(o=n.config.interactionConfig)||void 0===o?void 0:o.ugcFilterRules)&&void 0!==s?s:[]),timestamp:n.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=jc(),this._maxScrollHeight=Uc(),this.config=t,this.transport=e}return e.default=function(t,n){return new e(new Bc(t,n),n)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),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 n=jc();this._maxScrollX=e.x;var r=e.x+n;r>this._maxScrollWidth&&(this._maxScrollWidth=r),this.timestamp=t}if(e.y>this._maxScrollY){var i=Uc();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),zc=function(e){var t=e.sessionId,n=e.deviceId;this.deviceId=n,this.sessionId=t,t&&n&&(this.sessionReplayId=function(e,t){return"".concat(t,"/").concat(e)}(t,n))},Wc=864e5,Vc=function(e){return"".concat("AMP_SR_START_").concat(e.substring(0,10),"_")},$c=function(e,t){return"".concat(Vc(e)).concat(t)},Kc=function(){try{var e=z();return null==e?void 0:e.localStorage}catch(e){return}},Hc=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,dc(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,n;return u(this,function(r){switch(r.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 n=r.sent(),this.dbs[t]=n,[2,n]}})})},this.getTargetingMatchForSession=function(t){var n=t.loggerProvider,r=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(r)];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(),Cc(n,"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 n=t.loggerProvider,r=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(r)];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(),Cc(n,"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 n=t.loggerProvider,r=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(r)];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(),Cc(n,"Failed to clear old targeting matches for sessions: ".concat(d),d),[3,9];case 9:return[2]}})})}},Gc=new Hc,Jc=function(e){var t=e.sessionId,n=e.targetingConfig,r=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,f;return u(this,function(u){switch(u.label){case 0:return[4,Gc.clearStoreOfOldSessions({loggerProvider:r,apiKey:i,currentSessionId:t})];case 1:return u.sent(),[4,Gc.getTargetingMatchForSession({loggerProvider:r,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 sg})];case 4:return a=u.sent().evaluateTargeting,l=s(s({},o),{flag:n,sessionId:"string"==typeof t?parseInt(t,10):t,apiKey:i,loggerProvider:r}),[4,a(l)];case 5:return(d=u.sent())&&d.sr_targeting_config&&(e="on"===d.sr_targeting_config.key),Gc.storeTargetingMatchForSession({loggerProvider:r,apiKey:i,sessionId:t,targetingMatch:e}),[3,7];case 6:return h=u.sent(),f=h,r.warn(f.message),[3,7];case 7:return[2,e]}})})},Yc=2654435761,Xc=2246822519,Qc=3266489917,Zc=374761393;function ed(e,t){return(e<<t|e>>>32-t)>>>0}function td(e,t){return e=ed(e=e+Math.imul(t,Xc)>>>0,13),e=Math.imul(e,Yc)>>>0}function nd(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function rd(e,t){void 0===t&&(t=0);var n,r=function(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<e.length){var i=e.charCodeAt(n+1);i>=56320&&i<=57343&&(r=i-56320+(r-55296<<10)+65536,n++)}r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<65536?t.push(224|r>>12,128|r>>6&63,128|63&r):t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r)}return new Uint8Array(t)}(e),i=r.length,o=0;if(i>=16){for(var s=t+Yc+Xc>>>0,a=t+Xc>>>0,l=t>>>0,u=t-Yc>>>0;o<=i-16;)s=td(s,nd(r,o)),a=td(a,nd(r,o+=4)),l=td(l,nd(r,o+=4)),u=td(u,nd(r,o+=4)),o+=4;n=ed(s,1)+ed(a,7)+ed(l,12)+ed(u,18)>>>0}else n=t+Zc>>>0;for(n=n+i>>>0;o<=i-4;)n=n+Math.imul(nd(r,o),Qc)>>>0,n=Math.imul(ed(n,17),668265263)>>>0,o+=4;for(;o<i;)n=n+Math.imul(r[o],Zc)>>>0,n=Math.imul(ed(n,11),Yc)>>>0,o++;return n^=n>>>15,n=Math.imul(n,Xc)>>>0,n^=n>>>13,n=Math.imul(n,Qc)>>>0,(n^=n>>>16)>>>0}var id="__amplitude_url_tracking_patched__",od=new WeakMap;function sd(e,t,n){if(void 0===n&&(n={}),!(null==e?void 0:e.location))return function(){};var r=n.enablePolling,i=void 0!==r&&r,o=n.pollingInterval,s=void 0===o?Wa: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,r=a();r!==l&&(l=r,t(r),null===(e=n.onNavigation)||void 0===e||e.call(n,"replace"))},s);return function(){null!=u&&e.clearInterval(u)}}var c=od.get(e);if(!c){var d=void 0,h=new Set,f=function(t){var n=function(){var t;return null!==(t=e.location.href)&&void 0!==t?t:""}();void 0!==d&&n===d||(d=n,h.forEach(function(e){return e(n,t)}))},p=function(e,t){var n=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=e.apply(this,n);return f(t),i};return n[id]=!0,n},g=e.history;if(null==g?void 0:g.pushState){var v=Reflect.get(g,"pushState");v[id]||(g.pushState=p(v,"push"))}if(null==g?void 0:g.replaceState){var m=Reflect.get(g,"replaceState");m[id]||(g.replaceState=p(m,"replace"))}c={callbacks:h,notify:f,onPopStateOrHashChange:function(e){return f("hashchange"===(null==e?void 0:e.type)?"hash":"pop")},listenersAttached:!1},od.set(e,c)}var y=c;y.listenersAttached||(e.addEventListener("popstate",y.onPopStateOrHashChange),e.addEventListener("hashchange",y.onPopStateOrHashChange),y.listenersAttached=!0);var b=function(e,r){var i;t(e),null===(i=n.onNavigation)||void 0===i||i.call(n,r)};return y.callbacks.add(b),function(){y.callbacks.delete(b),0===y.callbacks.size&&y.listenersAttached&&(e.removeEventListener("popstate",y.onPopStateOrHashChange),e.removeEventListener("hashchange",y.onPopStateOrHashChange),y.listenersAttached=!1)}}function ad(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,n,r){var i,o,a,l=s(s({},e),r),u=l.ugcFilterRules||[],c=null!==(i=l.enablePolling)&&void 0!==i&&i,d=null!==(o=l.pollingInterval)&&void 0!==o?o:Wa,h=null!==(a=l.captureDocumentTitle)&&void 0!==a&&a;if(!n)return function(){};var f=void 0,p=function(){return n.location&&n.location.href||""},g=function(){var e=p();if(void 0===f||e!==f){f=e;var r=function(){var e=n.innerHeight,t=n.innerWidth,r=n.document,i=p(),o="";return h&&(o=(null==r?void 0:r.title)||""),{href:u.length>0?gl(i,u):i,title:o,viewportHeight:e,viewportWidth:t,type:"url-change-event"}}();t(r)}},v=sd(n,function(){return g()},c?{enablePolling:!0,pollingInterval:d}:{});return g(),function(){return v()}},options:e}}ad();var ld=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:el,action:"start"}),this.mutationObserver=new MutationObserver(function(e){var n,r,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))),f=h.next();!f.done;f=h.next()){(v=f.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{f&&!f.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}try{for(var p=(s=void 0,c(Array.from(d.removedNodes))),g=p.next();!g.done;g=p.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=p.return)&&a.call(p)}finally{if(s)throw s.error}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.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:el,action:"stop"})},e.prototype.sendToIframeAfterLoad=function(e){var t=this,n=function(){t.pendingLoadListeners.delete(e),t.sendToIframe(e,{type:el,action:"start"})};this.pendingLoadListeners.set(e,n),e.addEventListener("load",n,{once:!0})},e.prototype.sendToAllIframes=function(e){var t=this;document.querySelectorAll("iframe").forEach(function(n){return t.sendToIframe(n,e)})},e.prototype.sendToIframe=function(e,t){var n;try{null===(n=e.contentWindow)||void 0===n||n.postMessage(t,"*")}catch(e){}},e}();var ud,cd,dd,hd=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 n=z();n&&(n.removeEventListener("blur",e.blurListener),n.removeEventListener("focus",e.focusListener),!t&&n.addEventListener("blur",e.blurListener),!t&&n.addEventListener("focus",e.focusListener),n.self&&"onpagehide"in n.self?(n.removeEventListener("pagehide",e.pageLeaveListener),!t&&n.addEventListener("pagehide",e.pageLeaveListener)):(n.removeEventListener("beforeunload",e.pageLeaveListener),!t&&n.addEventListener("beforeunload",e.pageLeaveListener)))},this.blurListener=function(){e.sendEvents()},this.focusListener=function(){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 n;null===(n=e.eventCompressor)||void 0===n||n.flushQueue(),e.sendEvents(),e.pageLeaveFns.forEach(function(e){e(t)})},this.evaluateTargetingAndCapture=function(t,n,r,i){return void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===i&&(i=!1),l(e,void 0,void 0,function(){var e,s,a,l,c,d,h,f,p,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(!n)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!==(f=null===(h=t.page)||void 0===h?void 0:h.url)&&void 0!==f?f:null===(g=null===(p=z())||void 0===p?void 0:p.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,Jc({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 n?(this.initialize(!0),[3,5]):[3,3];case 3:return!r&&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,n,r){return void 0===n&&(n={}),void 0===r&&(r=!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!==Aa.METADATA?(e={config:ml(i),version:Yu},r?[4,vl()]:[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({},n),e)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(t," due to no ongoing recording.")),[3,4];case 3:return a=l.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",a),[3,4];case 4:return[2]}})})},this.stopRecordingEvents=function(t,n){var r,i,o,s;void 0===t&&(t="targeting"),void 0===n&&(n="stop");try{null===(r=e.semanticAdapter)||void 0===r||r.stop(t,n),e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,null===(i=e.networkObservers)||void 0===i||i.stop(),null===(o=e.crossOriginIframeCoordinator)||void 0===o||o.stop(),e.crossOriginIframeCoordinator=null,null===(s=e.crossOriginParentSignalCleanup)||void 0===s||s.call(e),e.crossOriginParentSignalCleanup=null}catch(t){var a=t;e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(a.toString()))}},this.loggerProvider=new tl(new ae)}return e.prototype.init=function(e,t){return ne(this._init(e,t))},e.prototype.setupUrlChangeListener=function(){var e,t,n=this;null===(e=this.urlChangeCleanup)||void 0===e||e.call(this);var r=z();if(null==r?void 0:r.location){var i=!!(null===(t=this.config)||void 0===t?void 0:t.targetingConfig),o=sd(r,function(e){if(n.currentPageUrl=e,i){var t=++n.latestUrlChangeTargetingEvaluationId;n.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:e}},!1,!1,!0),n.loggerProvider.debug("Queued URL-change targeting re-evaluation #".concat(t," for ").concat(e,"."))}});this.urlChangeCleanup=function(){o(),n.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,n=null===(t=null===(e=z())||void 0===e?void 0:e.location)||void 0===t?void 0:t.href;return null!=n?{url:n}:void 0},e.prototype._init=function(e,t){var n,r,i,o,a,f,p,g,v,m,y,b,w,S,k;return l(this,void 0,void 0,function(){var l,x,C,E,I,O,T,P,A,M,R,_,N,L,D,F,U,j,B,q,W,V,$,K,H,G,J,Y,X,Q,Z,ee=this;return u(this,function(u){switch(u.label){case 0:return null===(n=this.urlChangeCleanup)||void 0===n||n.call(this),null===(r=this.semanticAdapter)||void 0===r||r.stop("customer_stop"),this.semanticAdapter=void 0,this.recordingEnabled=!0,this.startChildRecordingOnSetup=!1,this.loggerProvider=new tl(t.loggerProvider||new ae),Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.currentPageUrl=pl(),this.identifiers=new zc({sessionId:t.sessionId,deviceId:t.deviceId}),l=Date.now(),function(e,t,n){var r,i,o=Kc();if(o){var s=Vc(e);try{for(var a=[],l=0;l<o.length;l++)if((p=o.key(l))&&p.startsWith(s)){var u=o.getItem(p);if(null!==u){var d=Number(u);(!Number.isFinite(d)||d<=0||t-d>=Wc)&&a.push(p)}}try{for(var h=c(a),f=h.next();!f.done;f=h.next()){var p=f.value;o.removeItem(p)}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}catch(e){null==n||n.debug("Failed to prune stale replay start times: ".concat(String(e)))}}}(e,l,this.loggerProvider),this.sessionStartTime=void 0!==t.sessionId&&null!==(i=function(e,t,n,r){var i=Kc();if(i){var o=$c(e,t);try{var s=i.getItem(o);if(null!==s){var a=Number(s);if(Number.isFinite(a)&&a>0&&a<=n&&n-a<Wc)return a}return i.setItem(o,String(n)),n}catch(e){return void(null==r||r.debug("Failed to read/write replay start time from storage: ".concat(String(e))))}}}(e,t.sessionId,l,this.loggerProvider))&&void 0!==i?i:l,x=this,[4,Uu(e,t)];case 1:return x.joinedConfigGenerator=u.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:return C=u.sent(),E=C.joinedConfig,I=C.localConfig,O=C.remoteConfig,this.config=E,this.setMetadata(t.sessionId,E,I,O,null===(o=t.version)||void 0===o?void 0:o.version,Yu,null===(a=t.version)||void 0===a?void 0:a.type),this.pageLeaveFns=[],t.sessionId&&(null===(f=this.config.interactionConfig)||void 0===f?void 0:f.enabled)&&(T=qc.default({sessionId:t.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[T.send(this.getDeviceId.bind(this)).bind(T)],this.scrollHook=T.hook.bind(T),this.clickHandler=new Fc(this.loggerProvider,T)),P=[],"idb"!==(A=this.config.storeType)||(null===(p=z())||void 0===p?void 0:p.indexedDB)||(A="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(A," for event storage.")),_=z(),this.config.useWebWorker&&_&&_.Worker?[4,Promise.resolve().then(function(){return ag})]:[3,4];case 3:N=u.sent(),L=N.compressionScript,D=N.trackDestinationScript,M=L,R=D,u.label=4;case 4:return u.trys.push([4,6,,7]),[4,_c({config:this.config,type:"replay",minInterval:null===(g=this.config.flushIntervalConfig)||void 0===g?void 0:g.minIntervalMs,maxInterval:null===(v=this.config.flushIntervalConfig)||void 0===v?void 0:v.maxIntervalMs,maxPersistedEventsSize:this.config.maxPersistedEventsSizeBytes,storeType:A,trackDestinationWorkerScript:R,shouldSend:function(){return!ee.isBelowMinSessionDuration()}})];case 5:return F=u.sent(),this.rrwebEventManager=F,P.push({name:"replay",manager:F}),[3,7];case 6:return U=u.sent(),W=U,this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(W.toString())),[3,7];case 7:if(!(null===(m=this.config.interactionConfig)||void 0===m?void 0:m.enabled))return[3,11];j=this.config.interactionConfig.batch?Dc:Lc,u.label=8;case 8:return u.trys.push([8,10,,11]),[4,_c({config:this.config,type:"interaction",minInterval:null!==(y=this.config.interactionConfig.trackEveryNms)&&void 0!==y?y:3e4,maxInterval:6e4,maxPersistedEventsSize:this.config.maxPersistedEventsSizeBytes,payloadBatcher:j,storeType:A,trackDestinationWorkerScript:R})];case 9:return B=u.sent(),P.push({name:"interaction",manager:B}),[3,11];case 10:return q=u.sent(),W=q,this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(W.toString())),[3,11];case 11:if(this.eventsManager=new(Nc.bind.apply(Nc,h([void 0],d(P),!1))),this.eventCompressor&&this.eventCompressor.terminate(),V=!0===this.config.eagerFullSnapshotSend?function(){return ee.sendEvents()}:void 0,this.eventCompressor=new Ku(this.eventsManager,this.config,this.getDeviceId(),M,V),this.pendingEmitEvents.length>0){$=this.pendingEmitEvents.splice(0);try{for(K=c($),H=K.next();!H.done;H=K.next())G=H.value,J=G.event,Y=G.sessionId,this.eventCompressor.enqueueEvent(J,Y)}catch(e){Q={error:e}}finally{try{H&&!H.done&&(Z=K.return)&&Z.call(K)}finally{if(Q)throw Q.error}}}return this.pageLeaveFns=h(h([],d(this.pageLeaveFns),!1),[function(){var e;if(ee.config&&(null===(e=ee.identifiers)||void 0===e?void 0:e.sessionId)&&F){var t=F.getBeaconEvents();if(t.length){var n=ee.getDeviceId();n&&(ee.isBelowMinSessionDuration()||F.trackDestination.sendBeacon({events:t,sessionId:ee.identifiers.sessionId,deviceId:n,apiKey:ee.config.apiKey,serverZone:ee.config.serverZone}))}}}],!1),[4,this.initializeNetworkObservers()];case 12:return u.sent(),(null===(b=z())||void 0===b?void 0:b.opener)&&(Kn(X=Wn()),X.setup(s({logger:this.loggerProvider},this.config.serverZone&&{endpoint:jn[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!==(k=null===(S=null===(w=this.config.privacyConfig)||void 0===w?void 0:w.urlMaskLevels)||void 0===S?void 0:S.length)&&void 0!==k?k:0)>0)&&this.setupUrlChangeListener(),[2]}})})},e.prototype.setSessionId=function(e,t){return ne(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t,n){var r,i,o,s,a,c;return l(this,void 0,void 0,function(){var l,d,h,f,p;return u(this,function(u){switch(u.label){case 0:return l=null===(r=this.identifiers)||void 0===r?void 0:r.sessionId,d=this.getDeviceId(),void 0===l||l!==e||void 0!==t&&t!==d||void 0!==(null==n?void 0:n.userProperties)&&0!==Object.keys(n.userProperties).length?(this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,l&&this.sendEvents(l),(h=l!==e)&&(null===(o=null===(i=this.config)||void 0===i?void 0:i.semanticCapture)||void 0===o?void 0:o.enabled)&&this.semanticAdapter&&this.stopRecordingEvents("new_session"),h&&(null===(s=this.rrwebEventManager)||void 0===s||s.dropPendingBeaconEvents()),f=t||this.getDeviceId(),this.identifiers=new zc({sessionId:e,deviceId:f}),h&&(this.sessionStartTime=Date.now(),this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,(null===(a=this.config)||void 0===a?void 0:a.apiKey)&&(function(e,t,n,r){var i=Kc();if(i)try{i.setItem($c(e,t),String(n))}catch(e){null==r||r.debug("Failed to write replay start time to storage: ".concat(String(e)))}}(this.config.apiKey,e,this.sessionStartTime,this.loggerProvider),void 0!==l&&function(e,t,n){var r=Kc();if(r)try{r.removeItem($c(e,t))}catch(e){null==n||n.debug("Failed to remove replay start time from storage: ".concat(String(e)))}}(this.config.apiKey,l,this.loggerProvider))),this.joinedConfigGenerator&&l?[4,this.joinedConfigGenerator.generateJoinedConfig()]:[3,2]):[2];case 1:p=u.sent().joinedConfig,this.config=p,u.label=2;case 2:return(null===(c=this.config)||void 0===c?void 0:c.targetingConfig)?[4,this.evaluateTargetingAndCapture({userProperties:null==n?void 0:n.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,n=this.identifiers;if(!t||!n)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var r=this.getShouldRecord(),i={};return r&&((e={})[Ba]=n.sessionReplayId?n.sessionReplayId:null,i=e,t.debugMode&&(i[Va]=JSON.stringify({appHash:Xe(t.apiKey).toString()}))),this.addCustomRRWebEvent(Aa.GET_SR_PROPS,{shouldRecord:r,eventProperties:i},10===this.eventCount),10===this.eventCount&&(this.eventCount=0),this.eventCount++,i},e.prototype.sendEvents=function(e){var t,n,r=e||(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId),i=this.getDeviceId();if(this.eventsManager&&r&&i){if(this.isBelowMinSessionDuration()){var o=this.sessionStartTime,s=this.config.minSessionDurationMs;return this.loggerProvider.log("Session ".concat(r," not sent: duration ").concat(Date.now()-o,"ms is below minimum ").concat(s,"ms.")),void this.suppressedSendCount++}if(!this.hasEmittedGateDecision&&void 0!==(null===(n=this.config)||void 0===n?void 0:n.minSessionDurationMs)&&this.recordCancelCallback&&this.recordFunction){this.hasEmittedGateDecision=!0;var a=void 0!==this.sessionStartTime?Date.now()-this.sessionStartTime:void 0;this.addCustomRRWebEvent(Aa.REPLAY_GATE_DECISION,{sessionId:r,suppressedSendCount:this.suppressedSendCount,elapsedMs:a,minSessionDurationMs:this.config.minSessionDurationMs},!1)}this.eventsManager.sendCurrentSequenceEvents({sessionId:r,deviceId:i})}},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),l(this,void 0,void 0,function(){var n;return u(this,function(r){return(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId)?(n=this.getDeviceId())?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:n}),[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,n;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(n=Ae(this.config.instanceName).identityStore.getIdentity().optOut);return void 0!==n?n:null===(t=this.config)||void 0===t?void 0:t.optOut},e.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.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,n=!1,r="",i=!1;this.config.targetingConfig?this.sessionTargetingMatch?(r="Capturing replays for session ".concat(this.identifiers.sessionId," due to matching targeting conditions."),this.loggerProvider.log(r),n=!0,i=!0):(r="Not capturing replays for session ".concat(this.identifiers.sessionId," due to not matching targeting conditions."),this.loggerProvider.log(r),n=!1,i=!1):(e=this.identifiers.sessionId,t=this.config.sampleRate,rd(e.toString())%1e6/1e6<t)?(n=!0,i=!0):(r="Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate."),this.loggerProvider.log(r),n=!1,i=!1);return this.lastShouldRecordDecision!==n&&this.config.targetingConfig&&(this.addCustomRRWebEvent(Aa.TARGETING_DECISION,{message:r,sessionId:this.identifiers.sessionId,matched:i,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=n),n},e.prototype.getBlockSelectors=function(){var e;return dl(null===(e=this.config)||void 0===e?void 0:e.privacyConfig)},e.prototype.getMaskTextSelectors=function(){var e;return hl(null===(e=this.config)||void 0===e?void 0:e.privacyConfig,this.currentPageUrl)},e.prototype.getRecordingPlugins=function(e){var t,n,r,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=ad({ugcFilterRules:(null===(n=null===(t=this.config)||void 0===t?void 0:t.interactionConfig)||void 0===n?void 0:n.ugcFilterRules)||[],enablePolling:(null===(r=this.config)||void 0===r?void 0:r.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 Sb})];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(n){switch(n.label){case 0:if(this.recordFunction)return[2,this.recordFunction];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return yE})];case 2:return e=n.sent().record,this.recordFunction=e,[2,e];case 3:return t=n.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(n){switch(n.label){case 0:if(this.recordEventsInFlight)return this.recordEventsPendingShouldLogMetadata=e,[2];this.recordEventsInFlight=!0,n.label=1;case 1:return n.trys.push([1,,6,7]),[4,this._recordEvents(e)];case 2:n.sent(),n.label=3;case 3:return null===this.recordEventsPendingShouldLogMetadata?[3,5]:(t=this.recordEventsPendingShouldLogMetadata,this.recordEventsPendingShouldLogMetadata=null,[4,this._recordEvents(t)]);case 4:return n.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,n,r,i,o,a,c,d,h,f,p,g,v;return void 0===e&&(e=!0),l(this,void 0,void 0,function(){var l,m,y,b,w,S,k,x,C,E,I,O,T,P,A,M,R,_,N,L,D,F=this;return u(this,function(u){switch(u.label){case 0:return l=this.config,m=this.getShouldRecord(),y=null===(t=this.identifiers)||void 0===t?void 0:t.sessionId,m&&y&&l?(this.stopRecordingEvents("focus","pause"),b=this.recordingGeneration,[4,this.getRecordFunction()]):((null===(n=null==l?void 0:l.semanticCapture)||void 0===n?void 0:n.enabled)&&this.semanticAdapter&&this.recordCancelCallback&&this.stopRecordingEvents(this.shouldOptOut()?"opt_out":l.targetingConfig?"targeting":"sampled_out"),[2]);case 1:return!(w=u.sent())||this.shouldAbandonRecordStart(b)?[2]:[4,this.initializeNetworkObservers()];case 2:if(u.sent(),this.shouldAbandonRecordStart(b))return[2];S=null===(r=l.loggingConfig)||void 0===r?void 0:r.network,k=fl(l.serverZone,l.trackServerUrl),x=[$a,Ka,Ha,k],null===(i=this.networkObservers)||void 0===i||i.start(function(e){x.some(function(t){return e.url.startsWith(t)})||F.addCustomRRWebEvent(Aa.FETCH_REQUEST,e)},S),C=l.interactionConfig,E=l.loggingConfig,I=(null==C?void 0:C.enabled)&&this.eventsManager?null===(o=this.clickHandler)||void 0===o?void 0:o.createHook({eventsManager:this.eventsManager,sessionId:y,deviceIdFn:this.getDeviceId.bind(this),mirror:w.mirror,ugcFilterRules:null!==(a=C.ugcFilterRules)&&void 0!==a?a:[],performanceOptions:null===(c=l.performanceConfig)||void 0===c?void 0:c.interaction}):void 0,O=(null===(d=l.semanticCapture)||void 0===d?void 0:d.enabled)&&w.supportsNativeMouseInteraction,T=I,O&&(P=null!==(h=this.clickHandler)&&void 0!==h?h:this.clickHandler=new Fc(this.loggerProvider),T=P.createSharedHook(I,function(e){var t;return null===(t=F.semanticAdapter)||void 0===t?void 0:t.click(e)})),A=s(s({},T?{mouseInteraction:T}:{}),(null==C?void 0:C.enabled)?{scroll:this.scrollHook}:{}),M=(null==C?void 0:C.enabled)&&C.ugcFilterRules?C.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(y,".")),u.label=3;case 3:return u.trys.push([3,5,,6]),R=!!(null===(f=l.crossOriginIframes)||void 0===f?void 0:f.enabled),_=!1!==(null===(p=l.crossOriginIframes)||void 0===p?void 0:p.coordinateChildren),N=R&&function(){try{var e=z();return!!e&&e.parent!==e}catch(e){return!0}}(),N&&_?(this.crossOriginParentSignalCleanup=function(e){var t=z();if(!t)return function(){};var n=t.parent;function r(t){if(t.source===n){var r=t.data;(null==r?void 0:r.type)===el&&("start"===r.action?e.onStart():"stop"===r.action&&e.onStop())}}return t.addEventListener("message",r),function(){return t.removeEventListener("message",r)}}({onStart:function(){F.recordingEnabled&&F._recordEventsInChildMode(w,y,l,A)},onStop:function(){try{F.recordCancelCallback&&F.recordCancelCallback(),F.recordCancelCallback=null}catch(t){var e=t;F.loggerProvider.warn("Error occurred while stopping child iframe replay capture: ".concat(e.toString()))}}}),this.startChildRecordingOnSetup&&(this.startChildRecordingOnSetup=!1,this._recordEventsInChildMode(w,y,l,A)),[2]):(this.startChildRecordingOnSetup=!1,[4,this.getRecordingPlugins(E)]);case 4:return L=u.sent(),this.shouldAbandonRecordStart(b)?[2]:(this.prepareSemanticCapture(l,y),this.recordCancelCallback=w(s(s({},this.buildRRWebRecordOptions(l,A,function(e){var t,n,r,i,o=(null===(n=null===(t=F.config)||void 0===t?void 0:t.semanticCapture)||void 0===n?void 0:n.enabled)&&F.semanticAdapter&&e.type===gu.Custom&&"amp-semantic/recording"===e.data.tag&&"stop"===(null===(r=e.data.payload)||void 0===r?void 0:r.state);if((F.shouldOptOut()||!F.recordingEnabled)&&!o)return F.loggerProvider.log(F.shouldOptOut()?"Opting session ".concat(y," out of recording due to optOut config."):"Session Replay capture stopping for ".concat(y,".")),F.stopRecordingEvents(F.shouldOptOut()?"opt_out":"customer_stop"),void F.sendEvents();e.type===gu.Meta&&(e.data.href=gl(e.data.href,M)),F.eventCompressor?F.eventCompressor.enqueueEvent(e,y):F.pendingEmitEvents.push({event:e,sessionId:y}),null===(i=F.semanticAdapter)||void 0===i||i.event(e)},"Error while capturing replay: ")),{plugins:L,recordCrossOriginIframes:R})),this.recordCancelCallback&&(null===(g=this.semanticAdapter)||void 0===g||g.recordingReady()),R&&!N&&_&&(this.crossOriginIframeCoordinator||(this.crossOriginIframeCoordinator=new ld),this.crossOriginIframeCoordinator.start()),this.addCustomRRWebEvent(Aa.DEBUG_INFO),e&&this.addCustomRRWebEvent(Aa.METADATA,this.metadata),[3,6]);case 5:return D=u.sent(),null===(v=this.semanticAdapter)||void 0===v||v.stop("error"),this.loggerProvider.warn("Failed to initialize session replay:",D),[3,6];case 6:return[2]}})})},e.prototype.prepareSemanticCapture=function(e,t){var n,r,i,o,a=this,l=z();if(null==l?void 0:l.document){if(!(null===(n=e.semanticCapture)||void 0===n?void 0:n.enabled))return null===(r=this.semanticAdapter)||void 0===r||r.stop("targeting"),void(null===(i=this.semanticAdapter)||void 0===i||i.prepare({enabled:!1},t));this.semanticAdapter||(this.semanticAdapter=new yu({document:l.document,window:l,sdk:"@amplitude/session-replay-browser@".concat(Yu),externalClicks:!0===(null===(o=this.recordFunction)||void 0===o?void 0:o.supportsNativeMouseInteraction),externalAuxClicks:!1,getNodeId:function(e){var t,n,r,i;return null!==(i=null===(r=null===(t=a.recordFunction)||void 0===t?void 0:(n=t.mirror).getId)||void 0===r?void 0:r.call(n,e))&&void 0!==i?i:-1},getNode:function(e){var t,n;return null!==(n=null===(t=a.recordFunction)||void 0===t?void 0:t.mirror.getNode(e))&&void 0!==n?n:null},getPrivacy:function(){var e,t;return null!==(t=null===(e=a.config)||void 0===e?void 0:e.privacyConfig)&&void 0!==t?t:{}},getUrl:function(){return l.location.href},getIdentity:function(){return function(e){var t=e.document,n=wu.get(t);if(n)return n;var r=Fl(t,e);if(e.top===e)try{var i=e.sessionStorage,o=function(){var e;try{var t=JSON.parse(null!==(e=i.getItem(bu))&&void 0!==e?e:"null");if(t&&Su.test(t.tab_id)&&(null===t.owner||"string"==typeof t.owner))return t}catch(e){}},a=o();null===(null==a?void 0:a.owner)&&(r=Object.freeze(s(s({},r),{tab_id:a.tab_id})));var l=function(e){try{i.setItem(bu,JSON.stringify({tab_id:r.tab_id,owner:e}))}catch(e){}};i.setItem(bu,JSON.stringify({tab_id:r.tab_id,owner:r.document_id})),e.addEventListener("pagehide",function(){var e;(null===(e=o())||void 0===e?void 0:e.owner)===r.document_id&&l(null)}),e.addEventListener("pageshow",function(e){e.persisted&&l(r.document_id)})}catch(n){r=Fl(t,e)}return wu.set(t,r),r}(l)},getAnalyticsContext:function(){var e,t;return null!==(t=null===(e=a.config)||void 0===e?void 0:e.semanticAnalyticsContext)&&void 0!==t?t:{present:!1,autocapture:[]}},inlineStylesheet:e.shouldInlineStylesheet,getSelector:function(e){var t,n;try{var r=s(s({},null===(n=null===(t=a.config)||void 0===t?void 0:t.performanceConfig)||void 0===n?void 0:n.interaction),{timeoutMs:1});return a.clickHandler?a.clickHandler.getSelector(e,r):ku(e,r)}catch(e){return null}},emit:function(e){a.recordCancelCallback&&a.recordFunction&&a.recordFunction.addCustomEvent("amp-semantic/".concat(e.name),e.payload)},onError:function(e){return a.loggerProvider.debug("Semantic capture error:",e)}})),this.semanticAdapter.prepare(e.semanticCapture,t)}},e.prototype.buildRRWebRecordOptions=function(e,t,n,r){var i=this,o=e.privacyConfig;return s(s(s(s({emit:n,inlineStylesheet:e.shouldInlineStylesheet,inlineImages:e.inlineImages,hooks:t},function(e,t){return void 0===t&&(t=function(){return""}),{maskAllInputs:!0,maskTextClass:"amp-mask",blockClass:"amp-block",blockSelector:dl(e),maskTextSelector:hl(e,t()),maskInputFn:ul("input",e,t),maskTextFn:ul("text",e,t),maskAttributeFn:cl(e,t)}}(o,function(){return i.currentPageUrl})),{applyBackgroundColorToBlockedElements:e.applyBackgroundColorToBlockedElements}),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(r,t.toString()),!0}})},e.prototype._recordEventsInChildMode=function(e,t,n,r){try{this.recordCancelCallback&&this.recordCancelCallback(),this.recordCancelCallback=null,this.recordCancelCallback=e(s(s({},this.buildRRWebRecordOptions(n,r,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 ne(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("customer_stop"),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(n){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.semanticAdapter&&this.shouldOptOut()?"opt_out":"customer_stop"),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,n,r,i,o,s){var a=(null==e?void 0:e.toString())?Xe(e.toString()):void 0;this.metadata={joinedConfig:t,localConfig:n,remoteConfig:r,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,n;return l(this,void 0,void 0,function(){var r,i;return u(this,function(o){switch(o.label){case 0:if(!(null===(n=null===(t=null===(e=this.config)||void 0===e?void 0:e.loggingConfig)||void 0===t?void 0:t.network)||void 0===n?void 0:n.enabled)||this.networkObservers)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Promise.resolve().then(function(){return CE})];case 2:return r=o.sent().NetworkObservers,this.networkObservers=new r,[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}(),fd=function(e){return function(){var t=e.config||yl();return{logger:t.loggerProvider,logLevel:t.logLevel}}},pd=function(){var e=new hd;return{init:be(e.init.bind(e),"init",fd(e)),evaluateTargetingAndCapture:be(e.evaluateTargetingAndCapture.bind(e),"evaluateTargetingAndRecord",fd(e)),setSessionId:be(e.setSessionId.bind(e),"setSessionId",fd(e)),getSessionId:be(e.getSessionId.bind(e),"getSessionId",fd(e)),getSessionReplayProperties:be(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",fd(e)),flush:be(e.flush.bind(e),"flush",fd(e)),start:be(e.start.bind(e),"start",fd(e)),stop:be(e.stop.bind(e),"stop",fd(e)),shutdown:be(e.shutdown.bind(e),"shutdown",fd(e))}}(),gd=pd.init,vd=pd.setSessionId,md=pd.getSessionId,yd=pd.getSessionReplayProperties,bd=pd.flush,wd=pd.start,Sd=pd.stop,kd=pd.shutdown,xd=pd.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"}(ud||(ud={})),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"}(cd||(cd={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(dd||(dd={}));var Cd=[ud.SET,ud.SET_ONCE,ud.ADD,ud.APPEND,ud.PREPEND,ud.POSTINSERT];var Ed="1.37.0-codexsemantic-review-integration.0",Id="".concat("[Amplitude]"," Session Replay ID"),Od=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:bd,getSessionId:md,getSessionReplayProperties:yd,init:gd,setSessionId:vd,start:wd,stop:Sd,shutdown:kd,evaluateTargetingAndCapture:xd},this.options=s({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var n,r,i,o,a,c,d,h,f;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(Ed,".")),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=Ae(this.config.instanceName).identityStore,l=t.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:null!==(n=this.options.deviceId)&&void 0!==n?n: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===(r=this.config.remoteConfig)||void 0===r?void 0:r.serverUrl),trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,semanticCapture:this.options.semanticCapture,semanticAnalyticsContext:{present:!0,autocapture:(g=this.config.autocapture,!0===g?["attribution","fileDownloads","formInteractions","pageViews","sessions","elementInteractions","webVitals","frustrationInteractions"]:g&&"object"==typeof g?Object.keys(g).filter(function(e){var t=g[e];if("frustrationInteractions"!==e)return Boolean(t);var n=g.frustrationInteractions;return!0===n||!(!n||"object"!=typeof n)&&(!1!==n.deadClicks&&null!==n.deadClicks||Boolean(n.errorClicks))}):[])},privacyConfig:{blockSelector:null===(i=this.options.privacyConfig)||void 0===i?void 0:i.blockSelector,maskAttributes:null===(o=this.options.privacyConfig)||void 0===o?void 0:o.maskAttributes,maskSelector:null===(a=this.options.privacyConfig)||void 0===a?void 0:a.maskSelector,unmaskSelector:null===(c=this.options.privacyConfig)||void 0===c?void 0:c.unmaskSelector,defaultMaskLevel:null===(d=this.options.privacyConfig)||void 0===d?void 0:d.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,inlineImages:this.options.inlineImages,version:{type:"plugin",version:Ed},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:null!==(h=this.options.useWebWorker)&&void 0!==h?h:null===(f=this.options.experimental)||void 0===f?void 0:f.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]}var g})})},e.prototype.onSessionIdChanged=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(n){switch(n.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 n.sent(),[2]}})})},e.prototype.onOptOutChanged=function(e){var t;return l(this,void 0,void 0,function(){return u(this,function(n){switch(n.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:n.sent(),n.label=3;case 3:n.label=4;case 4:return[2]}})})},e.prototype.execute=function(e){var t,n,r;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(n){if(Cd.includes(n)){var r=e.user_properties&&e.user_properties[n];t=s(s({},t),r)}}),t}}(e)),l=z(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:a,page:null!=(null===(n=null==l?void 0:l.location)||void 0===n?void 0:n.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[Id],[2,Promise.resolve(e)];case 9:return d=u.sent(),null===(r=this.config)||void 0===r||r.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}();const Td="is",Pd="is not",Ad="contains",Md="does not contain",Rd="less",_d="less or equal",Nd="greater",Ld="greater or equal",Dd="version less",Fd="version less or equal",Ud="version greater",jd="version greater or equal",Bd="set is",qd="set is not",zd="set contains",Wd="set does not contain",Vd="set contains any",$d="set does not contain any",Kd="regex match",Hd="regex does not match",Gd=-862048943,Jd=461845907,Yd=(e,t=0)=>{const n=(e=>{const t=[];let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296==(64512&i)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return Uint8Array.from(t)})(e),r=n.length,i=r>>2;let o=t;for(let e=0;e<i;e++){const t=eh(n,e<<2);o=Xd(t,o)}const s=i<<2;let a=0;switch(r-s){case 3:a^=n[s+2]<<16,a^=n[s+1]<<8,a^=n[s],a=Math.imul(a,Gd),a=Zd(a,15),a=Math.imul(a,Jd),o^=a;break;case 2:a^=n[s+1]<<8,a^=n[s],a=Math.imul(a,Gd),a=Zd(a,15),a=Math.imul(a,Jd),o^=a;break;case 1:a^=n[s],a=Math.imul(a,Gd),a=Zd(a,15),a=Math.imul(a,Jd),o^=a}return o^=r,Qd(o)>>>0},Xd=(e,t)=>{let n=e,r=t;return n=Math.imul(n,Gd),n=Zd(n,15),n=Math.imul(n,Jd),r^=n,r=Zd(r,13),r=Math.imul(r,5),r+-430675100|0},Qd=e=>{let t=e;return t^=t>>>16,t=Math.imul(t,-2048144789),t^=t>>>13,t=Math.imul(t,-1028477387),t^=t>>>16,t},Zd=(e,t,n=32)=>{t>n&&(t%=n);return(e<<t|(e&4294967295<<n-t>>>0)>>>0>>>n-t>>>0)>>>0},eh=(e,t=0)=>{const n=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return th(n)},th=e=>(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24,nh=(e,t)=>{if(t&&0!==t.length){for(const n of t){if(!n||!e||"object"!=typeof e)return;e=e[n]}return null==e?void 0:e}};class rh{constructor(e,t,n,r=void 0){this.major=e,this.minor=t,this.patch=n,this.preRelease=r}static parse(e){if(!e)return;const t=new RegExp("^(\\d+)\\.(\\d+)(\\.(\\d+)(-(([-\\w]+\\.?)*))?)?$").exec(e);if(!t)return;const n=Number(t[1]),r=Number(t[2]);if(isNaN(n)||isNaN(r))return;const i=Number(t[4])||0,o=t[5]||void 0;return new rh(n,r,i,o)}compareTo(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}}class ih{evaluate(e,t){const n={},r={context:e,result:n};for(const e of t){const t=this.evaluateFlag(r,e);t&&(n[e.key]=t)}return n}evaluateWithTraces(e,t){const n={},r={},i={context:e,result:n};for(const e of t){const{variant:t,trace:o}=this.evaluateFlagWithTrace(i,e);t&&(n[e.key]=t),r[e.key]=o}return{results:n,traces:r}}evaluateFlag(e,t){let n;for(const r of t.segments)if(n=this.evaluateSegment(e,t,r),n){const e=Object.assign(Object.assign(Object.assign({},t.metadata),r.metadata),n.metadata);n=Object.assign(Object.assign({},n),{metadata:e});break}return n}evaluateFlagWithTrace(e,t){var n,r;const i=[];let o,s,a;for(const l of t.segments){if(!l.conditions){const r=this.bucket(e,l),u=void 0!==r;i.push({segmentMetadata:l.metadata,conditionsPassed:!0,bucketed:u,bucketVariant:r,conditionResult:void 0,matched:u}),o||void 0===r||(o=t.variants[r],s=l,a=null===(n=l.metadata)||void 0===n?void 0:n.segmentName);continue}const u=[];let c=!1;for(const t of l.conditions){let n=!0;const r=[];for(const i of t){const t=nh(e,i.selector),o=this.matchCondition(e,i);if(r.push({propValue:t,condition:i,matched:o}),!o){n=!1;break}}if(u.push(r),n){c=!0;break}}let d,h=!1;c&&(d=this.bucket(e,l),h=void 0!==d),i.push({segmentMetadata:l.metadata,conditionsPassed:c,bucketed:h,bucketVariant:d,conditionResult:u,matched:c&&h}),c&&void 0!==d&&!o&&(o=t.variants[d],s=l,a=null===(r=l.metadata)||void 0===r?void 0:r.segmentName)}if(o&&s){const e=Object.assign(Object.assign(Object.assign({},t.metadata),s.metadata),o.metadata);o=Object.assign(Object.assign({},o),{metadata:e})}return{variant:o,trace:{flagKey:t.key,matched:void 0!==o,matchedSegment:a,steps:i}}}evaluateSegment(e,t,n){if(!n.conditions){const r=this.bucket(e,n);return void 0!==r?t.variants[r]:void 0}if(this.evaluateConditions(e,n.conditions)){const r=this.bucket(e,n);return void 0!==r?t.variants[r]:void 0}}evaluateConditions(e,t){for(const n of t){let t=!0;for(const r of n)if(t=this.matchCondition(e,r),!t)break;if(t)return!0}return!1}matchCondition(e,t){const n=nh(e,t.selector);if(null==n)return this.matchNull(t.op,t.values);{const e=this.coerceStringArray(n);if(this.isSetOperator(t.op))return!!e&&this.matchSet(e,t.op,t.values);if(e)return this.matchStringsNonSet(e,t.op,t.values);{const e=this.coerceString(n);return void 0!==e&&this.matchString(e,t.op,t.values)}}}getHash(e){return Yd(e)}bucket(e,t){if(!t.bucket)return t.variant;const n=this.coerceString(nh(e,t.bucket.selector));if(!n||0===n.length)return t.variant;const r=`${t.bucket.salt}/${n}`,i=this.getHash(r),o=i%100,s=Math.floor(i/100);for(const e of t.bucket.allocations){const t=e.range[0],n=e.range[1];if(o>=t&&o<n)for(const t of e.distributions){const e=t.range[0],n=t.range[1];if(s>=e&&s<n)return t.variant}}return t.variant}matchNull(e,t){const n=this.containsNone(t);switch(e){case Td:case Ad:case Rd:case _d:case Nd:case Ld:case Dd:case Fd:case Ud:case jd:case Bd:case zd:case Vd:return n;case Pd:case Md:case Wd:case $d:return!n;default:return!1}}matchSet(e,t,n){switch(t){case Bd:return this.setEquals(e,n);case qd:return!this.setEquals(e,n);case zd:return this.matchesSetContainsAll(e,n);case Wd:return!this.matchesSetContainsAll(e,n);case Vd:return this.matchesSetContainsAny(e,n);case $d:return!this.matchesSetContainsAny(e,n);default:return!1}}matchString(e,t,n){switch(t){case Td:return this.matchesIs(e,n);case Pd:return!this.matchesIs(e,n);case Ad:return this.matchesContains(e,n);case Md:return!this.matchesContains(e,n);case Rd:case _d:case Nd:case Ld:return this.matchesComparable(e,t,n,e=>this.parseNumber(e),(e,t,n)=>this.comparator(e,t,n));case Dd:case Fd:case Ud:case jd:return this.matchesComparable(e,t,n,e=>rh.parse(e),(e,t,n)=>this.versionComparator(e,t,n));case Kd:return this.matchesRegex(e,n);case Hd:return!this.matchesRegex(e,n);default:return!1}}matchStringsNonSet(e,t,n){return e.some(e=>this.matchString(e,t,n))}matchesIs(e,t){if(this.containsBooleans(t)){const n=e.toLowerCase();if("true"===n||"false"===n)return t.some(e=>e.toLowerCase()===n)}return t.some(t=>e===t)}matchesContains(e,t){for(const n of t)if(e.toLowerCase().includes(n.toLowerCase()))return!0;return!1}matchesComparable(e,t,n,r,i){const o=r(e),s=n.map(e=>r(e)).filter(e=>void 0!==e);return void 0===o||0===s.length?n.some(n=>this.comparator(e,t,n)):s.some(e=>i(o,t,e))}comparator(e,t,n){switch(t){case Rd:case Dd:return e<n;case _d:case Fd:return e<=n;case Nd:case Ud:return e>n;case Ld:case jd:return e>=n;default:return!1}}versionComparator(e,t,n){const r=e.compareTo(n);switch(t){case Rd:case Dd:return r<0;case _d:case Fd:return r<=0;case Nd:case Ud:return r>0;case Ld:case jd:return r>=0;default:return!1}}matchesRegex(e,t){return t.some(t=>Boolean(new RegExp(t).exec(e)))}containsNone(e){return e.some(e=>"(none)"===e)}containsBooleans(e){return e.some(e=>{switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})}parseNumber(e){var t;return null!==(t=Number(e))&&void 0!==t?t:void 0}coerceString(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)}coerceStringArray(e){if(Array.isArray(e)){return e.map(e=>this.coerceString(e)).filter(Boolean)}const t=String(e);if(t.startsWith("["))try{const e=JSON.parse(t);return Array.isArray(e)?e.map(e=>this.coerceString(e)).filter(Boolean):void 0}catch(e){return}}isSetOperator(e){switch(e){case Bd:case qd:case zd:case Wd:case Vd:case $d:return!0;default:return!1}}setEquals(e,t){const n=new Set(e),r=new Set(t);return n.size===r.size&&[...r].every(e=>n.has(e))}matchesSetContainsAll(e,t){if(e.length<t.length)return!1;for(const n of t)if(!this.matchesIs(n,e))return!1;return!0}matchesSetContainsAny(e,t){for(const n of t)if(this.matchesIs(n,e))return!0;return!1}}const oh=(e,t)=>{const n=Object.assign({},e),r=[],i=t||Object.keys(n);for(const e of i){const t=sh(e,n);t&&r.push(...t)}return r},sh=(e,t,n=[])=>{const r=t[e];if(!r)return;if(!r.dependencies||0===r.dependencies.length)return delete t[r.key],[r];n.push(r.key);const i=[];for(const e of r.dependencies){if(n.some(t=>t===e))throw Error(`Detected a cycle between flags ${n.join(", ")}`);const r=sh(e,t,n);r&&i.push(...r)}return i.push(r),n.pop(),delete t[r.key],i};function ah(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const lh="function"==typeof Buffer,uh=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),ch=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),dh=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(ch),hh=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,fh=String.fromCharCode.bind(String),ph=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_")),gh=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),vh=e=>{let t,n,r,i,o="";const s=e.length%3;for(let s=0;s<e.length;){if((n=e.charCodeAt(s++))>255||(r=e.charCodeAt(s++))>255||(i=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|i,o+=ch[t>>18&63]+ch[t>>12&63]+ch[t>>6&63]+ch[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},mh="function"==typeof btoa?e=>btoa(e):lh?e=>Buffer.from(e,"binary").toString("base64"):vh,yh=lh?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(fh.apply(null,e.subarray(n,n+4096)));return mh(t.join(""))},bh=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?fh(192|t>>>6)+fh(128|63&t):fh(224|t>>>12&15)+fh(128|t>>>6&63)+fh(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return fh(240|t>>>18&7)+fh(128|t>>>12&63)+fh(128|t>>>6&63)+fh(128|63&t)},wh=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Sh=e=>e.replace(wh,bh),kh=lh?e=>Buffer.from(e,"utf8").toString("base64"):uh?e=>yh(uh.encode(e)):e=>mh(Sh(e)),xh=(e,t=!1)=>t?ph(kh(e)):kh(e),Ch=e=>xh(e,!0),Eh=e=>{if(e=e.replace(/\s+/g,""),!hh.test(e))throw new TypeError("malformed base64.");let t,n,r;e+="==".slice(2-(3&e.length));let i=[];for(let o=0;o<e.length;)t=dh[e.charAt(o++)]<<18|dh[e.charAt(o++)]<<12|(n=dh[e.charAt(o++)])<<6|(r=dh[e.charAt(o++)]),64===n?i.push(fh(t>>16&255)):64===r?i.push(fh(t>>16&255,t>>8&255)):i.push(fh(t>>16&255,t>>8&255,255&t));return i.join("")},Ih=Ch;class Oh extends Error{constructor(e,t){super(t),this.statusCode=e,Object.setPrototypeOf(this,Oh.prototype)}}class Th extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Th.prototype)}}class Ph{constructor(e,t,n){this.deploymentKey=e,this.serverUrl=t,this.httpClient=n}getVariants(e,t){return ah(this,void 0,void 0,function*(){const n=Ih(JSON.stringify(e)),r={Authorization:`Api-Key ${this.deploymentKey}`,"X-Amp-Exp-User":n};(null==t?void 0:t.flagKeys)&&(r["X-Amp-Exp-Flag-Keys"]=Ih(JSON.stringify(t.flagKeys))),(null==t?void 0:t.trackingOption)&&(r["X-Amp-Exp-Track"]=t.trackingOption),(null==t?void 0:t.exposureTrackingOption)&&(r["X-Amp-Exp-Exposure-Track"]=t.exposureTrackingOption);const i=new URL(`${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);const o=yield this.httpClient.request({requestUrl:i.toString(),method:"GET",headers:r,timeoutMillis:null==t?void 0:t.timeoutMillis});if(200!=o.status)throw new Oh(o.status,`Fetch error response: status=${o.status}`);return JSON.parse(o.body)})}}class Ah{constructor(e,t,n){this.deploymentKey=e,this.serverUrl=t,this.httpClient=n}getFlags(e){return ah(this,void 0,void 0,function*(){const t={Authorization:`Api-Key ${this.deploymentKey}`};(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]=`${e.libraryName}/${e.libraryVersion}`),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=Ih(JSON.stringify(e.user)));const n=yield this.httpClient.request({requestUrl:`${this.serverUrl}/sdk/v2/flags`+((null==e?void 0:e.deliveryMethod)?`?delivery_method=${e.deliveryMethod}`:""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis});if(200!=n.status)throw Error(`Flags error response: status=${n.status}`);return JSON.parse(n.body).reduce((e,t)=>(e[t.key]=t,e),{})})}}const Mh=()=>"undefined"!=typeof globalThis&&null!==globalThis?globalThis:"undefined"!=typeof window&&null!==window?window:"undefined"!=typeof self&&null!==self?self:"undefined"!=typeof global&&null!==global?global:void 0,Rh=()=>{var e;return null===(e=Mh())||void 0===e?void 0:e.localStorage},_h=()=>{var e;return null===(e=Mh())||void 0===e?void 0:e.sessionStorage},Nh=()=>{const e=Mh();return(null==e?void 0:e.setTimeout)?e.setTimeout.bind(e):void 0},Lh=()=>{const e=Mh();return(null==e?void 0:e.setInterval)?e.setInterval.bind(e):void 0},Dh=()=>{const e=Mh();return(null==e?void 0:e.clearInterval)?e.clearInterval.bind(e):void 0};class Fh{constructor(e,t){this.poller=void 0,this.action=e,this.ms=t}start(){if(this.poller)return;const e=Lh();e&&(this.poller=e(()=>{this.action()},this.ms),this.action())}stop(){if(!this.poller)return;const e=Dh();e&&e(this.poller),this.poller=void 0}}var Uh={},jh={get exports(){return Uh},set exports(e){Uh=e}};function Bh(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})}!function(e,t){!function(n,r){var i="function",o="undefined",s="object",a="string",l="model",u="name",c="type",d="vendor",h="version",f="architecture",p="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",T="Huawei",P="LG",A="Microsoft",M="Motorola",R="Opera",_="Samsung",N="Sharp",L="Sony",D="Xiaomi",F="Zebra",U="Facebook",j=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];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 n,o,a,l,u,c,d=0;d<t.length&&!u;){var h=t[d],f=t[d+1];for(n=o=0;n<h.length&&!u;)if(u=h[n++].exec(e))for(a=0;a<f.length;a++)c=u[++o],typeof(l=f[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]):r:this[l[0]]=c?l[1].call(this,c,l[2]):r:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):r):this[l]=c||r;d+=2}},V=function(e,t){for(var n in t)if(typeof t[n]===s&&t[n].length>0){for(var i=0;i<t[n].length;i++)if(B(t[n][i],e))return"?"===n?r:n}else if(B(t[n],e))return"?"===n?r:n;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"},K={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,R+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[u,R]],[/(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,R+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[u,R+" 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],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,q]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",q]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,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,T],[c,v]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[d,T],[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,D],[c,g]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[d,D],[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,P],[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,P],[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,L],[c,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[d,L],[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,A],[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,A],[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,p]],[/droid.+; (shield) bui/i],[l,[d,"Nvidia"],[c,p]],[/(playstation [345portablevi]+)/i],[l,[d,L],[c,p]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[d,A],[c,p]],[/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,P],[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,L],[c,m]],[/(mitv-\w{5}) bui/i],[l,[d,D],[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]]},H=function(e,t){if(typeof e===s&&(t=e,e=r),!(this instanceof H))return new H(e,t).getResult();var i=e||(typeof n!==o&&n.navigator&&n.navigator.userAgent?n.navigator.userAgent:""),p=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(K,t):K;return this.getBrowser=function(){var e={};return e[u]=r,e[h]=r,W.call(e,i,p.browser),e.major=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:r}(e.version),e},this.getCPU=function(){var e={};return e[f]=r,W.call(e,i,p.cpu),e},this.getDevice=function(){var e={};return e[d]=r,e[l]=r,e[c]=r,W.call(e,i,p.device),e},this.getEngine=function(){var e={};return e[u]=r,e[h]=r,W.call(e,i,p.engine),e},this.getOS=function(){var e={};return e[u]=r,e[h]=r,W.call(e,i,p.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};H.VERSION="0.7.33",H.BROWSER=j([u,h,"major"]),H.CPU=j([f]),H.DEVICE=j([l,d,c,p,g,m,v,y,b]),H.ENGINE=H.OS=j([u,h]),e.exports&&(t=e.exports=H),t.UAParser=H;var G=typeof n!==o&&(n.jQuery||n.Zepto);if(G&&!G.ua){var J=new H;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 n in t)G.ua[n]=t[n]}}}("object"==typeof window?window:$)}(jh,Uh),"function"==typeof SuppressedError&&SuppressedError;const qh=(e,t=!1)=>{const n=zh(e,t);let r;const i=(()=>{var e;return null===(e=Mh())||void 0===e?void 0:e.document})();if(!i)return;const o=i.cookie.split("; ");for(const e of o){const[t,i]=e.split("=",2);t===n&&(r=decodeURIComponent(i))}if(r)try{if(t){const e=atob(r);return JSON.parse(decodeURIComponent(e))}const e=r.split(".");let n;return e.length>=2&&e[1]&&(n=atob(e[1])),{deviceId:e[0],userId:n}}catch(e){return}},zh=(e,t)=>{if(t){if((null==e?void 0:e.length)<10)return;return`AMP_${e.substring(0,10)}`}if(!((null==e?void 0:e.length)<6))return`amp_${e.substring(0,6)}`};class Wh{constructor(e,t,n){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=n,this.loadPersistedState(),n<=0&&(this.setup=void 0)}setup(e,t){return Bh(this,void 0,void 0,function*(){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener(()=>{null==t||t.fetch()}),this.waitForConnectorIdentity(this.timeoutMillis)})}getUser(){const e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}}track(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent(Object.assign({eventType:e.eventType,eventProperties:e.eventProperties},e.groups&&{groups:e.groups})),!0)}loadPersistedState(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;let e=qh(this.apiKey,!0);return e?(this.commitIdentityToConnector(e),!0):(e=qh(this.apiKey,!1),e?(this.commitIdentityToConnector(e),!0):(e=(e=>{const t=zh(e,!0);try{const e=Rh();if(!e)return;const n=e.getItem(t);if(!n)return;const r=JSON.parse(n);if("object"!=typeof r)return;return r}catch(e){return}})(this.apiKey),e?(this.commitIdentityToConnector(e),!0):(e=(e=>{const t=zh(e,!0);try{const e=_h();if(!e)return;const n=e.getItem(t);if(!n)return;const r=JSON.parse(n);if("object"!=typeof r)return;return r}catch(e){return}})(this.apiKey),!!e&&(this.commitIdentityToConnector(e),!0))))}commitIdentityToConnector(e){const t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()}waitForConnectorIdentity(e){return Bh(this,void 0,void 0,function*(){const t=this.identityStore.getIdentity();if(!t.userId&&!t.deviceId)return Promise.race([new Promise(e=>{const t=()=>{e(),this.identityStore.removeIdentityListener(t)};this.identityStore.addIdentityListener(t)}),new Promise((t,n)=>{const r=Nh();r?r(n,e,"Timed out waiting for Amplitude Analytics SDK to initialize."):n("Timed out waiting for Amplitude Analytics SDK to initialize.")})])})}}const Vh=(()=>{const e=Mh();return(null==e?void 0:e.fetch)?e.fetch.bind(e):void 0})()||function(e,t){return t=t||{},new Promise(function(n,r){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,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n}),n(l())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(u,t.headers[u]);i.send(t.body||null)})};class $h{constructor(e){this.client=e}request(e){return Bh(this,void 0,void 0,function*(){return yield this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)})}}const Kh={request:(e,t,n,r,i)=>((e,t)=>null==t||t<=0?e:new Promise(function(n,r){const i=Nh();i&&i(function(){r(new Th(`Request timeout after ${t} milliseconds`))},t),e.then(n,r)}))(Bh(void 0,void 0,void 0,function*(){const i=yield Vh(e,{method:t,headers:n,body:r});return{status:i.status,body:yield i.text()}}),i)};var Hh,Gh,Jh;!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"}(Hh||(Hh={})),function(e){e.LocalStorage="localStorage",e.InitialVariants="initialVariants"}(Gh||(Gh={})),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"}(Jh||(Jh={}));const Yh=e=>!e||e===Jh.FallbackInline||e===Jh.FallbackConfig||e===Jh.SecondaryInitialVariants,Xh={debug:!1,logLevel:Hh.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:Gh.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:Kh};var Qh="1.24.0";const Zh=e=>null==e,ef=e=>!!Zh(e)||e&&0===Object.keys(e).length,tf=e=>{if(!ef(e))return JSON.stringify(Object.keys(e).sort().map(t=>[t,[...e[t]].sort()]))},nf=e=>{var t;return"local"===(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.evaluationMode)};class rf{constructor(e,t){var n;this.isReady=new Promise(e=>{this.resolve=e}),this.config=e,this.client=t;const r=null!==(n=e.instanceName)&&void 0!==n?n:Xh.instanceName;this.queue=new sf(r,512,e.internalPersistenceAllowed),this.cache=new of(r,e.internalPersistenceAllowed)}ready(){return this.integration?this.isReady:Promise.resolve()}setIntegration(e){this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(()=>{this.queue.setTracker(this.integration.track.bind(e)),this.resolve()},()=>{this.queue.setTracker(this.integration.track.bind(e)),this.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())}getUser(){return this.integration?this.integration.getUser():{}}track(e,t){if(this.cache.shouldTrack(e,t)){const n=e.variant?null==t?void 0:t.groups:void 0,r=this.getExposureEvent(e,n);this.queue.push(r)}}getExposureEvent(e,t){var n,r;let i="$exposure";(null===(n=e.metadata)||void 0===n?void 0:n.exposureEvent)?i=e.metadata.exposureEvent:"web"===(null===(r=e.metadata)||void 0===r?void 0:r.deliveryMethod)&&(i="$impression");const o={eventType:i,eventProperties:e};return ef(t)||(o.groups=t),o}}class of{constructor(e,t){this.persistenceAllowed=t,this.clearStoredOnReopen=!1,this.hasGatedEntries=!1,this.inMemoryCache={},this.identity={},this.storageKey=`EXP_sent_v3_${e}`}isGated(){return void 0!==this.persistenceAllowed&&!this.persistenceAllowed()}usableStorage(){if(this.isGated())return;void 0===this.isSessionStorageAvailable&&(this.isSessionStorageAvailable=af());const e=_h();return this.isSessionStorageAvailable&&e?(this.clearStoredOnReopen&&(this.clearStoredOnReopen=!1,e.removeItem(this.storageKey)),e):void 0}shouldTrack(e,t){var n,r;if("web"===(null===(n=e.metadata)||void 0===n?void 0:n.deliveryMethod))return!0;const i={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id,groups:tf(null==t?void 0:t.groups)};this.identityEquals(this.identity,i)||this.clearCache(),this.identity=i,this.loadCache();const o=e.flag_key in this.inMemoryCache,s=this.inMemoryCache[e.flag_key],a=null!==(r=e.variant)&&void 0!==r?r:null;let l=!1;return o&&(null!=s?s:null)===a||(l=!0,this.inMemoryCache[e.flag_key]=a,this.isGated()&&(this.hasGatedEntries=!0)),this.storeCache(),l}clearCache(){this.inMemoryCache={},this.hasGatedEntries=!1;const e=this.usableStorage();e?e.removeItem(this.storageKey):this.isGated()&&(this.clearStoredOnReopen=!0)}identityEquals(e,t){return e.groups===t.groups&&(e.userId&&t.userId?e.userId===t.userId:!e.userId&&!t.userId&&e.deviceId===t.deviceId)}loadCache(){const e=this.usableStorage();if(e){const t=e.getItem(this.storageKey),n=t?JSON.parse(t):{};this.hasGatedEntries?(this.inMemoryCache=Object.assign(Object.assign({},n),this.inMemoryCache),this.hasGatedEntries=!1):this.inMemoryCache=n}}storeCache(){const e=this.usableStorage();if(e)try{e.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))}catch(e){}}}class sf{constructor(e,t=512,n){this.persistenceAllowed=n,this.inMemoryQueue=[],this.holdsGatedEvents=!1,this.storageKey=`EXP_unsent_${e}`,this.maxQueueSize=t}push(e){this.loadQueue(),this.inMemoryQueue.push(e),this.canPersist()||(this.holdsGatedEvents=!0),this.flush(),this.storeQueue()}setTracker(e){this.tracker=e;const t=Lh();t&&(this.poller=t(()=>{this.loadFlushStore()},1e3)),this.loadFlushStore()}flush(){if(!this.tracker)return;if(0===this.inMemoryQueue.length)return;let e=0;for(;e<this.inMemoryQueue.length;e++)try{if(!this.tracker(this.inMemoryQueue[e]))break}catch(e){break}if(this.inMemoryQueue=this.inMemoryQueue.slice(e),0===this.inMemoryQueue.length&&this.poller){const e=Dh();e&&e(this.poller),this.poller=void 0}}canPersist(){return!this.persistenceAllowed||this.persistenceAllowed()}usableStorage(){if(!this.canPersist())return;void 0===this.isLocalStorageAvailable&&(this.isLocalStorageAvailable=(()=>{const e=Mh();if(e)try{const t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){return!1}return!1})());const e=Rh();return this.isLocalStorageAvailable&&e?e:void 0}loadQueue(){const e=this.usableStorage();if(e){const t=e.getItem(this.storageKey),n=t?JSON.parse(t):[];this.holdsGatedEvents?(this.inMemoryQueue=[...n,...this.inMemoryQueue],this.holdsGatedEvents=!1):this.inMemoryQueue=n}}storeQueue(){const e=this.usableStorage();if(e){if(0===this.inMemoryQueue.length)return void e.removeItem(this.storageKey);this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),e.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue))}}loadFlushStore(){this.loadQueue(),this.flush(),this.storeQueue()}}const af=()=>{const e=Mh();if(e)try{const t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){return!1}return!1};class lf{constructor(e,t=Hh.Error){this.logger=e,this.logLevel=t}error(e,...t){this.logLevel>=Hh.Error&&this.logger.error(e,...t)}warn(e,...t){this.logLevel>=Hh.Warn&&this.logger.warn(e,...t)}info(e,...t){this.logLevel>=Hh.Info&&this.logger.info(e,...t)}debug(e,...t){this.logLevel>=Hh.Debug&&this.logger.debug(e,...t)}verbose(e,...t){this.logLevel>=Hh.Verbose&&this.logger.verbose(e,...t)}}class uf{error(e,...t){console.error(e,...t)}warn(e,...t){console.warn(e,...t)}info(e,...t){console.info(e,...t)}debug(e,...t){console.debug(e,...t)}verbose(e,...t){console.debug(e,...t)}}class cf{constructor(){this.globalScope=Mh()}get(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.localStorage.getItem(e)}put(e,t){var n;null===(n=this.globalScope)||void 0===n||n.localStorage.setItem(e,t)}delete(e){var t;null===(t=this.globalScope)||void 0===t||t.localStorage.removeItem(e)}}class df{constructor(e,t){this.namespace=e,this.storage=t}get(){return this.value}put(e){this.value=e}load(){const e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))}store(){void 0===this.value?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))}}class hf{constructor(e,t,n){this.cache={},this.namespace=e,this.storage=t,this.transformer=n}get(e){return this.cache[e]}getAll(){return Object.assign({},this.cache)}put(e,t){this.cache[e]=t}putAll(e){for(const t of Object.keys(e))this.cache[t]=e[t]}remove(e){delete this.cache[e]}clear(){this.cache={}}load(){const e=this.storage.get(this.namespace);let t;try{t=JSON.parse(e)||{}}catch(e){return}const n={};for(const e of Object.keys(t))try{let r;r=this.transformer?this.transformer(t[e]):t[e],r&&(n[e]=r)}catch(e){}this.clear(),this.putAll(n)}store(e=this.cache){this.storage.put(this.namespace,JSON.stringify(e))}}const ff=e=>{if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){const t=e.key,n=e.value,r=e.payload;let i=e.metadata,o=e.expKey;i&&i.experimentKey?o=i.experimentKey:o&&(i=i||{},i.experimentKey=o);const s={};return t?s.key=t:n&&(s.key=n),n&&(s.value=n),i&&(s.metadata=i),r&&(s.payload=r),o&&(s.expKey=o),s}};class pf{constructor(){this.globalScope=Mh()}get(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.sessionStorage.getItem(e)}put(e,t){var n;null===(n=this.globalScope)||void 0===n||n.sessionStorage.setItem(e,t)}delete(e){var t;null===(t=this.globalScope)||void 0===t||t.sessionStorage.removeItem(e)}}class gf{constructor(e,t,n,r){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=n,this.scalar=r}start(e){return Bh(this,void 0,void 0,function*(){if(this.started)throw Error("Backoff already started");this.started=!0,yield this.backoff(e,0,this.min)})}cancel(){this.done=!0;const e=(()=>{const e=Mh();return(null==e?void 0:e.clearTimeout)?e.clearTimeout.bind(e):void 0})();e&&e(this.timeoutHandle)}backoff(e,t,n){return Bh(this,void 0,void 0,function*(){if(this.done)return;const r=Nh();r&&(this.timeoutHandle=r(()=>{(()=>{Bh(this,void 0,void 0,function*(){try{yield e()}catch(r){const i=t+1;if(i<this.attempts){const t=Math.min(n*this.scalar,this.max);yield this.backoff(e,i,t)}}})})()},n))})}}const vf=e=>{var t,n;if(!e)return{};const r={user:e},i=Mh();(null==i?void 0:i.location)&&(r.page={url:i.location.href});const o={};if(!e.groups)return r;for(const r of Object.keys(e.groups)){const i=e.groups[r];if(i.length>0&&i[0]){const s=i[0],a={group_name:s},l=null===(n=null===(t=e.group_properties)||void 0===t?void 0:t[r])||void 0===n?void 0:n[s];l&&Object.keys(l).length>0&&(a.group_properties=l),o[r]=a}}return Object.keys(o).length>0&&(r.groups=o),delete r.user.groups,delete r.user.group_properties,r},mf=e=>null==e?{}:"string"==typeof e?{key:e,value:e}:e,yf=e=>{if(!e)return{};let t;e.metadata&&(t=e.metadata.experimentKey);const n={};return e.key&&(n.key=e.key),e.value&&(n.value=e.value),e.payload&&(n.payload=e.payload),t&&(n.expKey=t),e.metadata&&(n.metadata=e.metadata),n};class bf{constructor(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}track(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))}setUserProperty(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)}unsetUserProperty(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))}}class wf{constructor(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}track(e,t){const n={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id,groups:tf(null==t?void 0:t.groups)};this.identityEquals(this.identity,n)||(this.tracked={}),this.identity=n;const r=e.flag_key in this.tracked,i=this.tracked[e.flag_key];r&&i===e.variant||(this.tracked[e.flag_key]=e.variant,!e.variant||ef(null==t?void 0:t.groups)?this.exposureTrackingProvider.track(e):this.exposureTrackingProvider.track(e,t.groups))}identityEquals(e,t){return e.userId===t.userId&&e.deviceId===t.deviceId&&e.groups===t.groups}}class Sf{constructor(e,t){var n,r,i,o,s;this.engine=new ih,this.isRunning=!1,this.apiKey=e,t=(e=>{if(!e||"object"!=typeof e)return{};const t={};for(const[n,r]of Object.entries(e))Zh(r)||(t[n]=r);return t})(t),this.config=Object.assign(Object.assign(Object.assign({},Xh),t),{serverUrl:(null==t?void 0:t.serverUrl)||("eu"===(null===(n=null==t?void 0:t.serverZone)||void 0===n?void 0:n.toLowerCase())?"https://api.lab.eu.amplitude.com":Xh.serverUrl),flagsServerUrl:(null==t?void 0:t.flagsServerUrl)||("eu"===(null===(r=null==t?void 0:t.serverZone)||void 0===r?void 0:r.toLowerCase())?"https://flag.lab.eu.amplitude.com":Xh.flagsServerUrl),flagConfigPollingIntervalMillis:t.flagConfigPollingIntervalMillis<6e4?6e4:null!==(i=t.flagConfigPollingIntervalMillis)&&void 0!==i?i:Xh.flagConfigPollingIntervalMillis}),this.logger=new lf(this.config.loggerProvider||new uf,Sf.getLogLevel(t));const a=null===(o=this.config)||void 0===o?void 0:o.internalInstanceNameSuffix;if(this.isWebExperiment="web"===a,this.poller=new Fh(()=>Bh(this,void 0,void 0,function*(){try{yield this.doFlags()}catch(e){this.logger.info(e)}}),this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(const e in this.config.initialVariants)this.config.initialVariants[e]=ff(this.config.initialVariants[e]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new bf(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new wf(this.config.exposureTrackingProvider)),this.integrationManager=new rf(this.config,this);const l=new $h(this.config.httpClient||Kh);let u;this.flagApi=new Ah(this.apiKey,this.config.flagsServerUrl,l),this.evaluationApi=new Ph(this.apiKey,this.config.serverUrl,l);const c=a?`${this.config.instanceName}-${String(a)}`:this.config.instanceName;if(this.isWebExperiment){const e=null===(s=this.config)||void 0===s?void 0:s.internalCacheStorage;u=null!=e?e:new pf}else u=new cf;this.variants=((e,t,n)=>{const r=e.substring(e.length-6);return new hf(`amp-exp-${t}-${r}`,n,ff)})(this.apiKey,c,u),this.flags=((e,t,n=new cf)=>{const r=e.substring(e.length-6);return new hf(`amp-exp-${t}-${r}-flags`,n)})(this.apiKey,c,u),this.fetchVariantsOptions=((e,t,n=new cf)=>{const r=e.substring(e.length-6);return new df(`amp-exp-${t}-${r}-variants-options`,n)})(this.apiKey,c,u);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch(e){}this.mergeInitialFlagsWithStorage()}start(e){return Bh(this,void 0,void 0,function*(){var t;if(!this.isRunning){this.isRunning=!0,this.setUser(e);try{const n=this.doFlags();null===(t=this.config.fetchOnStart)||void 0===t||t?yield Promise.all([this.fetch(e),n]):yield n}catch(e){if(this.config.throwOnError)throw e}this.config.pollOnStart&&this.poller.start()}})}stop(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)}fetch(){return Bh(this,arguments,void 0,function*(e=this.user,t){this.setUser(e||{});try{yield this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)}catch(e){if(this.config.throwOnError)throw e;e instanceof Th?this.logger.debug(e):this.logger.error(e)}return this})}variant(e,t){var n,r;if(!this.apiKey)return{value:void 0};const i=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,i),this.logger.debug(`[Experiment] variant for ${e} is ${(null===(n=i.variant)||void 0===n?void 0:n.key)||(null===(r=i.variant)||void 0===r?void 0:r.value)}`),i.variant||{}}exposure(e){const t=this.variantAndSource(e);this.exposureInternal(e,t)}all(){if(!this.apiKey)return{};const e=this.evaluate();for(const t in e){const n=this.flags.get(t);nf(n)||delete e[t]}return Object.assign(Object.assign(Object.assign({},this.secondaryVariants()),this.sourceVariants()),e)}clear(){this.variants.clear();try{this.variants.store()}catch(e){}}getUser(){var e;if(!this.user)return this.user;if(null===(e=this.user)||void 0===e?void 0:e.user_properties){const e=Object.assign({},this.user.user_properties);return Object.assign(Object.assign({},this.user),{user_properties:e})}return Object.assign({},this.user)}setUser(e){var t;if(e)if(null===(t=this.user)||void 0===t?void 0:t.user_properties){const t=Object.assign({},e.user_properties);this.user=Object.assign(Object.assign({},e),{user_properties:t})}else this.user=Object.assign({},e);else this.user=null}getUserProvider(){return this.userProvider}setUserProvider(e){return this.userProvider=e,this}mergeInitialFlagsWithStorage(){if(this.config.initialFlags){JSON.parse(this.config.initialFlags).forEach(e=>{this.flags.get(e.key)||this.flags.put(e.key,e)})}}evaluate(e){const t=this.addContext(this.user),n=oh(this.flags.getAll(),e),r=vf(t),i=this.engine.evaluate(r,n),o={};for(const e of Object.keys(i))o[e]=yf(i[e]);return o}getEvaluationTraces(e){const t=this.addContext(this.user),n=oh(this.flags.getAll(),e),r=vf(t),{traces:i}=this.engine.evaluateWithTraces(r,n);return i}variantAndSource(e,t){let n={};this.config.source===Gh.LocalStorage?n=this.localStorageVariantAndSource(e,t):this.config.source===Gh.InitialVariants&&(n=this.initialVariantsVariantAndSource(e,t));const r=this.flags.get(e);return(nf(r)||!n.variant&&r)&&(n=this.localEvaluationVariantAndSource(e,r,t)),n}localEvaluationVariantAndSource(e,t,n){var r;let i={};const o=this.evaluate([t.key])[e],s=Jh.LocalEvaluation,a=null===(r=null==o?void 0:o.metadata)||void 0===r?void 0:r.default;if(!Zh(o)&&!a)return{variant:mf(o),source:s,hasDefaultVariant:!1};if(a&&(i={variant:mf(o),source:s,hasDefaultVariant:!0}),!Zh(n))return{variant:mf(n),source:Jh.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};const l=this.config.initialVariants[e];if(!Zh(l))return{variant:mf(l),source:Jh.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};const u=mf(this.config.fallbackVariant),c={variant:u,source:Jh.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return ef(u)?i:c}localStorageVariantAndSource(e,t){var n;let r={};const i=this.variants.get(e),o=null===(n=null==i?void 0:i.metadata)||void 0===n?void 0:n.default;if(!Zh(i)&&!o)return{variant:mf(i),source:Jh.LocalStorage,hasDefaultVariant:!1};if(o&&(r={variant:mf(i),source:Jh.LocalStorage,hasDefaultVariant:!0}),!Zh(t))return{variant:mf(t),source:Jh.FallbackInline,hasDefaultVariant:r.hasDefaultVariant};const s=this.config.initialVariants[e];if(!Zh(s))return{variant:mf(s),source:Jh.SecondaryInitialVariants,hasDefaultVariant:r.hasDefaultVariant};const a=mf(this.config.fallbackVariant),l={variant:a,source:Jh.FallbackConfig,hasDefaultVariant:r.hasDefaultVariant};return ef(a)?r:l}initialVariantsVariantAndSource(e,t){var n;let r={};const i=this.config.initialVariants[e];if(!Zh(i))return{variant:mf(i),source:Jh.InitialVariants,hasDefaultVariant:!1};const o=this.variants.get(e),s=null===(n=null==o?void 0:o.metadata)||void 0===n?void 0:n.default;if(!Zh(o)&&!s)return{variant:mf(o),source:Jh.LocalStorage,hasDefaultVariant:!1};if(s&&(r={variant:mf(o),source:Jh.LocalStorage,hasDefaultVariant:!0}),!Zh(t))return{variant:mf(t),source:Jh.FallbackInline,hasDefaultVariant:r.hasDefaultVariant};const a=mf(this.config.fallbackVariant),l={variant:a,source:Jh.FallbackConfig,hasDefaultVariant:r.hasDefaultVariant};return ef(a)?r:l}fetchInternal(e,t,n,r){return Bh(this,void 0,void 0,function*(){var i;if(!this.apiKey)throw Error("Experiment API key is empty");this.logger.debug(`[Experiment] Fetch all: retry=${String(n)}`),n&&this.stopRetries();try{const n=yield this.doFetch(e,t,Object.assign({trackingOption:null===(i=this.fetchVariantsOptions.get())||void 0===i?void 0:i.trackingOption},r));return yield this.storeVariants(n,r),n}catch(t){throw n&&this.shouldRetryFetch(t)&&this.startRetries(e,r),t}})}setTracksAssignment(e){return Bh(this,void 0,void 0,function*(){this.fetchVariantsOptions.put(Object.assign(Object.assign({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"})),this.fetchVariantsOptions.store()})}cleanUserPropsForFetch(e){const t=Object.assign({},e);return delete t.cookie,t}doFetch(e,t,n){return Bh(this,void 0,void 0,function*(){e=yield this.addContextOrWait(e),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e);const r=yield this.evaluationApi.getVariants(e,Object.assign({timeoutMillis:t},n)),i={};for(const e of Object.keys(r))i[e]=yf(r[e]);return this.logger.debug("[Experiment] Received variants: ",i),i})}doFlags(){return Bh(this,void 0,void 0,function*(){try{let e;this.isWebExperiment&&(e=yield this.addContextOrWait(this.getUser()));const t=yield this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:Qh,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});this.flags.clear(),this.flags.putAll(t)}catch(e){if(!(e instanceof Th))throw e;if(this.logger.debug(e),this.config.throwOnError)throw e}try{this.flags.store()}catch(e){}this.mergeInitialFlagsWithStorage()})}storeVariants(e,t){return Bh(this,void 0,void 0,function*(){let n=t&&t.flagKeys?t.flagKeys:[];0===n.length&&this.variants.clear();for(const t in e)n=n.filter(e=>e!==t),this.variants.put(t,e[t]);for(const e of n)this.variants.remove(e);try{this.variants.store()}catch(e){}this.logger.debug("[Experiment] Stored variants: ",e)})}startRetries(e,t){return Bh(this,void 0,void 0,function*(){this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new gf(8,500,1e4,1.5),this.retriesBackoff.start(()=>Bh(this,void 0,void 0,function*(){yield this.fetchInternal(e,1e4,!1,t)}))})}stopRetries(){this.retriesBackoff&&this.retriesBackoff.cancel()}addContext(e){var t;const n=null===(t=this.userProvider)||void 0===t?void 0:t.getUser(),r=this.integrationManager.getUser(),i=Object.assign(Object.assign(Object.assign({},null==n?void 0:n.user_properties),r.user_properties),null==e?void 0:e.user_properties);return Object.assign(Object.assign(Object.assign(Object.assign({library:`experiment-js-client/${Qh}`},n),r),e),{user_properties:i})}addContextOrWait(e){return Bh(this,void 0,void 0,function*(){return yield this.integrationManager.ready(),this.addContext(e)})}sourceVariants(){return this.config.source==Gh.LocalStorage?this.variants.getAll():this.config.source==Gh.InitialVariants?this.config.initialVariants:void 0}secondaryVariants(){return this.config.source==Gh.LocalStorage?this.config.initialVariants:this.config.source==Gh.InitialVariants?this.variants.getAll():void 0}exposureInternal(e,t){var n,r,i,o,s,a,l,u,c;if(!(null===(i=null===(r=null===(n=t.variant)||void 0===n?void 0:n.metadata)||void 0===r?void 0:r.trackExposure)||void 0===i||i))return;this.legacyExposureInternal(e,t.variant,t.source);const d={flag_key:e},h=Yh(t.source);if(h&&!t.hasDefaultVariant)return;(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);const f=null===(a=t.variant)||void 0===a?void 0:a.metadata;if(h||(null==f?void 0:f.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)),f&&(d.metadata=f),this.isWebExperiment&&(d.time=Date.now()),this.isWebExperiment){const e=Mh();if(null==e?void 0:e.location)try{const t=e.location.href;d.metadata.url=t.split("?")[0]||""}catch(e){}}const p=this.addContext(this.getUser()),g=Object.assign(Object.assign({},p),{groups:this.exposureGroups(p)});null===(c=this.userSessionExposureTracker)||void 0===c||c.track(d,g),this.integrationManager.track(d,g)}exposureGroups(e){if(ef(e.groups))return;const t=Object.values(e.groups).reduce((e,t)=>e+t.length,0);if(!(t>10))return e.groups;this.logger.warn(`[Experiment] User has ${t} group values, more than the limit of 10. Exposures will not include groups.`)}legacyExposureInternal(e,t,n){var r,i,o,s,a;if(this.analyticsProvider){const l=((e,t,n,r)=>{const i=null==n?void 0:n.value,o=`[Experiment] ${t}`;return{name:"[Experiment] Exposure",user:e,key:t,variant:n,userProperty:o,properties:{key:t,variant:i,source:r},userProperties:{[o]:i}}})(this.addContext(this.getUser()),e,t,n);Yh(n)||!(null==t?void 0:t.value)?null===(i=null===(r=this.analyticsProvider)||void 0===r?void 0:r.unsetUserProperty)||void 0===i||i.call(r,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))}}static getLogLevel(e){var t;return!0===e.debug?Hh.Debug:null!==(t=e.logLevel)&&void 0!==t?t:Hh.Error}shouldRetryFetch(e){return!(e instanceof Oh)||(e.statusCode<400||e.statusCode>=500||429===e.statusCode)}addPlugin(e){"integration"===e.type&&this.integrationManager.setIntegration(e)}}class kf{constructor(e,t,n){var r,i,o;this.globalScope=Mh(),this.userAgent=void 0!==(null===(r=this.globalScope)||void 0===r?void 0:r.navigator)?null===(i=this.globalScope)||void 0===i?void 0:i.navigator.userAgent:void 0,this.ua=new Uh.UAParser(this.userAgent).getResult(),this.localStorage=new cf,this.sessionStorage=new pf,this.userProvider=e,this.apiKey=t,this.persistenceAllowed=n,this.storageKey=`EXP_${null===(o=this.apiKey)||void 0===o?void 0:o.slice(0,10)}_DEFAULT_USER_PROVIDER`}canPersist(){return!this.persistenceAllowed||this.persistenceAllowed()}getUser(){var e,t,n,r,i;const o=(null===(e=this.userProvider)||void 0===e?void 0:e.getUser())||{};return Object.assign({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!==(n=null===(t=this.ua.device)||void 0===t?void 0:t.type)&&void 0!==n?n:"desktop",referring_url:null===(i=null===(r=this.globalScope)||void 0===r?void 0:r.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)}getLanguage(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""}getOs(e){var t,n;return[null===(t=e.browser)||void 0===t?void 0:t.name,null===(n=e.browser)||void 0===n?void 0:n.major].filter(e=>null!=e).join(" ")}getDeviceModel(e){var t;return null===(t=e.os)||void 0===t?void 0:t.name}getBrowser(e){var t;let n=null===(t=e.browser)||void 0===t?void 0:t.name;return(null==n?void 0:n.includes("Chrom"))&&(n="Chrome"),(null==n?void 0:n.includes("Firefox"))&&(n="Firefox"),(null==n?void 0:n.includes("Safari"))&&(n="Safari"),(null==n?void 0:n.includes("Edge"))&&(n="Edge"),(null==n?void 0:n.includes("Opera"))&&(n="Opera"),n}getCookie(){var e,t,n,r,i;if(this.canPersist()&&(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===(r=null===(n=this.globalScope)||void 0===n?void 0:n.document)||void 0===r?void 0:r.cookie)||void 0===i?void 0:i.split("; ").map(e=>e.split("=")))}getLandingUrl(){var e,t;if(!this.canPersist())return null!==(e=this.gatedLandingUrl)&&void 0!==e||(this.gatedLandingUrl=this.getCurrentUrl()),this.gatedLandingUrl;try{const e=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return e.landing_url||(e.landing_url=null!==(t=this.gatedLandingUrl)&&void 0!==t?t:this.getCurrentUrl(),this.sessionStorage.put(this.storageKey,JSON.stringify(e))),e.landing_url}catch(e){return}}getCurrentUrl(){var e,t;return null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.location)||void 0===t?void 0:t.href.replace(/\/$/,"")}getFirstSeen(){if(!this.canPersist())return(Date.now()/1e3).toString();try{const 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}}getUrlParam(){var e;if(!this.globalScope)return;const t={};try{const n=new URL(this.globalScope.location.href);for(const[r,i]of n.searchParams)t[r]=[...null!==(e=t[r])&&void 0!==e?e:[],...i.split(",")]}catch(e){return}return Object.entries(t).reduce((e,[t,n])=>(e[t]=1==n.length?n[0]:n,e),{})}}var xf;const Cf=Mh();Cf&&(Cf.experimentInstances={});const Ef=null!==(xf=null==Cf?void 0:Cf.experimentInstances)&&void 0!==xf?xf:{},If=e=>(null==e?void 0:e.instanceName)||Xh.instanceName,Of=(e,t,n)=>{const r=((e,t)=>{const n=If(t),r=null==t?void 0:t.internalInstanceNameSuffix;return r?`${n}.${e}.${String(r)}`:`${n}.${e}`})(e,t);let i=Ef[r];return i||(i=((e,t)=>new Sf(e,Object.assign(Object.assign({},t),{userProvider:new kf(null==t?void 0:t.userProvider,e,null==t?void 0:t.internalPersistenceAllowed)})))(e,t),n&&i.addPlugin(n()),Ef[r]=i,i)};var Tf=function(){function e(t){this.name=e.pluginName,this.config=t}return e.prototype.setup=function(e,t){var n,r;return l(this,void 0,void 0,function(){var t;return u(this,function(i){return t=void 0!==(null===(n=this.config)||void 0===n?void 0:n.instanceName)||void 0===e.instanceName?this.config:s(s({},this.config),{instanceName:e.instanceName}),this.experiment=((e,t)=>Of(e,t,()=>new Wh(e,Pe.getInstance(If(t)),1e4)))((null===(r=this.config)||void 0===r?void 0:r.deploymentKey)||e.apiKey,t),[2]})})},e.pluginName="@amplitude/experiment-analytics-plugin",e}(),Pf=function(e){return new Tf(e)},Af=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Mf(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),Mf=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},Rf=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}(),_f=function(){return _f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},_f.apply(this,arguments)};function Nf(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Lf(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}var Df=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=Nf(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next()){if(s.value===i)return e===t}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(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(!Df(u,c))return!1;var d=!0;return Object.keys(e).forEach(function(n){Df(e[n],t[n])||(d=!1)}),d}for(var h=0;h<e.length;h++)if(!Df(e[h],t[h]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var Ff=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=_f({},this.identity.userProperties),n=_f(_f({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,i,o,s,a,l=n.userProperties||{};try{for(var u=Nf(Object.entries(e)),c=u.next();!c.done;c=u.next()){var d=Lf(c.value,2),h=d[0],f=d[1];switch(h){case"$set":try{for(var p=(i=void 0,Nf(Object.entries(f))),g=p.next();!g.done;g=p.next()){var v=Lf(g.value,2),m=v[0],y=v[1];l[m]=y}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,Nf(Object.keys(f))),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&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return n.userProperties=l,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return _f({},this.identity)},e.prototype.setIdentity=function(e){var t=_f({},this.identity);this.identity=_f({},e),Df(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}(),Uf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:self,jf=function(){function e(){this.identityStore=new Ff,this.eventBridge=new Rf,this.applicationContextProvider=new Af}return e.getInstance=function(t){return Uf.analyticsConnectorInstances||(Uf.analyticsConnectorInstances={}),Uf.analyticsConnectorInstances[t]||(Uf.analyticsConnectorInstances[t]=new e),Uf.analyticsConnectorInstances[t]},e}(),Bf=["boot"],qf=Symbol.for("amplitude-engagement-plugin-caller");var zf=(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))(zf||{});var Wf=((e=>{if(typeof window<"u"&&window.opener)for(let t of Object.values(zf))window.opener.postMessage({message:e},t)})("ENGAGEMENT_SNIPPET"),function(e){var t,n,r,i,o,s,a,l,u,c;let d=typeof window<"u"?window.engagement:void 0,h=!1,f={_q:null!=(t=null==d?void 0:d._q)?t:[],_configuration:{apiKey:null!=(r=null==(n=null==d?void 0:d._configuration)?void 0:n.apiKey)?r:"",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,n){var r,i,o,s;if(f._configuration.apiKey)return void console.log("Engagement SDK has already been initialized. Ignoring additional init call.");if(!0===(null==n?void 0:n.skip))return console.log("Engagement SDK init skipped via `skip: true`. The SDK bundle will not be loaded."),void(h=!0);if(h&&(f._q.length=0),h=!1,null!=n&&n.useEngagementDomain){let e="EU"===(null!=(r=n.serverZone)?r:f._configuration.serverZone),t="amplitudeengagement.com";n.serverUrl||(n.serverUrl=e?`https://gs.eu.${t}`:`https://gs.${t}`),n.chatUrl||(n.chatUrl=e?`https://houston-chat.eu.${t}`:`https://houston-chat.${t}`),n.mediaUrl||(n.mediaUrl=e?`https://engagement-static.eu.${t}`:`https://engagement-static.${t}`),n.cdnUrl||(n.cdnUrl=e?`https://cdn.eu.${t}`:`https://cdn.${t}`)}let a;if(f._configuration={...f._configuration,...n,apiKey:t,options:{splitting:!0,...f._configuration.options,...null==n?void 0:n.options}},null!=(o=null==(i=f._configuration)?void 0:i.options)&&o.logger&&f._configuration.options.logger.enable(null!=(s=f._configuration.options.logLevel)?s:2),null!=n&&n.cdnUrl)a=f._configuration.options.splitting?`${n.cdnUrl}/engagement-browser/prod/split/index.js`:n.cdnUrl+"/engagement-browser/prod/index.min.js.gz";else{let e="EU"===f._configuration.serverZone?"https://cdn.eu.amplitude.com":"https://cdn.amplitude.com";a=f._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),f._q&&f._q.length>0)for(console.warn(`Engagement SDK failed to load within ${c}ms. Resolving pending calls gracefully.`);f._q.length>0;){let e=f._q.shift();if(!e)continue;let t=e[0],n=Bf.includes(t);if(console.warn(`Engagement SDK method '${t}' still in queue (isAsyncMethod=${n}); attempting to resolve as no-op.`),n&&e[1]instanceof Function&&e[2]instanceof Function){let n=e[1];console.warn(`Engagement SDK method '${t}' resolved as no-op due to script loading failure`),n(void 0)}}};e(a,f._configuration.options.splitting?"module":void 0,null==n?void 0:n.nonce,u);let c=1e4;l=setTimeout(()=>{u()},c)},plugin(e){let t=f.init,n=null==e?void 0:e.token,r=!0===(null==e?void 0:e.skip),i=(e,t)=>{let r=t.getIdentity(),i="function"==typeof n?n():n;return{user_id:e.getUserId(),device_id:e.getDeviceId(),user_properties:r.userProperties,getSessionId:e.getSessionId,...i?{token:i}:{}}};return{name:"@amplitude/engagement-browser",type:"enrichment",async setup(n,o){var s;if(r)return void t(n.apiKey,{skip:!0});let a=null!=(s=n.instanceName)?s:"$default_instance",l=jf.getInstance(a).identityStore;f._configuration._installedViaPlugin=!0,t(n.apiKey,{serverZone:n.serverZone,...e,options:{logLevel:n.logLevel,logger:n.loggerProvider,...null==e?void 0:e.options}});let u=[{track:e=>{o.track(e)}}];await window.engagement.boot({user:()=>i(o,l),integrations:u},qf),l.addIdentityListener(e=>{var t,n,r,s;null!=(t=window.engagement)&&t._.user&&null!=(n=window.engagement)&&n._analytics.hasBooted?(null==(s=null==(r=window.engagement)?void 0:r._.user)?void 0:s.user_id)!==e.userId?(window.engagement.shutdown(qf),window.engagement.boot({user:()=>i(o,l),integrations:u},qf)):window.engagement._setUserProperties(e.userProperties):console.warn("Engagement SDK not booted. Ignoring identity change.")})},execute:async e=>(r||window.engagement.forwardEvent(e),e)}}},p=f;return new Proxy(f,{get:function(e,t){return t in p?p[t]:"then"!==t?"gs"===t||"rc"===t||"assistant"===t?new Proxy({},{get:function(e,n){return function(){let e=Array.from(arguments),r=`${t}.${n}`;e.unshift(r),f._q.push(e)}}}):Bf.includes(t)?function(){let e=Array.prototype.slice.call(arguments);return new Promise((n,r)=>{e.unshift(t,n,r),f._q.push(e),h&&n(void 0)})}:function(){let e=Array.prototype.slice.call(arguments);e.unshift(t),f._q.push(e)}:void 0}})}((e,t,n,r)=>function(e,t,n,r){for(let i of e){let e=document.createElement("script");e.src=i,e.id="engagement-sdk-bundle",n&&e.setAttribute("nonce",n),t&&e.setAttribute("type",t),r&&(e.onerror=r);let o=document.getElementsByTagName("head")[0];o&&o.appendChild(e)}}([e||"https://cdn.amplitude.com/engagement-browser/prod/index.min.js.gz"],t,n,r))),Vf=e=>(typeof window<"u"&&!window.engagement&&(window.engagement=Wf),Wf.plugin(e)),$f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.sessionReplay=function(){return this._sessionReplay},t.prototype.experiment=function(){if(void 0!==this.config){var e=this.plugins(Tf);return 0===e.length?void this.config.loggerProvider.debug("".concat(Tf.pluginName," plugin is not found.")):1===e.length?e[0].experiment:void this.config.loggerProvider.debug("Multiple instances of ".concat(Tf.pluginName," are found."))}},t.prototype.initAll=function(t,n){return l(this,void 0,void 0,function(){var r=this;return u(this,function(i){return this._initAllPromise||(this._initAllPromise=l(r,void 0,void 0,function(){var r,i;return u(this,function(o){switch(o.label){case 0:return r={serverZone:null==n?void 0:n.serverZone,instanceName:null==n?void 0:n.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(n){return e.library="".concat("amplitude-ts-unified","/").concat("1.1.44-codexsemantic-review-integration.0","-").concat(null!==(t=e.library)&&void 0!==t?t:""),[2,e]})})}}),[4,e.prototype.init.call(this,t,s(s({},null==n?void 0:n.analytics),r)).promise];case 1:return o.sent(),[4,e.prototype.add.call(this,(a=s(s({},null==n?void 0:n.sessionReplay),r),new Od(a))).promise];case 2:return o.sent(),[4,e.prototype.add.call(this,Pf(s(s({},null==n?void 0:n.experiment),r))).promise];case 3:return o.sent(),void 0===(i=this.plugin(Od.pluginName))?this.config.loggerProvider.debug("".concat(Od.pluginName," plugin is not found.")):this._sessionReplay=i.sessionReplay,[4,e.prototype.add.call(this,Vf(s(s({},null==n?void 0:n.engagement),r))).promise];case 4:return o.sent(),[2]}var a})}).finally(function(){r._initAllPromise=void 0})),[2,this._initAllPromise]})})},t.prototype.init=function(t,n,r){return void 0===t&&(t=""),e.prototype.init.call(this,t,n,r)},t}(Ua),Kf=function(){var e=new $f;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"]))}},Hf=Kf(),Gf=Hf._setDiagnosticsSampleRate,Jf=Hf.initAll,Yf=Hf.experiment,Xf=Hf.sessionReplay,Qf=Hf.add,Zf=Hf.extendSession,ep=Hf.flush,tp=Hf.getDeviceId,np=Hf.getIdentity,rp=Hf.getOptOut,ip=Hf.getSessionId,op=Hf.getUserId,sp=Hf.groupIdentify,ap=Hf.identify,lp=Hf.logEvent,up=Hf.remove,cp=Hf.reset,dp=Hf.revenue,hp=Hf.setDeviceId,fp=Hf.setGroup,pp=Hf.setIdentity,gp=Hf.setOptOut,vp=Hf.setSessionId,mp=Hf.setTransport,yp=Hf.setUserId,bp=Hf.track,wp=function(e,t){return wp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},wp(e,t)};var Sp=function(){return Sp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Sp.apply(this,arguments)};function kp(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}"function"==typeof SuppressedError&&SuppressedError;var xp="is",Cp="is not",Ep="contains",Ip="does not contain",Op="less",Tp="less or equal",Pp="greater",Ap="greater or equal",Mp="version less",Rp="version less or equal",_p="version greater",Np="version greater or equal",Lp="set is",Dp="set is not",Fp="set contains",Up="set does not contain",jp="set contains any",Bp="set does not contain any",qp="regex match",zp="regex does not match",Wp=-862048943,Vp=461845907,$p=function(e,t){void 0===t&&(t=0);for(var n=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296==(64512&i)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return Uint8Array.from(t)}(e),r=n.length,i=r>>2,o=t,s=0;s<i;s++){var a=Jp(n,s<<2);o=Kp(a,o)}var l=i<<2,u=0;switch(r-l){case 3:u^=n[l+2]<<16,u^=n[l+1]<<8,u^=n[l],u=Math.imul(u,Wp),u=Gp(u,15),o^=u=Math.imul(u,Vp);break;case 2:u^=n[l+1]<<8,u^=n[l],u=Math.imul(u,Wp),u=Gp(u,15),o^=u=Math.imul(u,Vp);break;case 1:u^=n[l],u=Math.imul(u,Wp),u=Gp(u,15),o^=u=Math.imul(u,Vp)}return Hp(o^=r)>>>0},Kp=function(e,t){var n=e,r=t;return n=Math.imul(n,Wp),n=Gp(n,15),n=Math.imul(n,Vp),r=Gp(r^=n,13),(r=Math.imul(r,5))+-430675100|0},Hp=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},Gp=function(e,t,n){return void 0===n&&(n=32),t>n&&(t%=n),(e<<t|(e&4294967295<<n-t>>>0)>>>0>>>n-t>>>0)>>>0},Jp=function(e,t){void 0===t&&(t=0);var n=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return Yp(n)},Yp=function(e){return(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24},Xp=function(e,t){var n,r;if(t&&0!==t.length){try{for(var i=kp(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){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e||void 0}},Qp="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),Zp=function(){function e(e,t,n,r){void 0===r&&(r=void 0),this.major=e,this.minor=t,this.patch=n,this.preRelease=r}return e.parse=function(t){if(t){var n=new RegExp(Qp).exec(t);if(n){var r=Number(n[1]),i=Number(n[2]);if(!isNaN(r)&&!isNaN(i))return new e(r,i,Number(n[4])||0,n[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}(),eg=function(){function e(){}return e.prototype.evaluate=function(e,t){var n,r,i={},o={context:e,result:i};try{for(var s=kp(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){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i},e.prototype.evaluateFlag=function(e,t){var n,r,i;try{for(var o=kp(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){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},e.prototype.evaluateSegment=function(e,t,n){var r,i,o,s;if(!n.conditions)return void 0!==(u=this.bucket(e,n))?t.variants[u]:void 0;try{for(var a=kp(n.conditions),l=a.next();!l.done;l=a.next()){var u,c=l.value,d=!0;try{for(var h=(o=void 0,kp(c)),f=h.next();!f.done;f=h.next()){var p=f.value;if(!(d=this.matchCondition(e,p)))break}}catch(e){o={error:e}}finally{try{f&&!f.done&&(s=h.return)&&s.call(h)}finally{if(o)throw o.error}}if(d)return void 0!==(u=this.bucket(e,n))?t.variants[u]:void 0}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}},e.prototype.matchCondition=function(e,t){var n=Xp(e,t.selector);if(n){if(this.isSetOperator(t.op)){var r=this.coerceStringArray(n);return!!r&&this.matchSet(r,t.op,t.values)}var i=this.coerceString(n);return void 0!==i&&this.matchString(i,t.op,t.values)}return this.matchNull(t.op,t.values)},e.prototype.getHash=function(e){return $p(e)},e.prototype.bucket=function(e,t){var n,r,i,o;if(!t.bucket)return t.variant;var s=this.coerceString(Xp(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=kp(t.bucket.allocations),h=d.next();!h.done;h=d.next()){var f=h.value,p=f.range[0],g=f.range[1];if(u>=p&&u<g)try{for(var v=(i=void 0,kp(f.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){n={error:e}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return t.variant},e.prototype.matchNull=function(e,t){var n=this.containsNone(t);switch(e){case xp:case Ep:case Op:case Tp:case Pp:case Ap:case Mp:case Rp:case _p:case Np:case Lp:case Fp:case jp:return n;case Cp:case Ip:case Up:case Bp:return!n;default:return!1}},e.prototype.matchSet=function(e,t,n){switch(t){case Lp:return this.setEquals(e,n);case Dp:return!this.setEquals(e,n);case Fp:return this.matchesSetContainsAll(e,n);case Up:return!this.matchesSetContainsAll(e,n);case jp:return this.matchesSetContainsAny(e,n);case Bp:return!this.matchesSetContainsAny(e,n);default:return!1}},e.prototype.matchString=function(e,t,n){var r=this;switch(t){case xp:return this.matchesIs(e,n);case Cp:return!this.matchesIs(e,n);case Ep:return this.matchesContains(e,n);case Ip:return!this.matchesContains(e,n);case Op:case Tp:case Pp:case Ap:return this.matchesComparable(e,t,n,function(e){return r.parseNumber(e)},this.comparator);case Mp:case Rp:case _p:case Np:return this.matchesComparable(e,t,n,function(e){return Zp.parse(e)},this.versionComparator);case qp:return this.matchesRegex(e,n);case zp:return!this.matchesRegex(e,n);default:return!1}},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var n=e.toLowerCase();if("true"===n||"false"===n)return t.some(function(e){return e.toLowerCase()===n})}return t.some(function(t){return e===t})},e.prototype.matchesContains=function(e,t){var n,r;try{for(var i=kp(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.toLowerCase().includes(s.toLowerCase()))return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},e.prototype.matchesComparable=function(e,t,n,r,i){var o=this,s=r(e),a=n.map(function(e){return r(e)}).filter(function(e){return void 0!==e});return void 0===s||0===a.length?n.some(function(n){return o.comparator(e,t,n)}):a.some(function(e){return i(s,t,e)})},e.prototype.comparator=function(e,t,n){switch(t){case Op:case Mp:return e<n;case Tp:case Rp:return e<=n;case Pp:case _p:return e>n;case Ap:case Np:return e>=n;default:return!1}},e.prototype.versionComparator=function(e,t,n){var r=e.compareTo(n);switch(t){case Op:case Mp:return r<0;case Tp:case Rp:return r<=0;case Pp:case _p:return r>0;case Ap:case Np:return r>=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 n=String(e);try{var r=JSON.parse(n);return Array.isArray(r)?e.map(function(e){return t.coerceString(e)}).filter(Boolean):void 0}catch(e){return}},e.prototype.isSetOperator=function(e){switch(e){case Lp:case Dp:case Fp:case Up:case jp:case Bp:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var n=new Set(e),r=new Set(t);return n.size===r.size&&function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}(r),!1).every(function(e){return n.has(e)})},e.prototype.matchesSetContainsAll=function(e,t){var n,r;if(e.length<t.length)return!1;try{for(var i=kp(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!this.matchesIs(s,e))return!1}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0},e.prototype.matchesSetContainsAny=function(e,t){var n,r;try{for(var i=kp(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(this.matchesIs(s,e))return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},e}();"function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder;(e=>{let t={};e.forEach((e,n)=>t[e]=n)})(Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")),String.fromCharCode.bind(String),"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),function(e){function t(n,r){var i=e.call(this,r)||this;return i.statusCode=n,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 n(){this.constructor=e}wp(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)})(t,e)}(Error);var tg,ng=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,dc(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,n;return u(this,function(r){switch(r.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 n=r.sent(),this.dbs[t]=n,[2,n]}})})},this.updateEventListForSession=function(t){var n=t.sessionId,r=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,f,p,g;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,3,,4]),e=String(n),[4,a.store.get(e)];case 1:return t=u.sent(),l=t?t.eventTypes:{},c=l[r]||{},d=s(s({},l),((p={})[r]=s(s({},c),((g={})[i]={event_type:r},g)),p)),h={sessionId:e,eventTypes:d,lastUpdated:Date.now()},[4,a.store.put(h)];case 2:return u.sent(),[2,d];case 3:return f=u.sent(),o.warn("Failed to store events for targeting ".concat(n,": ").concat(f)),[3,4];case 4:return[2,void 0]}})})},this.deleteOldSessionEventTypes=function(t){var n=t.currentSessionId,r=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(n),[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(),r.warn("Failed to clear old session event types for targeting: ".concat(l)),[3,7];case 7:return[2]}})})},this.storeEventTypeForSession=function(t){var n=t.loggerProvider,r=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:r,tx:t,loggerProvider:n,eventType:i,eventTime:o})]:[2];case 2:return a=u.sent(),[4,this.deleteOldSessionEventTypes({currentSessionId:r,tx:t,loggerProvider:n})];case 3:return u.sent(),[4,t.done];case 4:return u.sent(),[2,a];case 5:return l=u.sent(),n.warn("Failed to store events for targeting ".concat(r,": ").concat(l)),[3,6];case 6:return[2,void 0]}})})}},rg=new ng,ig=function(){var e=this;this.evaluateTargeting=function(t){var n=t.apiKey,r=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,f;return u(this,function(u){switch(u.label){case 0:return i&&i.time?[4,rg.storeEventTypeForSession({loggerProvider:r,apiKey:n,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)),f={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(f,[h])]}})})},this.evaluationEngine=new eg},og=function(){var e=new ig;return{evaluateTargeting:e.evaluateTargeting.bind(e)}}().evaluateTargeting,sg=Object.freeze({__proto__:null,evaluateTargeting:og}),ag=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,h,y,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())h=v.value,d.set(h,p),p+=h.length}catch(e){y={error:e}}finally{try{v&&!v.done&&(b=f.return)&&b.call(f)}finally{if(y)throw y.error}}return[2,d];case 4:return m.sent(),[2,null];case 5:return[2]}})})}function l(e){for(var t=e.length,r=0;r<t&&!(e.charCodeAt(r)>127);r++);if(r===t)return t;for(var n=r;r<t;r++){var s=e.charCodeAt(r);if(s<=127)n++;else if(s<=2047)n+=2;else if(s>=55296&&s<=56319){var o=r+1<t?e.charCodeAt(r+1):NaN;o>=56320&&o<=57343?(n+=4,r++):n+=3}else n+=3}return n}var d=0,p=new Map,f=function(e,t){return fetch(e,t)},v=function(e,t){var r="".concat(++d);return new Promise(function(n,s){var o=t.signal,a=function(){p.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}),p.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 h(e,t,o){var d,p,f,v,h,y,b,g;return n(this,void 0,void 0,function(){var n,m,w,S,T,E,k,R,C,x,A,I,M,O,U;return s(this,function(s){switch(s.label){case 0:n=null!==(d=t.sendTimeoutMs)&&void 0!==d?d: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 w=s.sent(),[3,4];case 3:w=null,s.label=4;case 4:m=w,S="".concat(null!==(f=null===(p=t.version)||void 0===p?void 0:p.type)&&void 0!==f?f:"standalone","/").concat(null!==(h=null===(v=t.version)||void 0===v?void 0:v.version)&&void 0!==h?h:t.sdkVersion),T=new URLSearchParams({device_id:t.deviceId,session_id:"".concat(t.sessionId),type:t.eventType}),E="".concat((P=t.serverZone,_=t.trackServerUrl,_||("STAGING"===P?"https://api-sr.stag2.amplitude.com/sessions/v2/track":"EU"===P?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track")),"?").concat(T.toString()),k=r({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(t.apiKey),"X-Client-Version":t.sdkVersion,"X-Client-Library":S,"X-Client-Url":t.currentUrl.substring(0,1e3),"X-Client-Sample-Rate":"".concat(t.sampleRate),"X-Sampling-Hash-Alg":"xxhash32"},m?{"Content-Encoding":"gzip"}:{}),R=m?m.byteLength:l(e),C=new AbortController,x=n>0?setTimeout(function(){C.abort()},n):void 0,A=void 0,s.label=5;case 5:return s.trys.push([5,,7,8]),[4,o(E,{method:"POST",headers:k,body:null!=m?m:e,keepalive:R<=65536,signal:C.signal})];case 6:return A=s.sent(),[3,8];case 7:return x&&clearTimeout(x),[7];case 8:if(null===A)return[2,{shouldRetry:!1,success:!1,message:"Unexpected error occurred"}];if(A.status>=200&&A.status<300)return I=Math.round(function(e){for(var t=0,r=0;r<e.length;r++)t+=l(e[r]);return t}(t.events)/1024),M=null!==(g=null===(b=null===(y=A.headers)||void 0===y?void 0:y.get)||void 0===b?void 0:b.call(y,i))&&void 0!==g?g: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:M}];if(413!==A.status)return[3,13];O="",s.label=9;case 9:return s.trys.push([9,11,,12]),[4,A.text()];case 10:return O=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(O)}];case 13:return A.status>=500||408===A.status||429===A.status||499===A.status?[2,{shouldRetry:!0,success:!1,message:"HTTP ".concat(A.status)}]:[2,{shouldRetry:!1,success:!1,message:u}];case 14:return(U=s.sent())&&"object"==typeof U&&"AbortError"===U.name?[2,{shouldRetry:!0,success:!1,message:"Session replay worker request timed out after ".concat(n,"ms")}]:[2,{shouldRetry:!1,success:!1,message:String(U)}];case 15:return[2]}var 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,h(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=p.get(t.requestId))&&(p.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?v:f)]);case 1:s.sent(),s.label=2;case 2:return[2]}})})};var b=onmessage;return e.trackDestinationOnMessage=b,Object.defineProperty(e,"__esModule",{value:!0}),e}({});\n'}),lg=Object.defineProperty,ug=(e,t,n)=>((e,t,n)=>t in e?lg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),cg=Object.defineProperty,dg=(e,t,n)=>((e,t,n)=>t in e?cg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),hg=Object.defineProperty,fg=(e,t,n)=>((e,t,n)=>t in e?hg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const pg={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},gg={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},vg={};function mg(e){if(vg[e])return vg[e];const t=function(e){var t,n;const r=null==(n=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:n.call(t,e);return r&&globalThis[r]?globalThis[r]:void 0}(e)||globalThis[e],n=t.prototype,r=e in pg?pg[e]:void 0,i=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),o=e in gg?gg[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return vg[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(r),o?vg[e]=o:n}catch{return n}}const yg={};function bg(e,t,n){var r;const i=`${e}.${String(n)}`;if(yg[i])return yg[i].call(t);const o=mg(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(yg[i]=s,s.call(t)):t[n]}const wg={};function Sg(e,t,n){const r=`${e}.${String(n)}`;if(wg[r])return wg[r].bind(t);const i=mg(e)[n];return"function"!=typeof i?t[n]:(wg[r]=i,i.bind(t))}const kg={childNodes:function(e){return bg("Node",e,"childNodes")},parentNode:function(e){return bg("Node",e,"parentNode")},parentElement:function(e){return bg("Node",e,"parentElement")},textContent:function(e){return bg("Node",e,"textContent")},contains:function(e,t){return Sg("Node",e,"contains")(t)},getRootNode:function(e){return Sg("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?bg("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?bg("Element",e,"shadowRoot"):null},querySelector:function(e,t){return bg("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return bg("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return mg("MutationObserver").constructor}};class xg{constructor(){fg(this,"idNodeMap",new Map),fg(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 n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Cg(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&Cg(kg.parentNode(e),t,n);for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!!n&&Cg(kg.parentNode(e),t,n)}function Eg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ig(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Og,Tg={exports:{}};function Pg(){if(Og)return Tg.exports;Og=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,blackBright:e,redBright:e,greenBright:e,yellowBright:e,blueBright:e,magentaBright:e,cyanBright:e,whiteBright:e,bgBlackBright:e,bgRedBright:e,bgGreenBright:e,bgYellowBright:e,bgBlueBright:e,bgMagentaBright:e,bgCyanBright:e,bgWhiteBright:e}};return Tg.exports=t(),Tg.exports.createColors=t,Tg.exports}const Ag=Ig(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Mg,Rg,_g,Ng,Lg,Dg;function Fg(){if(Rg)return Mg;Rg=1;let e=Pg(),t=Ag;class n extends Error{constructor(e,t,r,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!==r&&("number"==typeof t?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}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(n){if(!this.source)return"";let r=this.source;null==n&&(n=e.isColorSupported);let i=e=>e,o=e=>e,s=e=>e;if(n){let{bold:n,gray:r,red:a}=e.createColors(!0);o=e=>n(a(e)),i=e=>r(e),t&&(s=e=>t(e))}let a=r.split(/\r?\n/),l=Math.max(this.line-3,0),u=Math.min(this.line+2,a.length),c=String(u).length;return a.slice(l,u).map((e,t)=>{let n=l+1+t,r=" "+(" "+n).slice(-c)+" | ";if(n===this.line){if(e.length>160){let t=20,n=Math.max(0,this.column-t),a=Math.max(this.column+t,this.endColumn+t),l=e.slice(n,a),u=i(r.replace(/\d/g," "))+e.slice(0,Math.min(this.column-1,t-1)).replace(/[^\t]/g," ");return o(">")+i(r)+s(l)+"\n "+u+o("^")}let t=i(r.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return o(">")+i(r)+s(e)+"\n "+t+o("^")}return" "+i(r)+s(e)}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return Mg=n,n.default=n,Mg}function Ug(){if(Ng)return _g;Ng=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 n="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:r&&(n+=" "),e.nodes)this.block(e,n+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,e)}}beforeAfter(e,t){let n;n="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 r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)n+=t}return n}block(e,t){let n,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==r||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),r=e.prop+n+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],void 0!==i))return i;let o=t.parent;if("before"===r){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[r];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[r])return s.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(t,r);{let e="raw"+((a=r)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[n],void 0!==i)return!1})}var a;return void 0===i&&(i=e[r]),s.rawCache[r]=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 n;return e.walkComments(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}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(n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.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(n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==n.raws.before){let e=n.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 n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}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 _g=t,t.default=t,_g}function jg(){if(Dg)return Lg;Dg=1;let e=Ug();function t(t,n){new e(n).stringify(t)}return Lg=t,t.default=t,Lg}var Bg,qg,zg,Wg,Vg,$g,Kg,Hg,Gg,Jg,Yg,Xg,Qg,Zg,ev,tv,nv,rv,iv,ov,sv,av,lv,uv,cv,dv,hv,fv,pv,gv,vv,mv,yv,bv,wv,Sv,kv,xv,Cv,Ev,Iv,Ov,Tv,Pv,Av,Mv,Rv,_v,Nv,Lv={};function Dv(){return Bg||(Bg=1,Lv.isClean=Symbol("isClean"),Lv.my=Symbol("my")),Lv}function Fv(){if(zg)return qg;zg=1;let e=Fg(),t=Ug(),n=jg(),{isClean:r,my:i}=Dv();function o(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],s=typeof i;"parent"===r&&"object"===s?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>o(e,n)):("object"===s&&null!==i&&(i=o(i)),n[r]=i)}return n}function s(e,t){if(t&&void 0!==t.offset)return t.offset;let n=1,r=1,i=0;for(let o=0;o<e.length;o++){if(r===t.line&&n===t.column){i=o;break}"\n"===e[o]?(n=1,r+=1):n+=1}return i}class a{get proxyOf(){return this}constructor(e={}){this.raws={},this[r]=!1,this[i]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let n of e[t])"function"==typeof n.clone?this.append(n.clone()):this.append(n)}else this[t]=e[t]}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 n in e)t[n]=e[n];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(t,n={}){if(this.source){let{end:e,start:r}=this.rangeBy(n);return this.source.input.error(t,{column:r.column,line:r.line},{column:e.column,line:e.line},n)}return new e(t)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markClean(){this[r]=!0}markDirty(){if(this[r]){this[r]=!1;let e=this;for(;e=e.parent;)e[r]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e={}){let t=this.source.start;if(e.index)t=this.positionInside(e.index);else if(e.word){let n="document"in this.source.input?this.source.input.document:this.source.input.css,r=n.slice(s(n,this.source.start),s(n,this.source.end)).indexOf(e.word);-1!==r&&(t=this.positionInside(r))}return t}positionInside(e){let t=this.source.start.column,n=this.source.start.line,r="document"in this.source.input?this.source.input.document:this.source.input.css,i=s(r,this.source.start),o=i+e;for(let e=i;e<o;e++)"\n"===r[e]?(t=1,n+=1):t+=1;return{column:t,line:n,offset:o}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e={}){let t="document"in this.source.input?this.source.input.document:this.source.input.css,n={column:this.source.start.column,line:this.source.start.line,offset:s(t,this.source.start)},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line,offset:"number"==typeof this.source.end.offset?this.source.end.offset:s(t,this.source.end)+1}:{column:n.column+1,line:n.line,offset:n.offset+1};if(e.word){let i=t.slice(s(t,this.source.start),s(t,this.source.end)).indexOf(e.word);-1!==i&&(n=this.positionInside(i),r=this.positionInside(i+e.word.length))}else e.start?n={column:e.start.column,line:e.start.line,offset:s(t,e.start)}:e.index&&(n=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line,offset:s(t,e.end)}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<n.line||r.line===n.line&&r.column<=n.column)&&(r={column:n.column+1,line:n.line,offset:n.offset+1}),{end:r,start:n}}raw(e,n){return(new t).raw(this,e,n)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},r=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 r=this[e];if(Array.isArray(r))n[e]=r.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof r&&r.toJSON)n[e]=r.toJSON(null,t);else if("source"===e){if(null==r)continue;let o=t.get(r.input);null==o&&(o=i,t.set(r.input,i),i++),n[e]={end:r.end,inputId:o,start:r.start}}else n[e]=r}return r&&(n.inputs=[...t.keys()].map(e=>e.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=n){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,n={}){let r={node:this};for(let e in n)r[e]=n[e];return e.warn(t,r)}}return qg=a,a.default=a,qg}function Uv(){if(Vg)return Wg;Vg=1;let e=Fv();class t extends e{constructor(e){super(e),this.type="comment"}}return Wg=t,t.default=t,Wg}function jv(){if(Kg)return $g;Kg=1;let e=Fv();class t extends e{get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}}return $g=t,t.default=t,$g}function Bv(){if(Gg)return Hg;Gg=1;let e,t,n,r,i=Uv(),o=jv(),s=Fv(),{isClean:a,my:l}=Dv();function u(e){return e.map(e=>(e.nodes&&(e.nodes=u(e.nodes)),delete e.source,e))}function c(e){if(e[a]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class d extends s{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]}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,n,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[r]+=1;return delete this.indexes[r],n}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")?(...n)=>e[t](...n.map(e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e)):"every"===t||"some"===t?n=>e[t]((e,...t)=>n(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,n)=>(e[t]===n||(e[t]=n,"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 n,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)n=this.indexes[e],r<n&&(this.indexes[e]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of o)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)n=this.indexes[e],r<=n&&(this.indexes[e]=n+o.length);return this.markDirty(),this}normalize(n,s){if("string"==typeof n)n=u(t(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 o(n)]}else if(n.selector||n.selectors)n=[new r(n)];else if(n.name)n=[new e(n)];else{if(!n.text)throw new Error("Unknown node type in node creation");n=[new i(n)]}return n.map(e=>(e[l]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[a]&&c(e),e.raws||(e.raws={}),void 0===e.raws.before&&s&&void 0!==s.raws.before&&(e.raws.before=s.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 n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,n)=>{let r;try{r=e(t,n)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("atrule"===n.type&&e.test(n.name))return t(n,r)}):this.walk((n,r)=>{if("atrule"===n.type&&n.name===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("atrule"===e.type)return t(e,n)}))}walkComments(e){return this.walk((t,n)=>{if("comment"===t.type)return e(t,n)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("decl"===n.type&&e.test(n.prop))return t(n,r)}):this.walk((n,r)=>{if("decl"===n.type&&n.prop===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("decl"===e.type)return t(e,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("rule"===n.type&&e.test(n.selector))return t(n,r)}):this.walk((n,r)=>{if("rule"===n.type&&n.selector===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("rule"===e.type)return t(e,n)}))}}return d.registerParse=e=>{t=e},d.registerRule=e=>{r=e},d.registerAtRule=t=>{e=t},d.registerRoot=e=>{n=e},Hg=d,d.default=d,d.rebuild=t=>{"atrule"===t.type?Object.setPrototypeOf(t,e.prototype):"rule"===t.type?Object.setPrototypeOf(t,r.prototype):"decl"===t.type?Object.setPrototypeOf(t,o.prototype):"comment"===t.type?Object.setPrototypeOf(t,i.prototype):"root"===t.type&&Object.setPrototypeOf(t,n.prototype),t[l]=!0,t.nodes&&t.nodes.forEach(e=>{d.rebuild(e)})},Hg}function qv(){if(Yg)return Jg;Yg=1;let e=Bv();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 Jg=t,t.default=t,e.registerAtRule(t),Jg}function zv(){if(Qg)return Xg;Qg=1;let e,t,n=Bv();class r extends n{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},Xg=r,r.default=r,Xg}function Wv(){if(ev)return Zg;ev=1;return Zg={nanoid:(e=21)=>{let t="",n=0|e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",i=0|n;for(;i--;)r+=e[Math.random()*e.length|0];return r}},Zg}function Vv(){if(nv)return tv;nv=1;let{existsSync:e,readFileSync:t}=Ag,{dirname:n,join:r}=Ag,{SourceMapConsumer:i,SourceMapGenerator:o}=Ag;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,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=n(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new i(this.text)),this.consumerCache}decodeInline(e){let t=e.match(/^data:application\/json;charset=utf-?8,/)||e.match(/^data:application\/json,/);if(t)return decodeURIComponent(e.substr(t[0].length));let n=e.match(/^data:application\/json;charset=utf-?8;base64,/)||e.match(/^data:application\/json;base64,/);if(n)return r=e.substr(n[0].length),Buffer?Buffer.from(r,"base64").toString():window.atob(r);var r;let i=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+i)}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=/g);if(!t)return;let n=e.lastIndexOf(t.pop()),r=e.indexOf("*/",n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(r){if(this.root=n(r),e(r))return this.mapFile=r,t(r,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof i)return o.fromSourceMap(t).toString();if(t instanceof o)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let n=t(e);if(n){let e=this.loadFile(n);if(!e)throw new Error("Unable to load previous source map: "+n.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=r(n(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return tv=s,s.default=s,tv}function $v(){if(iv)return rv;iv=1;let{nanoid:e}=Wv(),{isAbsolute:t,resolve:n}=Ag,{SourceMapConsumer:r,SourceMapGenerator:i}=Ag,{fileURLToPath:o,pathToFileURL:s}=Ag,a=Fg(),l=Vv(),u=Ag,c=Symbol("lineToIndexCache"),d=Boolean(r&&i),h=Boolean(n&&t);function f(e){if(e[c])return e[c];let t=e.css.split("\n"),n=new Array(t.length),r=0;for(let e=0,i=t.length;e<i;e++)n[e]=r,r+=t[e].length+1;return e[c]=n,n}class p{get from(){return this.file||this.id}constructor(r,i={}){if(null==r||"object"==typeof r&&!r.toString)throw new Error(`PostCSS received ${r} instead of CSS string`);if(this.css=r.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,i.document&&(this.document=i.document.toString()),i.from&&(!h||/^\w+:\/\//.test(i.from)||t(i.from)?this.file=i.from:this.file=n(i.from)),h&&d){let e=new l(this.css,i);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 "+e(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let i,o,l,u,c;if(t&&"object"==typeof t){let e=t,r=n;if("number"==typeof e.offset){u=e.offset;let r=this.fromOffset(u);t=r.line,n=r.col}else t=e.line,n=e.column,u=this.fromLineAndColumn(t,n);if("number"==typeof r.offset){l=r.offset;let e=this.fromOffset(l);o=e.line,i=e.col}else o=r.line,i=r.column,l=this.fromLineAndColumn(r.line,r.column)}else if(n)u=this.fromLineAndColumn(t,n);else{u=t;let e=this.fromOffset(u);t=e.line,n=e.col}let d=this.origin(t,n,o,i);return c=d?new a(e,void 0===d.endLine?d.line:{column:d.column,line:d.line},void 0===d.endLine?d.column:{column:d.endColumn,line:d.endLine},d.source,d.file,r.plugin):new a(e,void 0===o?t:{column:n,line:t},void 0===o?n:{column:i,line:o},this.css,this.file,r.plugin),c.input={column:n,endColumn:i,endLine:o,endOffset:l,line:t,offset:u,source:this.css},this.file&&(s&&(c.input.url=s(this.file).toString()),c.input.file=this.file),c}fromLineAndColumn(e,t){return f(this)[e-1]+t-1}fromOffset(e){let t=f(this),n=0;if(e>=t[t.length-1])n=t.length-1;else{let r,i=t.length-2;for(;n<i;)if(r=n+(i-n>>1),e<t[r])i=r-1;else{if(!(e>=t[r+1])){n=r;break}n=r+1}}return{col:e-t[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:n(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,n,r,i){if(!this.map)return!1;let a,l,u=this.map.consumer(),c=u.originalPositionFor({column:n,line:e});if(!c.source)return!1;"number"==typeof r&&(a=u.originalPositionFor({column:i,line:r})),l=t(c.source)?s(c.source):new URL(c.source,this.map.consumer().sourceRoot||s(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(!o)throw new Error("file: protocol is not available in this PostCSS build");d.file=o(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}}return rv=p,p.default=p,u&&u.registerInput&&u.registerInput(p),rv}function Kv(){if(sv)return ov;sv=1;let e,t,n=Bv();class r extends n{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let r=super.normalize(e);if(t)if("prepend"===n)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 r)e.raws.before=t.raws.before;return r}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},ov=r,r.default=r,n.registerRoot(r),ov}function Hv(){if(lv)return av;lv=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,n){let r=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let n of e)u?u=!1:"\\"===n?u=!0:a?n===l&&(a=!1):'"'===n||"'"===n?(a=!0,l=n):"("===n?s+=1:")"===n?s>0&&(s-=1):0===s&&t.includes(n)&&(o=!0),o?(""!==i&&r.push(i.trim()),i="",o=!1):i+=n;return(n||""!==i)&&r.push(i.trim()),r}};return av=e,e.default=e,av}function Gv(){if(cv)return uv;cv=1;let e=Bv(),t=Hv();class n extends e{get selectors(){return t.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}}return uv=n,n.default=n,e.registerRule(n),uv}function Jv(){if(pv)return fv;pv=1;let{dirname:e,relative:t,resolve:n,sep:r}=Ag,{SourceMapConsumer:i,SourceMapGenerator:o}=Ag,{pathToFileURL:s}=Ag,a=$v(),l=Boolean(i&&o),u=Boolean(e&&n&&t&&r);return fv=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,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,r=this.toUrl(this.path(t.file)),o=t.root||e(t.file);!1===this.mapOpts.sourcesContent?(n=new i(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,r,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&&e.text.startsWith("# 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=o.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new o({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 o({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,n=1,r=1,i="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(o,a,l)=>{if(this.css+=o,a&&"end"!==l&&(s.generated.line=n,s.generated.column=r-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=i,s.original.line=1,s.original.column=0,this.map.addMapping(s))),t=o.match(/\n/g),t?(n+=t.length,e=o.lastIndexOf("\n"),r=o.length-e):r+=o.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=r-2,this.map.addMapping(s)):(s.source=i,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=r-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(r){if(this.mapOpts.absolute)return r;if(60===r.charCodeAt(0))return r;if(/^\w+:\/\//.test(r))return r;let i=this.memoizedPaths.get(r);if(i)return i;let o=this.opts.to?e(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=e(n(o,this.mapOpts.annotation)));let s=t(o,r);return this.memoizedPaths.set(r,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 n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,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;"\\"===r&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},fv}function Yv(){if(yv)return mv;yv=1;let e=qv(),t=Uv(),n=jv(),r=Kv(),i=Gv(),o=function(){if(vv)return gv;vv=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),n="\\".charCodeAt(0),r="/".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),f="{".charCodeAt(0),p="}".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 gv=function(x,C={}){let E,I,O,T,P,A,M,R,_,N,L=x.css.valueOf(),D=C.ignoreErrors,F=L.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=L.charCodeAt(U),E){case i:case o:case a:case l:case s:T=U;do{T+=1,E=L.charCodeAt(T)}while(E===o||E===i||E===a||E===l||E===s);A=["space",L.slice(U,T)],U=T-1;break;case u:case c:case f:case p:case m:case g:case h:{let e=String.fromCharCode(E);A=[e,e,U];break}case d:if(N=j.length?j.pop()[1]:"",_=L.charCodeAt(U+1),"url"===N&&_!==e&&_!==t&&_!==o&&_!==i&&_!==a&&_!==s&&_!==l){T=U;do{if(M=!1,T=L.indexOf(")",T+1),-1===T){if(D||C){T=U;break}q("bracket")}for(R=T;L.charCodeAt(R-1)===n;)R-=1,M=!M}while(M);A=["brackets",L.slice(U,T+1),U,T],U=T}else T=L.indexOf(")",U+1),I=L.slice(U,T+1),-1===T||S.test(I)?A=["(","(",U]:(A=["brackets",I,U,T],U=T);break;case e:case t:P=E===e?"'":'"',T=U;do{if(M=!1,T=L.indexOf(P,T+1),-1===T){if(D||C){T=U+1;break}q("string")}for(R=T;L.charCodeAt(R-1)===n;)R-=1,M=!M}while(M);A=["string",L.slice(U,T+1),U,T],U=T;break;case y:b.lastIndex=U+1,b.test(L),T=0===b.lastIndex?L.length-1:b.lastIndex-2,A=["at-word",L.slice(U,T+1),U,T],U=T;break;case n:for(T=U,O=!0;L.charCodeAt(T+1)===n;)T+=1,O=!O;if(E=L.charCodeAt(T+1),O&&E!==r&&E!==o&&E!==i&&E!==a&&E!==l&&E!==s&&(T+=1,k.test(L.charAt(T)))){for(;k.test(L.charAt(T+1));)T+=1;L.charCodeAt(T+1)===o&&(T+=1)}A=["word",L.slice(U,T+1),U,T],U=T;break;default:E===r&&L.charCodeAt(U+1)===v?(T=L.indexOf("*/",U+2)+1,0===T&&(D||C?T=L.length:q("comment")),A=["comment",L.slice(U,T+1),U,T],U=T):(w.lastIndex=U+1,w.test(L),T=0===w.lastIndex?L.length-1:w.lastIndex-2,A=["word",L.slice(U,T+1),U,T],j.push(A),U=T)}return U++,A},position:function(){return U}}}}();const s={empty:!0,space:!0};return mv=class{constructor(e){this.input=e,this.root=new r,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(t){let n,r,i,o=new e;o.name=t[1].slice(1),""===o.name&&this.unnamedAtrule(o,t),this.init(o,t[2]);let s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(n=(t=this.tokenizer.nextToken())[0],"("===n||"["===n?u.push("("===n?")":"]"):"{"===n&&u.length>0?u.push("}"):n===u[u.length-1]&&u.pop(),0===u.length){if(";"===n){o.source.end=this.getPosition(t[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===n){a=!0;break}if("}"===n){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(t);break}l.push(t)}else l.push(t);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&&(t=l[l.length-1],o.source.end=this.getPosition(t[3]||t[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 n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[o,s]of e.entries()){if(n=s,r=n[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(t){if("word"===t[0]&&"progid"===t[1])continue;return o}this.doubleColon(n)}t=n}return!1}comment(e){let n=new t;this.init(n,e[2]),n.source.end=this.getPosition(e[3]||e[2]),n.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))n.text="",n.raws.left=r,n.raws.right="";else{let e=r.match(/^(\s*)([^]*\S)(\s*)$/);n.text=e[2],n.raws.left=e[1],n.raws.right=e[3]}}createTokenizer(){this.tokenizer=o(this.input)}decl(e,t){let r=new n;this.init(r,e[0][2]);let i,o=e[e.length-1];for(";"===o[0]&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}(e)),r.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;r.prop+=e.shift()[1]}for(r.raws.between="";e.length;){if(i=e.shift(),":"===i[0]){r.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),r.raws.between+=i[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let s,a=[];for(;e.length&&(s=e[0][0],"space"===s||"comment"===s);)a.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(i=e[t],"!important"===i[1].toLowerCase()){r.important=!0;let n=this.stringFrom(e,t);n=this.spacesFromEnd(e)+n," !important"!==n&&(r.raws.important=n);break}if("important"===i[1].toLowerCase()){let n=e.slice(0),i="";for(let e=t;e>0;e--){let t=n[e][0];if(i.trim().startsWith("!")&&"space"!==t)break;i=n.pop()[1]+i}i.trim().startsWith("!")&&(r.important=!0,r.raws.important=i,e=n)}if("space"!==i[0]&&"comment"!==i[0])break}e.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(r.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(r,"value",a.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new i;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 t=this.current.nodes[this.current.nodes.length-1];t&&"rule"===t.type&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="",t.source.end=this.getPosition(e[2]),t.source.end.offset+=t.raws.ownSemicolon.length)}}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,n=null,r=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)i||(i=l),o.push("("===n?")":"]");else if(s&&r&&"{"===n)i||(i=l),o.push("}");else if(0===o.length){if(";"===n){if(r)return void this.decl(a,s);break}if("{"===n)return void this.rule(a);if("}"===n){this.tokenizer.back(a.pop()),t=!0;break}":"===n&&(r=!0)}else n===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&&r){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,n,r){let i,o,a,l,u=n.length,c="",d=!0;for(let e=0;e<u;e+=1)i=n[e],o=i[0],"space"!==o||e!==u-1||r?"comment"===o?(l=n[e-1]?n[e-1][0]:"empty",a=n[e+1]?n[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let r=n.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,value:c}}e[t]=c}rule(e){e.pop();let t=new i;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}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 "+e[0][1],{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})}},mv}function Xv(){if(wv)return bv;wv=1;let e=Bv(),t=$v(),n=Yv();function r(e,r){let i=new t(e,r),o=new n(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&r&&r.from&&(/\.scss$/i.test(r.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(r.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(r.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=r,r.default=r,e.registerParse(r),bv}function Qv(){if(kv)return Sv;kv=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 Sv=e,e.default=e,Sv}function Zv(){if(Cv)return xv;Cv=1;let e=Qv();class t{get content(){return this.css}constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css="",this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new e(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>"warning"===e.type)}}return xv=t,t.default=t,xv}function em(){if(Iv)return Ev;Iv=1;let e={};return Ev=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function tm(){if(Tv)return Ov;Tv=1;let e=Bv(),t=zv(),n=Jv(),r=Xv(),i=Zv(),o=Kv(),s=jg(),{isClean:a,my:l}=Dv(),u=em();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 f(e){return"object"==typeof e&&"function"==typeof e.then}function p(e){let t=!1,n=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,0,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,0,n+"Exit"]:[n,n+"Exit"]}function g(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:p(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function v(e){return e[a]=!1,e.nodes&&e.nodes.forEach(e=>v(e)),e}let m={};class y{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"}constructor(t,n,o){let s;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof y||n instanceof i)s=v(n.root),n.map&&(void 0===o.map&&(o.map={}),o.map.inline||(o.map.inline=!1),o.map.prev=n.map);else{let t=r;o.syntax&&(t=o.syntax.parse),o.parser&&(t=o.parser),t.parse&&(t=t.parse);try{s=t(n,o)}catch(e){this.processed=!0,this.error=e}s&&!s[l]&&e.rebuild(s)}else s=v(n);this.result=new i(t,s,o),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 n=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(n.postcssVersion&&"production"!==process.env.NODE_ENV){let e=n.postcssPlugin,t=n.postcssVersion,r=this.result.processor.version,i=t.split("."),o=r.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=n.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!d[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[n])if("object"==typeof t[n])for(let r in t[n])e(t,"*"===r?n:n+"-"+r.toLowerCase(),t[n][r]);else"function"==typeof t[n]&&e(t,n,t[n])}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],n=this.runOnRoot(t);if(f(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[a];){e[a]=!0;let t=[g(e)];for(;t.length>0;){let e=this.visitTick(t);if(f(e))try{await e}catch(e){let n=t[t.length-1].node;throw this.handleError(e,n)}}}if(this.listeners.OnceExit)for(let[t,n]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map(e=>n(e,this.helpers));await Promise.all(t)}else await n(e,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 f(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=s;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let r=new n(t,this.result.root,this.result.opts).generate();return this.result.css=r[0],this.result.map=r[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(f(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[a];)e[a]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||u("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[n,r]of e){let e;this.result.lastPlugin=n;try{e=r(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(f(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:n,visitors:r}=t;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=n.nodes[n.indexes[i]];)if(n.indexes[i]+=1,!r[a])return r[a]=!0,void e.push(g(r));t.iterator=0,delete n.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(n.nodes&&n.nodes.length&&(n[a]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[a]=!0;let t=p(e);for(let n of t)if(0===n)e.nodes&&e.each(e=>{e[a]||this.walkSync(e)});else{let t=this.listeners[n];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}}return y.registerPostcss=e=>{m=e},Ov=y,y.default=y,o.registerLazyResult(y),t.registerLazyResult(y),Ov}function nm(){if(Rv)return Mv;Rv=1;let e=zv(),t=tm(),n=function(){if(Av)return Pv;Av=1;let e=Jv(),t=Xv();const n=Zv();let r=jg(),i=em();class o{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,n=t;try{e=n(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"}constructor(t,i,o){let s;i=i.toString(),this.stringified=!1,this._processor=t,this._css=i,this._opts=o,this._map=void 0;let a=r;this.result=new n(this._processor,s,this._opts),this.result.css=i;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,i);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||i("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[]}}return Pv=o,o.default=o,Pv}(),r=Kv();class i{constructor(e=[]){this.version="8.5.6",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else{if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" 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(e,r={}){return this.plugins.length||r.parser||r.stringifier||r.syntax?new t(this,e,r):new n(this,e,r)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return Mv=i,i.default=i,r.registerProcessor(i),e.registerProcessor(i),Mv}const rm=Eg(function(){if(Nv)return _v;Nv=1;let e=qv(),t=Uv(),n=Bv(),r=Fg(),i=jv(),o=zv(),s=function(){if(hv)return dv;hv=1;let e=qv(),t=Uv(),n=jv(),r=$v(),i=Vv(),o=Kv(),s=Gv();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 t={...e,__proto__:r.prototype};t.map&&(t.map={...t.map,__proto__:i.prototype}),u.push(t)}}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 n(d);if("rule"===d.type)return new s(d);if("comment"===d.type)return new t(d);if("atrule"===d.type)return new e(d);throw new Error("Unknown node type: "+l.type)}return dv=a,a.default=a,dv}(),a=$v(),l=tm(),u=Hv(),c=Fv(),d=Xv(),h=nm(),f=Zv(),p=Kv(),g=Gv(),v=jg(),m=Qv();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new h(e)}return y.plugin=function(e,t){let n,r=!1;function i(...n){console&&console.warn&&!r&&(r=!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 i=t(...n);return i.postcssPlugin=e,i.postcssVersion=(new h).version,i}return Object.defineProperty(i,"postcss",{get:()=>(n||(n=i()),n)}),i.process=function(e,t,n){return y([i(n)]).process(e,t)},i},y.stringify=v,y.parse=d,y.fromJSON=s,y.list=u,y.comment=e=>new t(e),y.atRule=t=>new e(t),y.decl=e=>new i(e),y.rule=e=>new g(e),y.root=e=>new p(e),y.document=e=>new o(e),y.CssSyntaxError=r,y.Declaration=i,y.Container=n,y.Processor=h,y.Document=o,y.Comment=t,y.Warning=m,y.AtRule=e,y.Result=f,y.Input=a,y.Rule=g,y.Root=p,y.Node=c,l.registerPostcss(y),_v=y,y.default=y,_v}());rm.stringify,rm.fromJSON,rm.plugin,rm.parse,rm.list,rm.document,rm.comment,rm.atRule,rm.rule,rm.decl,rm.root,rm.CssSyntaxError,rm.Declaration,rm.Container,rm.Processor,rm.Document,rm.Comment,rm.Warning,rm.AtRule,rm.Result,rm.Input,rm.Rule,rm.Root,rm.Node;var im=Object.defineProperty,om=(e,t,n)=>((e,t,n)=>t in e?im(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);function sm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function am(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var lm,um={exports:{}};function cm(){if(lm)return um.exports;lm=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,blackBright:e,redBright:e,greenBright:e,yellowBright:e,blueBright:e,magentaBright:e,cyanBright:e,whiteBright:e,bgBlackBright:e,bgRedBright:e,bgGreenBright:e,bgYellowBright:e,bgBlueBright:e,bgMagentaBright:e,bgCyanBright:e,bgWhiteBright:e}};return um.exports=t(),um.exports.createColors=t,um.exports}const dm=am(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var hm,fm,pm,gm,vm,mm;function ym(){if(fm)return hm;fm=1;let e=cm(),t=dm;class n extends Error{constructor(e,t,r,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!==r&&("number"==typeof t?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}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(n){if(!this.source)return"";let r=this.source;null==n&&(n=e.isColorSupported);let i=e=>e,o=e=>e,s=e=>e;if(n){let{bold:n,gray:r,red:a}=e.createColors(!0);o=e=>n(a(e)),i=e=>r(e),t&&(s=e=>t(e))}let a=r.split(/\r?\n/),l=Math.max(this.line-3,0),u=Math.min(this.line+2,a.length),c=String(u).length;return a.slice(l,u).map((e,t)=>{let n=l+1+t,r=" "+(" "+n).slice(-c)+" | ";if(n===this.line){if(e.length>160){let t=20,n=Math.max(0,this.column-t),a=Math.max(this.column+t,this.endColumn+t),l=e.slice(n,a),u=i(r.replace(/\d/g," "))+e.slice(0,Math.min(this.column-1,t-1)).replace(/[^\t]/g," ");return o(">")+i(r)+s(l)+"\n "+u+o("^")}let t=i(r.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return o(">")+i(r)+s(e)+"\n "+t+o("^")}return" "+i(r)+s(e)}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return hm=n,n.default=n,hm}function bm(){if(gm)return pm;gm=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 n="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:r&&(n+=" "),e.nodes)this.block(e,n+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,e)}}beforeAfter(e,t){let n;n="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 r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)n+=t}return n}block(e,t){let n,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==r||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),r=e.prop+n+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],void 0!==i))return i;let o=t.parent;if("before"===r){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[r];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[r])return s.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(t,r);{let e="raw"+((a=r)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[n],void 0!==i)return!1})}var a;return void 0===i&&(i=e[r]),s.rawCache[r]=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 n;return e.walkComments(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}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(n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.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(n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==n.raws.before){let e=n.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 n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}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 pm=t,t.default=t,pm}function wm(){if(mm)return vm;mm=1;let e=bm();function t(t,n){new e(n).stringify(t)}return vm=t,t.default=t,vm}var Sm,km,xm,Cm,Em,Im,Om,Tm,Pm,Am,Mm,Rm,_m,Nm,Lm,Dm,Fm,Um,jm,Bm,qm,zm,Wm,Vm,$m,Km,Hm,Gm,Jm,Ym,Xm,Qm,Zm,ey,ty,ny,ry,iy,oy,sy,ay,ly,uy,cy,dy,hy,fy,py,gy,vy={};function my(){return Sm||(Sm=1,vy.isClean=Symbol("isClean"),vy.my=Symbol("my")),vy}function yy(){if(xm)return km;xm=1;let e=ym(),t=bm(),n=wm(),{isClean:r,my:i}=my();function o(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],s=typeof i;"parent"===r&&"object"===s?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>o(e,n)):("object"===s&&null!==i&&(i=o(i)),n[r]=i)}return n}function s(e,t){if(t&&void 0!==t.offset)return t.offset;let n=1,r=1,i=0;for(let o=0;o<e.length;o++){if(r===t.line&&n===t.column){i=o;break}"\n"===e[o]?(n=1,r+=1):n+=1}return i}class a{get proxyOf(){return this}constructor(e={}){this.raws={},this[r]=!1,this[i]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let n of e[t])"function"==typeof n.clone?this.append(n.clone()):this.append(n)}else this[t]=e[t]}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 n in e)t[n]=e[n];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(t,n={}){if(this.source){let{end:e,start:r}=this.rangeBy(n);return this.source.input.error(t,{column:r.column,line:r.line},{column:e.column,line:e.line},n)}return new e(t)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markClean(){this[r]=!0}markDirty(){if(this[r]){this[r]=!1;let e=this;for(;e=e.parent;)e[r]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e={}){let t=this.source.start;if(e.index)t=this.positionInside(e.index);else if(e.word){let n="document"in this.source.input?this.source.input.document:this.source.input.css,r=n.slice(s(n,this.source.start),s(n,this.source.end)).indexOf(e.word);-1!==r&&(t=this.positionInside(r))}return t}positionInside(e){let t=this.source.start.column,n=this.source.start.line,r="document"in this.source.input?this.source.input.document:this.source.input.css,i=s(r,this.source.start),o=i+e;for(let e=i;e<o;e++)"\n"===r[e]?(t=1,n+=1):t+=1;return{column:t,line:n,offset:o}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e={}){let t="document"in this.source.input?this.source.input.document:this.source.input.css,n={column:this.source.start.column,line:this.source.start.line,offset:s(t,this.source.start)},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line,offset:"number"==typeof this.source.end.offset?this.source.end.offset:s(t,this.source.end)+1}:{column:n.column+1,line:n.line,offset:n.offset+1};if(e.word){let i=t.slice(s(t,this.source.start),s(t,this.source.end)).indexOf(e.word);-1!==i&&(n=this.positionInside(i),r=this.positionInside(i+e.word.length))}else e.start?n={column:e.start.column,line:e.start.line,offset:s(t,e.start)}:e.index&&(n=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line,offset:s(t,e.end)}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<n.line||r.line===n.line&&r.column<=n.column)&&(r={column:n.column+1,line:n.line,offset:n.offset+1}),{end:r,start:n}}raw(e,n){return(new t).raw(this,e,n)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},r=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 r=this[e];if(Array.isArray(r))n[e]=r.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof r&&r.toJSON)n[e]=r.toJSON(null,t);else if("source"===e){if(null==r)continue;let o=t.get(r.input);null==o&&(o=i,t.set(r.input,i),i++),n[e]={end:r.end,inputId:o,start:r.start}}else n[e]=r}return r&&(n.inputs=[...t.keys()].map(e=>e.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=n){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,n={}){let r={node:this};for(let e in n)r[e]=n[e];return e.warn(t,r)}}return km=a,a.default=a,km}function by(){if(Em)return Cm;Em=1;let e=yy();class t extends e{constructor(e){super(e),this.type="comment"}}return Cm=t,t.default=t,Cm}function wy(){if(Om)return Im;Om=1;let e=yy();class t extends e{get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}}return Im=t,t.default=t,Im}function Sy(){if(Pm)return Tm;Pm=1;let e,t,n,r,i=by(),o=wy(),s=yy(),{isClean:a,my:l}=my();function u(e){return e.map(e=>(e.nodes&&(e.nodes=u(e.nodes)),delete e.source,e))}function c(e){if(e[a]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class d extends s{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]}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,n,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[r]+=1;return delete this.indexes[r],n}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")?(...n)=>e[t](...n.map(e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e)):"every"===t||"some"===t?n=>e[t]((e,...t)=>n(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,n)=>(e[t]===n||(e[t]=n,"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 n,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)n=this.indexes[e],r<n&&(this.indexes[e]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of o)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)n=this.indexes[e],r<=n&&(this.indexes[e]=n+o.length);return this.markDirty(),this}normalize(n,s){if("string"==typeof n)n=u(t(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 o(n)]}else if(n.selector||n.selectors)n=[new r(n)];else if(n.name)n=[new e(n)];else{if(!n.text)throw new Error("Unknown node type in node creation");n=[new i(n)]}return n.map(e=>(e[l]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[a]&&c(e),e.raws||(e.raws={}),void 0===e.raws.before&&s&&void 0!==s.raws.before&&(e.raws.before=s.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 n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,n)=>{let r;try{r=e(t,n)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("atrule"===n.type&&e.test(n.name))return t(n,r)}):this.walk((n,r)=>{if("atrule"===n.type&&n.name===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("atrule"===e.type)return t(e,n)}))}walkComments(e){return this.walk((t,n)=>{if("comment"===t.type)return e(t,n)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("decl"===n.type&&e.test(n.prop))return t(n,r)}):this.walk((n,r)=>{if("decl"===n.type&&n.prop===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("decl"===e.type)return t(e,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("rule"===n.type&&e.test(n.selector))return t(n,r)}):this.walk((n,r)=>{if("rule"===n.type&&n.selector===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("rule"===e.type)return t(e,n)}))}}return d.registerParse=e=>{t=e},d.registerRule=e=>{r=e},d.registerAtRule=t=>{e=t},d.registerRoot=e=>{n=e},Tm=d,d.default=d,d.rebuild=t=>{"atrule"===t.type?Object.setPrototypeOf(t,e.prototype):"rule"===t.type?Object.setPrototypeOf(t,r.prototype):"decl"===t.type?Object.setPrototypeOf(t,o.prototype):"comment"===t.type?Object.setPrototypeOf(t,i.prototype):"root"===t.type&&Object.setPrototypeOf(t,n.prototype),t[l]=!0,t.nodes&&t.nodes.forEach(e=>{d.rebuild(e)})},Tm}function ky(){if(Mm)return Am;Mm=1;let e=Sy();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 Am=t,t.default=t,e.registerAtRule(t),Am}function xy(){if(_m)return Rm;_m=1;let e,t,n=Sy();class r extends n{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},Rm=r,r.default=r,Rm}function Cy(){if(Lm)return Nm;Lm=1;return Nm={nanoid:(e=21)=>{let t="",n=0|e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",i=0|n;for(;i--;)r+=e[Math.random()*e.length|0];return r}},Nm}function Ey(){if(Fm)return Dm;Fm=1;let{existsSync:e,readFileSync:t}=dm,{dirname:n,join:r}=dm,{SourceMapConsumer:i,SourceMapGenerator:o}=dm;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,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=n(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new i(this.text)),this.consumerCache}decodeInline(e){let t=e.match(/^data:application\/json;charset=utf-?8,/)||e.match(/^data:application\/json,/);if(t)return decodeURIComponent(e.substr(t[0].length));let n=e.match(/^data:application\/json;charset=utf-?8;base64,/)||e.match(/^data:application\/json;base64,/);if(n)return r=e.substr(n[0].length),Buffer?Buffer.from(r,"base64").toString():window.atob(r);var r;let i=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+i)}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=/g);if(!t)return;let n=e.lastIndexOf(t.pop()),r=e.indexOf("*/",n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(r){if(this.root=n(r),e(r))return this.mapFile=r,t(r,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof i)return o.fromSourceMap(t).toString();if(t instanceof o)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let n=t(e);if(n){let e=this.loadFile(n);if(!e)throw new Error("Unable to load previous source map: "+n.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=r(n(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return Dm=s,s.default=s,Dm}function Iy(){if(jm)return Um;jm=1;let{nanoid:e}=Cy(),{isAbsolute:t,resolve:n}=dm,{SourceMapConsumer:r,SourceMapGenerator:i}=dm,{fileURLToPath:o,pathToFileURL:s}=dm,a=ym(),l=Ey(),u=dm,c=Symbol("lineToIndexCache"),d=Boolean(r&&i),h=Boolean(n&&t);function f(e){if(e[c])return e[c];let t=e.css.split("\n"),n=new Array(t.length),r=0;for(let e=0,i=t.length;e<i;e++)n[e]=r,r+=t[e].length+1;return e[c]=n,n}class p{get from(){return this.file||this.id}constructor(r,i={}){if(null==r||"object"==typeof r&&!r.toString)throw new Error(`PostCSS received ${r} instead of CSS string`);if(this.css=r.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,i.document&&(this.document=i.document.toString()),i.from&&(!h||/^\w+:\/\//.test(i.from)||t(i.from)?this.file=i.from:this.file=n(i.from)),h&&d){let e=new l(this.css,i);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 "+e(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let i,o,l,u,c;if(t&&"object"==typeof t){let e=t,r=n;if("number"==typeof e.offset){u=e.offset;let r=this.fromOffset(u);t=r.line,n=r.col}else t=e.line,n=e.column,u=this.fromLineAndColumn(t,n);if("number"==typeof r.offset){l=r.offset;let e=this.fromOffset(l);o=e.line,i=e.col}else o=r.line,i=r.column,l=this.fromLineAndColumn(r.line,r.column)}else if(n)u=this.fromLineAndColumn(t,n);else{u=t;let e=this.fromOffset(u);t=e.line,n=e.col}let d=this.origin(t,n,o,i);return c=d?new a(e,void 0===d.endLine?d.line:{column:d.column,line:d.line},void 0===d.endLine?d.column:{column:d.endColumn,line:d.endLine},d.source,d.file,r.plugin):new a(e,void 0===o?t:{column:n,line:t},void 0===o?n:{column:i,line:o},this.css,this.file,r.plugin),c.input={column:n,endColumn:i,endLine:o,endOffset:l,line:t,offset:u,source:this.css},this.file&&(s&&(c.input.url=s(this.file).toString()),c.input.file=this.file),c}fromLineAndColumn(e,t){return f(this)[e-1]+t-1}fromOffset(e){let t=f(this),n=0;if(e>=t[t.length-1])n=t.length-1;else{let r,i=t.length-2;for(;n<i;)if(r=n+(i-n>>1),e<t[r])i=r-1;else{if(!(e>=t[r+1])){n=r;break}n=r+1}}return{col:e-t[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:n(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,n,r,i){if(!this.map)return!1;let a,l,u=this.map.consumer(),c=u.originalPositionFor({column:n,line:e});if(!c.source)return!1;"number"==typeof r&&(a=u.originalPositionFor({column:i,line:r})),l=t(c.source)?s(c.source):new URL(c.source,this.map.consumer().sourceRoot||s(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(!o)throw new Error("file: protocol is not available in this PostCSS build");d.file=o(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}}return Um=p,p.default=p,u&&u.registerInput&&u.registerInput(p),Um}function Oy(){if(qm)return Bm;qm=1;let e,t,n=Sy();class r extends n{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let r=super.normalize(e);if(t)if("prepend"===n)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 r)e.raws.before=t.raws.before;return r}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},Bm=r,r.default=r,n.registerRoot(r),Bm}function Ty(){if(Wm)return zm;Wm=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,n){let r=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let n of e)u?u=!1:"\\"===n?u=!0:a?n===l&&(a=!1):'"'===n||"'"===n?(a=!0,l=n):"("===n?s+=1:")"===n?s>0&&(s-=1):0===s&&t.includes(n)&&(o=!0),o?(""!==i&&r.push(i.trim()),i="",o=!1):i+=n;return(n||""!==i)&&r.push(i.trim()),r}};return zm=e,e.default=e,zm}function Py(){if($m)return Vm;$m=1;let e=Sy(),t=Ty();class n extends e{get selectors(){return t.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}}return Vm=n,n.default=n,e.registerRule(n),Vm}function Ay(){if(Jm)return Gm;Jm=1;let{dirname:e,relative:t,resolve:n,sep:r}=dm,{SourceMapConsumer:i,SourceMapGenerator:o}=dm,{pathToFileURL:s}=dm,a=Iy(),l=Boolean(i&&o),u=Boolean(e&&n&&t&&r);return Gm=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,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,r=this.toUrl(this.path(t.file)),o=t.root||e(t.file);!1===this.mapOpts.sourcesContent?(n=new i(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,r,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&&e.text.startsWith("# 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=o.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new o({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 o({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,n=1,r=1,i="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(o,a,l)=>{if(this.css+=o,a&&"end"!==l&&(s.generated.line=n,s.generated.column=r-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=i,s.original.line=1,s.original.column=0,this.map.addMapping(s))),t=o.match(/\n/g),t?(n+=t.length,e=o.lastIndexOf("\n"),r=o.length-e):r+=o.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=r-2,this.map.addMapping(s)):(s.source=i,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=r-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(r){if(this.mapOpts.absolute)return r;if(60===r.charCodeAt(0))return r;if(/^\w+:\/\//.test(r))return r;let i=this.memoizedPaths.get(r);if(i)return i;let o=this.opts.to?e(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=e(n(o,this.mapOpts.annotation)));let s=t(o,r);return this.memoizedPaths.set(r,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 n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,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;"\\"===r&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},Gm}function My(){if(Zm)return Qm;Zm=1;let e=ky(),t=by(),n=wy(),r=Oy(),i=Py(),o=function(){if(Xm)return Ym;Xm=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),n="\\".charCodeAt(0),r="/".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),f="{".charCodeAt(0),p="}".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 Ym=function(x,C={}){let E,I,O,T,P,A,M,R,_,N,L=x.css.valueOf(),D=C.ignoreErrors,F=L.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=L.charCodeAt(U),E){case i:case o:case a:case l:case s:T=U;do{T+=1,E=L.charCodeAt(T)}while(E===o||E===i||E===a||E===l||E===s);A=["space",L.slice(U,T)],U=T-1;break;case u:case c:case f:case p:case m:case g:case h:{let e=String.fromCharCode(E);A=[e,e,U];break}case d:if(N=j.length?j.pop()[1]:"",_=L.charCodeAt(U+1),"url"===N&&_!==e&&_!==t&&_!==o&&_!==i&&_!==a&&_!==s&&_!==l){T=U;do{if(M=!1,T=L.indexOf(")",T+1),-1===T){if(D||C){T=U;break}q("bracket")}for(R=T;L.charCodeAt(R-1)===n;)R-=1,M=!M}while(M);A=["brackets",L.slice(U,T+1),U,T],U=T}else T=L.indexOf(")",U+1),I=L.slice(U,T+1),-1===T||S.test(I)?A=["(","(",U]:(A=["brackets",I,U,T],U=T);break;case e:case t:P=E===e?"'":'"',T=U;do{if(M=!1,T=L.indexOf(P,T+1),-1===T){if(D||C){T=U+1;break}q("string")}for(R=T;L.charCodeAt(R-1)===n;)R-=1,M=!M}while(M);A=["string",L.slice(U,T+1),U,T],U=T;break;case y:b.lastIndex=U+1,b.test(L),T=0===b.lastIndex?L.length-1:b.lastIndex-2,A=["at-word",L.slice(U,T+1),U,T],U=T;break;case n:for(T=U,O=!0;L.charCodeAt(T+1)===n;)T+=1,O=!O;if(E=L.charCodeAt(T+1),O&&E!==r&&E!==o&&E!==i&&E!==a&&E!==l&&E!==s&&(T+=1,k.test(L.charAt(T)))){for(;k.test(L.charAt(T+1));)T+=1;L.charCodeAt(T+1)===o&&(T+=1)}A=["word",L.slice(U,T+1),U,T],U=T;break;default:E===r&&L.charCodeAt(U+1)===v?(T=L.indexOf("*/",U+2)+1,0===T&&(D||C?T=L.length:q("comment")),A=["comment",L.slice(U,T+1),U,T],U=T):(w.lastIndex=U+1,w.test(L),T=0===w.lastIndex?L.length-1:w.lastIndex-2,A=["word",L.slice(U,T+1),U,T],j.push(A),U=T)}return U++,A},position:function(){return U}}}}();const s={empty:!0,space:!0};return Qm=class{constructor(e){this.input=e,this.root=new r,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(t){let n,r,i,o=new e;o.name=t[1].slice(1),""===o.name&&this.unnamedAtrule(o,t),this.init(o,t[2]);let s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(n=(t=this.tokenizer.nextToken())[0],"("===n||"["===n?u.push("("===n?")":"]"):"{"===n&&u.length>0?u.push("}"):n===u[u.length-1]&&u.pop(),0===u.length){if(";"===n){o.source.end=this.getPosition(t[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===n){a=!0;break}if("}"===n){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(t);break}l.push(t)}else l.push(t);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&&(t=l[l.length-1],o.source.end=this.getPosition(t[3]||t[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 n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[o,s]of e.entries()){if(n=s,r=n[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(t){if("word"===t[0]&&"progid"===t[1])continue;return o}this.doubleColon(n)}t=n}return!1}comment(e){let n=new t;this.init(n,e[2]),n.source.end=this.getPosition(e[3]||e[2]),n.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))n.text="",n.raws.left=r,n.raws.right="";else{let e=r.match(/^(\s*)([^]*\S)(\s*)$/);n.text=e[2],n.raws.left=e[1],n.raws.right=e[3]}}createTokenizer(){this.tokenizer=o(this.input)}decl(e,t){let r=new n;this.init(r,e[0][2]);let i,o=e[e.length-1];for(";"===o[0]&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}(e)),r.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;r.prop+=e.shift()[1]}for(r.raws.between="";e.length;){if(i=e.shift(),":"===i[0]){r.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),r.raws.between+=i[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let s,a=[];for(;e.length&&(s=e[0][0],"space"===s||"comment"===s);)a.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(i=e[t],"!important"===i[1].toLowerCase()){r.important=!0;let n=this.stringFrom(e,t);n=this.spacesFromEnd(e)+n," !important"!==n&&(r.raws.important=n);break}if("important"===i[1].toLowerCase()){let n=e.slice(0),i="";for(let e=t;e>0;e--){let t=n[e][0];if(i.trim().startsWith("!")&&"space"!==t)break;i=n.pop()[1]+i}i.trim().startsWith("!")&&(r.important=!0,r.raws.important=i,e=n)}if("space"!==i[0]&&"comment"!==i[0])break}e.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(r.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(r,"value",a.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new i;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 t=this.current.nodes[this.current.nodes.length-1];t&&"rule"===t.type&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="",t.source.end=this.getPosition(e[2]),t.source.end.offset+=t.raws.ownSemicolon.length)}}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,n=null,r=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)i||(i=l),o.push("("===n?")":"]");else if(s&&r&&"{"===n)i||(i=l),o.push("}");else if(0===o.length){if(";"===n){if(r)return void this.decl(a,s);break}if("{"===n)return void this.rule(a);if("}"===n){this.tokenizer.back(a.pop()),t=!0;break}":"===n&&(r=!0)}else n===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&&r){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,n,r){let i,o,a,l,u=n.length,c="",d=!0;for(let e=0;e<u;e+=1)i=n[e],o=i[0],"space"!==o||e!==u-1||r?"comment"===o?(l=n[e-1]?n[e-1][0]:"empty",a=n[e+1]?n[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let r=n.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,value:c}}e[t]=c}rule(e){e.pop();let t=new i;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}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 "+e[0][1],{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})}},Qm}function Ry(){if(ty)return ey;ty=1;let e=Sy(),t=Iy(),n=My();function r(e,r){let i=new t(e,r),o=new n(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&r&&r.from&&(/\.scss$/i.test(r.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(r.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(r.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 ey=r,r.default=r,e.registerParse(r),ey}function _y(){if(ry)return ny;ry=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 ny=e,e.default=e,ny}function Ny(){if(oy)return iy;oy=1;let e=_y();class t{get content(){return this.css}constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css="",this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new e(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>"warning"===e.type)}}return iy=t,t.default=t,iy}function Ly(){if(ay)return sy;ay=1;let e={};return sy=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function Dy(){if(uy)return ly;uy=1;let e=Sy(),t=xy(),n=Ay(),r=Ry(),i=Ny(),o=Oy(),s=wm(),{isClean:a,my:l}=my(),u=Ly();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 f(e){return"object"==typeof e&&"function"==typeof e.then}function p(e){let t=!1,n=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,0,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,0,n+"Exit"]:[n,n+"Exit"]}function g(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:p(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function v(e){return e[a]=!1,e.nodes&&e.nodes.forEach(e=>v(e)),e}let m={};class y{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"}constructor(t,n,o){let s;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof y||n instanceof i)s=v(n.root),n.map&&(void 0===o.map&&(o.map={}),o.map.inline||(o.map.inline=!1),o.map.prev=n.map);else{let t=r;o.syntax&&(t=o.syntax.parse),o.parser&&(t=o.parser),t.parse&&(t=t.parse);try{s=t(n,o)}catch(e){this.processed=!0,this.error=e}s&&!s[l]&&e.rebuild(s)}else s=v(n);this.result=new i(t,s,o),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 n=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(n.postcssVersion&&"production"!==process.env.NODE_ENV){let e=n.postcssPlugin,t=n.postcssVersion,r=this.result.processor.version,i=t.split("."),o=r.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=n.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!d[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[n])if("object"==typeof t[n])for(let r in t[n])e(t,"*"===r?n:n+"-"+r.toLowerCase(),t[n][r]);else"function"==typeof t[n]&&e(t,n,t[n])}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],n=this.runOnRoot(t);if(f(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[a];){e[a]=!0;let t=[g(e)];for(;t.length>0;){let e=this.visitTick(t);if(f(e))try{await e}catch(e){let n=t[t.length-1].node;throw this.handleError(e,n)}}}if(this.listeners.OnceExit)for(let[t,n]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map(e=>n(e,this.helpers));await Promise.all(t)}else await n(e,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 f(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=s;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let r=new n(t,this.result.root,this.result.opts).generate();return this.result.css=r[0],this.result.map=r[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(f(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[a];)e[a]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||u("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[n,r]of e){let e;this.result.lastPlugin=n;try{e=r(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(f(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:n,visitors:r}=t;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=n.nodes[n.indexes[i]];)if(n.indexes[i]+=1,!r[a])return r[a]=!0,void e.push(g(r));t.iterator=0,delete n.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(n.nodes&&n.nodes.length&&(n[a]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[a]=!0;let t=p(e);for(let n of t)if(0===n)e.nodes&&e.each(e=>{e[a]||this.walkSync(e)});else{let t=this.listeners[n];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}}return y.registerPostcss=e=>{m=e},ly=y,y.default=y,o.registerLazyResult(y),t.registerLazyResult(y),ly}function Fy(){if(fy)return hy;fy=1;let e=xy(),t=Dy(),n=function(){if(dy)return cy;dy=1;let e=Ay(),t=Ry();const n=Ny();let r=wm(),i=Ly();class o{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,n=t;try{e=n(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"}constructor(t,i,o){let s;i=i.toString(),this.stringified=!1,this._processor=t,this._css=i,this._opts=o,this._map=void 0;let a=r;this.result=new n(this._processor,s,this._opts),this.result.css=i;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,i);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||i("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[]}}return cy=o,o.default=o,cy}(),r=Oy();class i{constructor(e=[]){this.version="8.5.6",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else{if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" 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(e,r={}){return this.plugins.length||r.parser||r.stringifier||r.syntax?new t(this,e,r):new n(this,e,r)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return hy=i,i.default=i,r.registerProcessor(i),e.registerProcessor(i),hy}const Uy=sm(function(){if(gy)return py;gy=1;let e=ky(),t=by(),n=Sy(),r=ym(),i=wy(),o=xy(),s=function(){if(Hm)return Km;Hm=1;let e=ky(),t=by(),n=wy(),r=Iy(),i=Ey(),o=Oy(),s=Py();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 t={...e,__proto__:r.prototype};t.map&&(t.map={...t.map,__proto__:i.prototype}),u.push(t)}}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 n(d);if("rule"===d.type)return new s(d);if("comment"===d.type)return new t(d);if("atrule"===d.type)return new e(d);throw new Error("Unknown node type: "+l.type)}return Km=a,a.default=a,Km}(),a=Iy(),l=Dy(),u=Ty(),c=yy(),d=Ry(),h=Fy(),f=Ny(),p=Oy(),g=Py(),v=wm(),m=_y();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new h(e)}return y.plugin=function(e,t){let n,r=!1;function i(...n){console&&console.warn&&!r&&(r=!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 i=t(...n);return i.postcssPlugin=e,i.postcssVersion=(new h).version,i}return Object.defineProperty(i,"postcss",{get:()=>(n||(n=i()),n)}),i.process=function(e,t,n){return y([i(n)]).process(e,t)},i},y.stringify=v,y.parse=d,y.fromJSON=s,y.list=u,y.comment=e=>new t(e),y.atRule=t=>new e(t),y.decl=e=>new i(e),y.rule=e=>new g(e),y.root=e=>new p(e),y.document=e=>new o(e),y.CssSyntaxError=r,y.Declaration=i,y.Container=n,y.Processor=h,y.Document=o,y.Comment=t,y.Warning=m,y.AtRule=e,y.Result=f,y.Input=a,y.Rule=g,y.Root=p,y.Node=c,l.registerPostcss(y),py=y,y.default=y,py}());Uy.stringify,Uy.fromJSON,Uy.plugin,Uy.parse,Uy.list,Uy.document,Uy.comment,Uy.atRule,Uy.rule,Uy.decl,Uy.root,Uy.CssSyntaxError,Uy.Declaration,Uy.Container,Uy.Processor,Uy.Document,Uy.Comment,Uy.Warning,Uy.AtRule,Uy.Result,Uy.Input,Uy.Rule,Uy.Root,Uy.Node;class jy{constructor(...e){om(this,"parentElement",null),om(this,"parentNode",null),om(this,"ownerDocument"),om(this,"firstChild",null),om(this,"lastChild",null),om(this,"previousSibling",null),om(this,"nextSibling",null),om(this,"ELEMENT_NODE",1),om(this,"TEXT_NODE",3),om(this,"nodeType"),om(this,"nodeName"),om(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 jy))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 By={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},qy={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},zy={};function Wy(e){if(zy[e])return zy[e];const t=function(e){var t,n;const r=null==(n=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:n.call(t,e);return r&&globalThis[r]?globalThis[r]:void 0}(e)||globalThis[e],n=t.prototype,r=e in By?By[e]:void 0,i=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),o=e in qy?qy[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return zy[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(r),o?zy[e]=o:n}catch{return n}}const Vy={};function $y(e,t,n){var r;const i=`${e}.${String(n)}`;if(Vy[i])return Vy[i].call(t);const o=Wy(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(Vy[i]=s,s.call(t)):t[n]}const Ky={};function Hy(e,t,n){const r=`${e}.${String(n)}`;if(Ky[r])return Ky[r].bind(t);const i=Wy(e)[n];return"function"!=typeof i?t[n]:(Ky[r]=i,i.bind(t))}const Gy={childNodes:function(e){return $y("Node",e,"childNodes")},parentNode:function(e){return $y("Node",e,"parentNode")},parentElement:function(e){return $y("Node",e,"parentElement")},textContent:function(e){return $y("Node",e,"textContent")},contains:function(e,t){return Hy("Node",e,"contains")(t)},getRootNode:function(e){return Hy("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?$y("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?$y("Element",e,"shadowRoot"):null},querySelector:function(e,t){return $y("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return $y("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return Wy("MutationObserver").constructor}};const Jy="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 Yy={map:{},getId:()=>(console.error(Jy),-1),getNode:()=>(console.error(Jy),null),removeNodeFromMap(){console.error(Jy)},has:()=>(console.error(Jy),!1),reset(){console.error(Jy)}};"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Yy=new Proxy(Yy,{get:(e,t,n)=>("map"===t&&console.error(Jy),Reflect.get(e,t,n))}));let Xy=Date.now;function Qy(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:Gy.parentElement(e)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Xy=()=>(new Date).getTime());function Zy(e){var t;let n=null;return"getRootNode"in e&&(null==(t=Gy.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Gy.host(Gy.getRootNode(e))&&(n=Gy.host(Gy.getRootNode(e))),n}function eb(e){let t,n=e;for(;t=Zy(n);)n=t;return n}function tb(e){const t=e.ownerDocument;if(!t)return!1;const n=eb(e);return Gy.contains(t,n)}const nb=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:class{constructor(){dg(this,"id",1),dg(this,"styleIDMap",new WeakMap),dg(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 n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}},get _mirror(){return Yy},closestElementOfNode:Qy,getBaseDimension:function e(t,n){var r,i;const o=null==(i=null==(r=t.ownerDocument)?void 0:r.defaultView)?void 0:i.frameElement;if(!o||o===n)return{x:0,y:0,relativeScale:1,absoluteScale:1};const s=o.getBoundingClientRect(),a=e(o,n),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,n){const r=t[n[0]];return 1===n.length?r:e(r.cssRules[n[1]].cssRules,n.slice(2))},getPositionsAndIndex:function(e){const t=[...e],n=t.pop();return{positions:t,index:n}},getRootShadowHost:eb,getShadowHost:Zy,getWindowHeight:function(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight},getWindowScroll:function(e){var t,n,r,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=Gy.parentElement(o.body))?void 0:t.scrollLeft)||(null==(n=null==o?void 0:o.body)?void 0:n.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==(r=Gy.parentElement(o.body))?void 0:r.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 jy&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Gy.shadowRoot(e)))},hookSetter:function e(t,n,r,i,o=window){const s=o.Object.getOwnPropertyDescriptor(t,n);return o.Object.defineProperty(t,n,i?r:{set(e){setTimeout(()=>{r.set.call(this,e)},0),s&&s.set&&s.set.call(this,e)}}),()=>e(t,n,s||{},!0)},inDom:function(e){const t=e.ownerDocument;return!!t&&(Gy.contains(t,e)||tb(e))},isAncestorRemoved:function e(t,n){if(function(e){const t=e&&"host"in e&&"mode"in e&&kg.host(e)||null;return Boolean(t&&"shadowRoot"in t&&kg.shadowRoot(t)===e)}(t))return!1;const r=n.getId(t);if(!n.has(r))return!0;const i=Gy.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||e(i,n))},isBlocked:function(e,t,n,r){if(!e)return!1;const i=Qy(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(Cg(i,t,r))return!0}catch(e){}if(n){if(i.matches(n))return!0;if(r&&null!==i.closest(n))return!0}return!1},isIgnored:function(e,t,n){return!("TITLE"!==e.tagName||!n.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,n){n(t.value);for(let r=t.children.length-1;r>=0;r--)e(t.children[r],n)},legacy_isTouchEvent:function(e){return Boolean(e.changedTouches)},get nowTimestamp(){return Xy},on:function(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)},patch:function(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{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={},n=(e,n)=>{const r={value:e,parent:n,children:[]};return t[e.node.id]=r,r},r=[];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,n(i,o.parent))}else{const e=r.indexOf(o);r.splice(e,0,n(i,null))}continue}if(o in t){const e=t[o];e.children.push(n(i,e));continue}r.push(n(i,null))}return r},shadowHostInDom:tb,throttle:function(e,t,n={}){let r=null,i=0;return function(...o){const s=Date.now();i||!1!==n.leading||(i=s);const a=t-(s-i),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=s,e.apply(l,o)):r||!1===n.trailing||(r=setTimeout(()=>{i=!1===n.leading?0:Date.now(),r=null,e.apply(l,o)},a))}},uniqueTextMutations:function(e){const t=new Set,n=[];for(let r=e.length;r--;){const i=e[r];t.has(i.id)||(n.push(i),t.add(i.id))}return n}},Symbol.toStringTag,{value:"Module"}));for(var rb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ib="undefined"==typeof Uint8Array?[]:new Uint8Array(256),ob=0;ob<64;ob++)ib[rb.charCodeAt(ob)]=ob;"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==(tg=e.contentWindow)?void 0:tg.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var sb,ab;new xg,(ab=sb||(sb={}))[ab.NotStarted=0]="NotStarted",ab[ab.Running=1]="Running",ab[ab.Stopped=2]="Stopped";class lb{constructor(e){ug(this,"fileName"),ug(this,"functionName"),ug(this,"lineNumber"),ug(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 ub=/(^|@)\S+:\d+/,cb=/^\s*at .*(\S+:\d+|\(native\))/m,db=/^(eval@)?(\[native code])?$/,hb={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(cb)?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(cb)},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 n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const r=t.split(/\s+/).slice(1),i=this.extractLocation(n?n[1]:r.pop()),o=r.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new lb({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(db)},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 lb({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,""));return new lb({functionName:r,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,n=e.message.split("\n"),r=[];for(let e=2,i=n.length;e<i;e+=2){const i=t.exec(n[e]);i&&r.push(new lb({fileName:i[2],lineNumber:parseFloat(i[1])}))}return r},parseOpera10:function(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),r=[];for(let e=0,i=n.length;e<i;e+=2){const i=t.exec(n[e]);i&&r.push(new lb({functionName:i[3]||void 0,fileName:i[2],lineNumber:parseFloat(i[1])}))}return r},parseOpera11:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(ub)&&!e.match(/^Error created at/)},this).map(function(e){const t=e.split("@"),n=this.extractLocation(t.pop()),r=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new lb({functionName:r,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})},this)}};function fb(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();const r=e.parentElement,i=[];if(r.children&&r.children.length>0)for(let e=0;e<r.children.length;e++){const t=r.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===n&&i.push(t)}i.length>1&&(n+=`:eq(${i.indexOf(e)})`),t=n+(t?">"+t:""),e=r}return t}function pb(e){return"[object Object]"===Object.prototype.toString.call(e)}function gb(e,t){if(0===t)return!0;const n=Object.keys(e);for(const r of n)if(pb(e[r])&&gb(e[r],t-1))return!0;return!1}function vb(e,t){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);const r=[],i=[];return JSON.stringify(e,function(e,t){if(r.length>0){const n=r.indexOf(this);~n?r.splice(n+1):r.push(this),~n?i.splice(n,1/0,e):i.push(e),~r.indexOf(t)&&(t=r[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,r.indexOf(t)).join(".")+"]")}else r.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(function(e){if(pb(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(pb(e)&&gb(e,n.depthOfLimit))return!0;return!1}(t))return function(e){let t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t=`${t.slice(0,n.stringLengthLimit)}...`);return t}(t);if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const n in t){const r=t[n];Array.isArray(r)?e[n]=fb(r.length?r[0]:null):e[n]=r}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 mb={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 yb(e,t,n){const r=n?Object.assign({},mb,n):mb,i=r.logger;if(!i)return()=>{};let o;o="string"==typeof i?t[i]:i;let s=0,a=!1;const l=[];if(r.level.includes("error")){const n=t=>{const n=t.message,i=t.error,o=hb.parse(i).map(e=>e.toString()),s=[vb(n,r.stringifyOptions)];e({level:"error",trace:o,payload:s})};t.addEventListener("error",n),l.push(()=>{t.removeEventListener("error",n)});const i=t=>{let n,i;t.reason instanceof Error?(n=t.reason,i=[vb(`Uncaught (in promise) ${n.name}: ${n.message}`,r.stringifyOptions)]):(n=new Error,i=[vb("Uncaught (in promise)",r.stringifyOptions),vb(t.reason,r.stringifyOptions)]);const o=hb.parse(n).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 r.level)l.push(u(o,e));return()=>{l.forEach(e=>e())};function u(t,n){return t[n]?nb.patch(t,n,t=>(...i)=>{if(t.apply(this,i),!("assert"===n&&i[0]||a)){a=!0;try{const t=hb.parse(new Error).map(e=>e.toString()).splice(1),o=("assert"===n?i.slice(1):i).map(e=>vb(e,r.stringifyOptions));s++,s<r.lengthThreshold?e({level:n,trace:t,payload:o}):s===r.lengthThreshold&&e({level:"warn",trace:[],payload:[vb("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...i)}finally{a=!1}}}):()=>{}}}const bb="rrweb/console@1";var wb,Sb=Object.freeze({__proto__:null,PLUGIN_NAME:bb,getRecordConsolePlugin:e=>({name:bb,observer:yb,options:e})}),kb=Object.defineProperty,xb=(e,t,n)=>((e,t,n)=>t in e?kb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Cb=Object.defineProperty,Eb=(e,t,n)=>((e,t,n)=>t in e?Cb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Ib=(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))(Ib||{});const Ob={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Tb={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Pb={};function Ab(e){if(Pb[e])return Pb[e];const t=function(e){var t,n;const r=null==(n=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:n.call(t,e);return r&&globalThis[r]?globalThis[r]:void 0}(e)||globalThis[e],n=t.prototype,r=e in Ob?Ob[e]:void 0,i=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),o=e in Tb?Tb[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return Pb[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(r),o?Pb[e]=o:n}catch{return n}}const Mb={};function Rb(e,t,n){var r;const i=`${e}.${String(n)}`;if(Mb[i])return Mb[i].call(t);const o=Ab(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(Mb[i]=s,s.call(t)):t[n]}const _b={};function Nb(e,t,n){const r=`${e}.${String(n)}`;if(_b[r])return _b[r].bind(t);const i=Ab(e)[n];return"function"!=typeof i?t[n]:(_b[r]=i,i.bind(t))}const Lb={childNodes:function(e){return Rb("Node",e,"childNodes")},parentNode:function(e){return Rb("Node",e,"parentNode")},parentElement:function(e){return Rb("Node",e,"parentElement")},textContent:function(e){return Rb("Node",e,"textContent")},contains:function(e,t){return Nb("Node",e,"contains")(t)},getRootNode:function(e){return Nb("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Rb("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Rb("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Rb("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Rb("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return Ab("MutationObserver").constructor}};function Db(e){return e.nodeType===e.ELEMENT_NODE}function Fb(e){const t=e&&"host"in e&&"mode"in e&&Lb.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Lb.shadowRoot(t)===e)}function Ub(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function jb(e){try{const n=e.rules||e.cssRules;if(!n)return null;let r=e.href;!r&&e.ownerNode&&e.ownerNode.ownerDocument&&(r=e.ownerNode.ownerDocument.location.href);const i=Array.from(n,e=>Bb(e,r)).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 Bb(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=jb(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(n){t=e.cssText}return e.styleSheet.href?Xb(t,e.styleSheet.href):t}{let n=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(n=function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(n)),t?Xb(n,t):n}}class qb{constructor(){Eb(this,"idNodeMap",new Map),Eb(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 n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function zb({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:o}){let s=i||"";const a=r&&Wb(r);return(t[n.toLowerCase()]||a&&t[a])&&(s=o?o(s,e):"*".repeat(s.length)),s}function Wb(e){return e.toLowerCase()}const Vb="__rrweb_original__";function $b(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Wb(t):null}function Kb(e,t){let n;try{n=new URL(e,t??window.location.href)}catch(e){return null}const r=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(null==r?void 0:r[1])??null}const Hb=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Gb=/^(?:[a-z+]+:)?\/\//i,Jb=/^www\..*/i,Yb=/^(data:)([^,]*),(.*)/i;function Xb(e,t){return(e||"").replace(Hb,(e,n,r,i,o,s)=>{const a=r||o||s,l=n||i||"";if(!a)return e;if(Gb.test(a)||Jb.test(a))return`url(${l}${a}${l})`;if(Yb.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 Qb(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Zb(e,t){return function(e,t,n=!1){const r=Array.from(t.childNodes),i=[];let o=0;if(r.length>1&&e&&"string"==typeof e){let t=Qb(e,n);const s=t.length/e.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&"string"==typeof r[a].textContent){const l=Qb(r[a].textContent,n),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),f=-1;if(2===h.length)f=h[0].length;else if(h.length>2&&""===h[0]&&""!==r[a-1].textContent)f=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&&(f=t.indexOf(d));if(h.length>=2&&c>u){const e=r[a-1].textContent;if(e&&"string"==typeof e){const n=Qb(e).length;f=t.indexOf(d,n)}-1===f&&(f=h[0].length)}if(-1!==f){let a=Math.floor(f/s);for(;a>0&&a<e.length;){if(o+=1,o>50*r.length)return i.push(e),i;const l=Qb(e.substring(0,a),n);if(l.length===f){i.push(e.substring(0,a)),e=e.substring(a),t=t.substring(f);break}l.length<f?a+=Math.max(1,Math.floor((f-l.length)/s)):a-=Math.max(1,Math.floor((l.length-f)*s))}break}}}}return i.push(e),i}(e,t).join("/* rr_split */")}const ew="lightgrey";let tw=1;const nw=new RegExp("[^a-z0-9-_:]");function rw(){return tw++}let iw,ow;const sw=/^[^ \t\n\r\u000c]+/,aw=/^[, \t\n\r\u000c]+/;const lw=new WeakMap;function uw(e,t){return t&&""!==t.trim()?dw(e,t):t}function cw(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function dw(e,t){let n=lw.get(e);if(n||(n=e.createElement("a"),lw.set(e,n)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return n.setAttribute("href",t),n.href}function hw(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?uw(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):""}const i=[];for(;r(aw),!(n>=t.length);){let o=r(sw);if(","===o.slice(-1))o=uw(e,o.substring(0,o.length-1)),i.push(o);else{let r="";o=uw(e,o);let s=!1;for(;;){const e=t.charAt(n);if(""===e){i.push((o+r).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){n+=1,i.push((o+r).trim());break}"("===e&&(s=!0)}r+=e,n+=1}}}return i.join(", ")}(e,r):"style"===n?Xb(r,dw(e)):"object"===t&&"data"===n?uw(e,r):r:uw(e,r):r}function fw(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function pw(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&pw(Lb.parentNode(e),t,n);for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!!n&&pw(Lb.parentNode(e),t,n)}function gw(e,t,n,r){let i;if(Db(e)){if(i=e,!Lb.childNodes(i).length)return!1}else{if(null===Lb.parentElement(e))return!1;i=Lb.parentElement(e)}try{if("string"==typeof t){if(r){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(pw(i,t,r))return!0;if(n)if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}catch(e){}return!1}function vw(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,maskAttributeFn:d,dataURLOptions:h={},inlineImages:f,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:v=!1,cssCaptured:m=!1,applyBackgroundColorToBlockedElements:y=!1}=t,b=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Ib.Document,childNodes:[],compatMode:e.compatMode}:{type:Ib.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Ib.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return function(e,t){const{doc:n,blockClass:r,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:a,maskAttributeFn:l,dataURLOptions:u={},inlineImages:c,recordCanvas:d,keepIframeSrcFn:h,newlyAddedElement:f=!1,rootId:p,applyBackgroundColorToBlockedElements:g=!1}=t,v=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,i),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=Wb(e.tagName);return nw.test(t)?"div":t}(e);let y={};const b=e.attributes.length;for(let t=0;t<b;t++){const r=e.attributes[t];if(!fw(m,r.name,r.value)){const t=hw(n,m,Wb(r.name),r.value);if(l&&null!==t){const n=l(r.name,t,e);null!==n&&(y[r.name]=n)}else y[r.name]=t}}if("link"===m&&o){const t=Array.from(n.styleSheets).find(t=>t.href===e.href);let r=null;t&&(r=jb(t)),r&&(delete y.rel,delete y.href,y._cssText=r)}if("style"===m&&e.sheet){let t=jb(e.sheet);t&&(e.childNodes.length>1&&(t=Zb(t,e)),y._cssText=t)}if("input"===m||"textarea"===m||"select"===m){const t=e.value,n=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=zb({element:e,type:$b(e),tagName:m,value:t,maskInputOptions:s,maskInputFn:a}):n&&(y.checked=n)}"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 n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const i=t.getImageData,o=Vb in i?i[Vb]:i;if(new Uint32Array(o.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).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),r=n.createElement("canvas");r.width=e.width,r.height=e.height;t!==r.toDataURL(u.type,u.quality)&&(y.rr_dataURL=t)}if("img"===m&&c){iw||(iw=n.createElement("canvas"),ow=iw.getContext("2d"));const t=e,r=t.currentSrc||t.getAttribute("src")||"<unknown-src>",i=t.crossOrigin,o=()=>{t.removeEventListener("load",o);try{iw.width=t.naturalWidth,iw.height=t.naturalHeight,ow.drawImage(t,0,0),y.rr_dataURL=iw.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=${r}! 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}f||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(v){const{width:t,height:n}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${n}px`,...g?{rr_background_color:ew}:{}}}"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:Ib.Element,tagName:m,attributes:y,childNodes:[],isSVG:cw(e)||void 0,needBlock:v,rootId:p,isCustom:w}}(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,maskAttributeFn:d,dataURLOptions:h,inlineImages:f,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:v,rootId:b,applyBackgroundColorToBlockedElements:y});case e.TEXT_NODE:return function(e,t){const{needsMask:n,maskTextFn:r,rootId:i,cssCaptured:o}=t,s=Lb.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=Lb.textContent(e),u&&l&&(l=Xb(l,dw(t.doc))));!u&&!c&&l&&n&&(l=r?r(l,Lb.parentElement(e)):l.replace(/[\S]/g,"*"));return{type:Ib.Text,textContent:l||"",rootId:i}}(e,{doc:n,needsMask:s,maskTextFn:u,rootId:b,cssCaptured:m});case e.CDATA_SECTION_NODE:return{type:Ib.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:Ib.Comment,textContent:Lb.textContent(e)||"",rootId:b};default:return!1}}function mw(e){return null==e?"":e.toLowerCase()}function yw(e,t,n){return Array.from(e).map(e=>{const r=t(e);let i=[];if(!n.has(r)){n.add(r);try{i=Array.from(e.cssRules,(t,n)=>({rule:Bb(t,e.href),index:n}))}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}return{styleId:r,rules:i}})}function bw(e,t){var n,r;const{doc:i,mirror:o,blockClass:s,blockSelector:a,maskTextClass:l,maskTextSelector:u,skipChild:c=!1,inlineStylesheet:d=!0,maskInputOptions:h={},maskTextFn:f,maskInputFn:p,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:T=!1,applyBackgroundColorToBlockedElements:P=!1}=t,A=t._emittedStyleIds??new Set;let{needsMask:M}=t,{preserveWhiteSpace:R=!0}=t;if(!M){M=gw(e,l,u,void 0===M)}const _=vw(e,{doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:M,inlineStylesheet:d,maskInputOptions:h,maskTextFn:f,maskInputFn:p,maskAttributeFn:g,dataURLOptions:m,inlineImages:y,recordCanvas:b,keepIframeSrcFn:I,newlyAddedElement:O,cssCaptured:T,applyBackgroundColorToBlockedElements:P});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===Ib.Comment)return!0;if(e.type===Ib.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"===Kb(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(mw(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===mw(e.attributes.name)||"icon"===mw(e.attributes.rel)||"apple-touch-icon"===mw(e.attributes.rel)||"shortcut icon"===mw(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&mw(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(mw(e.attributes.property).match(/^(og|twitter|fb):/)||mw(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===mw(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===mw(e.attributes.name)||"googlebot"===mw(e.attributes.name)||"bingbot"===mw(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===mw(e.attributes.name)||"generator"===mw(e.attributes.name)||"framework"===mw(e.attributes.name)||"publisher"===mw(e.attributes.name)||"progid"===mw(e.attributes.name)||mw(e.attributes.property).match(/^article:/)||mw(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===mw(e.attributes.name)||"yandex-verification"===mw(e.attributes.name)||"csrf-token"===mw(e.attributes.name)||"p:domain_verify"===mw(e.attributes.name)||"verify-v1"===mw(e.attributes.name)||"verification"===mw(e.attributes.name)||"shopify-checkout-api-token"===mw(e.attributes.name)))return!0}}return!1}(_,v)||!R&&_.type===Ib.Text&&!_.textContent.replace(/^\s+|\s+$/gm,"").length?-2:rw();const L=Object.assign(_,{id:N});if(o.add(e,L),-2===N)return null;w&&w(e);let D=!c;if(L.type===Ib.Element){D=D&&!L.needBlock,delete L.needBlock;const t=Lb.shadowRoot(e);t&&Ub(t)&&(L.isShadowHost=!0,S&&(null==(n=t.adoptedStyleSheets)?void 0:n.length)&&(L.adoptedStyleSheets=yw(t.adoptedStyleSheets,S,A)))}if(L.type===Ib.Document&&S){const t=e;(null==(r=t.adoptedStyleSheets)?void 0:r.length)&&(L.adoptedStyleSheets=yw(t.adoptedStyleSheets,S,A))}if((L.type===Ib.Document||L.type===Ib.Element)&&D){v.headWhitespace&&L.type===Ib.Element&&"head"===L.tagName&&(R=!1);const t={doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:M,maskTextClass:l,maskTextSelector:u,skipChild:c,inlineStylesheet:d,maskInputOptions:h,maskTextFn:f,maskInputFn:p,maskAttributeFn:g,slimDOMOptions:v,dataURLOptions:m,inlineImages:y,recordCanvas:b,preserveWhiteSpace:R,onSerialize:w,onAdoptedStyleSheet:S,_emittedStyleIds:A,onIframeLoad:k,iframeLoadTimeout:x,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I,cssCaptured:!1,applyBackgroundColorToBlockedElements:P};if(L.type===Ib.Element&&"textarea"===L.tagName&&void 0!==L.attributes.value);else{L.type===Ib.Element&&void 0!==L.attributes._cssText&&"string"==typeof L.attributes._cssText&&(t.cssCaptured=!0);for(const n of Array.from(Lb.childNodes(e))){const e=bw(n,t);e&&L.childNodes.push(e)}}let n=null;if(Db(e)&&(n=Lb.shadowRoot(e)))for(const e of Array.from(Lb.childNodes(n))){const r=bw(e,t);r&&(Ub(n)&&(r.isShadow=!0),L.childNodes.push(r))}}const F=Lb.parentNode(e);return F&&Fb(F)&&Ub(F)&&(L.isShadow=!0),L.type===Ib.Element&&"iframe"===L.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let i,o=!1;try{i=r.document.readyState}catch(e){return}if("complete"!==i){const r=setTimeout(()=>{o||(t(),o=!0)},n);return void e.addEventListener("load",()=>{clearTimeout(r),o=!0,t()})}const s="about:blank";if(r.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 n=bw(t,{doc:t,mirror:o,blockClass:s,blockSelector:a,needsMask:M,maskTextClass:l,maskTextSelector:u,skipChild:!1,inlineStylesheet:d,maskInputOptions:h,maskTextFn:f,maskInputFn:p,maskAttributeFn:g,slimDOMOptions:v,dataURLOptions:m,inlineImages:y,recordCanvas:b,preserveWhiteSpace:R,onSerialize:w,onAdoptedStyleSheet:S,_emittedStyleIds:A,onIframeLoad:k,iframeLoadTimeout:x,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I});n&&k(e,n)}},x),L.type===Ib.Element&&"link"===L.tagName&&"string"==typeof L.attributes.rel&&("stylesheet"===L.attributes.rel||"preload"===L.attributes.rel&&"string"==typeof L.attributes.href&&"css"===Kb(L.attributes.href))&&function(e,t,n){let r,i=!1;try{r=e.sheet}catch(e){return}if(r)return;const o=setTimeout(()=>{i||(t(),i=!0)},n);e.addEventListener("load",()=>{clearTimeout(o),i=!0,t()})}(e,()=>{if(C){const t=bw(e,{doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:M,maskTextClass:l,maskTextSelector:u,skipChild:!1,inlineStylesheet:d,maskInputOptions:h,maskTextFn:f,maskInputFn:p,maskAttributeFn:g,slimDOMOptions:v,dataURLOptions:m,inlineImages:y,recordCanvas:b,preserveWhiteSpace:R,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:x,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I});t&&C(e,t)}},E),L}function ww(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Sw(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var kw,xw={exports:{}};function Cw(){if(kw)return xw.exports;kw=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,blackBright:e,redBright:e,greenBright:e,yellowBright:e,blueBright:e,magentaBright:e,cyanBright:e,whiteBright:e,bgBlackBright:e,bgRedBright:e,bgGreenBright:e,bgYellowBright:e,bgBlueBright:e,bgMagentaBright:e,bgCyanBright:e,bgWhiteBright:e}};return xw.exports=t(),xw.exports.createColors=t,xw.exports}const Ew=Sw(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Iw,Ow,Tw,Pw,Aw,Mw;function Rw(){if(Ow)return Iw;Ow=1;let e=Cw(),t=Ew;class n extends Error{constructor(e,t,r,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!==r&&("number"==typeof t?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}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(n){if(!this.source)return"";let r=this.source;null==n&&(n=e.isColorSupported);let i=e=>e,o=e=>e,s=e=>e;if(n){let{bold:n,gray:r,red:a}=e.createColors(!0);o=e=>n(a(e)),i=e=>r(e),t&&(s=e=>t(e))}let a=r.split(/\r?\n/),l=Math.max(this.line-3,0),u=Math.min(this.line+2,a.length),c=String(u).length;return a.slice(l,u).map((e,t)=>{let n=l+1+t,r=" "+(" "+n).slice(-c)+" | ";if(n===this.line){if(e.length>160){let t=20,n=Math.max(0,this.column-t),a=Math.max(this.column+t,this.endColumn+t),l=e.slice(n,a),u=i(r.replace(/\d/g," "))+e.slice(0,Math.min(this.column-1,t-1)).replace(/[^\t]/g," ");return o(">")+i(r)+s(l)+"\n "+u+o("^")}let t=i(r.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return o(">")+i(r)+s(e)+"\n "+t+o("^")}return" "+i(r)+s(e)}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return Iw=n,n.default=n,Iw}function _w(){if(Pw)return Tw;Pw=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 n="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:r&&(n+=" "),e.nodes)this.block(e,n+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,e)}}beforeAfter(e,t){let n;n="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 r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)n+=t}return n}block(e,t){let n,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==r||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),r=e.prop+n+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],void 0!==i))return i;let o=t.parent;if("before"===r){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[r];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[r])return s.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(t,r);{let e="raw"+((a=r)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[n],void 0!==i)return!1})}var a;return void 0===i&&(i=e[r]),s.rawCache[r]=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 n;return e.walkComments(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}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(n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.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(n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==n.raws.before){let e=n.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 n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}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 Tw=t,t.default=t,Tw}function Nw(){if(Mw)return Aw;Mw=1;let e=_w();function t(t,n){new e(n).stringify(t)}return Aw=t,t.default=t,Aw}var Lw,Dw,Fw,Uw,jw,Bw,qw,zw,Ww,Vw,$w,Kw,Hw,Gw,Jw,Yw,Xw,Qw,Zw,eS,tS,nS,rS,iS,oS,sS,aS,lS,uS,cS,dS,hS,fS,pS,gS,vS,mS,yS,bS,wS,SS,kS,xS,CS,ES,IS,OS,TS,PS,AS={};function MS(){return Lw||(Lw=1,AS.isClean=Symbol("isClean"),AS.my=Symbol("my")),AS}function RS(){if(Fw)return Dw;Fw=1;let e=Rw(),t=_w(),n=Nw(),{isClean:r,my:i}=MS();function o(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],s=typeof i;"parent"===r&&"object"===s?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>o(e,n)):("object"===s&&null!==i&&(i=o(i)),n[r]=i)}return n}function s(e,t){if(t&&void 0!==t.offset)return t.offset;let n=1,r=1,i=0;for(let o=0;o<e.length;o++){if(r===t.line&&n===t.column){i=o;break}"\n"===e[o]?(n=1,r+=1):n+=1}return i}class a{get proxyOf(){return this}constructor(e={}){this.raws={},this[r]=!1,this[i]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let n of e[t])"function"==typeof n.clone?this.append(n.clone()):this.append(n)}else this[t]=e[t]}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 n in e)t[n]=e[n];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(t,n={}){if(this.source){let{end:e,start:r}=this.rangeBy(n);return this.source.input.error(t,{column:r.column,line:r.line},{column:e.column,line:e.line},n)}return new e(t)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markClean(){this[r]=!0}markDirty(){if(this[r]){this[r]=!1;let e=this;for(;e=e.parent;)e[r]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e={}){let t=this.source.start;if(e.index)t=this.positionInside(e.index);else if(e.word){let n="document"in this.source.input?this.source.input.document:this.source.input.css,r=n.slice(s(n,this.source.start),s(n,this.source.end)).indexOf(e.word);-1!==r&&(t=this.positionInside(r))}return t}positionInside(e){let t=this.source.start.column,n=this.source.start.line,r="document"in this.source.input?this.source.input.document:this.source.input.css,i=s(r,this.source.start),o=i+e;for(let e=i;e<o;e++)"\n"===r[e]?(t=1,n+=1):t+=1;return{column:t,line:n,offset:o}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e={}){let t="document"in this.source.input?this.source.input.document:this.source.input.css,n={column:this.source.start.column,line:this.source.start.line,offset:s(t,this.source.start)},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line,offset:"number"==typeof this.source.end.offset?this.source.end.offset:s(t,this.source.end)+1}:{column:n.column+1,line:n.line,offset:n.offset+1};if(e.word){let i=t.slice(s(t,this.source.start),s(t,this.source.end)).indexOf(e.word);-1!==i&&(n=this.positionInside(i),r=this.positionInside(i+e.word.length))}else e.start?n={column:e.start.column,line:e.start.line,offset:s(t,e.start)}:e.index&&(n=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line,offset:s(t,e.end)}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<n.line||r.line===n.line&&r.column<=n.column)&&(r={column:n.column+1,line:n.line,offset:n.offset+1}),{end:r,start:n}}raw(e,n){return(new t).raw(this,e,n)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},r=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 r=this[e];if(Array.isArray(r))n[e]=r.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof r&&r.toJSON)n[e]=r.toJSON(null,t);else if("source"===e){if(null==r)continue;let o=t.get(r.input);null==o&&(o=i,t.set(r.input,i),i++),n[e]={end:r.end,inputId:o,start:r.start}}else n[e]=r}return r&&(n.inputs=[...t.keys()].map(e=>e.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=n){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,n={}){let r={node:this};for(let e in n)r[e]=n[e];return e.warn(t,r)}}return Dw=a,a.default=a,Dw}function _S(){if(jw)return Uw;jw=1;let e=RS();class t extends e{constructor(e){super(e),this.type="comment"}}return Uw=t,t.default=t,Uw}function NS(){if(qw)return Bw;qw=1;let e=RS();class t extends e{get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}}return Bw=t,t.default=t,Bw}function LS(){if(Ww)return zw;Ww=1;let e,t,n,r,i=_S(),o=NS(),s=RS(),{isClean:a,my:l}=MS();function u(e){return e.map(e=>(e.nodes&&(e.nodes=u(e.nodes)),delete e.source,e))}function c(e){if(e[a]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class d extends s{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]}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,n,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[r]+=1;return delete this.indexes[r],n}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")?(...n)=>e[t](...n.map(e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e)):"every"===t||"some"===t?n=>e[t]((e,...t)=>n(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,n)=>(e[t]===n||(e[t]=n,"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 n,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)n=this.indexes[e],r<n&&(this.indexes[e]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of o)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)n=this.indexes[e],r<=n&&(this.indexes[e]=n+o.length);return this.markDirty(),this}normalize(n,s){if("string"==typeof n)n=u(t(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 o(n)]}else if(n.selector||n.selectors)n=[new r(n)];else if(n.name)n=[new e(n)];else{if(!n.text)throw new Error("Unknown node type in node creation");n=[new i(n)]}return n.map(e=>(e[l]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[a]&&c(e),e.raws||(e.raws={}),void 0===e.raws.before&&s&&void 0!==s.raws.before&&(e.raws.before=s.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 n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,n)=>{let r;try{r=e(t,n)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("atrule"===n.type&&e.test(n.name))return t(n,r)}):this.walk((n,r)=>{if("atrule"===n.type&&n.name===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("atrule"===e.type)return t(e,n)}))}walkComments(e){return this.walk((t,n)=>{if("comment"===t.type)return e(t,n)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("decl"===n.type&&e.test(n.prop))return t(n,r)}):this.walk((n,r)=>{if("decl"===n.type&&n.prop===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("decl"===e.type)return t(e,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("rule"===n.type&&e.test(n.selector))return t(n,r)}):this.walk((n,r)=>{if("rule"===n.type&&n.selector===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("rule"===e.type)return t(e,n)}))}}return d.registerParse=e=>{t=e},d.registerRule=e=>{r=e},d.registerAtRule=t=>{e=t},d.registerRoot=e=>{n=e},zw=d,d.default=d,d.rebuild=t=>{"atrule"===t.type?Object.setPrototypeOf(t,e.prototype):"rule"===t.type?Object.setPrototypeOf(t,r.prototype):"decl"===t.type?Object.setPrototypeOf(t,o.prototype):"comment"===t.type?Object.setPrototypeOf(t,i.prototype):"root"===t.type&&Object.setPrototypeOf(t,n.prototype),t[l]=!0,t.nodes&&t.nodes.forEach(e=>{d.rebuild(e)})},zw}function DS(){if($w)return Vw;$w=1;let e=LS();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 Vw=t,t.default=t,e.registerAtRule(t),Vw}function FS(){if(Hw)return Kw;Hw=1;let e,t,n=LS();class r extends n{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},Kw=r,r.default=r,Kw}function US(){if(Jw)return Gw;Jw=1;return Gw={nanoid:(e=21)=>{let t="",n=0|e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",i=0|n;for(;i--;)r+=e[Math.random()*e.length|0];return r}},Gw}function jS(){if(Xw)return Yw;Xw=1;let{existsSync:e,readFileSync:t}=Ew,{dirname:n,join:r}=Ew,{SourceMapConsumer:i,SourceMapGenerator:o}=Ew;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,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=n(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new i(this.text)),this.consumerCache}decodeInline(e){let t=e.match(/^data:application\/json;charset=utf-?8,/)||e.match(/^data:application\/json,/);if(t)return decodeURIComponent(e.substr(t[0].length));let n=e.match(/^data:application\/json;charset=utf-?8;base64,/)||e.match(/^data:application\/json;base64,/);if(n)return r=e.substr(n[0].length),Buffer?Buffer.from(r,"base64").toString():window.atob(r);var r;let i=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+i)}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=/g);if(!t)return;let n=e.lastIndexOf(t.pop()),r=e.indexOf("*/",n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(r){if(this.root=n(r),e(r))return this.mapFile=r,t(r,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof i)return o.fromSourceMap(t).toString();if(t instanceof o)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let n=t(e);if(n){let e=this.loadFile(n);if(!e)throw new Error("Unable to load previous source map: "+n.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=r(n(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return Yw=s,s.default=s,Yw}function BS(){if(Zw)return Qw;Zw=1;let{nanoid:e}=US(),{isAbsolute:t,resolve:n}=Ew,{SourceMapConsumer:r,SourceMapGenerator:i}=Ew,{fileURLToPath:o,pathToFileURL:s}=Ew,a=Rw(),l=jS(),u=Ew,c=Symbol("lineToIndexCache"),d=Boolean(r&&i),h=Boolean(n&&t);function f(e){if(e[c])return e[c];let t=e.css.split("\n"),n=new Array(t.length),r=0;for(let e=0,i=t.length;e<i;e++)n[e]=r,r+=t[e].length+1;return e[c]=n,n}class p{get from(){return this.file||this.id}constructor(r,i={}){if(null==r||"object"==typeof r&&!r.toString)throw new Error(`PostCSS received ${r} instead of CSS string`);if(this.css=r.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,i.document&&(this.document=i.document.toString()),i.from&&(!h||/^\w+:\/\//.test(i.from)||t(i.from)?this.file=i.from:this.file=n(i.from)),h&&d){let e=new l(this.css,i);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 "+e(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let i,o,l,u,c;if(t&&"object"==typeof t){let e=t,r=n;if("number"==typeof e.offset){u=e.offset;let r=this.fromOffset(u);t=r.line,n=r.col}else t=e.line,n=e.column,u=this.fromLineAndColumn(t,n);if("number"==typeof r.offset){l=r.offset;let e=this.fromOffset(l);o=e.line,i=e.col}else o=r.line,i=r.column,l=this.fromLineAndColumn(r.line,r.column)}else if(n)u=this.fromLineAndColumn(t,n);else{u=t;let e=this.fromOffset(u);t=e.line,n=e.col}let d=this.origin(t,n,o,i);return c=d?new a(e,void 0===d.endLine?d.line:{column:d.column,line:d.line},void 0===d.endLine?d.column:{column:d.endColumn,line:d.endLine},d.source,d.file,r.plugin):new a(e,void 0===o?t:{column:n,line:t},void 0===o?n:{column:i,line:o},this.css,this.file,r.plugin),c.input={column:n,endColumn:i,endLine:o,endOffset:l,line:t,offset:u,source:this.css},this.file&&(s&&(c.input.url=s(this.file).toString()),c.input.file=this.file),c}fromLineAndColumn(e,t){return f(this)[e-1]+t-1}fromOffset(e){let t=f(this),n=0;if(e>=t[t.length-1])n=t.length-1;else{let r,i=t.length-2;for(;n<i;)if(r=n+(i-n>>1),e<t[r])i=r-1;else{if(!(e>=t[r+1])){n=r;break}n=r+1}}return{col:e-t[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:n(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,n,r,i){if(!this.map)return!1;let a,l,u=this.map.consumer(),c=u.originalPositionFor({column:n,line:e});if(!c.source)return!1;"number"==typeof r&&(a=u.originalPositionFor({column:i,line:r})),l=t(c.source)?s(c.source):new URL(c.source,this.map.consumer().sourceRoot||s(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(!o)throw new Error("file: protocol is not available in this PostCSS build");d.file=o(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}}return Qw=p,p.default=p,u&&u.registerInput&&u.registerInput(p),Qw}function qS(){if(tS)return eS;tS=1;let e,t,n=LS();class r extends n{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let r=super.normalize(e);if(t)if("prepend"===n)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 r)e.raws.before=t.raws.before;return r}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},eS=r,r.default=r,n.registerRoot(r),eS}function zS(){if(rS)return nS;rS=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,n){let r=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let n of e)u?u=!1:"\\"===n?u=!0:a?n===l&&(a=!1):'"'===n||"'"===n?(a=!0,l=n):"("===n?s+=1:")"===n?s>0&&(s-=1):0===s&&t.includes(n)&&(o=!0),o?(""!==i&&r.push(i.trim()),i="",o=!1):i+=n;return(n||""!==i)&&r.push(i.trim()),r}};return nS=e,e.default=e,nS}function WS(){if(oS)return iS;oS=1;let e=LS(),t=zS();class n extends e{get selectors(){return t.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}}return iS=n,n.default=n,e.registerRule(n),iS}function VS(){if(uS)return lS;uS=1;let{dirname:e,relative:t,resolve:n,sep:r}=Ew,{SourceMapConsumer:i,SourceMapGenerator:o}=Ew,{pathToFileURL:s}=Ew,a=BS(),l=Boolean(i&&o),u=Boolean(e&&n&&t&&r);return lS=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,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,r=this.toUrl(this.path(t.file)),o=t.root||e(t.file);!1===this.mapOpts.sourcesContent?(n=new i(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,r,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&&e.text.startsWith("# 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=o.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new o({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 o({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,n=1,r=1,i="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(o,a,l)=>{if(this.css+=o,a&&"end"!==l&&(s.generated.line=n,s.generated.column=r-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=i,s.original.line=1,s.original.column=0,this.map.addMapping(s))),t=o.match(/\n/g),t?(n+=t.length,e=o.lastIndexOf("\n"),r=o.length-e):r+=o.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=r-2,this.map.addMapping(s)):(s.source=i,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=r-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(r){if(this.mapOpts.absolute)return r;if(60===r.charCodeAt(0))return r;if(/^\w+:\/\//.test(r))return r;let i=this.memoizedPaths.get(r);if(i)return i;let o=this.opts.to?e(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=e(n(o,this.mapOpts.annotation)));let s=t(o,r);return this.memoizedPaths.set(r,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 n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,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;"\\"===r&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},lS}function $S(){if(fS)return hS;fS=1;let e=DS(),t=_S(),n=NS(),r=qS(),i=WS(),o=function(){if(dS)return cS;dS=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),n="\\".charCodeAt(0),r="/".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),f="{".charCodeAt(0),p="}".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 cS=function(x,C={}){let E,I,O,T,P,A,M,R,_,N,L=x.css.valueOf(),D=C.ignoreErrors,F=L.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=L.charCodeAt(U),E){case i:case o:case a:case l:case s:T=U;do{T+=1,E=L.charCodeAt(T)}while(E===o||E===i||E===a||E===l||E===s);A=["space",L.slice(U,T)],U=T-1;break;case u:case c:case f:case p:case m:case g:case h:{let e=String.fromCharCode(E);A=[e,e,U];break}case d:if(N=j.length?j.pop()[1]:"",_=L.charCodeAt(U+1),"url"===N&&_!==e&&_!==t&&_!==o&&_!==i&&_!==a&&_!==s&&_!==l){T=U;do{if(M=!1,T=L.indexOf(")",T+1),-1===T){if(D||C){T=U;break}q("bracket")}for(R=T;L.charCodeAt(R-1)===n;)R-=1,M=!M}while(M);A=["brackets",L.slice(U,T+1),U,T],U=T}else T=L.indexOf(")",U+1),I=L.slice(U,T+1),-1===T||S.test(I)?A=["(","(",U]:(A=["brackets",I,U,T],U=T);break;case e:case t:P=E===e?"'":'"',T=U;do{if(M=!1,T=L.indexOf(P,T+1),-1===T){if(D||C){T=U+1;break}q("string")}for(R=T;L.charCodeAt(R-1)===n;)R-=1,M=!M}while(M);A=["string",L.slice(U,T+1),U,T],U=T;break;case y:b.lastIndex=U+1,b.test(L),T=0===b.lastIndex?L.length-1:b.lastIndex-2,A=["at-word",L.slice(U,T+1),U,T],U=T;break;case n:for(T=U,O=!0;L.charCodeAt(T+1)===n;)T+=1,O=!O;if(E=L.charCodeAt(T+1),O&&E!==r&&E!==o&&E!==i&&E!==a&&E!==l&&E!==s&&(T+=1,k.test(L.charAt(T)))){for(;k.test(L.charAt(T+1));)T+=1;L.charCodeAt(T+1)===o&&(T+=1)}A=["word",L.slice(U,T+1),U,T],U=T;break;default:E===r&&L.charCodeAt(U+1)===v?(T=L.indexOf("*/",U+2)+1,0===T&&(D||C?T=L.length:q("comment")),A=["comment",L.slice(U,T+1),U,T],U=T):(w.lastIndex=U+1,w.test(L),T=0===w.lastIndex?L.length-1:w.lastIndex-2,A=["word",L.slice(U,T+1),U,T],j.push(A),U=T)}return U++,A},position:function(){return U}}}}();const s={empty:!0,space:!0};return hS=class{constructor(e){this.input=e,this.root=new r,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(t){let n,r,i,o=new e;o.name=t[1].slice(1),""===o.name&&this.unnamedAtrule(o,t),this.init(o,t[2]);let s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(n=(t=this.tokenizer.nextToken())[0],"("===n||"["===n?u.push("("===n?")":"]"):"{"===n&&u.length>0?u.push("}"):n===u[u.length-1]&&u.pop(),0===u.length){if(";"===n){o.source.end=this.getPosition(t[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===n){a=!0;break}if("}"===n){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(t);break}l.push(t)}else l.push(t);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&&(t=l[l.length-1],o.source.end=this.getPosition(t[3]||t[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 n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[o,s]of e.entries()){if(n=s,r=n[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(t){if("word"===t[0]&&"progid"===t[1])continue;return o}this.doubleColon(n)}t=n}return!1}comment(e){let n=new t;this.init(n,e[2]),n.source.end=this.getPosition(e[3]||e[2]),n.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))n.text="",n.raws.left=r,n.raws.right="";else{let e=r.match(/^(\s*)([^]*\S)(\s*)$/);n.text=e[2],n.raws.left=e[1],n.raws.right=e[3]}}createTokenizer(){this.tokenizer=o(this.input)}decl(e,t){let r=new n;this.init(r,e[0][2]);let i,o=e[e.length-1];for(";"===o[0]&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}(e)),r.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;r.prop+=e.shift()[1]}for(r.raws.between="";e.length;){if(i=e.shift(),":"===i[0]){r.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),r.raws.between+=i[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let s,a=[];for(;e.length&&(s=e[0][0],"space"===s||"comment"===s);)a.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(i=e[t],"!important"===i[1].toLowerCase()){r.important=!0;let n=this.stringFrom(e,t);n=this.spacesFromEnd(e)+n," !important"!==n&&(r.raws.important=n);break}if("important"===i[1].toLowerCase()){let n=e.slice(0),i="";for(let e=t;e>0;e--){let t=n[e][0];if(i.trim().startsWith("!")&&"space"!==t)break;i=n.pop()[1]+i}i.trim().startsWith("!")&&(r.important=!0,r.raws.important=i,e=n)}if("space"!==i[0]&&"comment"!==i[0])break}e.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(r.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(r,"value",a.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new i;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 t=this.current.nodes[this.current.nodes.length-1];t&&"rule"===t.type&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="",t.source.end=this.getPosition(e[2]),t.source.end.offset+=t.raws.ownSemicolon.length)}}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,n=null,r=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)i||(i=l),o.push("("===n?")":"]");else if(s&&r&&"{"===n)i||(i=l),o.push("}");else if(0===o.length){if(";"===n){if(r)return void this.decl(a,s);break}if("{"===n)return void this.rule(a);if("}"===n){this.tokenizer.back(a.pop()),t=!0;break}":"===n&&(r=!0)}else n===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&&r){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,n,r){let i,o,a,l,u=n.length,c="",d=!0;for(let e=0;e<u;e+=1)i=n[e],o=i[0],"space"!==o||e!==u-1||r?"comment"===o?(l=n[e-1]?n[e-1][0]:"empty",a=n[e+1]?n[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let r=n.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,value:c}}e[t]=c}rule(e){e.pop();let t=new i;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}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 "+e[0][1],{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})}},hS}function KS(){if(gS)return pS;gS=1;let e=LS(),t=BS(),n=$S();function r(e,r){let i=new t(e,r),o=new n(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&r&&r.from&&(/\.scss$/i.test(r.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(r.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(r.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 pS=r,r.default=r,e.registerParse(r),pS}function HS(){if(mS)return vS;mS=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 vS=e,e.default=e,vS}function GS(){if(bS)return yS;bS=1;let e=HS();class t{get content(){return this.css}constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css="",this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new e(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>"warning"===e.type)}}return yS=t,t.default=t,yS}function JS(){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 YS(){if(xS)return kS;xS=1;let e=LS(),t=FS(),n=VS(),r=KS(),i=GS(),o=qS(),s=Nw(),{isClean:a,my:l}=MS(),u=JS();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 f(e){return"object"==typeof e&&"function"==typeof e.then}function p(e){let t=!1,n=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,0,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,0,n+"Exit"]:[n,n+"Exit"]}function g(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:p(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function v(e){return e[a]=!1,e.nodes&&e.nodes.forEach(e=>v(e)),e}let m={};class y{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"}constructor(t,n,o){let s;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof y||n instanceof i)s=v(n.root),n.map&&(void 0===o.map&&(o.map={}),o.map.inline||(o.map.inline=!1),o.map.prev=n.map);else{let t=r;o.syntax&&(t=o.syntax.parse),o.parser&&(t=o.parser),t.parse&&(t=t.parse);try{s=t(n,o)}catch(e){this.processed=!0,this.error=e}s&&!s[l]&&e.rebuild(s)}else s=v(n);this.result=new i(t,s,o),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 n=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(n.postcssVersion&&"production"!==process.env.NODE_ENV){let e=n.postcssPlugin,t=n.postcssVersion,r=this.result.processor.version,i=t.split("."),o=r.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=n.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!d[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[n])if("object"==typeof t[n])for(let r in t[n])e(t,"*"===r?n:n+"-"+r.toLowerCase(),t[n][r]);else"function"==typeof t[n]&&e(t,n,t[n])}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],n=this.runOnRoot(t);if(f(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[a];){e[a]=!0;let t=[g(e)];for(;t.length>0;){let e=this.visitTick(t);if(f(e))try{await e}catch(e){let n=t[t.length-1].node;throw this.handleError(e,n)}}}if(this.listeners.OnceExit)for(let[t,n]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map(e=>n(e,this.helpers));await Promise.all(t)}else await n(e,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 f(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=s;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let r=new n(t,this.result.root,this.result.opts).generate();return this.result.css=r[0],this.result.map=r[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(f(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[a];)e[a]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||u("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[n,r]of e){let e;this.result.lastPlugin=n;try{e=r(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(f(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:n,visitors:r}=t;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=n.nodes[n.indexes[i]];)if(n.indexes[i]+=1,!r[a])return r[a]=!0,void e.push(g(r));t.iterator=0,delete n.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(n.nodes&&n.nodes.length&&(n[a]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[a]=!0;let t=p(e);for(let n of t)if(0===n)e.nodes&&e.each(e=>{e[a]||this.walkSync(e)});else{let t=this.listeners[n];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}}return y.registerPostcss=e=>{m=e},kS=y,y.default=y,o.registerLazyResult(y),t.registerLazyResult(y),kS}function XS(){if(OS)return IS;OS=1;let e=FS(),t=YS(),n=function(){if(ES)return CS;ES=1;let e=VS(),t=KS();const n=GS();let r=Nw(),i=JS();class o{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,n=t;try{e=n(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"}constructor(t,i,o){let s;i=i.toString(),this.stringified=!1,this._processor=t,this._css=i,this._opts=o,this._map=void 0;let a=r;this.result=new n(this._processor,s,this._opts),this.result.css=i;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,i);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||i("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[]}}return CS=o,o.default=o,CS}(),r=qS();class i{constructor(e=[]){this.version="8.5.6",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else{if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" 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(e,r={}){return this.plugins.length||r.parser||r.stringifier||r.syntax?new t(this,e,r):new n(this,e,r)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return IS=i,i.default=i,r.registerProcessor(i),e.registerProcessor(i),IS}var QS=function(){if(PS)return TS;PS=1;let e=DS(),t=_S(),n=LS(),r=Rw(),i=NS(),o=FS(),s=function(){if(aS)return sS;aS=1;let e=DS(),t=_S(),n=NS(),r=BS(),i=jS(),o=qS(),s=WS();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 t={...e,__proto__:r.prototype};t.map&&(t.map={...t.map,__proto__:i.prototype}),u.push(t)}}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 n(d);if("rule"===d.type)return new s(d);if("comment"===d.type)return new t(d);if("atrule"===d.type)return new e(d);throw new Error("Unknown node type: "+l.type)}return sS=a,a.default=a,sS}(),a=BS(),l=YS(),u=zS(),c=RS(),d=KS(),h=XS(),f=GS(),p=qS(),g=WS(),v=Nw(),m=HS();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new h(e)}return y.plugin=function(e,t){let n,r=!1;function i(...n){console&&console.warn&&!r&&(r=!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 i=t(...n);return i.postcssPlugin=e,i.postcssVersion=(new h).version,i}return Object.defineProperty(i,"postcss",{get:()=>(n||(n=i()),n)}),i.process=function(e,t,n){return y([i(n)]).process(e,t)},i},y.stringify=v,y.parse=d,y.fromJSON=s,y.list=u,y.comment=e=>new t(e),y.atRule=t=>new e(t),y.decl=e=>new i(e),y.rule=e=>new g(e),y.root=e=>new p(e),y.document=e=>new o(e),y.CssSyntaxError=r,y.Declaration=i,y.Container=n,y.Processor=h,y.Document=o,y.Comment=t,y.Warning=m,y.AtRule=e,y.Result=f,y.Input=a,y.Rule=g,y.Root=p,y.Node=c,l.registerPostcss(y),TS=y,y.default=y,TS}();const ZS=ww(QS);ZS.stringify,ZS.fromJSON,ZS.plugin,ZS.parse,ZS.list,ZS.document,ZS.comment,ZS.atRule,ZS.rule,ZS.decl,ZS.root,ZS.CssSyntaxError,ZS.Declaration,ZS.Container,ZS.Processor,ZS.Document,ZS.Comment,ZS.Warning,ZS.AtRule,ZS.Result,ZS.Input,ZS.Rule,ZS.Root,ZS.Node;var ek=Object.defineProperty,tk=(e,t,n)=>((e,t,n)=>t in e?ek(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);function nk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function rk(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var ik,ok={exports:{}};function sk(){if(ik)return ok.exports;ik=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,blackBright:e,redBright:e,greenBright:e,yellowBright:e,blueBright:e,magentaBright:e,cyanBright:e,whiteBright:e,bgBlackBright:e,bgRedBright:e,bgGreenBright:e,bgYellowBright:e,bgBlueBright:e,bgMagentaBright:e,bgCyanBright:e,bgWhiteBright:e}};return ok.exports=t(),ok.exports.createColors=t,ok.exports}const ak=rk(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var lk,uk,ck,dk,hk,fk;function pk(){if(uk)return lk;uk=1;let e=sk(),t=ak;class n extends Error{constructor(e,t,r,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!==r&&("number"==typeof t?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,n)}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(n){if(!this.source)return"";let r=this.source;null==n&&(n=e.isColorSupported);let i=e=>e,o=e=>e,s=e=>e;if(n){let{bold:n,gray:r,red:a}=e.createColors(!0);o=e=>n(a(e)),i=e=>r(e),t&&(s=e=>t(e))}let a=r.split(/\r?\n/),l=Math.max(this.line-3,0),u=Math.min(this.line+2,a.length),c=String(u).length;return a.slice(l,u).map((e,t)=>{let n=l+1+t,r=" "+(" "+n).slice(-c)+" | ";if(n===this.line){if(e.length>160){let t=20,n=Math.max(0,this.column-t),a=Math.max(this.column+t,this.endColumn+t),l=e.slice(n,a),u=i(r.replace(/\d/g," "))+e.slice(0,Math.min(this.column-1,t-1)).replace(/[^\t]/g," ");return o(">")+i(r)+s(l)+"\n "+u+o("^")}let t=i(r.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return o(">")+i(r)+s(e)+"\n "+t+o("^")}return" "+i(r)+s(e)}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return lk=n,n.default=n,lk}function gk(){if(dk)return ck;dk=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 n="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:r&&(n+=" "),e.nodes)this.block(e,n+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,e)}}beforeAfter(e,t){let n;n="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 r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)n+=t}return n}block(e,t){let n,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==r||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),r=e.prop+n+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],void 0!==i))return i;let o=t.parent;if("before"===r){if(!o||"root"===o.type&&o.first===t)return"";if(o&&"document"===o.type)return""}if(!o)return e[r];let s=t.root();if(s.rawCache||(s.rawCache={}),void 0!==s.rawCache[r])return s.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(t,r);{let e="raw"+((a=r)[0].toUpperCase()+a.slice(1));this[e]?i=this[e](s,t):s.walk(e=>{if(i=e.raws[n],void 0!==i)return!1})}var a;return void 0===i&&(i=e[r]),s.rawCache[r]=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 n;return e.walkComments(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}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(n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.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(n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==n.raws.before){let e=n.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 n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}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 ck=t,t.default=t,ck}function vk(){if(fk)return hk;fk=1;let e=gk();function t(t,n){new e(n).stringify(t)}return hk=t,t.default=t,hk}var mk,yk,bk,wk,Sk,kk,xk,Ck,Ek,Ik,Ok,Tk,Pk,Ak,Mk,Rk,_k,Nk,Lk,Dk,Fk,Uk,jk,Bk,qk,zk,Wk,Vk,$k,Kk,Hk,Gk,Jk,Yk,Xk,Qk,Zk,ex,tx,nx,rx,ix,ox,sx,ax,lx,ux,cx,dx,hx={};function fx(){return mk||(mk=1,hx.isClean=Symbol("isClean"),hx.my=Symbol("my")),hx}function px(){if(bk)return yk;bk=1;let e=pk(),t=gk(),n=vk(),{isClean:r,my:i}=fx();function o(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],s=typeof i;"parent"===r&&"object"===s?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>o(e,n)):("object"===s&&null!==i&&(i=o(i)),n[r]=i)}return n}function s(e,t){if(t&&void 0!==t.offset)return t.offset;let n=1,r=1,i=0;for(let o=0;o<e.length;o++){if(r===t.line&&n===t.column){i=o;break}"\n"===e[o]?(n=1,r+=1):n+=1}return i}class a{get proxyOf(){return this}constructor(e={}){this.raws={},this[r]=!1,this[i]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let n of e[t])"function"==typeof n.clone?this.append(n.clone()):this.append(n)}else this[t]=e[t]}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 n in e)t[n]=e[n];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(t,n={}){if(this.source){let{end:e,start:r}=this.rangeBy(n);return this.source.input.error(t,{column:r.column,line:r.line},{column:e.column,line:e.line},n)}return new e(t)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markClean(){this[r]=!0}markDirty(){if(this[r]){this[r]=!1;let e=this;for(;e=e.parent;)e[r]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e={}){let t=this.source.start;if(e.index)t=this.positionInside(e.index);else if(e.word){let n="document"in this.source.input?this.source.input.document:this.source.input.css,r=n.slice(s(n,this.source.start),s(n,this.source.end)).indexOf(e.word);-1!==r&&(t=this.positionInside(r))}return t}positionInside(e){let t=this.source.start.column,n=this.source.start.line,r="document"in this.source.input?this.source.input.document:this.source.input.css,i=s(r,this.source.start),o=i+e;for(let e=i;e<o;e++)"\n"===r[e]?(t=1,n+=1):t+=1;return{column:t,line:n,offset:o}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e={}){let t="document"in this.source.input?this.source.input.document:this.source.input.css,n={column:this.source.start.column,line:this.source.start.line,offset:s(t,this.source.start)},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line,offset:"number"==typeof this.source.end.offset?this.source.end.offset:s(t,this.source.end)+1}:{column:n.column+1,line:n.line,offset:n.offset+1};if(e.word){let i=t.slice(s(t,this.source.start),s(t,this.source.end)).indexOf(e.word);-1!==i&&(n=this.positionInside(i),r=this.positionInside(i+e.word.length))}else e.start?n={column:e.start.column,line:e.start.line,offset:s(t,e.start)}:e.index&&(n=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line,offset:s(t,e.end)}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<n.line||r.line===n.line&&r.column<=n.column)&&(r={column:n.column+1,line:n.line,offset:n.offset+1}),{end:r,start:n}}raw(e,n){return(new t).raw(this,e,n)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},r=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 r=this[e];if(Array.isArray(r))n[e]=r.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof r&&r.toJSON)n[e]=r.toJSON(null,t);else if("source"===e){if(null==r)continue;let o=t.get(r.input);null==o&&(o=i,t.set(r.input,i),i++),n[e]={end:r.end,inputId:o,start:r.start}}else n[e]=r}return r&&(n.inputs=[...t.keys()].map(e=>e.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=n){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,n={}){let r={node:this};for(let e in n)r[e]=n[e];return e.warn(t,r)}}return yk=a,a.default=a,yk}function gx(){if(Sk)return wk;Sk=1;let e=px();class t extends e{constructor(e){super(e),this.type="comment"}}return wk=t,t.default=t,wk}function vx(){if(xk)return kk;xk=1;let e=px();class t extends e{get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}}return kk=t,t.default=t,kk}function mx(){if(Ek)return Ck;Ek=1;let e,t,n,r,i=gx(),o=vx(),s=px(),{isClean:a,my:l}=fx();function u(e){return e.map(e=>(e.nodes&&(e.nodes=u(e.nodes)),delete e.source,e))}function c(e){if(e[a]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class d extends s{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]}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,n,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[r]+=1;return delete this.indexes[r],n}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")?(...n)=>e[t](...n.map(e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e)):"every"===t||"some"===t?n=>e[t]((e,...t)=>n(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,n)=>(e[t]===n||(e[t]=n,"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 n,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)n=this.indexes[e],r<n&&(this.indexes[e]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of o)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)n=this.indexes[e],r<=n&&(this.indexes[e]=n+o.length);return this.markDirty(),this}normalize(n,s){if("string"==typeof n)n=u(t(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 o(n)]}else if(n.selector||n.selectors)n=[new r(n)];else if(n.name)n=[new e(n)];else{if(!n.text)throw new Error("Unknown node type in node creation");n=[new i(n)]}return n.map(e=>(e[l]||d.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[a]&&c(e),e.raws||(e.raws={}),void 0===e.raws.before&&s&&void 0!==s.raws.before&&(e.raws.before=s.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 n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,n)=>{let r;try{r=e(t,n)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("atrule"===n.type&&e.test(n.name))return t(n,r)}):this.walk((n,r)=>{if("atrule"===n.type&&n.name===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("atrule"===e.type)return t(e,n)}))}walkComments(e){return this.walk((t,n)=>{if("comment"===t.type)return e(t,n)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("decl"===n.type&&e.test(n.prop))return t(n,r)}):this.walk((n,r)=>{if("decl"===n.type&&n.prop===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("decl"===e.type)return t(e,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("rule"===n.type&&e.test(n.selector))return t(n,r)}):this.walk((n,r)=>{if("rule"===n.type&&n.selector===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("rule"===e.type)return t(e,n)}))}}return d.registerParse=e=>{t=e},d.registerRule=e=>{r=e},d.registerAtRule=t=>{e=t},d.registerRoot=e=>{n=e},Ck=d,d.default=d,d.rebuild=t=>{"atrule"===t.type?Object.setPrototypeOf(t,e.prototype):"rule"===t.type?Object.setPrototypeOf(t,r.prototype):"decl"===t.type?Object.setPrototypeOf(t,o.prototype):"comment"===t.type?Object.setPrototypeOf(t,i.prototype):"root"===t.type&&Object.setPrototypeOf(t,n.prototype),t[l]=!0,t.nodes&&t.nodes.forEach(e=>{d.rebuild(e)})},Ck}function yx(){if(Ok)return Ik;Ok=1;let e=mx();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 Ik=t,t.default=t,e.registerAtRule(t),Ik}function bx(){if(Pk)return Tk;Pk=1;let e,t,n=mx();class r extends n{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},Tk=r,r.default=r,Tk}function wx(){if(Mk)return Ak;Mk=1;return Ak={nanoid:(e=21)=>{let t="",n=0|e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",i=0|n;for(;i--;)r+=e[Math.random()*e.length|0];return r}},Ak}function Sx(){if(_k)return Rk;_k=1;let{existsSync:e,readFileSync:t}=ak,{dirname:n,join:r}=ak,{SourceMapConsumer:i,SourceMapGenerator:o}=ak;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,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=n(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new i(this.text)),this.consumerCache}decodeInline(e){let t=e.match(/^data:application\/json;charset=utf-?8,/)||e.match(/^data:application\/json,/);if(t)return decodeURIComponent(e.substr(t[0].length));let n=e.match(/^data:application\/json;charset=utf-?8;base64,/)||e.match(/^data:application\/json;base64,/);if(n)return r=e.substr(n[0].length),Buffer?Buffer.from(r,"base64").toString():window.atob(r);var r;let i=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+i)}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=/g);if(!t)return;let n=e.lastIndexOf(t.pop()),r=e.indexOf("*/",n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(r){if(this.root=n(r),e(r))return this.mapFile=r,t(r,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof i)return o.fromSourceMap(t).toString();if(t instanceof o)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let n=t(e);if(n){let e=this.loadFile(n);if(!e)throw new Error("Unable to load previous source map: "+n.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=r(n(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return Rk=s,s.default=s,Rk}function kx(){if(Lk)return Nk;Lk=1;let{nanoid:e}=wx(),{isAbsolute:t,resolve:n}=ak,{SourceMapConsumer:r,SourceMapGenerator:i}=ak,{fileURLToPath:o,pathToFileURL:s}=ak,a=pk(),l=Sx(),u=ak,c=Symbol("lineToIndexCache"),d=Boolean(r&&i),h=Boolean(n&&t);function f(e){if(e[c])return e[c];let t=e.css.split("\n"),n=new Array(t.length),r=0;for(let e=0,i=t.length;e<i;e++)n[e]=r,r+=t[e].length+1;return e[c]=n,n}class p{get from(){return this.file||this.id}constructor(r,i={}){if(null==r||"object"==typeof r&&!r.toString)throw new Error(`PostCSS received ${r} instead of CSS string`);if(this.css=r.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,i.document&&(this.document=i.document.toString()),i.from&&(!h||/^\w+:\/\//.test(i.from)||t(i.from)?this.file=i.from:this.file=n(i.from)),h&&d){let e=new l(this.css,i);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 "+e(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let i,o,l,u,c;if(t&&"object"==typeof t){let e=t,r=n;if("number"==typeof e.offset){u=e.offset;let r=this.fromOffset(u);t=r.line,n=r.col}else t=e.line,n=e.column,u=this.fromLineAndColumn(t,n);if("number"==typeof r.offset){l=r.offset;let e=this.fromOffset(l);o=e.line,i=e.col}else o=r.line,i=r.column,l=this.fromLineAndColumn(r.line,r.column)}else if(n)u=this.fromLineAndColumn(t,n);else{u=t;let e=this.fromOffset(u);t=e.line,n=e.col}let d=this.origin(t,n,o,i);return c=d?new a(e,void 0===d.endLine?d.line:{column:d.column,line:d.line},void 0===d.endLine?d.column:{column:d.endColumn,line:d.endLine},d.source,d.file,r.plugin):new a(e,void 0===o?t:{column:n,line:t},void 0===o?n:{column:i,line:o},this.css,this.file,r.plugin),c.input={column:n,endColumn:i,endLine:o,endOffset:l,line:t,offset:u,source:this.css},this.file&&(s&&(c.input.url=s(this.file).toString()),c.input.file=this.file),c}fromLineAndColumn(e,t){return f(this)[e-1]+t-1}fromOffset(e){let t=f(this),n=0;if(e>=t[t.length-1])n=t.length-1;else{let r,i=t.length-2;for(;n<i;)if(r=n+(i-n>>1),e<t[r])i=r-1;else{if(!(e>=t[r+1])){n=r;break}n=r+1}}return{col:e-t[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:n(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,n,r,i){if(!this.map)return!1;let a,l,u=this.map.consumer(),c=u.originalPositionFor({column:n,line:e});if(!c.source)return!1;"number"==typeof r&&(a=u.originalPositionFor({column:i,line:r})),l=t(c.source)?s(c.source):new URL(c.source,this.map.consumer().sourceRoot||s(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(!o)throw new Error("file: protocol is not available in this PostCSS build");d.file=o(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}}return Nk=p,p.default=p,u&&u.registerInput&&u.registerInput(p),Nk}function xx(){if(Fk)return Dk;Fk=1;let e,t,n=mx();class r extends n{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let r=super.normalize(e);if(t)if("prepend"===n)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 r)e.raws.before=t.raws.before;return r}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(n={}){return new e(new t,this,n).stringify()}}return r.registerLazyResult=t=>{e=t},r.registerProcessor=e=>{t=e},Dk=r,r.default=r,n.registerRoot(r),Dk}function Cx(){if(jk)return Uk;jk=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(e,t,n){let r=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let n of e)u?u=!1:"\\"===n?u=!0:a?n===l&&(a=!1):'"'===n||"'"===n?(a=!0,l=n):"("===n?s+=1:")"===n?s>0&&(s-=1):0===s&&t.includes(n)&&(o=!0),o?(""!==i&&r.push(i.trim()),i="",o=!1):i+=n;return(n||""!==i)&&r.push(i.trim()),r}};return Uk=e,e.default=e,Uk}function Ex(){if(qk)return Bk;qk=1;let e=mx(),t=Cx();class n extends e{get selectors(){return t.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}}return Bk=n,n.default=n,e.registerRule(n),Bk}function Ix(){if($k)return Vk;$k=1;let{dirname:e,relative:t,resolve:n,sep:r}=ak,{SourceMapConsumer:i,SourceMapGenerator:o}=ak,{pathToFileURL:s}=ak,a=kx(),l=Boolean(i&&o),u=Boolean(e&&n&&t&&r);return Vk=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,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,r=this.toUrl(this.path(t.file)),o=t.root||e(t.file);!1===this.mapOpts.sourcesContent?(n=new i(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,r,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&&e.text.startsWith("# 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=o.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new o({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 o({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,n=1,r=1,i="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(o,a,l)=>{if(this.css+=o,a&&"end"!==l&&(s.generated.line=n,s.generated.column=r-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=i,s.original.line=1,s.original.column=0,this.map.addMapping(s))),t=o.match(/\n/g),t?(n+=t.length,e=o.lastIndexOf("\n"),r=o.length-e):r+=o.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=r-2,this.map.addMapping(s)):(s.source=i,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=r-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(r){if(this.mapOpts.absolute)return r;if(60===r.charCodeAt(0))return r;if(/^\w+:\/\//.test(r))return r;let i=this.memoizedPaths.get(r);if(i)return i;let o=this.opts.to?e(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(o=e(n(o,this.mapOpts.annotation)));let s=t(o,r);return this.memoizedPaths.set(r,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 n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,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;"\\"===r&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},Vk}function Ox(){if(Jk)return Gk;Jk=1;let e=yx(),t=gx(),n=vx(),r=xx(),i=Ex(),o=function(){if(Hk)return Kk;Hk=1;const e="'".charCodeAt(0),t='"'.charCodeAt(0),n="\\".charCodeAt(0),r="/".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),f="{".charCodeAt(0),p="}".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 Kk=function(x,C={}){let E,I,O,T,P,A,M,R,_,N,L=x.css.valueOf(),D=C.ignoreErrors,F=L.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=L.charCodeAt(U),E){case i:case o:case a:case l:case s:T=U;do{T+=1,E=L.charCodeAt(T)}while(E===o||E===i||E===a||E===l||E===s);A=["space",L.slice(U,T)],U=T-1;break;case u:case c:case f:case p:case m:case g:case h:{let e=String.fromCharCode(E);A=[e,e,U];break}case d:if(N=j.length?j.pop()[1]:"",_=L.charCodeAt(U+1),"url"===N&&_!==e&&_!==t&&_!==o&&_!==i&&_!==a&&_!==s&&_!==l){T=U;do{if(M=!1,T=L.indexOf(")",T+1),-1===T){if(D||C){T=U;break}q("bracket")}for(R=T;L.charCodeAt(R-1)===n;)R-=1,M=!M}while(M);A=["brackets",L.slice(U,T+1),U,T],U=T}else T=L.indexOf(")",U+1),I=L.slice(U,T+1),-1===T||S.test(I)?A=["(","(",U]:(A=["brackets",I,U,T],U=T);break;case e:case t:P=E===e?"'":'"',T=U;do{if(M=!1,T=L.indexOf(P,T+1),-1===T){if(D||C){T=U+1;break}q("string")}for(R=T;L.charCodeAt(R-1)===n;)R-=1,M=!M}while(M);A=["string",L.slice(U,T+1),U,T],U=T;break;case y:b.lastIndex=U+1,b.test(L),T=0===b.lastIndex?L.length-1:b.lastIndex-2,A=["at-word",L.slice(U,T+1),U,T],U=T;break;case n:for(T=U,O=!0;L.charCodeAt(T+1)===n;)T+=1,O=!O;if(E=L.charCodeAt(T+1),O&&E!==r&&E!==o&&E!==i&&E!==a&&E!==l&&E!==s&&(T+=1,k.test(L.charAt(T)))){for(;k.test(L.charAt(T+1));)T+=1;L.charCodeAt(T+1)===o&&(T+=1)}A=["word",L.slice(U,T+1),U,T],U=T;break;default:E===r&&L.charCodeAt(U+1)===v?(T=L.indexOf("*/",U+2)+1,0===T&&(D||C?T=L.length:q("comment")),A=["comment",L.slice(U,T+1),U,T],U=T):(w.lastIndex=U+1,w.test(L),T=0===w.lastIndex?L.length-1:w.lastIndex-2,A=["word",L.slice(U,T+1),U,T],j.push(A),U=T)}return U++,A},position:function(){return U}}}}();const s={empty:!0,space:!0};return Gk=class{constructor(e){this.input=e,this.root=new r,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(t){let n,r,i,o=new e;o.name=t[1].slice(1),""===o.name&&this.unnamedAtrule(o,t),this.init(o,t[2]);let s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(n=(t=this.tokenizer.nextToken())[0],"("===n||"["===n?u.push("("===n?")":"]"):"{"===n&&u.length>0?u.push("}"):n===u[u.length-1]&&u.pop(),0===u.length){if(";"===n){o.source.end=this.getPosition(t[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===n){a=!0;break}if("}"===n){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(t);break}l.push(t)}else l.push(t);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&&(t=l[l.length-1],o.source.end=this.getPosition(t[3]||t[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 n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[o,s]of e.entries()){if(n=s,r=n[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(t){if("word"===t[0]&&"progid"===t[1])continue;return o}this.doubleColon(n)}t=n}return!1}comment(e){let n=new t;this.init(n,e[2]),n.source.end=this.getPosition(e[3]||e[2]),n.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))n.text="",n.raws.left=r,n.raws.right="";else{let e=r.match(/^(\s*)([^]*\S)(\s*)$/);n.text=e[2],n.raws.left=e[1],n.raws.right=e[3]}}createTokenizer(){this.tokenizer=o(this.input)}decl(e,t){let r=new n;this.init(r,e[0][2]);let i,o=e[e.length-1];for(";"===o[0]&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}(e)),r.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;r.prop+=e.shift()[1]}for(r.raws.between="";e.length;){if(i=e.shift(),":"===i[0]){r.raws.between+=i[1];break}"word"===i[0]&&/\w/.test(i[1])&&this.unknownWord([i]),r.raws.between+=i[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let s,a=[];for(;e.length&&(s=e[0][0],"space"===s||"comment"===s);)a.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(i=e[t],"!important"===i[1].toLowerCase()){r.important=!0;let n=this.stringFrom(e,t);n=this.spacesFromEnd(e)+n," !important"!==n&&(r.raws.important=n);break}if("important"===i[1].toLowerCase()){let n=e.slice(0),i="";for(let e=t;e>0;e--){let t=n[e][0];if(i.trim().startsWith("!")&&"space"!==t)break;i=n.pop()[1]+i}i.trim().startsWith("!")&&(r.important=!0,r.raws.important=i,e=n)}if("space"!==i[0]&&"comment"!==i[0])break}e.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(r.raws.between+=a.map(e=>e[1]).join(""),a=[]),this.raw(r,"value",a.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new i;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 t=this.current.nodes[this.current.nodes.length-1];t&&"rule"===t.type&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="",t.source.end=this.getPosition(e[2]),t.source.end.offset+=t.raws.ownSemicolon.length)}}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,n=null,r=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)i||(i=l),o.push("("===n?")":"]");else if(s&&r&&"{"===n)i||(i=l),o.push("}");else if(0===o.length){if(";"===n){if(r)return void this.decl(a,s);break}if("{"===n)return void this.rule(a);if("}"===n){this.tokenizer.back(a.pop()),t=!0;break}":"===n&&(r=!0)}else n===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&&r){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,n,r){let i,o,a,l,u=n.length,c="",d=!0;for(let e=0;e<u;e+=1)i=n[e],o=i[0],"space"!==o||e!==u-1||r?"comment"===o?(l=n[e-1]?n[e-1][0]:"empty",a=n[e+1]?n[e+1][0]:"empty",s[l]||s[a]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[1]:d=!1;if(!d){let r=n.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,value:c}}e[t]=c}rule(e){e.pop();let t=new i;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}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 "+e[0][1],{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})}},Gk}function Tx(){if(Xk)return Yk;Xk=1;let e=mx(),t=kx(),n=Ox();function r(e,r){let i=new t(e,r),o=new n(i);try{o.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&r&&r.from&&(/\.scss$/i.test(r.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(r.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(r.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 Yk=r,r.default=r,e.registerParse(r),Yk}function Px(){if(Zk)return Qk;Zk=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 Qk=e,e.default=e,Qk}function Ax(){if(tx)return ex;tx=1;let e=Px();class t{get content(){return this.css}constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css="",this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new e(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>"warning"===e.type)}}return ex=t,t.default=t,ex}function Mx(){if(rx)return nx;rx=1;let e={};return nx=function(t){e[t]||(e[t]=!0,"undefined"!=typeof console&&console.warn&&console.warn(t))}}function Rx(){if(ox)return ix;ox=1;let e=mx(),t=bx(),n=Ix(),r=Tx(),i=Ax(),o=xx(),s=vk(),{isClean:a,my:l}=fx(),u=Mx();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 f(e){return"object"==typeof e&&"function"==typeof e.then}function p(e){let t=!1,n=c[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,0,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,0,n+"Exit"]:[n,n+"Exit"]}function g(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:p(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function v(e){return e[a]=!1,e.nodes&&e.nodes.forEach(e=>v(e)),e}let m={};class y{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"}constructor(t,n,o){let s;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof y||n instanceof i)s=v(n.root),n.map&&(void 0===o.map&&(o.map={}),o.map.inline||(o.map.inline=!1),o.map.prev=n.map);else{let t=r;o.syntax&&(t=o.syntax.parse),o.parser&&(t=o.parser),t.parse&&(t=t.parse);try{s=t(n,o)}catch(e){this.processed=!0,this.error=e}s&&!s[l]&&e.rebuild(s)}else s=v(n);this.result=new i(t,s,o),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 n=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(n.postcssVersion&&"production"!==process.env.NODE_ENV){let e=n.postcssPlugin,t=n.postcssVersion,r=this.result.processor.version,i=t.split("."),o=r.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=n.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!d[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[n])if("object"==typeof t[n])for(let r in t[n])e(t,"*"===r?n:n+"-"+r.toLowerCase(),t[n][r]);else"function"==typeof t[n]&&e(t,n,t[n])}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],n=this.runOnRoot(t);if(f(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[a];){e[a]=!0;let t=[g(e)];for(;t.length>0;){let e=this.visitTick(t);if(f(e))try{await e}catch(e){let n=t[t.length-1].node;throw this.handleError(e,n)}}}if(this.listeners.OnceExit)for(let[t,n]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map(e=>n(e,this.helpers));await Promise.all(t)}else await n(e,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 f(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=s;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let r=new n(t,this.result.root,this.result.opts).generate();return this.result.css=r[0],this.result.map=r[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(f(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[a];)e[a]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||u("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[n,r]of e){let e;this.result.lastPlugin=n;try{e=r(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(f(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:n,visitors:r}=t;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=n.nodes[n.indexes[i]];)if(n.indexes[i]+=1,!r[a])return r[a]=!0,void e.push(g(r));t.iterator=0,delete n.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(n.nodes&&n.nodes.length&&(n[a]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[a]=!0;let t=p(e);for(let n of t)if(0===n)e.nodes&&e.each(e=>{e[a]||this.walkSync(e)});else{let t=this.listeners[n];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}}return y.registerPostcss=e=>{m=e},ix=y,y.default=y,o.registerLazyResult(y),t.registerLazyResult(y),ix}function _x(){if(ux)return lx;ux=1;let e=bx(),t=Rx(),n=function(){if(ax)return sx;ax=1;let e=Ix(),t=Tx();const n=Ax();let r=vk(),i=Mx();class o{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,n=t;try{e=n(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"}constructor(t,i,o){let s;i=i.toString(),this.stringified=!1,this._processor=t,this._css=i,this._opts=o,this._map=void 0;let a=r;this.result=new n(this._processor,s,this._opts),this.result.css=i;let l=this;Object.defineProperty(this.result,"root",{get:()=>l.root});let u=new e(a,s,this._opts,i);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||i("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[]}}return sx=o,o.default=o,sx}(),r=xx();class i{constructor(e=[]){this.version="8.5.6",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else{if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" 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(e,r={}){return this.plugins.length||r.parser||r.stringifier||r.syntax?new t(this,e,r):new n(this,e,r)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}return lx=i,i.default=i,r.registerProcessor(i),e.registerProcessor(i),lx}var Nx=function(){if(dx)return cx;dx=1;let e=yx(),t=gx(),n=mx(),r=pk(),i=vx(),o=bx(),s=function(){if(Wk)return zk;Wk=1;let e=yx(),t=gx(),n=vx(),r=kx(),i=Sx(),o=xx(),s=Ex();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 t={...e,__proto__:r.prototype};t.map&&(t.map={...t.map,__proto__:i.prototype}),u.push(t)}}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 n(d);if("rule"===d.type)return new s(d);if("comment"===d.type)return new t(d);if("atrule"===d.type)return new e(d);throw new Error("Unknown node type: "+l.type)}return zk=a,a.default=a,zk}(),a=kx(),l=Rx(),u=Cx(),c=px(),d=Tx(),h=_x(),f=Ax(),p=xx(),g=Ex(),v=vk(),m=Px();function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new h(e)}return y.plugin=function(e,t){let n,r=!1;function i(...n){console&&console.warn&&!r&&(r=!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 i=t(...n);return i.postcssPlugin=e,i.postcssVersion=(new h).version,i}return Object.defineProperty(i,"postcss",{get:()=>(n||(n=i()),n)}),i.process=function(e,t,n){return y([i(n)]).process(e,t)},i},y.stringify=v,y.parse=d,y.fromJSON=s,y.list=u,y.comment=e=>new t(e),y.atRule=t=>new e(t),y.decl=e=>new i(e),y.rule=e=>new g(e),y.root=e=>new p(e),y.document=e=>new o(e),y.CssSyntaxError=r,y.Declaration=i,y.Container=n,y.Processor=h,y.Document=o,y.Comment=t,y.Warning=m,y.AtRule=e,y.Result=f,y.Input=a,y.Rule=g,y.Root=p,y.Node=c,l.registerPostcss(y),cx=y,y.default=y,cx}();const Lx=nk(Nx);Lx.stringify,Lx.fromJSON,Lx.plugin,Lx.parse,Lx.list,Lx.document,Lx.comment,Lx.atRule,Lx.rule,Lx.decl,Lx.root,Lx.CssSyntaxError,Lx.Declaration,Lx.Container,Lx.Processor,Lx.Document,Lx.Comment,Lx.Warning,Lx.AtRule,Lx.Result,Lx.Input,Lx.Rule,Lx.Root,Lx.Node;class Dx{constructor(...e){tk(this,"parentElement",null),tk(this,"parentNode",null),tk(this,"ownerDocument"),tk(this,"firstChild",null),tk(this,"lastChild",null),tk(this,"previousSibling",null),tk(this,"nextSibling",null),tk(this,"ELEMENT_NODE",1),tk(this,"TEXT_NODE",3),tk(this,"nodeType"),tk(this,"nodeName"),tk(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 Dx))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 Fx={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Ux={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},jx={};function Bx(e){if(jx[e])return jx[e];const t=function(e){var t,n;const r=null==(n=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:n.call(t,e);return r&&globalThis[r]?globalThis[r]:void 0}(e)||globalThis[e],n=t.prototype,r=e in Fx?Fx[e]:void 0,i=Boolean(r&&r.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),o=e in Ux?Ux[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s)return jx[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(r),o?jx[e]=o:n}catch{return n}}const qx={};function zx(e,t,n){var r;const i=`${e}.${String(n)}`;if(qx[i])return qx[i].call(t);const o=Bx(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(qx[i]=s,s.call(t)):t[n]}const Wx={};function Vx(e,t,n){const r=`${e}.${String(n)}`;if(Wx[r])return Wx[r].bind(t);const i=Bx(e)[n];return"function"!=typeof i?t[n]:(Wx[r]=i,i.bind(t))}function $x(){return Bx("MutationObserver").constructor}const Kx={childNodes:function(e){return zx("Node",e,"childNodes")},parentNode:function(e){return zx("Node",e,"parentNode")},parentElement:function(e){return zx("Node",e,"parentElement")},textContent:function(e){return zx("Node",e,"textContent")},contains:function(e,t){return Vx("Node",e,"contains")(t)},getRootNode:function(e){return Vx("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?zx("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?zx("Element",e,"shadowRoot"):null},querySelector:function(e,t){return zx("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return zx("Element",e,"querySelectorAll")(t)},mutationObserver:$x};function Hx(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const Gx="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 Jx={map:{},getId:()=>(console.error(Gx),-1),getNode:()=>(console.error(Gx),null),removeNodeFromMap(){console.error(Gx)},has:()=>(console.error(Gx),!1),reset(){console.error(Gx)}};function Yx(e,t,n={}){let r=null,i=0;return function(...o){const s=Date.now();i||!1!==n.leading||(i=s);const a=t-(s-i),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=s,e.apply(l,o)):r||!1===n.trailing||(r=setTimeout(()=>{i=!1===n.leading?0:Date.now(),r=null,e.apply(l,o)},a))}}function Xx(e,t,n,r,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),o&&o.set&&o.set.call(this,e)}}),()=>Xx(e,t,o||{},!0)}function Qx(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Jx=new Proxy(Jx,{get:(e,t,n)=>("map"===t&&console.error(Gx),Reflect.get(e,t,n))}));let Zx=Date.now;function eC(e){var t,n,r,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=Kx.parentElement(o.body))?void 0:t.scrollLeft)||(null==(n=null==o?void 0:o.body)?void 0:n.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==(r=Kx.parentElement(o.body))?void 0:r.scrollTop)||(null==(i=null==o?void 0:o.body)?void 0:i.scrollTop)||0}}function tC(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function nC(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function rC(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:Kx.parentElement(e)}function iC(e,t,n,r){if(!e)return!1;const i=rC(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(pw(i,t,r))return!0}catch(e){}if(n){if(i.matches(n))return!0;if(r&&null!==i.closest(n))return!0}return!1}function oC(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||-2===t.getId(e)}function sC(e,t){if(Fb(e))return!1;const n=t.getId(e);if(!t.has(n))return!0;const r=Kx.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||sC(r,t))}function aC(e){return Boolean(e.changedTouches)}function lC(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function uC(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function cC(e){return!!e&&(e instanceof Dx&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Kx.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Zx=()=>(new Date).getTime());class dC{constructor(){xb(this,"id",1),xb(this,"styleIDMap",new WeakMap),xb(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 n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function hC(e){var t;let n=null;return"getRootNode"in e&&(null==(t=Kx.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Kx.host(Kx.getRootNode(e))&&(n=Kx.host(Kx.getRootNode(e))),n}function fC(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=hC(n);)n=t;return n}(e);return Kx.contains(t,n)}function pC(e){const t=e.ownerDocument;return!!t&&(Kx.contains(t,e)||fC(e))}var gC=(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))(gC||{}),vC=(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))(vC||{}),mC=(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))(mC||{}),yC=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(yC||{}),bC=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(bC||{}),wC=(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))(wC||{}),SC=(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))(SC||{});function kC(e){return"__ln"in e}class xC{constructor(){xb(this,"length",0),xb(this,"head",null),xb(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)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&&kC(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&kC(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.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 CC=(e,t)=>`${e}@${t}`;class EC{constructor(){xb(this,"frozen",!1),xb(this,"locked",!1),xb(this,"texts",[]),xb(this,"attributes",[]),xb(this,"attributeMap",new WeakMap),xb(this,"removes",[]),xb(this,"mapRemoves",[]),xb(this,"movedMap",{}),xb(this,"addedSet",new Set),xb(this,"movedSet",new Set),xb(this,"droppedSet",new Set),xb(this,"removesSubTreeCache",new Set),xb(this,"mutationCb"),xb(this,"blockClass"),xb(this,"blockSelector"),xb(this,"maskTextClass"),xb(this,"maskTextSelector"),xb(this,"inlineStylesheet"),xb(this,"maskInputOptions"),xb(this,"maskTextFn"),xb(this,"maskInputFn"),xb(this,"maskAttributeFn"),xb(this,"keepIframeSrcFn"),xb(this,"recordCanvas"),xb(this,"inlineImages"),xb(this,"slimDOMOptions"),xb(this,"dataURLOptions"),xb(this,"doc"),xb(this,"mirror"),xb(this,"iframeManager"),xb(this,"stylesheetManager"),xb(this,"shadowDomManager"),xb(this,"canvasManager"),xb(this,"processedNodeManager"),xb(this,"captureAdoptedStyleSheets"),xb(this,"unattachedDoc"),xb(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),xb(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new xC,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},i=i=>{const o=Kx.parentNode(i);if(!o||!pC(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=Fb(o)?this.mirror.getId(hC(i)):this.mirror.getId(o),l=r(i);if(-1===a||-1===l)return n.addNode(i);const u=bw(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=>{lC(e,this.mirror)&&this.iframeManager.addIframe(e),uC(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),cC(i)&&this.shadowDomManager.addShadowRoot(Kx.shadowRoot(i),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)},onAdoptedStyleSheet:this.captureAdoptedStyleSheets?e=>this.stylesheetManager.styleMirror.add(e):void 0,_emittedStyleIds:this.captureAdoptedStyleSheets?this.stylesheetManager.getInlinedAdoptedStyleSheetRuleIds():void 0,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)OC(this.removesSubTreeCache,e,this.mirror)&&!this.movedSet.has(Kx.parentNode(e))||i(e);for(const e of this.addedSet)TC(this.droppedSet,e)||OC(this.removesSubTreeCache,e,this.mirror)?TC(this.movedSet,e)?i(e):this.droppedSet.add(e):i(e);let o=null;for(;n.length;){let e=null;if(o){const t=this.mirror.getId(Kx.parentNode(o.value)),n=r(o.value);-1!==t&&-1!==n&&(e=o)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(Kx.parentNode(n.value));if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value,r=Kx.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=Kx.host(r);if(-1!==this.mirror.getId(t)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}o=e.previous,n.removeNode(e.value),i(e.value)}const s={texts:this.texts.map(e=>{const t=e.node,n=Kx.parentNode(t);return n&&"TEXTAREA"===n.tagName&&this.genTextAreaValueMutation(n),{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 n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).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))}),xb(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 n=Array.from(Kx.childNodes(e),e=>Kx.textContent(e)||"").join("");t.attributes.value=zb({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:$b(e),value:n,maskInputFn:this.maskInputFn})}),xb(this,"processMutation",e=>{if(!oC(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=Kx.textContent(e.target);iC(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:gw(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,rC(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,r=e.target.getAttribute(n);if("value"===n){const e=$b(t);r=zb({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(iC(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;n="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!fw(t.tagName,n)){if(i.attributes[n]=hw(this.doc,Wb(t.tagName),Wb(n),r),this.maskAttributeFn&&"string"==typeof i.attributes[n]){const e=this.maskAttributeFn(n,i.attributes[n],t);null!==e?i.attributes[n]=e:delete i.attributes[n]}if("style"===n){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const n=this.unattachedDoc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const r=t.style.getPropertyValue(e),o=t.style.getPropertyPriority(e);r!==n.style.getPropertyValue(e)||o!==n.style.getPropertyPriority(e)?i.styleDiff[e]=""===o?r:[r,o]:i._unchangedStyles[e]=[r,o]}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}else"open"===n&&"DIALOG"===t.tagName&&(t.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal")}break}case"childList":if(iC(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 n=this.mirror.getId(t),r=Fb(e.target)?this.mirror.getId(Kx.host(e.target)):this.mirror.getId(e.target);iC(e.target,this.blockClass,this.blockSelector,!1)||oC(t,this.mirror,this.slimDOMOptions)||(!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(IC(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||sC(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[CC(n,r)]?IC(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:!(!Fb(e.target)||!Ub(e.target))||void 0}),function(e,t){const n=[e];for(;n.length;){const e=n.pop();t.has(e)||(t.add(e),Kx.childNodes(e).forEach(e=>n.push(e)))}}(t,this.removesSubTreeCache)))),this.mapRemoves.push(t))})}}),xb(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(oC(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[CC(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);iC(e,this.blockClass,this.blockSelector,!1)||(Kx.childNodes(e).forEach(e=>this.genAdds(e)),cC(e)&&Kx.childNodes(Kx.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","captureAdoptedStyleSheets"].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 IC(e,t){e.delete(t),Kx.childNodes(t).forEach(t=>IC(e,t))}function OC(e,t,n){return 0!==e.size&&function(e,t){const n=Kx.parentNode(t);return!!n&&e.has(n)}(e,t)}function TC(e,t){return 0!==e.size&&PC(e,t)}function PC(e,t){const n=Kx.parentNode(t);return!!n&&(!!e.has(n)||PC(e,n))}let AC;const MC=e=>{if(!AC)return e;return(...t)=>{try{return e(...t)}catch(e){if(AC&&!0===AC(e))return;throw e}}};function RC(e){return(...t)=>{try{return e(...t)}catch(e){try{e._external_=!0}catch{}throw e}}}const _C=[];function NC(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 LC(e,t){const n=new EC;_C.push(n),n.init(e);const r=new($x())(MC(n.processMutations.bind(n)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function DC({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,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(mC).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(o=>{let s=Wb(o);const u=(t=>o=>{const s=NC(o);if(iC(s,r,i,!0))return;let a=null,u=t;if("pointerType"in o){switch(o.pointerType){case"mouse":a=yC.Mouse;break;case"touch":a=yC.Touch;break;case"pen":a=yC.Pen}a===yC.Touch?mC[t]===mC.MouseDown?u="TouchStart":mC[t]===mC.MouseUp&&(u="TouchEnd"):yC.Pen}else aC(o)&&(a=yC.Touch);null!==a?(l=a,(u.startsWith("Touch")&&a===yC.Touch||u.startsWith("Mouse")&&a===yC.Mouse)&&(a=null)):mC[t]===mC.Click&&(a=l,l=null);const c=aC(o)?o.changedTouches[0]:o;if(!c)return;const d=n.getId(s),{clientX:h,clientY:f}=c;MC(e)({type:mC[u],id:d,x:h,y:f,...null!==a&&{pointerType:a}},o)})(o);if(window.PointerEvent)switch(mC[o]){case mC.MouseDown:case mC.MouseUp:s=s.replace("mouse","pointer");break;case mC.TouchStart:case mC.TouchEnd:return}a.push(Hx(s,u,t))}),MC(()=>{a.forEach(e=>e())})}function FC({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){const s=MC(Yx(MC(o=>{const s=NC(o);if(!s||iC(s,r,i,!0))return;const a=n.getId(s);if(s===t&&t.defaultView){const n=eC(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})}),o.scroll||100));return Hx("scroll",s,t)}const UC=["INPUT","TEXTAREA","SELECT"],jC=new WeakMap;function BC(e){return function(e,t){if(VC("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||VC("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||VC("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||VC("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function qC(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function zC({mirror:e,stylesheetManager:t},n){var r,i,o;let s=null;s="#document"===n.nodeName?e.getId(n):e.getId(Kx.host(n));const a="#document"===n.nodeName?null==(r=n.defaultView)?void 0:r.Document:null==(o=null==(i=n.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(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var n;const r=null==(n=l.set)?void 0:n.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(e){}return r}}),MC(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function WC(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:h,selectionCb:f,customElementCb:p}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(e[0])},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),f(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),p(...e)}}(e,t),e.recordDOM&&(r=LC(e,e.doc));const i=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){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=Yx(MC(t=>{const n=Date.now()-s;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],s=null}),o),u=MC(Yx(MC(e=>{const t=NC(e),{clientX:n,clientY:i}=aC(e)?e.changedTouches[0]:e;s||(s=Zx()),a.push({x:n,y:i,id:r.getId(t),timeOffset:Zx()-s}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?vC.Drag:e instanceof MouseEvent?vC.MouseMove:vC.TouchMove)}),i,{trailing:!1})),c=[Hx("mousemove",u,n),Hx("touchmove",u,n),Hx("drag",u,n)];return MC(()=>{c.forEach(e=>e())})}(e),o=DC(e),s=FC(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return Hx("resize",MC(Yx(MC(()=>{const t=tC(),i=nC();n===t&&r===i||(e({width:Number(i),height:Number(t)}),n=t,r=i)}),200)),t)}(e,{win:n}),l=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:u,userTriggeredOnInput:c}){function d(e){let n=NC(e);const u=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=Kx.parentElement(n)),!n||!d||UC.indexOf(d)<0||iC(n,r,i,!0))return;if(n.classList.contains(o)||s&&n.matches(s))return;let f=n.value,p=!1;const g=$b(n)||"";"radio"===g||"checkbox"===g?p=n.checked:(a[d.toLowerCase()]||a[g])&&(f=zb({element:n,maskInputOptions:a,tagName:d,type:g,value:f,maskInputFn:l})),h(n,c?{text:f,isChecked:p,userTriggered:u}:{text:f,isChecked:p});const v=n.name;"radio"===g&&v&&p&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach(e=>{if(e!==n){const t=e.value;h(e,c?{text:t,isChecked:!p,userTriggered:!1}:{text:t,isChecked:!p})}})}function h(t,r){const i=jC.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){jC.set(t,r);const i=n.getId(t);MC(e)({...r,id:i})}}const f=("last"===u.input?["change"]:["input","change"]).map(e=>Hx(e,MC(d),t)),p=t.defaultView;if(!p)return()=>{f.forEach(e=>e())};const g=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),v=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&f.push(...v.map(e=>Xx(e[0],e[1],{set(){MC(d)({target:this,isTrusted:!1})}},!1,p))),MC(()=>{f.forEach(e=>e())})}(e),u=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){const s=MC(o=>Yx(MC(i=>{const s=NC(i);if(!s||iC(s,t,n,!0))return;const{currentTime:a,volume:l,muted:u,playbackRate:c,loop:d}=s;e({type:o,id:r.getId(s),currentTime:a,volume:l,muted:u,playbackRate:c,loop:d})}),i.media||500)),a=[Hx("play",s(wC.Play),o),Hx("pause",s(wC.Pause),o),Hx("seeked",s(wC.Seeked),o),Hx("volumechange",s(wC.VolumeChange),o),Hx("ratechange",s(wC.RateChange),o)];return MC(()=>{a.forEach(e=>e())})}(e);let c=()=>{},d=()=>{},h=()=>{},f=()=>{};e.recordDOM&&(c=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:MC((r,i,o)=>{const[s,a]=o,{id:l,styleId:u}=qC(i,t,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,adds:[{rule:s,index:a}]}),RC(()=>r.apply(i,o))()})}),r.CSSStyleSheet.prototype.addRule=function(e,t,n=this.cssRules.length){const i=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[i,n])};const o=r.CSSStyleSheet.prototype.deleteRule;let s,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:MC((r,i,o)=>{const[s]=o,{id:a,styleId:l}=qC(i,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:s}]}),RC(()=>r.apply(i,o))()})}),r.CSSStyleSheet.prototype.removeRule=function(e){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:MC((r,i,o)=>{const[s]=o,{id:a,styleId:l}=qC(i,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replace:s}),r.apply(i,o)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:MC((r,i,o)=>{const[s]=o,{id:a,styleId:l}=qC(i,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replaceSync:s}),r.apply(i,o)})}));const l={};$C("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:($C("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),$C("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),$C("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const u={};return Object.entries(l).forEach(([r,i])=>{u[r]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(u[r].insertRule,{apply:MC((r,i,o)=>{const[s,a]=o,{id:l,styleId:u}=qC(i.parentStyleSheet,t,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,adds:[{rule:s,index:[...BC(i),a||0]}]}),r.apply(i,o)})}),i.prototype.deleteRule=new Proxy(u[r].deleteRule,{apply:MC((r,i,o)=>{const[s]=o,{id:a,styleId:l}=qC(i.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:[...BC(i),s]}]}),r.apply(i,o)})})}),MC(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})})}(e,{win:n}),d=zC(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:MC((i,s,a)=>{var l;const[u,c,d]=a;if(n.has(u))return o.apply(s,[u,c,d]);const{id:h,styleId:f}=qC(null==(l=s.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||f&&-1!==f)&&e({id:h,styleId:f,set:{property:u,value:c,priority:d},index:BC(s.parentRule)}),i.apply(s,a)})});const s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:MC((i,o,a)=>{var l;const[u]=a;if(n.has(u))return s.apply(o,[u]);const{id:c,styleId:d}=qC(null==(l=o.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(c&&-1!==c||d&&-1!==d)&&e({id:c,styleId:d,remove:{property:u},index:BC(o.parentRule)}),i.apply(o,a)})}),MC(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}(e,{win:n}),e.collectFonts&&(f=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(e,t,n){const r=new o(e,t,n);return i.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const s=Qx(t.fonts,"add",function(t){return function(n){return setTimeout(MC(()=>{const t=i.get(n);t&&(e(t),i.delete(n))}),0),t.apply(this,[n])}});return r.push(()=>{n.FontFace=o}),r.push(s),MC(()=>{r.forEach(e=>e())})}(e)));const p=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e;let s=!0;const a=MC(()=>{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;iC(s,r,i,!0)||iC(u,r,i,!0)||a.push({start:n.getId(s),startOffset:l,end:n.getId(u),endOffset:c})}o({ranges:a})});return a(),Hx("selectionchange",a)}(e),g=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?Qx(n.customElements,"define",function(e){return function(n,r,i){try{t({define:{name:n}})}catch(e){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,r,i])}}):()=>{}}(e),v=[];for(const t of e.plugins)v.push(t.observer(t.callback,n,t.options));return MC(()=>{_C.forEach(e=>e.reset()),null==r||r.disconnect(),i(),o(),s(),a(),l(),u(),c(),d(),h(),f(),p(),g(),v.forEach(e=>e())})}function VC(e){return void 0!==window[e]}function $C(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class KC{constructor(e){xb(this,"iframeIdToRemoteIdMap",new WeakMap),xb(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,n,r){const i=n||this.getIdToRemoteIdMap(e),o=r||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 n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,r))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const i=r.get(t);return i||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}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 HC{constructor(e){xb(this,"iframes",new WeakMap),xb(this,"crossOriginIframeMap",new WeakMap),xb(this,"crossOriginIframeMirror",new KC(rw)),xb(this,"crossOriginIframeStyleMirror"),xb(this,"crossOriginIframeRootIdMap",new WeakMap),xb(this,"mirror"),xb(this,"mutationCb"),xb(this,"wrappedEmit"),xb(this,"loadListener"),xb(this,"stylesheetManager"),xb(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new KC(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n,r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(n=e.contentWindow)||n.addEventListener("message",this.handleMessage.bind(this))),null==(r=this.loadListener)||r.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 n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case gC.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:gC.IncrementalSnapshot,data:{source:vC.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case gC.Meta:case gC.Load:case gC.DomContentLoaded:return!1;case gC.Plugin:return t;case gC.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case gC.IncrementalSnapshot:switch(t.data.source){case vC.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case vC.Drag:case vC.TouchMove:case vC.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case vC.ViewportResize:return!1;case vC.MediaInteraction:case vC.MouseInteraction:case vC.Scroll:case vC.CanvasMutation:case vC.Input:return this.replaceIds(t.data,e,["id"]),t;case vC.StyleSheetRule:case vC.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case vC.Font:return t;case vC.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case vC.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(n=t.data.styles)||n.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,n,r){for(const i of r)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===SC.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}}class GC{constructor(e){xb(this,"shadowDoms",new WeakSet),xb(this,"mutationCb"),xb(this,"scrollCb"),xb(this,"bypassOptions"),xb(this,"mirror"),xb(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(!Ub(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=LC({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(FC({...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(Kx.host(e))),this.restoreHandlers.push(zC({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 n=this;this.restoreHandlers.push(Qx(e.prototype,"attachShadow",function(e){return function(r){const i=e.call(this,r),o=Kx.shadowRoot(this);return o&&pC(this)&&n.addShadowRoot(o,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var JC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",YC="undefined"==typeof Uint8Array?[]:new Uint8Array(256),XC=0;XC<64;XC++)YC[JC.charCodeAt(XC)]=XC;const QC=new Map;const ZC=(e,t,n)=>{if(!e||!nE(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=QC.get(e);return n||(n=new Map,QC.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let i=r.indexOf(e);return-1===i&&(i=r.length,r.push(e)),i};function eE(e,t,n){if(e instanceof Array)return e.map(e=>eE(e,t,n));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,n=new Uint8Array(e),r=n.length,i="";for(t=0;t<r;t+=3)i+=JC[n[t]>>2],i+=JC[(3&n[t])<<4|n[t+1]>>4],i+=JC[(15&n[t+1])<<2|n[t+2]>>6],i+=JC[63&n[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[eE(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[eE(e.data,t,n),e.width,e.height]}}if(nE(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:ZC(e,t,n)}}return e}const tE=(e,t,n)=>e.map(e=>eE(e,t,n)),nE=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(n.find(n=>e instanceof t[n]))};function rE(e,t,n,r){const i=[];try{const o=Qx(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(i,...o){if(!iC(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=e),r&&["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 iE(e,t,n,r,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=Qx(e,l,function(e){return function(...s){const a=e.apply(this,s);if(ZC(a,o,this),"tagName"in this.canvas&&!iC(this.canvas,r,i,!0)){const e=tE(s,o,this),r={type:t,property:l,args:e};n(this.canvas,r)}return a}});s.push(a)}catch{const r=Xx(e,l,{set(e){n(this.canvas,{type:t,property:l,args:[e],setter:!0})}});s.push(r)}return s}const oE='(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',sE="undefined"!=typeof self&&self.Blob&&new Blob([oE],{type:"text/javascript;charset=utf-8"});function aE(e){let t;try{if(t=sE&&(self.URL||self.webkitURL).createObjectURL(sE),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(oE),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class lE{constructor(e){xb(this,"pendingCanvasMutations",new Map),xb(this,"rafStamps",{latestId:0,invokeId:null}),xb(this,"mirror"),xb(this,"mutationCb"),xb(this,"resetObservers"),xb(this,"frozen",!1),xb(this,"locked",!1),xb(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:n,blockClass:r,blockSelector:i,recordCanvas:o,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(n,r,i),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,i,{dataURLOptions:s})}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,n,r,i){const o=rE(t,n,r,!0),s=new Map,a=new aE;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:i,height:o}=e.data;this.mutationCb({id:t,type:bC["2D"],commands:[{property:"clearRect",args:[0,0,i,o]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};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=>{iC(t,n,r,!0)||e.push(t)}),e})().forEach(async e=>{var t;const n=this.mirror.getId(e);if(s.get(n))return;if(0===e.width||0===e.height)return;if(s.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null==(t=null==n?void 0:n.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=await createImageBitmap(e);a.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[r])})),u=requestAnimationFrame(d)};u=requestAnimationFrame(d),this.resetObservers=()=>{o(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=rE(e,t,n,!1),i=function(e,t,n,r){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const o=Qx(t.CanvasRenderingContext2D.prototype,s,function(i){return function(...o){return iC(this.canvas,n,r,!0)||setTimeout(()=>{const n=tE(o,t,this);e(this.canvas,{type:bC["2D"],property:s,args:n})},0),i.apply(this,o)}});i.push(o)}catch{const n=Xx(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:bC["2D"],property:s,args:[t],setter:!0})}});i.push(n)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n),o=function(e,t,n,r){const i=[];return i.push(...iE(t.WebGLRenderingContext.prototype,bC.WebGL,e,n,r,t)),void 0!==t.WebGL2RenderingContext&&i.push(...iE(t.WebGL2RenderingContext.prototype,bC.WebGL2,e,n,r,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n);this.resetObservers=()=>{r(),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 n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map(e=>{const{type:t,...n}=e;return n}),{type:i}=n[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}}class uE{constructor(e){xb(this,"trackedLinkElements",new WeakSet),xb(this,"mutationCb"),xb(this,"adoptedStyleSheetCb"),xb(this,"styleMirror",new dC),xb(this,"inlinedAdoptedStyleSheetRuleIds",new Set),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}getInlinedAdoptedStyleSheetRuleIds(){return this.inlinedAdoptedStyleSheetRuleIds}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 n={id:t,styleIds:[]},r=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);let n=[];try{n=Array.from(t.cssRules,(e,n)=>({rule:Bb(e,t.href),index:n}))}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}r.push({styleId:e,rules:n})}n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.inlinedAdoptedStyleSheetRuleIds.clear()}trackStylesheetInLinkElement(e){}}class cE{constructor(){xb(this,"nodeMap",new WeakMap),xb(this,"active",!1)}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).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 dE,hE,fE,pE=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(wb=e.contentWindow)?void 0:wb.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const gE=new qb;function vE(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,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:f,maskInputFn:p,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:T=!1,captureAdoptedStyleSheets:P=!1,plugins:A,keepIframeSrcFn:M=()=>!1,ignoreCSSAttributes:R=new Set([]),errorHandler:_,applyBackgroundColorToBlockedElements:N=!1}=e;AC=_;const L=!C||window.parent===window;let D=!1;if(!L)try{window.parent.document&&(D=!1)}catch(e){D=!0}if(L&&!t)throw new Error("emit function is required");if(!L&&!D)return()=>{};void 0!==S&&void 0===b.mousemove&&(b.mousemove=S),gE.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===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===f,headMetaDescKeywords:"all"===f,headTitleMutations:"all"===f}:f||{};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 A||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!D&&(e=y(e)),e};dE=(e,i)=>{var o;const s=e;if(s.timestamp=Zx(),!(null==(o=_C[0])?void 0:o.isFrozen())||s.type===gC.FullSnapshot||s.type===gC.IncrementalSnapshot&&s.data.source===vC.Mutation||_C.forEach(e=>e.unfreeze()),L)null==t||t(q(s),i);else if(D){const e={type:"rrweb",event:q(s),origin:window.location.origin,isCheckout:i};window.parent.postMessage(e,"*")}if(s.type===gC.FullSnapshot)j=s,B=0;else if(s.type===gC.IncrementalSnapshot){if(s.data.source===vC.Mutation&&s.data.isAttachIframe)return;B++;const e=r&&B>=r,t=n&&s.timestamp-j.timestamp>n;(e||t)&&hE(!0)}};const z=e=>{dE({type:gC.IncrementalSnapshot,data:{source:vC.Mutation,...e}})},W=e=>dE({type:gC.IncrementalSnapshot,data:{source:vC.Scroll,...e}}),V=e=>dE({type:gC.IncrementalSnapshot,data:{source:vC.CanvasMutation,...e}}),$=new uE({mutationCb:z,adoptedStyleSheetCb:e=>dE({type:gC.IncrementalSnapshot,data:{source:vC.AdoptedStyleSheet,...e}})}),K=new HC({mirror:gE,mutationCb:z,stylesheetManager:$,recordCrossOriginIframes:C,wrappedEmit:dE});for(const e of A||[])e.getMirror&&e.getMirror({nodeMirror:gE,crossOriginIframeMirror:K.crossOriginIframeMirror,crossOriginIframeStyleMirror:K.crossOriginIframeStyleMirror});const H=new cE;fE=new lE({recordCanvas:x,mutationCb:V,win:window,blockClass:i,blockSelector:o,mirror:gE,sampling:b.canvas,dataURLOptions:w});const G=new GC({mutationCb:z,scrollCb:W,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:F,dataURLOptions:w,maskTextFn:g,maskInputFn:p,maskAttributeFn:v,recordCanvas:x,inlineImages:T,sampling:b,slimDOMOptions:U,iframeManager:K,stylesheetManager:$,canvasManager:fE,keepIframeSrcFn:M,processedNodeManager:H,captureAdoptedStyleSheets:P},mirror:gE});hE=(e=!1)=>{if(!k)return;dE({type:gC.Meta,data:{href:window.location.href,width:nC(),height:tC()}},e),$.reset(),G.init(),_C.forEach(e=>e.lock());const t=function(e,t){const{mirror:n=new qb,blockClass:r="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:f,slimDOM:p=!1,dataURLOptions:g,preserveWhiteSpace:v,onSerialize:m,onAdoptedStyleSheet:y,_emittedStyleIds:b,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:k,stylesheetLoadTimeout:x,keepIframeSrcFn:C=()=>!1,applyBackgroundColorToBlockedElements:E=!1}=t||{};return bw(e,{doc:e,mirror:n,blockClass:r,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:f,slimDOMOptions:!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===p,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===p?{}:p,dataURLOptions:g,inlineImages:l,recordCanvas:u,preserveWhiteSpace:v,onSerialize:m,onAdoptedStyleSheet:y,_emittedStyleIds:b,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:k,stylesheetLoadTimeout:x,keepIframeSrcFn:C,newlyAddedElement:!1,applyBackgroundColorToBlockedElements:E})}(document,{mirror:gE,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:F,maskTextFn:g,maskInputFn:p,maskAttributeFn:v,slimDOM:U,dataURLOptions:w,recordCanvas:x,inlineImages:T,applyBackgroundColorToBlockedElements:N,onSerialize:e=>{lC(e,gE)&&K.addIframe(e),uC(e,gE)&&$.trackLinkElement(e),cC(e)&&G.addShadowRoot(Kx.shadowRoot(e),document)},onAdoptedStyleSheet:P?e=>$.styleMirror.add(e):void 0,_emittedStyleIds:P?$.getInlinedAdoptedStyleSheetRuleIds():void 0,onIframeLoad:(e,t)=>{K.attachIframe(e,t),G.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{$.attachLinkElement(e,t)},keepIframeSrcFn:M});if(!t)return console.warn("Failed to snapshot the document");dE({type:gC.FullSnapshot,data:{node:t,initialOffset:eC(window)}},e),_C.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,gE.getId(document))};try{const e=[],t=e=>{var t;return MC(WC)({mutationCb:z,mousemoveCb:(e,t)=>dE({type:gC.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>dE({type:gC.IncrementalSnapshot,data:{source:vC.MouseInteraction,...e}}),scrollCb:W,viewportResizeCb:e=>dE({type:gC.IncrementalSnapshot,data:{source:vC.ViewportResize,...e}}),inputCb:e=>dE({type:gC.IncrementalSnapshot,data:{source:vC.Input,...e}}),mediaInteractionCb:e=>dE({type:gC.IncrementalSnapshot,data:{source:vC.MediaInteraction,...e}}),styleSheetRuleCb:e=>dE({type:gC.IncrementalSnapshot,data:{source:vC.StyleSheetRule,...e}}),styleDeclarationCb:e=>dE({type:gC.IncrementalSnapshot,data:{source:vC.StyleDeclaration,...e}}),canvasMutationCb:V,fontCb:e=>dE({type:gC.IncrementalSnapshot,data:{source:vC.Font,...e}}),selectionCb:e=>{dE({type:gC.IncrementalSnapshot,data:{source:vC.Selection,...e}})},customElementCb:e=>{dE({type:gC.IncrementalSnapshot,data:{source:vC.CustomElement,...e}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:u,maskInputOptions:F,inlineStylesheet:c,sampling:b,recordDOM:k,recordCanvas:x,inlineImages:T,userTriggeredOnInput:I,collectFonts:O,doc:e,maskInputFn:p,maskTextFn:g,maskAttributeFn:v,keepIframeSrcFn:M,blockSelector:o,slimDOMOptions:U,dataURLOptions:w,mirror:gE,iframeManager:K,stylesheetManager:$,shadowDomManager:G,processedNodeManager:H,captureAdoptedStyleSheets:P,canvasManager:fE,ignoreCSSAttributes:R,plugins:(null==(t=null==A?void 0:A.filter(e=>e.observer))?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>dE({type:gC.Plugin,data:{plugin:e.name,payload:t}})})))||[]},m)};K.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}});const n=()=>{hE(),e.push(t(document)),pE=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(Hx("DOMContentLoaded",()=>{dE({type:gC.DomContentLoaded,data:{}}),"DOMContentLoaded"===E&&n()})),e.push(Hx("load",()=>{dE({type:gC.Load,data:{}}),"load"===E&&n()},window))),()=>{e.forEach(e=>e()),H.destroy(),pE=!1,AC=void 0}}catch(e){console.warn(e)}}var mE;vE.addCustomEvent=(e,t)=>{if(!pE)throw new Error("please add custom event after start recording");dE({type:gC.Custom,data:{tag:e,payload:t}})},vE.freezePage=()=>{_C.forEach(e=>e.freeze())},vE.takeFullSnapshot=e=>{if(!pE)throw new Error("please take full snapshot after start recording");hE(e)},vE.mirror=gE,vE.supportsNativeMouseInteraction=!0,function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(mE||(mE={}));var yE=Object.freeze({__proto__:null,record:vE}),bE=function(e){return void 0!==e&&("boolean"==typeof e?e:!1!==e.enabled)},wE=function(e,t,n,r){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,n){if(0===t.length&&0===n.length)return e;var r=t.length>0?t:["/**"];try{var i=JSON.parse(e);return Wt(i,r,n),JSON.stringify(i)}catch(t){return e}}(e,i.allowlist,i.excludelist);return r(o,n)},SE=["image/","audio/","video/","application/octet-stream","font/"];function kE(e,t){return function(e,t){t<0&&(t=0);for(var n=e.length,r=0,i=0;i<n;i++){var o=e.charCodeAt(i),s=1,a=1;if(o<=127)s=1;else if(o<=2047)s=2;else if(o>=55296&&o<=56319){var l=i+1<n?e.charCodeAt(i+1):NaN;l>=56320&&l<=57343?(s=4,a=2):s=3}else s=3;if(r+s>t)break;r+=s,2===a&&i++}return i>=n?{value:e,truncated:!1}:{value:e.slice(0,i),truncated:!0}}(e,t)}var xE=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 n=t.fetch;n&&(t.fetch=function(t,r){return l(e,void 0,void 0,function(){var e,i,o,s,a,l,c,d,h,f,p,g,v=this;return u(this,function(u){switch(u.label){case 0:e=Date.now(),i={timestamp:e,type:"fetch",method:(null==r?void 0:r.method)||"GET",url:t.toString(),requestHeaders:null==r?void 0:r.headers},(o=null===(p=this.networkConfig)||void 0===p?void 0:p.body)&&bE(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,n){t.push("".concat(n,"=").concat("string"==typeof e?e:"[File]"))}),t.join("&")}}}(null==r?void 0:r.body))&&(a=null!==(g=o.maxBodySizeBytes)&&void 0!==g?g:10240,i.requestBody=wE(s,o.request,a,kE).value),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,n(t,r)];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&&bE(o.response)?!function(e){return!!e&&SE.some(function(t){return e.toLowerCase().startsWith(t)})}(c["content-type"]||null)?l.clone().text().then(function(e){var t,n=null!==(t=o.maxBodySizeBytes)&&void 0!==t?t:10240,r=wE(e,o.response,n,kE),s=r.value,a=r.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,f=d,i.error={name:f.name||"UnknownError",message:f.message||"An unknown error occurred"},this.notifyEvent(i),d;case 4:return[2]}})})},this.fetchObserver=function(){t.fetch=n})}},e}(),CE=Object.freeze({__proto__:null,NetworkObservers:xE});e.Identify=F,e.Revenue=ie,e.Types=jr,e._setDiagnosticsSampleRate=Gf,e.add=Qf,e.createInstance=Kf,e.experiment=Yf,e.extendSession=Zf,e.flush=ep,e.getDeviceId=tp,e.getIdentity=np,e.getOptOut=rp,e.getSessionId=ip,e.getUserId=op,e.groupIdentify=sp,e.identify=ap,e.initAll=Jf,e.logEvent=lp,e.remove=up,e.reset=cp,e.revenue=dp,e.sessionReplay=Xf,e.setDeviceId=hp,e.setGroup=fp,e.setIdentity=pp,e.setOptOut=gp,e.setSessionId=vp,e.setTransport=mp,e.setUserId=yp,e.track=bp,Object.defineProperty(e,"__esModule",{value:!0})});