@grafana/faro-web-sdk 1.2.2 → 1.2.3

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
- var GrafanaFaroWebSdk=function(e){"use strict";function n(e,n){return typeof e===n}function t(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function i(e,n){try{return e instanceof n}catch(e){return!1}}const r=e=>n(e,"undefined"),o=e=>n(e,"null"),s=e=>n(e,"string"),a=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),l=e=>!o(e)&&n(e,"object"),u=e=>n(e,"function"),c=e=>t(e,"Array"),d=e=>!l(e)&&!u(e),p=!r(Event),f=e=>p&&i(e,Event),g="undefined"!=typeof Error,b=e=>g&&i(e,Error),v=e=>t(e,"ErrorEvent"),m=e=>t(e,"DOMError"),h=e=>t(e,"DOMException"),w="undefined"!=typeof Element,y="undefined"!=typeof Map;function E(e,t){if(e===t)return!0;if(n(e,"number")&&isNaN(e))return n(t,"number")&&isNaN(t);const i=c(e),r=c(t);if(i!==r)return!1;if(i&&r){const n=e.length;if(n!==t.length)return!1;for(let i=n;0!=i--;)if(!E(e[i],t[i]))return!1;return!0}const o=l(e),s=l(t);if(o!==s)return!1;if(e&&t&&o&&s){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let e of n)if(!i.includes(e))return!1;for(let i of n)if(!E(e[i],t[i]))return!1;return!0}return!1}function x(){return(new Date).toISOString()}var T;e.LogLevel=void 0,(T=e.LogLevel||(e.LogLevel={})).TRACE="trace",T.DEBUG="debug",T.INFO="info",T.LOG="log",T.WARN="warn",T.ERROR="error";const k=e.LogLevel.LOG,S=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function O(){}function I(e){const{size:n,concurrency:t}=e,i=[];let r=0;const o=()=>{if(r<t&&i.length){const{producer:e,resolve:n,reject:t}=i.shift();r++,e().then((e=>{r--,o(),n(e)}),(e=>{r--,o(),t(e)}))}};return{add:e=>{if(i.length+r>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{i.push({producer:e,resolve:n,reject:t}),o()}))}}}const L="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function A(e=10){return Array.from(Array(e)).map((()=>L[Math.floor(Math.random()*L.length)])).join("")}function C(){return Date.now()}var j="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},N={exports:{}},R={exports:{}};R.exports=function(e,n){var t,i,r,o,s,a,l,u;for(t=3&e.length,i=e.length-t,r=n,s=3432918353,a=461845907,u=0;u<i;)l=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,r=27492+(65535&(o=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,t){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return r^=e.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0};var D=R.exports,M={exports:{}};!function(e){e.exports=function(e,n){for(var t,i=e.length,r=n^i,o=0;i>=4;)t=1540483477*(65535&(t=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(t>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(t=1540483477*(65535&(t^=t>>>24))+((1540483477*(t>>>16)&65535)<<16)),i-=4,++o;switch(i){case 3:r^=(255&e.charCodeAt(o+2))<<16;case 2:r^=(255&e.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0}}(M);var P=D,_=M.exports;N.exports=P;var B=N.exports.murmur3=P;N.exports.murmur2=_;class z{constructor(e,n){var t,i;this.signalBuffer=[],this.itemLimit=null!==(t=null==n?void 0:n.itemLimit)&&void 0!==t?t:50,this.sendTimeout=null!==(i=null==n?void 0:n.sendTimeout)&&void 0!==i?i:250,this.paused=(null==n?void 0:n.paused)||!1,this.sendFn=e,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&this.flush()}))}addItem(e){this.paused||(this.signalBuffer.push(e),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval((()=>this.flush()),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(e){const n=new Map;return e.forEach((e=>{const t=B(JSON.stringify(e.meta));let i=n.get(t);i=void 0===i?[e]:[...i,e],n.set(t,i)})),Array.from(n.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var F;e.TransportItemType=void 0,(F=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",F.LOG="log",F.MEASUREMENT="measurement",F.TRACE="trace",F.EVENT="event";const U={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function $(n){return t=>{if(t.type===e.TransportItemType.EXCEPTION&&t.payload){const e=t.payload,i=`${e.type}: ${e.value}`;if(function(e,n){return e.some((e=>s(e)?n.includes(e):!!n.match(e)))}(n,i))return null}return t}}var V;e.InternalLoggerLevel=void 0,(V=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[V.OFF=0]="OFF",V[V.ERROR=1]="ERROR",V[V.WARN=2]="WARN",V[V.INFO=3]="INFO",V[V.VERBOSE=4]="VERBOSE";const q={debug:O,error:O,info:O,prefix:"Faro",warn:O},G=e.InternalLoggerLevel.ERROR,W=Object.assign({},console);let H=W;function K(e){var n;return H=null!==(n=e.unpatchedConsole)&&void 0!==n?n:H,H}function X(n=W,t=G){const i=q;return t>e.InternalLoggerLevel.OFF&&(i.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${i.prefix}\n`,...e)}:O,i.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${i.prefix}\n`,...e)}:O,i.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${i.prefix}\n`,...e)}:O,i.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${i.prefix}\n`,...e)}:O),i}let J=q;function Z(e,n){return J=X(e,n.internalLoggerLevel),J}class Q{constructor(){this.unpatchedConsole=W,this.internalLogger=q,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}class Y extends Q{isBatched(){return!1}getIgnoreUrls(){return[]}}function ee(e,n){var t,i;if(void 0===n)return e;if(void 0===e)return{resourceSpans:n};const r=null===(t=e.resourceSpans)||void 0===t?void 0:t[0];if(void 0===r)return e;const o=(null==r?void 0:r.scopeSpans)||[],s=(null===(i=null==n?void 0:n[0])||void 0===i?void 0:i.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},r),{scopeSpans:[...o,...s]})]})}function ne(n){let t={meta:{}};return void 0!==n[0]&&(t.meta=n[0].meta),n.forEach((n=>{switch(n.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:const i=U[n.type],r=t[i];t=Object.assign(Object.assign({},t),{[i]:void 0===r?[n.payload]:[...r,n.payload]});break;case e.TransportItemType.TRACE:t=Object.assign(Object.assign({},t),{traces:ee(t.traces,n.payload.resourceSpans)})}})),t}const te="Error";let ie;function re(n,t,i,r,s){t.debug("Initializing API");const a=function(n,t,i,r,o){let s;return t.debug("Initializing traces API"),{getOTEL:()=>s,getTraceContext:()=>{const e=null==s?void 0:s.trace.getSpanContext(s.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),s={trace:e,context:n}},isOTELInitialized:()=>!!s,pushTraces:n=>{try{const i={type:e.TransportItemType.TRACE,payload:n,meta:r.value};t.debug("Pushing trace\n",i),o.execute(i)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,r,s);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a),function(n,t,i,r,s,a){var l;t.debug("Initializing exceptions API");let u=null;ie=null!==(l=i.parseStacktrace)&&void 0!==l?l:ie;const c=e=>{t.debug("Changing stacktrace parser"),ie=null!=e?e:ie};return c(i.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>ie,pushError:(n,{skipDedupe:l,stackFrames:c,type:d,context:p}={})=>{d=d||n.name||te;const f={meta:r.value,payload:{type:d,value:n.message,timestamp:x(),trace:a.getTraceContext(),context:null!=p?p:{}},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==ie?void 0:ie(n).frames:void 0)?void 0:c.length)&&(f.payload.stacktrace={frames:c});const g={type:f.payload.type,value:f.payload.value,stackTrace:f.payload.stacktrace,context:f.payload.context};l||!i.dedupe||o(u)||!E(g,u)?(u=g,t.debug("Pushing exception\n",f),s.execute(f)):t.debug("Skipping error push because it is the same as the last one\n",f.payload)}}}(0,t,i,r,s,a)),function(e,n,t,i,r){let o,s,a;n.debug("Initializing meta API");const l=e=>{s&&i.remove(s),s={user:e},i.add(s)},u=e=>{o&&i.remove(o),o={session:e},i.add(o)};return{setUser:l,resetUser:l,setSession:u,resetSession:u,getSession:()=>i.value.session,setView:e=>{a&&i.remove(a),a={view:e},i.add(a)},getView:()=>i.value.view}}(0,t,0,r)),function(n,t,i,r,s,a){t.debug("Initializing logs API");let l=null;return{pushLog:(n,{context:u,level:c,skipDedupe:d}={})=>{try{const p={type:e.TransportItemType.LOG,payload:{message:n.map((e=>{try{return String(e)}catch(e){return""}})).join(" "),level:null!=c?c:k,context:null!=u?u:{},timestamp:x(),trace:a.getTraceContext()},meta:r.value},f={message:p.payload.message,level:p.payload.level,context:p.payload.context};if(!d&&i.dedupe&&!o(l)&&E(f,l))return void t.debug("Skipping log push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing log\n",p),s.execute(p)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,i,r,s,a)),function(n,t,i,r,s,a){t.debug("Initializing measurements API");let l=null;return{pushMeasurement:(n,{skipDedupe:u,context:c}={})=>{var d;try{const p={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:a.getTraceContext(),timestamp:null!==(d=n.timestamp)&&void 0!==d?d:x(),context:null!=c?c:{}}),meta:r.value},f={type:p.payload.type,values:p.payload.values,context:p.payload.context};if(!u&&i.dedupe&&!o(l)&&E(f,l))return void t.debug("Skipping measurement push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing measurement\n",p),s.execute(p)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,i,r,s,a)),function(n,t,i,r,s,a){let l=null;return{pushEvent:(n,u,c,{skipDedupe:d}={})=>{try{const p={meta:r.value,payload:{name:n,domain:null!=c?c:i.eventDomain,attributes:u,timestamp:x(),trace:a.getTraceContext()},type:e.TransportItemType.EVENT},f={name:p.payload.name,attributes:p.payload.attributes,domain:p.payload.domain};if(!d&&i.dedupe&&!o(l)&&E(f,l))return void t.debug("Skipping event push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing event\n",p),s.execute(p)}catch(e){t.error("Error pushing event",e)}}}}(0,t,i,r,s,a))}const oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;class se extends Q{constructor(){super(...arguments),this.api={},this.transports={}}}const ae="1.2.2";const le="_faroInternal";function ue(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(oe,le,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function ce(){return le in oe}function de(n,t,i,r,o,s,a){return t.debug("Initializing Faro"),e.faro={api:s,config:i,instrumentations:a,internalLogger:t,metas:r,pause:o.pause,transports:o,unpatchedConsole:n,unpause:o.unpause},ue(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in oe)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(oe,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}function pe(e){const n=K(e),t=Z(n,e);if(ce()&&!e.isolate)return void t.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');t.debug("Initializing");const i=function(e,n,t){let i=[],r=[];const o=()=>i.reduce(((e,n)=>Object.assign(e,u(n)?n():n)),{}),s=()=>{if(r.length){const e=o();r.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),i.push(...e),s()},remove:(...e)=>{n.debug("Removing metas\n",e),i=i.filter((n=>!e.includes(n))),s()},addListener:e=>{n.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),r=r.filter((n=>n!==e))},get value(){return o()}}}(0,t),r=function(e,n,t,i){var r;n.debug("Initializing transports");const o=[];let s=t.paused,a=[];const l=e=>{let n=e;for(const e of a){const t=n.map(e).filter(Boolean);if(0===t.length)return[];n=t}return n},u=e=>{const t=l(e);if(0!==t.length)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)},c=e=>{var i;const[r]=l([e]);if(void 0!==r)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,r),e.isBatched()?(null===(i=t.batching)||void 0===i?void 0:i.enabled)||e.send([r]):e.send(r)};let d;return(null===(r=t.batching)||void 0===r?void 0:r.enabled)&&(d=new z(u,{sendTimeout:t.batching.sendTimeout,itemLimit:t.batching.itemLimit,paused:s})),{add:(...r)=>{n.debug("Adding transports"),r.forEach((r=>{n.debug(`Adding "${r.name}" transport`),o.some((e=>e===r))?n.warn(`Transport ${r.name} is already added`):(r.unpatchedConsole=e,r.internalLogger=n,r.config=t,r.metas=i,o.push(r))}))},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",a),e.forEach((e=>{e&&a.push(e)}))},addIgnoreErrorsPatterns:(...e)=>{n.debug("Adding ignoreErrorsPatterns\n",e),e.forEach((e=>{e&&a.push($(e))}))},getBeforeSendHooks:()=>[...a],execute:e=>{var n;s||((null===(n=t.batching)||void 0===n?void 0:n.enabled)?(null==d||d.addItem(e),c(e)):c(e))},isPaused:()=>s,pause:()=>{n.debug("Pausing transports"),null==d||d.pause(),s=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach((e=>{n.debug(`Removing "${e.name}" transport`);const t=o.indexOf(e);-1!==t?o.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{a.filter((n=>!e.includes(n)))},get transports(){return[...o]},unpause:()=>{n.debug("Unpausing transports"),null==d||d.start(),s=!1}}}(n,t,e,i),o=re(0,t,e,i,r),s=function(e,n,t,i,r,o){n.debug("Initializing instrumentations");const s=[];return{add:(...a)=>{n.debug("Adding instrumentations"),a.forEach((a=>{n.debug(`Adding "${a.name}" instrumentation`),s.some((e=>e.name===a.name))?n.warn(`Instrumentation ${a.name} is already added`):(a.unpatchedConsole=e,a.internalLogger=n,a.config=t,a.metas=i,a.transports=r,a.api=o,s.push(a),a.initialize())}))},get instrumentations(){return[...s]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,i;n.debug(`Removing "${e.name}" instrumentation`);const r=s.reduce(((n,t,i)=>null===n&&t.name===e.name?i:null),null);r?(null===(i=(t=s[r]).destroy)||void 0===i||i.call(t),s.splice(r,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,i,r,o),a=de(n,t,e,i,r,o,s);return function(e){var n,t,i;const r={sdk:{name:"@grafana/faro-core",version:ae,integrations:e.config.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}},o=null!==(t=null===(n=e.config.experimentalSessions)||void 0===n?void 0:n.session)&&void 0!==t?t:e.config.session;o&&e.api.setSession(o),e.config.app&&(r.app=e.config.app),e.config.user&&(r.user=e.config.user),e.config.view&&(r.view=e.config.view),e.metas.add(r,...null!==(i=e.config.metas)&&void 0!==i?i:[])}(a),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(a),function(e){e.instrumentations.add(...e.config.instrumentations)}(a),a}e.faro={};const fe="faro",ge={enabled:!0,sendTimeout:250,itemLimit:50},be={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}};const ve=function(n){var t;try{let e;e=window[n];const t="__faro_storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(i){return null===(t=e.faro.internalLogger)||void 0===t||t.info(`Web storage of type ${n} is not available. Reason: ${i}`),!1}}("localStorage");const me="__FARO_SESSION__";function he(e){const n=C();return{sessionId:null!=e?e:A(),lastActivity:n,started:n}}function we(e){!function(e,n){if(ve)try{localStorage.setItem(e,n)}catch(e){}}(me,JSON.stringify(e))}function ye(){const e=(n=me,ve?localStorage.getItem(n):null);var n;return e?JSON.parse(e):null}function Ee(e){if(null==e)return!1;const n=C();if(!(n-e.started<144e5))return!1;return n-e.lastActivity<9e5}function xe(n){const t=function(e,n){let t,i=!1;const r=()=>{null!=t?(e(...t),t=null,setTimeout(r,n)):i=!1};return(...o)=>{i?t=o:(e(...o),i=!0,setTimeout(r,n))}}((()=>{var n,t,i,r,o,s;const a=ye();if(Ee(a))we(Object.assign(Object.assign({},a),{lastActivity:C()}));else{let l=he();l=Object.assign(Object.assign({},l),{sessionMeta:{id:l.sessionId,attributes:Object.assign(Object.assign({},null!==(t=null===(n=e.faro.metas.value.session)||void 0===n?void 0:n.attributes)&&void 0!==t?t:{}),null!=a?{previousSession:a.sessionId}:{})}}),we(l),null===(i=e.faro.api)||void 0===i||i.setSession(l.sessionMeta),null===(o=null===(r=e.faro.config.experimentalSessions)||void 0===r?void 0:r.onSessionChange)||void 0===o||o.call(r,null!==(s=null==a?void 0:a.sessionMeta)&&void 0!==s?s:null,l.sessionMeta)}}),1e3);return{handleUpdate:t,init:function(){we(he(n)),document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&t()})),window.addEventListener("storage",(n=>{var t,i,r;if(n.key!==me)return;const o=JSON.parse(null!==(t=n.newValue)&&void 0!==t?t:""),s=JSON.parse(null!==(i=n.oldValue)&&void 0!==i?i:"");o.sessionId!==s.sessionId&&(null===(r=e.faro.api)||void 0===r||r.setSession(o.sessionMeta))})),e.faro.metas.addListener((function(n){var t,i;const r=n.session,o=ye();if(r&&r.id!==(null==o?void 0:o.sessionId)){const n=Object.assign(Object.assign({},he(r.id)),{sessionMeta:{id:r.id,attributes:Object.assign(Object.assign(Object.assign({},null!==(i=null===(t=null==o?void 0:o.sessionMeta)||void 0===t?void 0:t.attributes)&&void 0!==i?i:{}),r.attributes),o?{previousSession:o.sessionId}:{})}});we(n),e.faro.api.setSession(n.sessionMeta)}}))}}}function Te(n){var t;return(null===(t=e.faro.config.experimentalSessions)||void 0===t?void 0:t.persistent)&&ve?xe(n):function(n){let t=he(n);function i(){var n,i,r,o,s;if(Ee(t))t.lastActivity=C();else{t=he();const a=e.faro.metas.value.session,l={id:t.sessionId,attributes:Object.assign(Object.assign({},null!==(i=null===(n=e.faro.metas.value.session)||void 0===n?void 0:n.attributes)&&void 0!==i?i:{}),(null==a?void 0:a.id)?{previousSession:a.id}:{})};null===(o=null===(r=e.faro.config.experimentalSessions)||void 0===r?void 0:r.onSessionChange)||void 0===o||o.call(r,null!=a?a:null,l),null===(s=e.faro.api)||void 0===s||s.setSession(l)}}return{handleUpdate:i,init:function(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&i()})),e.faro.metas.addListener((function(n){var i;const r=n.session;if(r&&r.id!==(null==t?void 0:t.sessionId)){const n=t.sessionId;t=he(r.id),e.faro.api.setSession({id:t.sessionId,attributes:Object.assign(Object.assign({},null!==(i=r.attributes)&&void 0!==i?i:{}),{previousSession:n})})}}))}}}(n)}class ke extends se{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=ae}sendSessionStartEvent(e){var n;const t=e.session;t&&t.id!==(null===(n=this.notifiedSession)||void 0===n?void 0:n.id)&&(this.notifiedSession=t,this.api.pushEvent(be.EventNames.SESSION_START,{},void 0,{skipDedupe:!0}))}initialize(){var e,n,t;this.logDebug("init session instrumentation"),this.sendSessionStartEvent(this.metas.value),this.metas.addListener(this.sendSessionStartEvent.bind(this)),(null===(e=this.config.experimentalSessions)||void 0===e?void 0:e.enabled)&&(this.sessionUpdater=Te(null===(n=this.metas.value.session)||void 0===n?void 0:n.id),this.sessionUpdater.init(),null===(t=this.transports)||void 0===t||t.addBeforeSendHooks(...this.transports.getBeforeSendHooks(),(e=>{var n;return null===(n=this.sessionUpdater)||void 0===n||n.handleUpdate(),e})))}}class Se extends se{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=ae}initialize(){this.logDebug("Initializing\n",this.options),S.filter((e=>{var n;return!(null!==(n=this.options.disabledLevels)&&void 0!==n?n:Se.defaultDisabledLevels).includes(e)})).forEach((e=>{console[e]=(...n)=>{try{this.api.pushLog(n,{level:e})}catch(e){this.logError(e)}finally{this.unpatchedConsole[e](...n)}}}))}}Se.defaultDisabledLevels=[e.LogLevel.DEBUG,e.LogLevel.TRACE,e.LogLevel.LOG];const Oe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ie=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Le=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ae="address at ",Ce=Ae.length,je=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ne=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Re="safari-extension",De="safari-web-extension",Me=/Minified React error #\d+;/i;function Pe(e,n,t,i){const r={filename:e||document.location.href,function:n||"?"};return void 0!==t&&(r.lineno=t),void 0!==i&&(r.colno=i),r}function _e(e,n){const t=null==e?void 0:e.includes(Re),i=!t&&(null==e?void 0:e.includes(De));return t||i?[(null==e?void 0:e.includes("@"))?e.split("@")[0]:e,t?`${Re}:${n}`:`${De}:${n}`]:[e,n]}function Be(e){let n=[];e.stacktrace?n=e.stacktrace.split("\n").filter(((e,n)=>n%2==0)):e.stack&&(n=e.stack.split("\n"));const t=n.reduce(((n,t,i)=>{let r,o,s,l,u;if(r=Ie.exec(t)){if(o=r[1],s=r[2],l=r[3],u=r[4],null==s?void 0:s.startsWith("eval")){const e=Le.exec(s);e&&(s=e[1],l=e[2],u=e[3])}s=(null==s?void 0:s.startsWith(Ae))?s.substring(Ce):s,[o,s]=_e(o,s)}else if(r=je.exec(t)){if(o=r[1],s=r[3],l=r[4],u=r[5],s&&s.includes(" > eval")){const e=Ne.exec(s);e&&(o=o||"eval",s=e[1],l=e[2])}else 0===i&&!u&&a(e.columnNumber)&&(u=String(e.columnNumber+1));[o,s]=_e(o,s)}return(s||o)&&n.push(Pe(s,o,l?Number(l):void 0,u?Number(u):void 0)),n}),[]);return Me.test(e.message)?t.slice(1):t}function ze(e){return{frames:Be(e)}}function Fe(e){let n,t,i,r,o=[];if(v(e)&&e.error)n=e.error.message,t=e.error.name,o=Be(e.error);else if((i=m(e))||h(e)){const{name:r,message:o}=e;t=null!=r?r:i?"DOMError":"DOMException",n=o?`${t}: ${o}`:t}else b(e)?(n=e.message,o=Be(e)):(l(e)||(r=f(e)))&&(t=r?e.constructor.name:void 0,n=`Non-Error exception captured with keys: ${Object.keys(e)}`);return[n,t,o]}function Ue(e){const n=window.onerror;window.onerror=(...t)=>{try{const[i,r,o,a,l]=t;let u,c,d=[];const p=s(i),f=Pe(r,"?",o,a);l||!p?([u,c,d]=Fe(null!=l?l:i),0===d.length&&(d=[f])):p&&([u,c]=function(e){var n,t;const i=e.match(Oe),r=null!==(n=null==i?void 0:i[1])&&void 0!==n?n:te;return[null!==(t=null==i?void 0:i[2])&&void 0!==t?t:e,r]}(i),d=[f]),u&&e.pushError(new Error(u),{type:c,stackFrames:d})}finally{null==n||n.apply(window,t)}}}class $e extends se{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=ae}initialize(){var e;this.logDebug("Initializing"),Ue(this.api),e=this.api,window.addEventListener("unhandledrejection",(n=>{var t,i;let r,o,s=n;s.reason?s=n.reason:(null===(t=n.detail)||void 0===t?void 0:t.reason)&&(s=null===(i=n.detail)||void 0===i?void 0:i.reason);let a=[];d(s)?(r=`Non-Error promise rejection captured with value: ${String(s)}`,o="UnhandledRejection"):[r,o,a]=Fe(s),r&&e.pushError(new Error(r),{type:o,stackFrames:a})}))}}class Ve extends se{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=ae}sendViewChangedEvent(e){const n=e.view;n&&n!==this.notifiedView&&(this.notifiedView=n,this.api.pushEvent(be.EventNames.VIEW_CHANGED,{},void 0,{skipDedupe:!0}))}initialize(){this.sendViewChangedEvent(this.metas.value),this.metas.addListener(this.sendViewChangedEvent.bind(this))}}var qe,Ge,We,He,Ke,Xe=-1,Je=function(e){addEventListener("pageshow",(function(n){n.persisted&&(Xe=n.timeStamp,e(n))}),!0)},Ze=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},Qe=function(){var e=Ze();return e&&e.activationStart||0},Ye=function(e,n){var t=Ze(),i="navigate";return Xe>=0?i="back-forward-cache":t&&(document.prerendering||Qe()>0?i="prerender":document.wasDiscarded?i="restore":t.type&&(i=t.type.replace(/_/g,"-"))),{name:e,value:void 0===n?-1:n,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},en=function(e,n,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){n(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},t||{})),i}}catch(e){}},nn=function(e,n,t,i){var r,o;return function(s){n.value>=0&&(s||i)&&((o=n.value-(r||0))||void 0===r)&&(r=n.value,n.delta=o,n.rating=function(e,n){return e>n[1]?"poor":e>n[0]?"needs-improvement":"good"}(n.value,t),e(n))}},tn=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},rn=function(e){var n=function(n){"pagehide"!==n.type&&"hidden"!==document.visibilityState||e(n)};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},on=function(e){var n=!1;return function(t){n||(e(t),n=!0)}},sn=-1,an=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},ln=function(e){"hidden"===document.visibilityState&&sn>-1&&(sn="visibilitychange"===e.type?e.timeStamp:0,cn())},un=function(){addEventListener("visibilitychange",ln,!0),addEventListener("prerenderingchange",ln,!0)},cn=function(){removeEventListener("visibilitychange",ln,!0),removeEventListener("prerenderingchange",ln,!0)},dn=function(){return sn<0&&(sn=an(),un(),Je((function(){setTimeout((function(){sn=an(),un()}),0)}))),{get firstHiddenTime(){return sn}}},pn=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},fn=[1800,3e3],gn=function(e,n){n=n||{},pn((function(){var t,i=dn(),r=Ye("FCP"),o=en("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-Qe(),0),r.entries.push(e),t(!0)))}))}));o&&(t=nn(e,r,fn,n.reportAllChanges),Je((function(i){r=Ye("FCP"),t=nn(e,r,fn,n.reportAllChanges),tn((function(){r.value=performance.now()-i.timeStamp,t(!0)}))})))}))},bn=[.1,.25],vn={passive:!0,capture:!0},mn=new Date,hn=function(e,n){qe||(qe=n,Ge=e,We=new Date,En(removeEventListener),wn())},wn=function(){if(Ge>=0&&Ge<We-mn){var e={entryType:"first-input",name:qe.type,target:qe.target,cancelable:qe.cancelable,startTime:qe.timeStamp,processingStart:qe.timeStamp+Ge};He.forEach((function(n){n(e)})),He=[]}},yn=function(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,n){var t=function(){hn(e,n),r()},i=function(){r()},r=function(){removeEventListener("pointerup",t,vn),removeEventListener("pointercancel",i,vn)};addEventListener("pointerup",t,vn),addEventListener("pointercancel",i,vn)}(n,e):hn(n,e)}},En=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,yn,vn)}))},xn=[100,300],Tn=0,kn=1/0,Sn=0,On=function(e){e.forEach((function(e){e.interactionId&&(kn=Math.min(kn,e.interactionId),Sn=Math.max(Sn,e.interactionId),Tn=Sn?(Sn-kn)/7+1:0)}))},In=function(){return Ke?Tn:performance.interactionCount||0},Ln=function(){"interactionCount"in performance||Ke||(Ke=en("event",On,{type:"event",buffered:!0,durationThreshold:0}))},An=[200,500],Cn=0,jn=function(){return In()-Cn},Nn=[],Rn={},Dn=function(e){var n=Nn[Nn.length-1],t=Rn[e.interactionId];if(t||Nn.length<10||e.duration>n.latency){if(t)t.entries.push(e),t.latency=Math.max(t.latency,e.duration);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};Rn[i.id]=i,Nn.push(i)}Nn.sort((function(e,n){return n.latency-e.latency})),Nn.splice(10).forEach((function(e){delete Rn[e.id]}))}},Mn=[2500,4e3],Pn={},_n=[800,1800],Bn=function e(n){document.prerendering?pn((function(){return e(n)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(n)}),!0):setTimeout(n,0)};class zn extends se{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=ae}initialize(){this.logDebug("Initializing"),Object.entries(zn.mapping).forEach((([e,n])=>{n((n=>{this.api.pushMeasurement({type:"web-vitals",values:{[e]:n.value}})}))}))}}function Fn(e={}){const n=[new $e,new zn,new ke,new Ve];return!1!==e.captureConsole&&n.push(new Se({disabledLevels:e.captureConsoleDisabledLevels})),n}zn.mapping={cls:function(e,n){n=n||{},gn(on((function(){var t,i=Ye("CLS",0),r=0,o=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=o[0],t=o[o.length-1];r&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(r+=e.value,o.push(e)):(r=e.value,o=[e])}})),r>i.value&&(i.value=r,i.entries=o,t())},a=en("layout-shift",s);a&&(t=nn(e,i,bn,n.reportAllChanges),rn((function(){s(a.takeRecords()),t(!0)})),Je((function(){r=0,i=Ye("CLS",0),t=nn(e,i,bn,n.reportAllChanges),tn((function(){return t()}))})),setTimeout(t,0))})))},fcp:gn,fid:function(e,n){n=n||{},pn((function(){var t,i=dn(),r=Ye("FID"),o=function(e){e.startTime<i.firstHiddenTime&&(r.value=e.processingStart-e.startTime,r.entries.push(e),t(!0))},s=function(e){e.forEach(o)},a=en("first-input",s);t=nn(e,r,xn,n.reportAllChanges),a&&rn(on((function(){s(a.takeRecords()),a.disconnect()}))),a&&Je((function(){var i;r=Ye("FID"),t=nn(e,r,xn,n.reportAllChanges),He=[],Ge=-1,qe=null,En(addEventListener),i=o,He.push(i),wn()}))}))},inp:function(e,n){n=n||{},pn((function(){var t;Ln();var i,r=Ye("INP"),o=function(e){e.forEach((function(e){e.interactionId&&Dn(e),"first-input"===e.entryType&&!Nn.some((function(n){return n.entries.some((function(n){return e.duration===n.duration&&e.startTime===n.startTime}))}))&&Dn(e)}));var n,t=(n=Math.min(Nn.length-1,Math.floor(jn()/50)),Nn[n]);t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,i())},s=en("event",o,{durationThreshold:null!==(t=n.durationThreshold)&&void 0!==t?t:40});i=nn(e,r,An,n.reportAllChanges),s&&("interactionId"in PerformanceEventTiming.prototype&&s.observe({type:"first-input",buffered:!0}),rn((function(){o(s.takeRecords()),r.value<0&&jn()>0&&(r.value=0,r.entries=[]),i(!0)})),Je((function(){Nn=[],Cn=In(),r=Ye("INP"),i=nn(e,r,An,n.reportAllChanges)})))}))},lcp:function(e,n){n=n||{},pn((function(){var t,i=dn(),r=Ye("LCP"),o=function(e){var n=e[e.length-1];n&&n.startTime<i.firstHiddenTime&&(r.value=Math.max(n.startTime-Qe(),0),r.entries=[n],t())},s=en("largest-contentful-paint",o);if(s){t=nn(e,r,Mn,n.reportAllChanges);var a=on((function(){Pn[r.id]||(o(s.takeRecords()),s.disconnect(),Pn[r.id]=!0,t(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return setTimeout(a,0)}),!0)})),rn(a),Je((function(i){r=Ye("LCP"),t=nn(e,r,Mn,n.reportAllChanges),tn((function(){r.value=performance.now()-i.timeStamp,Pn[r.id]=!0,t(!0)}))}))}}))},ttfb:function(e,n){n=n||{};var t=Ye("TTFB"),i=nn(e,t,_n,n.reportAllChanges);Bn((function(){var r=Ze();if(r){var o=r.responseStart;if(o<=0||o>performance.now())return;t.value=Math.max(o-Qe(),0),t.entries=[r],i(!0),Je((function(){t=Ye("TTFB",0),(i=nn(e,t,_n,n.reportAllChanges))(!0)}))}}))}};const Un="browser";var $n={exports:{}};!function(e,n){!function(t,i){var r="function",o="undefined",s="object",a="string",l="major",u="model",c="name",d="type",p="vendor",f="version",g="architecture",b="console",v="mobile",m="tablet",h="smarttv",w="wearable",y="embedded",E="Amazon",x="Apple",T="ASUS",k="BlackBerry",S="Browser",O="Chrome",I="Firefox",L="Google",A="Huawei",C="LG",j="Microsoft",N="Motorola",R="Opera",D="Samsung",M="Sharp",P="Sony",_="Xiaomi",B="Zebra",z="Facebook",F="Chromium OS",U="Mac OS",$=function(e){for(var n={},t=0;t<e.length;t++)n[e[t].toUpperCase()]=e[t];return n},V=function(e,n){return typeof e===a&&-1!==q(n).indexOf(q(e))},q=function(e){return e.toLowerCase()},G=function(e,n){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof n===o?e:e.substring(0,350)},W=function(e,n){for(var t,o,a,l,u,c,d=0;d<n.length&&!u;){var p=n[d],f=n[d+1];for(t=o=0;t<p.length&&!u&&p[t];)if(u=p[t++].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]==r?this[l[0]]=l[1].call(this,c):this[l[0]]=l[1]:3===l.length?typeof l[1]!==r||l[1].exec&&l[1].test?this[l[0]]=c?c.replace(l[1],l[2]):i:this[l[0]]=c?l[1].call(this,c,l[2]):i:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):i):this[l]=c||i;d+=2}},H=function(e,n){for(var t in n)if(typeof n[t]===s&&n[t].length>0){for(var r=0;r<n[t].length;r++)if(V(n[t][r],e))return"?"===t?i:t}else if(V(n[t],e))return"?"===t?i:t;return e},K={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"},X={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,f],[/opios[\/ ]+([\w\.]+)/i],[f,[c,R+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[c,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|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[c,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[c,"UC"+S]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[c,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure "+S],f],[/\bfocus\/([\w\.]+)/i],[f,[c,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[c,R+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[c,R+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[c,"MIUI "+S]],[/fxios\/([-\w\.]+)/i],[f,[c,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[c,"360 "+S]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 "+S],f],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[c,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,z],f],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[c,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[c,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[c,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[c,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,O+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[c,"Android "+S]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[c,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[f,H,{"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],[c,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[c,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,/panasonic;(viera)/i],[c,f],[/(cobalt)\/([\w\.]+)/i],[c,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,q]],[/((?:i[346]|x)86)[;\)]/i],[[g,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[g,/ower/,"",q]],[/(sun4\w)[;\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[g,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],[u,[p,D],[d,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[p,D],[d,v]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[p,x],[d,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[p,x],[d,m]],[/(macintosh);/i],[u,[p,x]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[p,M],[d,v]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[p,A],[d,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[p,A],[d,v]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: 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],[[u,/_/g," "],[p,_],[d,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[p,_],[d,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[p,"OPPO"],[d,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[p,"Vivo"],[d,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[p,"Realme"],[d,v]],[/\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],[u,[p,N],[d,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[p,N],[d,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[p,C],[d,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[p,C],[d,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[p,"Lenovo"],[d,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[p,"Nokia"],[d,v]],[/(pixel c)\b/i],[u,[p,L],[d,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[p,L],[d,v]],[/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],[u,[p,P],[d,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[p,P],[d,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[p,"OnePlus"],[d,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[p,E],[d,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[p,E],[d,v]],[/(playbook);[-\w\),; ]+(rim)/i],[u,p,[d,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[p,k],[d,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[p,T],[d,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[p,T],[d,v]],[/(nexus 9)/i],[u,[p,"HTC"],[d,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[u,/_/g," "],[d,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[p,"Acer"],[d,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[p,"Meizu"],[d,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,u,[d,v]],[/(kobo)\s(ereader|touch)/i,/(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],[p,u,[d,m]],[/(surface duo)/i],[u,[p,j],[d,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[p,"Fairphone"],[d,v]],[/(u304aa)/i],[u,[p,"AT&T"],[d,v]],[/\bsie-(\w*)/i],[u,[p,"Siemens"],[d,v]],[/\b(rct\w+) b/i],[u,[p,"RCA"],[d,m]],[/\b(venue[\d ]{2,7}) b/i],[u,[p,"Dell"],[d,m]],[/\b(q(?:mv|ta)\w+) b/i],[u,[p,"Verizon"],[d,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[p,"Barnes & Noble"],[d,m]],[/\b(tm\d{3}\w+) b/i],[u,[p,"NuVision"],[d,m]],[/\b(k88) b/i],[u,[p,"ZTE"],[d,m]],[/\b(nx\d{3}j) b/i],[u,[p,"ZTE"],[d,v]],[/\b(gen\d{3}) b.+49h/i],[u,[p,"Swiss"],[d,v]],[/\b(zur\d{3}) b/i],[u,[p,"Swiss"],[d,m]],[/\b((zeki)?tb.*\b) b/i],[u,[p,"Zeki"],[d,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],u,[d,m]],[/\b(ns-?\w{0,9}) b/i],[u,[p,"Insignia"],[d,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[p,"NextBook"],[d,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],u,[d,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],u,[d,v]],[/\b(ph-1) /i],[u,[p,"Essential"],[d,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[p,"Envizen"],[d,m]],[/\b(trio[-\w\. ]+) b/i],[u,[p,"MachSpeed"],[d,m]],[/\btu_(1491) b/i],[u,[p,"Rotor"],[d,m]],[/(shield[\w ]+) b/i],[u,[p,"Nvidia"],[d,m]],[/(sprint) (\w+)/i],[p,u,[d,v]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[p,j],[d,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[p,B],[d,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[p,B],[d,v]],[/smart-tv.+(samsung)/i],[p,[d,h]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[p,D],[d,h]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,C],[d,h]],[/(apple) ?tv/i],[p,[u,x+" TV"],[d,h]],[/crkey/i],[[u,O+"cast"],[p,L],[d,h]],[/droid.+aft(\w+)( bui|\))/i],[u,[p,E],[d,h]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[p,M],[d,h]],[/(bravia[\w ]+)( bui|\))/i],[u,[p,P],[d,h]],[/(mitv-\w{5}) bui/i],[u,[p,_],[d,h]],[/Hbbtv.*(technisat) (.*);/i],[p,u,[d,h]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,G],[u,G],[d,h]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,h]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,u,[d,b]],[/droid.+; (shield) bui/i],[u,[p,"Nvidia"],[d,b]],[/(playstation [345portablevi]+)/i],[u,[p,P],[d,b]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[p,j],[d,b]],[/((pebble))app/i],[p,u,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[p,x],[d,w]],[/droid.+; (glass) \d/i],[u,[p,L],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[u,[p,B],[d,w]],[/(quest( 2| pro)?)/i],[u,[p,z],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,y]],[/(aeobc)\b/i],[u,[p,E],[d,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[d,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[d,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,v]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[c,"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,/\b(libweb)/i],[c,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[c,[f,H,K]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,"Windows"],[f,H,K]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,U],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,c],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[c,f],[/\(bb(10);/i],[f,[c,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[c,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[c,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[c,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[c,O+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[c,F],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(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],[c,f],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[c,f]]},J=function(e,n){if(typeof e===s&&(n=e,e=i),!(this instanceof J))return new J(e,n).getResult();var b=typeof t!==o&&t.navigator?t.navigator:i,h=e||(b&&b.userAgent?b.userAgent:""),w=b&&b.userAgentData?b.userAgentData:i,y=n?function(e,n){var t={};for(var i in e)n[i]&&n[i].length%2==0?t[i]=n[i].concat(e[i]):t[i]=e[i];return t}(X,n):X,E=b&&b.userAgent==h;return this.getBrowser=function(){var e,n={};return n[c]=i,n[f]=i,W.call(n,h,y.browser),n[l]=typeof(e=n[f])===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i,E&&b&&b.brave&&typeof b.brave.isBrave==r&&(n[c]="Brave"),n},this.getCPU=function(){var e={};return e[g]=i,W.call(e,h,y.cpu),e},this.getDevice=function(){var e={};return e[p]=i,e[u]=i,e[d]=i,W.call(e,h,y.device),E&&!e[d]&&w&&w.mobile&&(e[d]=v),E&&"Macintosh"==e[u]&&b&&typeof b.standalone!==o&&b.maxTouchPoints&&b.maxTouchPoints>2&&(e[u]="iPad",e[d]=m),e},this.getEngine=function(){var e={};return e[c]=i,e[f]=i,W.call(e,h,y.engine),e},this.getOS=function(){var e={};return e[c]=i,e[f]=i,W.call(e,h,y.os),E&&!e[c]&&w&&"Unknown"!=w.platform&&(e[c]=w.platform.replace(/chrome os/i,F).replace(/macos/i,U)),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 h},this.setUA=function(e){return h=typeof e===a&&e.length>350?G(e,350):e,this},this.setUA(h),this};J.VERSION="1.0.36",J.BROWSER=$([c,f,l]),J.CPU=$([g]),J.DEVICE=$([u,p,d,b,v,h,m,w,y]),J.ENGINE=J.OS=$([c,f]),e.exports&&(n=e.exports=J),n.UAParser=J;var Z=typeof t!==o&&(t.jQuery||t.Zepto);if(Z&&!Z.ua){var Q=new J;Z.ua=Q.getResult(),Z.ua.get=function(){return Q.getUA()},Z.ua.set=function(e){Q.setUA(e);var n=Q.getResult();for(var t in n)Z.ua[t]=n[t]}}}("object"==typeof window?window:j)}($n,$n.exports);var Vn=$n.exports;const qn=()=>{const e=new Vn.UAParser,{name:n,version:t}=e.getBrowser(),{name:i,version:r}=e.getOS(),o=e.getUA(),s=navigator.language,a=navigator.userAgent.includes("Mobi"),l=function(){if(!n||!t)return;if("userAgentData"in navigator)return navigator.userAgentData.brands;return}(),u="unknown";return{browser:{name:null!=n?n:u,version:null!=t?t:u,os:`${null!=i?i:u} ${null!=r?r:u}`,userAgent:null!=o?o:u,language:null!=s?s:u,mobile:a,brands:null!=l?l:u}}},Gn=()=>({page:{url:location.href}}),Wn=[qn,Gn];function Hn(e){return{id:A(),attributes:e}}const Kn={name:"default"},Xn=()=>({k6:{}});function Jn(e,n,t,i){return new(t||(t=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,a)}l((i=i.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class Zn extends Y{constructor(e){var n,t,i,r;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-fetch",this.version=ae,this.disabledUntil=new Date,this.rateLimitBackoffMs=null!==(n=e.defaultRateLimitBackoffMs)&&void 0!==n?n:5e3,this.getNow=null!==(t=e.getNow)&&void 0!==t?t:()=>Date.now(),this.promiseBuffer=I({size:null!==(i=e.bufferSize)&&void 0!==i?i:30,concurrency:null!==(r=e.concurrency)&&void 0!==r?r:5})}send(e){return Jn(this,void 0,void 0,(function*(){try{if(this.disabledUntil>new Date(this.getNow()))return this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`),Promise.resolve();yield this.promiseBuffer.add((()=>{var n,t,i;const r=JSON.stringify(ne(e)),{url:o,requestOptions:s,apiKey:a}=this.options,l=null!=s?s:{},{headers:u}=l,c=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)n.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(t[i[r]]=e[i[r]])}return t}(l,["headers"]);return fetch(o,Object.assign({method:"POST",headers:Object.assign(Object.assign(Object.assign({"Content-Type":"application/json"},null!=u?u:{}),a?{"x-api-key":a}:{}),(null===(n=this.config.experimentalSessions)||void 0===n?void 0:n.enabled)&&(null===(t=this.metas.value.session)||void 0===t?void 0:t.id)?{"x-faro-session-id":null===(i=this.metas.value.session)||void 0===i?void 0:i.id}:{}),body:r,keepalive:!0},null!=c?c:{})).then((e=>(429===e.status&&(this.disabledUntil=this.getRetryAfterDate(e),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),e.text().catch(O),e))).catch((e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(r),e)}))}))}catch(e){this.logError(e)}}))}getIgnoreUrls(){return[this.options.url]}isBatched(){return!0}getRetryAfterDate(e){const n=this.getNow(),t=e.headers.get("Retry-After");if(t){const e=Number(t);if(!isNaN(e))return new Date(1e3*e+n);const i=Date.parse(t);if(!isNaN(i))return new Date(i)}return new Date(n+this.rateLimitBackoffMs)}}function Qn(e){var n,t,i,r,o,s,a,u,c,d;const p=[],f=X(e.unpatchedConsole,e.internalLoggerLevel);return e.transports?((e.url||e.apiKey)&&f.error('if "transports" is defined, "url" and "apiKey" should not be defined'),p.push(...e.transports)):e.url?p.push(new Zn({url:e.url,apiKey:e.apiKey})):f.error('either "url" or "transports" must be defined'),{app:e.app,batching:Object.assign(Object.assign({},ge),e.batching),dedupe:null===(n=e.dedupe)||void 0===n||n,globalObjectKey:e.globalObjectKey||fe,instrumentations:null!==(t=e.instrumentations)&&void 0!==t?t:Fn(),internalLoggerLevel:null!==(i=e.internalLoggerLevel)&&void 0!==i?i:G,isolate:null!==(r=e.isolate)&&void 0!==r&&r,metas:function(){const n=Wn;return e.metas&&n.push(...e.metas),l(window.k6)?[...n,Xn]:n}(),parseStacktrace:ze,paused:null!==(o=e.paused)&&void 0!==o&&o,preventGlobalExposure:null!==(s=e.preventGlobalExposure)&&void 0!==s&&s,transports:p,unpatchedConsole:null!==(a=e.unpatchedConsole)&&void 0!==a?a:W,beforeSend:e.beforeSend,eventDomain:null!==(u=e.eventDomain)&&void 0!==u?u:Un,ignoreErrors:e.ignoreErrors,experimentalSessions:Object.assign({enabled:!1,persistent:!1,session:Yn()},e.experimentalSessions),session:null!==(c=e.session)&&void 0!==c?c:Hn(),user:e.user,view:null!==(d=e.view)&&void 0!==d?d:Kn}}function Yn(){const e=ye();return{id:Ee(e)?null==e?void 0:e.sessionId:Hn().id}}return e.BaseExtension=Q,e.BaseInstrumentation=se,e.BaseTransport=Y,e.ConsoleInstrumentation=Se,e.ConsoleTransport=class extends Y{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-console",this.version=ae}send(n){var t;return this.unpatchedConsole[null!==(t=this.options.level)&&void 0!==t?t:e.LogLevel.DEBUG]("New event",ne([n]))}},e.Conventions=be,e.ErrorsInstrumentation=$e,e.FetchTransport=Zn,e.SessionInstrumentation=ke,e.VERSION=ae,e.ViewInstrumentation=Ve,e.WebVitalsInstrumentation=zn,e.allLogLevels=S,e.browserMeta=qn,e.buildStackFrame=Pe,e.createInternalLogger=X,e.createPromiseBuffer=I,e.createSession=Hn,e.deepEqual=E,e.defaultEventDomain=Un,e.defaultExceptionType=te,e.defaultGlobalObjectKey=fe,e.defaultInternalLoggerLevel=G,e.defaultLogLevel=k,e.defaultMetas=Wn,e.defaultViewMeta=Kn,e.genShortID=A,e.getCurrentTimestamp=x,e.getDataFromSafariExtensions=_e,e.getInternalFaroFromGlobalObject=function(){return oe[le]},e.getStackFramesFromError=Be,e.getTransportBody=ne,e.getWebInstrumentations=Fn,e.globalObject=oe,e.initializeFaro=function(e){const n=Qn(e);if(n)return pe(n)},e.internalGlobalObjectKey=le,e.isArray=c,e.isBoolean=e=>n(e,"boolean"),e.isDomError=m,e.isDomException=h,e.isElement=e=>w&&i(e,Element),e.isElementDefined=w,e.isError=b,e.isErrorDefined=g,e.isErrorEvent=v,e.isEvent=f,e.isEventDefined=p,e.isFunction=u,e.isInstanceOf=i,e.isInt=e=>a(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=ce,e.isMap=e=>y&&i(e,Map),e.isMapDefined=y,e.isNull=o,e.isNumber=a,e.isObject=l,e.isPrimitive=d,e.isRegExp=e=>t(e,"RegExp"),e.isString=s,e.isSymbol=e=>n(e,"symbol"),e.isSyntheticEvent=e=>l(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>u(null==e?void 0:e.then),e.isToString=t,e.isTypeof=n,e.isUndefined=r,e.makeCoreConfig=Qn,e.noop=O,e.pageMeta=Gn,e.parseStacktrace=ze,e.setInternalFaroOnGlobalObject=ue,e.transportItemTypeToBodyKey=U,e}({});
1
+ var GrafanaFaroWebSdk=function(e){"use strict";function n(e,n){return typeof e===n}function t(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function i(e,n){try{return e instanceof n}catch(e){return!1}}const r=e=>n(e,"undefined"),o=e=>n(e,"null"),s=e=>n(e,"string"),a=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),l=e=>!o(e)&&n(e,"object"),u=e=>n(e,"function"),c=e=>t(e,"Array"),d=e=>!l(e)&&!u(e),p=!r(Event),f=e=>p&&i(e,Event),g="undefined"!=typeof Error,b=e=>g&&i(e,Error),v=e=>t(e,"ErrorEvent"),m=e=>t(e,"DOMError"),h=e=>t(e,"DOMException"),w="undefined"!=typeof Element,y="undefined"!=typeof Map;function E(e,t){if(e===t)return!0;if(n(e,"number")&&isNaN(e))return n(t,"number")&&isNaN(t);const i=c(e),r=c(t);if(i!==r)return!1;if(i&&r){const n=e.length;if(n!==t.length)return!1;for(let i=n;0!=i--;)if(!E(e[i],t[i]))return!1;return!0}const o=l(e),s=l(t);if(o!==s)return!1;if(e&&t&&o&&s){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let e of n)if(!i.includes(e))return!1;for(let i of n)if(!E(e[i],t[i]))return!1;return!0}return!1}function x(){return(new Date).toISOString()}var T;e.LogLevel=void 0,(T=e.LogLevel||(e.LogLevel={})).TRACE="trace",T.DEBUG="debug",T.INFO="info",T.LOG="log",T.WARN="warn",T.ERROR="error";const k=e.LogLevel.LOG,S=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function O(){}function I(e){const{size:n,concurrency:t}=e,i=[];let r=0;const o=()=>{if(r<t&&i.length){const{producer:e,resolve:n,reject:t}=i.shift();r++,e().then((e=>{r--,o(),n(e)}),(e=>{r--,o(),t(e)}))}};return{add:e=>{if(i.length+r>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{i.push({producer:e,resolve:n,reject:t}),o()}))}}}const L="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function A(e=10){return Array.from(Array(e)).map((()=>L[Math.floor(Math.random()*L.length)])).join("")}function C(){return Date.now()}var j="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},N={exports:{}},R={exports:{}};R.exports=function(e,n){var t,i,r,o,s,a,l,u;for(t=3&e.length,i=e.length-t,r=n,s=3432918353,a=461845907,u=0;u<i;)l=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,r=27492+(65535&(o=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,t){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return r^=e.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0};var D=R.exports,M={exports:{}};!function(e){e.exports=function(e,n){for(var t,i=e.length,r=n^i,o=0;i>=4;)t=1540483477*(65535&(t=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(t>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(t=1540483477*(65535&(t^=t>>>24))+((1540483477*(t>>>16)&65535)<<16)),i-=4,++o;switch(i){case 3:r^=(255&e.charCodeAt(o+2))<<16;case 2:r^=(255&e.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0}}(M);var P=D,_=M.exports;N.exports=P;var B=N.exports.murmur3=P;N.exports.murmur2=_;class z{constructor(e,n){var t,i;this.signalBuffer=[],this.itemLimit=null!==(t=null==n?void 0:n.itemLimit)&&void 0!==t?t:50,this.sendTimeout=null!==(i=null==n?void 0:n.sendTimeout)&&void 0!==i?i:250,this.paused=(null==n?void 0:n.paused)||!1,this.sendFn=e,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&this.flush()}))}addItem(e){this.paused||(this.signalBuffer.push(e),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval((()=>this.flush()),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(e){const n=new Map;return e.forEach((e=>{const t=B(JSON.stringify(e.meta));let i=n.get(t);i=void 0===i?[e]:[...i,e],n.set(t,i)})),Array.from(n.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var F;e.TransportItemType=void 0,(F=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",F.LOG="log",F.MEASUREMENT="measurement",F.TRACE="trace",F.EVENT="event";const U={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function $(n){return t=>{if(t.type===e.TransportItemType.EXCEPTION&&t.payload){const e=t.payload,i=`${e.type}: ${e.value}`;if(function(e,n){return e.some((e=>s(e)?n.includes(e):!!n.match(e)))}(n,i))return null}return t}}var V;e.InternalLoggerLevel=void 0,(V=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[V.OFF=0]="OFF",V[V.ERROR=1]="ERROR",V[V.WARN=2]="WARN",V[V.INFO=3]="INFO",V[V.VERBOSE=4]="VERBOSE";const q={debug:O,error:O,info:O,prefix:"Faro",warn:O},G=e.InternalLoggerLevel.ERROR,W=Object.assign({},console);let H=W;function K(e){var n;return H=null!==(n=e.unpatchedConsole)&&void 0!==n?n:H,H}function X(n=W,t=G){const i=q;return t>e.InternalLoggerLevel.OFF&&(i.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${i.prefix}\n`,...e)}:O,i.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${i.prefix}\n`,...e)}:O,i.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${i.prefix}\n`,...e)}:O,i.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${i.prefix}\n`,...e)}:O),i}let J=q;function Z(e,n){return J=X(e,n.internalLoggerLevel),J}class Q{constructor(){this.unpatchedConsole=W,this.internalLogger=q,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}class Y extends Q{isBatched(){return!1}getIgnoreUrls(){return[]}}function ee(e,n){var t,i;if(void 0===n)return e;if(void 0===e)return{resourceSpans:n};const r=null===(t=e.resourceSpans)||void 0===t?void 0:t[0];if(void 0===r)return e;const o=(null==r?void 0:r.scopeSpans)||[],s=(null===(i=null==n?void 0:n[0])||void 0===i?void 0:i.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},r),{scopeSpans:[...o,...s]})]})}function ne(n){let t={meta:{}};return void 0!==n[0]&&(t.meta=n[0].meta),n.forEach((n=>{switch(n.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:const i=U[n.type],r=t[i];t=Object.assign(Object.assign({},t),{[i]:void 0===r?[n.payload]:[...r,n.payload]});break;case e.TransportItemType.TRACE:t=Object.assign(Object.assign({},t),{traces:ee(t.traces,n.payload.resourceSpans)})}})),t}const te="Error";let ie;function re(n,t,i,r,s){t.debug("Initializing API");const a=function(n,t,i,r,o){let s;return t.debug("Initializing traces API"),{getOTEL:()=>s,getTraceContext:()=>{const e=null==s?void 0:s.trace.getSpanContext(s.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),s={trace:e,context:n}},isOTELInitialized:()=>!!s,pushTraces:n=>{try{const i={type:e.TransportItemType.TRACE,payload:n,meta:r.value};t.debug("Pushing trace\n",i),o.execute(i)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,r,s);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a),function(n,t,i,r,s,a){var l;t.debug("Initializing exceptions API");let u=null;ie=null!==(l=i.parseStacktrace)&&void 0!==l?l:ie;const c=e=>{t.debug("Changing stacktrace parser"),ie=null!=e?e:ie};return c(i.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>ie,pushError:(n,{skipDedupe:l,stackFrames:c,type:d,context:p}={})=>{d=d||n.name||te;const f={meta:r.value,payload:{type:d,value:n.message,timestamp:x(),trace:a.getTraceContext(),context:null!=p?p:{}},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==ie?void 0:ie(n).frames:void 0)?void 0:c.length)&&(f.payload.stacktrace={frames:c});const g={type:f.payload.type,value:f.payload.value,stackTrace:f.payload.stacktrace,context:f.payload.context};l||!i.dedupe||o(u)||!E(g,u)?(u=g,t.debug("Pushing exception\n",f),s.execute(f)):t.debug("Skipping error push because it is the same as the last one\n",f.payload)}}}(0,t,i,r,s,a)),function(e,n,t,i,r){let o,s,a;n.debug("Initializing meta API");const l=e=>{s&&i.remove(s),s={user:e},i.add(s)},u=e=>{o&&i.remove(o),o={session:e},i.add(o)};return{setUser:l,resetUser:l,setSession:u,resetSession:u,getSession:()=>i.value.session,setView:e=>{a&&i.remove(a),a={view:e},i.add(a)},getView:()=>i.value.view}}(0,t,0,r)),function(n,t,i,r,s,a){t.debug("Initializing logs API");let l=null;return{pushLog:(n,{context:u,level:c,skipDedupe:d}={})=>{try{const p={type:e.TransportItemType.LOG,payload:{message:n.map((e=>{try{return String(e)}catch(e){return""}})).join(" "),level:null!=c?c:k,context:null!=u?u:{},timestamp:x(),trace:a.getTraceContext()},meta:r.value},f={message:p.payload.message,level:p.payload.level,context:p.payload.context};if(!d&&i.dedupe&&!o(l)&&E(f,l))return void t.debug("Skipping log push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing log\n",p),s.execute(p)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,i,r,s,a)),function(n,t,i,r,s,a){t.debug("Initializing measurements API");let l=null;return{pushMeasurement:(n,{skipDedupe:u,context:c}={})=>{var d;try{const p={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:a.getTraceContext(),timestamp:null!==(d=n.timestamp)&&void 0!==d?d:x(),context:null!=c?c:{}}),meta:r.value},f={type:p.payload.type,values:p.payload.values,context:p.payload.context};if(!u&&i.dedupe&&!o(l)&&E(f,l))return void t.debug("Skipping measurement push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing measurement\n",p),s.execute(p)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,i,r,s,a)),function(n,t,i,r,s,a){let l=null;return{pushEvent:(n,u,c,{skipDedupe:d}={})=>{try{const p={meta:r.value,payload:{name:n,domain:null!=c?c:i.eventDomain,attributes:u,timestamp:x(),trace:a.getTraceContext()},type:e.TransportItemType.EVENT},f={name:p.payload.name,attributes:p.payload.attributes,domain:p.payload.domain};if(!d&&i.dedupe&&!o(l)&&E(f,l))return void t.debug("Skipping event push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing event\n",p),s.execute(p)}catch(e){t.error("Error pushing event",e)}}}}(0,t,i,r,s,a))}const oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;class se extends Q{constructor(){super(...arguments),this.api={},this.transports={}}}const ae="1.2.3";const le="_faroInternal";function ue(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(oe,le,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function ce(){return le in oe}function de(n,t,i,r,o,s,a){return t.debug("Initializing Faro"),e.faro={api:s,config:i,instrumentations:a,internalLogger:t,metas:r,pause:o.pause,transports:o,unpatchedConsole:n,unpause:o.unpause},ue(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in oe)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(oe,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}function pe(e){const n=K(e),t=Z(n,e);if(ce()&&!e.isolate)return void t.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');t.debug("Initializing");const i=function(e,n,t){let i=[],r=[];const o=()=>i.reduce(((e,n)=>Object.assign(e,u(n)?n():n)),{}),s=()=>{if(r.length){const e=o();r.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),i.push(...e),s()},remove:(...e)=>{n.debug("Removing metas\n",e),i=i.filter((n=>!e.includes(n))),s()},addListener:e=>{n.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),r=r.filter((n=>n!==e))},get value(){return o()}}}(0,t),r=function(e,n,t,i){var r;n.debug("Initializing transports");const o=[];let s=t.paused,a=[];const l=e=>{let n=e;for(const e of a){const t=n.map(e).filter(Boolean);if(0===t.length)return[];n=t}return n},u=e=>{const t=l(e);if(0!==t.length)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)},c=e=>{var i;const[r]=l([e]);if(void 0!==r)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,r),e.isBatched()?(null===(i=t.batching)||void 0===i?void 0:i.enabled)||e.send([r]):e.send(r)};let d;return(null===(r=t.batching)||void 0===r?void 0:r.enabled)&&(d=new z(u,{sendTimeout:t.batching.sendTimeout,itemLimit:t.batching.itemLimit,paused:s})),{add:(...r)=>{n.debug("Adding transports"),r.forEach((r=>{n.debug(`Adding "${r.name}" transport`),o.some((e=>e===r))?n.warn(`Transport ${r.name} is already added`):(r.unpatchedConsole=e,r.internalLogger=n,r.config=t,r.metas=i,o.push(r))}))},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",a),e.forEach((e=>{e&&a.push(e)}))},addIgnoreErrorsPatterns:(...e)=>{n.debug("Adding ignoreErrorsPatterns\n",e),e.forEach((e=>{e&&a.push($(e))}))},getBeforeSendHooks:()=>[...a],execute:e=>{var n;s||((null===(n=t.batching)||void 0===n?void 0:n.enabled)?(null==d||d.addItem(e),c(e)):c(e))},isPaused:()=>s,pause:()=>{n.debug("Pausing transports"),null==d||d.pause(),s=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach((e=>{n.debug(`Removing "${e.name}" transport`);const t=o.indexOf(e);-1!==t?o.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{a.filter((n=>!e.includes(n)))},get transports(){return[...o]},unpause:()=>{n.debug("Unpausing transports"),null==d||d.start(),s=!1}}}(n,t,e,i),o=re(0,t,e,i,r),s=function(e,n,t,i,r,o){n.debug("Initializing instrumentations");const s=[];return{add:(...a)=>{n.debug("Adding instrumentations"),a.forEach((a=>{n.debug(`Adding "${a.name}" instrumentation`),s.some((e=>e.name===a.name))?n.warn(`Instrumentation ${a.name} is already added`):(a.unpatchedConsole=e,a.internalLogger=n,a.config=t,a.metas=i,a.transports=r,a.api=o,s.push(a),a.initialize())}))},get instrumentations(){return[...s]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,i;n.debug(`Removing "${e.name}" instrumentation`);const r=s.reduce(((n,t,i)=>null===n&&t.name===e.name?i:null),null);r?(null===(i=(t=s[r]).destroy)||void 0===i||i.call(t),s.splice(r,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,i,r,o),a=de(n,t,e,i,r,o,s);return function(e){var n,t,i;const r={sdk:{name:"@grafana/faro-core",version:ae,integrations:e.config.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}},o=null!==(t=null===(n=e.config.experimentalSessions)||void 0===n?void 0:n.session)&&void 0!==t?t:e.config.session;o&&e.api.setSession(o),e.config.app&&(r.app=e.config.app),e.config.user&&(r.user=e.config.user),e.config.view&&(r.view=e.config.view),e.metas.add(r,...null!==(i=e.config.metas)&&void 0!==i?i:[])}(a),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(a),function(e){e.instrumentations.add(...e.config.instrumentations)}(a),a}e.faro={};const fe="faro",ge={enabled:!0,sendTimeout:250,itemLimit:50},be={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}};const ve=function(n){var t;try{let e;e=window[n];const t="__faro_storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(i){return null===(t=e.faro.internalLogger)||void 0===t||t.info(`Web storage of type ${n} is not available. Reason: ${i}`),!1}}("localStorage");const me="__FARO_SESSION__";function he(e){const n=C();return{sessionId:null!=e?e:A(),lastActivity:n,started:n}}function we(e){!function(e,n){if(ve)try{localStorage.setItem(e,n)}catch(e){}}(me,JSON.stringify(e))}function ye(){const e=(n=me,ve?localStorage.getItem(n):null);var n;return e?JSON.parse(e):null}function Ee(e){if(null==e)return!1;const n=C();if(!(n-e.started<144e5))return!1;return n-e.lastActivity<9e5}function xe(n){const t=function(e,n){let t,i=!1;const r=()=>{null!=t?(e(...t),t=null,setTimeout(r,n)):i=!1};return(...o)=>{i?t=o:(e(...o),i=!0,setTimeout(r,n))}}((()=>{var n,t,i,r,o,s;const a=ye();if(Ee(a))we(Object.assign(Object.assign({},a),{lastActivity:C()}));else{let l=he();l=Object.assign(Object.assign({},l),{sessionMeta:{id:l.sessionId,attributes:Object.assign(Object.assign({},null!==(t=null===(n=e.faro.metas.value.session)||void 0===n?void 0:n.attributes)&&void 0!==t?t:{}),null!=a?{previousSession:a.sessionId}:{})}}),we(l),null===(i=e.faro.api)||void 0===i||i.setSession(l.sessionMeta),null===(o=null===(r=e.faro.config.experimentalSessions)||void 0===r?void 0:r.onSessionChange)||void 0===o||o.call(r,null!==(s=null==a?void 0:a.sessionMeta)&&void 0!==s?s:null,l.sessionMeta)}}),1e3);return{handleUpdate:t,init:function(){we(he(n)),document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&t()})),window.addEventListener("storage",(n=>{var t,i,r;if(n.key!==me)return;const o=JSON.parse(null!==(t=n.newValue)&&void 0!==t?t:""),s=JSON.parse(null!==(i=n.oldValue)&&void 0!==i?i:"");o.sessionId!==s.sessionId&&(null===(r=e.faro.api)||void 0===r||r.setSession(o.sessionMeta))})),e.faro.metas.addListener((function(n){var t,i;const r=n.session,o=ye();if(r&&r.id!==(null==o?void 0:o.sessionId)){const n=Object.assign(Object.assign({},he(r.id)),{sessionMeta:{id:r.id,attributes:Object.assign(Object.assign(Object.assign({},null!==(i=null===(t=null==o?void 0:o.sessionMeta)||void 0===t?void 0:t.attributes)&&void 0!==i?i:{}),r.attributes),o?{previousSession:o.sessionId}:{})}});we(n),e.faro.api.setSession(n.sessionMeta)}}))}}}function Te(n){var t;return(null===(t=e.faro.config.experimentalSessions)||void 0===t?void 0:t.persistent)&&ve?xe(n):function(n){let t=he(n);function i(){var n,i,r,o,s;if(Ee(t))t.lastActivity=C();else{t=he();const a=e.faro.metas.value.session,l={id:t.sessionId,attributes:Object.assign(Object.assign({},null!==(i=null===(n=e.faro.metas.value.session)||void 0===n?void 0:n.attributes)&&void 0!==i?i:{}),(null==a?void 0:a.id)?{previousSession:a.id}:{})};null===(o=null===(r=e.faro.config.experimentalSessions)||void 0===r?void 0:r.onSessionChange)||void 0===o||o.call(r,null!=a?a:null,l),null===(s=e.faro.api)||void 0===s||s.setSession(l)}}return{handleUpdate:i,init:function(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&i()})),e.faro.metas.addListener((function(n){var i;const r=n.session;if(r&&r.id!==(null==t?void 0:t.sessionId)){const n=t.sessionId;t=he(r.id),e.faro.api.setSession({id:t.sessionId,attributes:Object.assign(Object.assign({},null!==(i=r.attributes)&&void 0!==i?i:{}),{previousSession:n})})}}))}}}(n)}class ke extends se{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=ae}sendSessionStartEvent(e){var n;const t=e.session;t&&t.id!==(null===(n=this.notifiedSession)||void 0===n?void 0:n.id)&&(this.notifiedSession=t,this.api.pushEvent(be.EventNames.SESSION_START,{},void 0,{skipDedupe:!0}))}initialize(){var e,n,t;this.logDebug("init session instrumentation"),this.sendSessionStartEvent(this.metas.value),this.metas.addListener(this.sendSessionStartEvent.bind(this)),(null===(e=this.config.experimentalSessions)||void 0===e?void 0:e.enabled)&&(this.sessionUpdater=Te(null===(n=this.metas.value.session)||void 0===n?void 0:n.id),this.sessionUpdater.init(),null===(t=this.transports)||void 0===t||t.addBeforeSendHooks(...this.transports.getBeforeSendHooks(),(e=>{var n;return null===(n=this.sessionUpdater)||void 0===n||n.handleUpdate(),e})))}}class Se extends se{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=ae}initialize(){this.logDebug("Initializing\n",this.options),S.filter((e=>{var n;return!(null!==(n=this.options.disabledLevels)&&void 0!==n?n:Se.defaultDisabledLevels).includes(e)})).forEach((e=>{console[e]=(...n)=>{try{this.api.pushLog(n,{level:e})}catch(e){this.logError(e)}finally{this.unpatchedConsole[e](...n)}}}))}}Se.defaultDisabledLevels=[e.LogLevel.DEBUG,e.LogLevel.TRACE,e.LogLevel.LOG];const Oe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ie=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Le=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ae="address at ",Ce=Ae.length,je=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ne=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Re="safari-extension",De="safari-web-extension",Me=/Minified React error #\d+;/i;function Pe(e,n,t,i){const r={filename:e||document.location.href,function:n||"?"};return void 0!==t&&(r.lineno=t),void 0!==i&&(r.colno=i),r}function _e(e,n){const t=null==e?void 0:e.includes(Re),i=!t&&(null==e?void 0:e.includes(De));return t||i?[(null==e?void 0:e.includes("@"))?e.split("@")[0]:e,t?`${Re}:${n}`:`${De}:${n}`]:[e,n]}function Be(e){let n=[];e.stacktrace?n=e.stacktrace.split("\n").filter(((e,n)=>n%2==0)):e.stack&&(n=e.stack.split("\n"));const t=n.reduce(((n,t,i)=>{let r,o,s,l,u;if(r=Ie.exec(t)){if(o=r[1],s=r[2],l=r[3],u=r[4],null==s?void 0:s.startsWith("eval")){const e=Le.exec(s);e&&(s=e[1],l=e[2],u=e[3])}s=(null==s?void 0:s.startsWith(Ae))?s.substring(Ce):s,[o,s]=_e(o,s)}else if(r=je.exec(t)){if(o=r[1],s=r[3],l=r[4],u=r[5],s&&s.includes(" > eval")){const e=Ne.exec(s);e&&(o=o||"eval",s=e[1],l=e[2])}else 0===i&&!u&&a(e.columnNumber)&&(u=String(e.columnNumber+1));[o,s]=_e(o,s)}return(s||o)&&n.push(Pe(s,o,l?Number(l):void 0,u?Number(u):void 0)),n}),[]);return Me.test(e.message)?t.slice(1):t}function ze(e){return{frames:Be(e)}}function Fe(e){let n,t,i,r,o=[];if(v(e)&&e.error)n=e.error.message,t=e.error.name,o=Be(e.error);else if((i=m(e))||h(e)){const{name:r,message:o}=e;t=null!=r?r:i?"DOMError":"DOMException",n=o?`${t}: ${o}`:t}else b(e)?(n=e.message,o=Be(e)):(l(e)||(r=f(e)))&&(t=r?e.constructor.name:void 0,n=`Non-Error exception captured with keys: ${Object.keys(e)}`);return[n,t,o]}function Ue(e){const n=window.onerror;window.onerror=(...t)=>{try{const[i,r,o,a,l]=t;let u,c,d=[];const p=s(i),f=Pe(r,"?",o,a);l||!p?([u,c,d]=Fe(null!=l?l:i),0===d.length&&(d=[f])):p&&([u,c]=function(e){var n,t;const i=e.match(Oe),r=null!==(n=null==i?void 0:i[1])&&void 0!==n?n:te;return[null!==(t=null==i?void 0:i[2])&&void 0!==t?t:e,r]}(i),d=[f]),u&&e.pushError(new Error(u),{type:c,stackFrames:d})}finally{null==n||n.apply(window,t)}}}class $e extends se{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=ae}initialize(){var e;this.logDebug("Initializing"),Ue(this.api),e=this.api,window.addEventListener("unhandledrejection",(n=>{var t,i;let r,o,s=n;s.reason?s=n.reason:(null===(t=n.detail)||void 0===t?void 0:t.reason)&&(s=null===(i=n.detail)||void 0===i?void 0:i.reason);let a=[];d(s)?(r=`Non-Error promise rejection captured with value: ${String(s)}`,o="UnhandledRejection"):[r,o,a]=Fe(s),r&&e.pushError(new Error(r),{type:o,stackFrames:a})}))}}class Ve extends se{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=ae}sendViewChangedEvent(e){const n=e.view;n&&n!==this.notifiedView&&(this.notifiedView=n,this.api.pushEvent(be.EventNames.VIEW_CHANGED,{},void 0,{skipDedupe:!0}))}initialize(){this.sendViewChangedEvent(this.metas.value),this.metas.addListener(this.sendViewChangedEvent.bind(this))}}var qe,Ge,We,He,Ke,Xe=-1,Je=function(e){addEventListener("pageshow",(function(n){n.persisted&&(Xe=n.timeStamp,e(n))}),!0)},Ze=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},Qe=function(){var e=Ze();return e&&e.activationStart||0},Ye=function(e,n){var t=Ze(),i="navigate";return Xe>=0?i="back-forward-cache":t&&(document.prerendering||Qe()>0?i="prerender":document.wasDiscarded?i="restore":t.type&&(i=t.type.replace(/_/g,"-"))),{name:e,value:void 0===n?-1:n,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},en=function(e,n,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){n(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},t||{})),i}}catch(e){}},nn=function(e,n,t,i){var r,o;return function(s){n.value>=0&&(s||i)&&((o=n.value-(r||0))||void 0===r)&&(r=n.value,n.delta=o,n.rating=function(e,n){return e>n[1]?"poor":e>n[0]?"needs-improvement":"good"}(n.value,t),e(n))}},tn=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},rn=function(e){var n=function(n){"pagehide"!==n.type&&"hidden"!==document.visibilityState||e(n)};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},on=function(e){var n=!1;return function(t){n||(e(t),n=!0)}},sn=-1,an=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},ln=function(e){"hidden"===document.visibilityState&&sn>-1&&(sn="visibilitychange"===e.type?e.timeStamp:0,cn())},un=function(){addEventListener("visibilitychange",ln,!0),addEventListener("prerenderingchange",ln,!0)},cn=function(){removeEventListener("visibilitychange",ln,!0),removeEventListener("prerenderingchange",ln,!0)},dn=function(){return sn<0&&(sn=an(),un(),Je((function(){setTimeout((function(){sn=an(),un()}),0)}))),{get firstHiddenTime(){return sn}}},pn=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},fn=[1800,3e3],gn=function(e,n){n=n||{},pn((function(){var t,i=dn(),r=Ye("FCP"),o=en("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-Qe(),0),r.entries.push(e),t(!0)))}))}));o&&(t=nn(e,r,fn,n.reportAllChanges),Je((function(i){r=Ye("FCP"),t=nn(e,r,fn,n.reportAllChanges),tn((function(){r.value=performance.now()-i.timeStamp,t(!0)}))})))}))},bn=[.1,.25],vn={passive:!0,capture:!0},mn=new Date,hn=function(e,n){qe||(qe=n,Ge=e,We=new Date,En(removeEventListener),wn())},wn=function(){if(Ge>=0&&Ge<We-mn){var e={entryType:"first-input",name:qe.type,target:qe.target,cancelable:qe.cancelable,startTime:qe.timeStamp,processingStart:qe.timeStamp+Ge};He.forEach((function(n){n(e)})),He=[]}},yn=function(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,n){var t=function(){hn(e,n),r()},i=function(){r()},r=function(){removeEventListener("pointerup",t,vn),removeEventListener("pointercancel",i,vn)};addEventListener("pointerup",t,vn),addEventListener("pointercancel",i,vn)}(n,e):hn(n,e)}},En=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,yn,vn)}))},xn=[100,300],Tn=0,kn=1/0,Sn=0,On=function(e){e.forEach((function(e){e.interactionId&&(kn=Math.min(kn,e.interactionId),Sn=Math.max(Sn,e.interactionId),Tn=Sn?(Sn-kn)/7+1:0)}))},In=function(){return Ke?Tn:performance.interactionCount||0},Ln=function(){"interactionCount"in performance||Ke||(Ke=en("event",On,{type:"event",buffered:!0,durationThreshold:0}))},An=[200,500],Cn=0,jn=function(){return In()-Cn},Nn=[],Rn={},Dn=function(e){var n=Nn[Nn.length-1],t=Rn[e.interactionId];if(t||Nn.length<10||e.duration>n.latency){if(t)t.entries.push(e),t.latency=Math.max(t.latency,e.duration);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};Rn[i.id]=i,Nn.push(i)}Nn.sort((function(e,n){return n.latency-e.latency})),Nn.splice(10).forEach((function(e){delete Rn[e.id]}))}},Mn=[2500,4e3],Pn={},_n=[800,1800],Bn=function e(n){document.prerendering?pn((function(){return e(n)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(n)}),!0):setTimeout(n,0)};class zn extends se{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=ae}initialize(){this.logDebug("Initializing"),Object.entries(zn.mapping).forEach((([e,n])=>{n((n=>{this.api.pushMeasurement({type:"web-vitals",values:{[e]:n.value}})}))}))}}function Fn(e={}){const n=[new $e,new zn,new ke,new Ve];return!1!==e.captureConsole&&n.push(new Se({disabledLevels:e.captureConsoleDisabledLevels})),n}zn.mapping={cls:function(e,n){n=n||{},gn(on((function(){var t,i=Ye("CLS",0),r=0,o=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=o[0],t=o[o.length-1];r&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(r+=e.value,o.push(e)):(r=e.value,o=[e])}})),r>i.value&&(i.value=r,i.entries=o,t())},a=en("layout-shift",s);a&&(t=nn(e,i,bn,n.reportAllChanges),rn((function(){s(a.takeRecords()),t(!0)})),Je((function(){r=0,i=Ye("CLS",0),t=nn(e,i,bn,n.reportAllChanges),tn((function(){return t()}))})),setTimeout(t,0))})))},fcp:gn,fid:function(e,n){n=n||{},pn((function(){var t,i=dn(),r=Ye("FID"),o=function(e){e.startTime<i.firstHiddenTime&&(r.value=e.processingStart-e.startTime,r.entries.push(e),t(!0))},s=function(e){e.forEach(o)},a=en("first-input",s);t=nn(e,r,xn,n.reportAllChanges),a&&rn(on((function(){s(a.takeRecords()),a.disconnect()}))),a&&Je((function(){var i;r=Ye("FID"),t=nn(e,r,xn,n.reportAllChanges),He=[],Ge=-1,qe=null,En(addEventListener),i=o,He.push(i),wn()}))}))},inp:function(e,n){n=n||{},pn((function(){var t;Ln();var i,r=Ye("INP"),o=function(e){e.forEach((function(e){e.interactionId&&Dn(e),"first-input"===e.entryType&&!Nn.some((function(n){return n.entries.some((function(n){return e.duration===n.duration&&e.startTime===n.startTime}))}))&&Dn(e)}));var n,t=(n=Math.min(Nn.length-1,Math.floor(jn()/50)),Nn[n]);t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,i())},s=en("event",o,{durationThreshold:null!==(t=n.durationThreshold)&&void 0!==t?t:40});i=nn(e,r,An,n.reportAllChanges),s&&("interactionId"in PerformanceEventTiming.prototype&&s.observe({type:"first-input",buffered:!0}),rn((function(){o(s.takeRecords()),r.value<0&&jn()>0&&(r.value=0,r.entries=[]),i(!0)})),Je((function(){Nn=[],Cn=In(),r=Ye("INP"),i=nn(e,r,An,n.reportAllChanges)})))}))},lcp:function(e,n){n=n||{},pn((function(){var t,i=dn(),r=Ye("LCP"),o=function(e){var n=e[e.length-1];n&&n.startTime<i.firstHiddenTime&&(r.value=Math.max(n.startTime-Qe(),0),r.entries=[n],t())},s=en("largest-contentful-paint",o);if(s){t=nn(e,r,Mn,n.reportAllChanges);var a=on((function(){Pn[r.id]||(o(s.takeRecords()),s.disconnect(),Pn[r.id]=!0,t(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return setTimeout(a,0)}),!0)})),rn(a),Je((function(i){r=Ye("LCP"),t=nn(e,r,Mn,n.reportAllChanges),tn((function(){r.value=performance.now()-i.timeStamp,Pn[r.id]=!0,t(!0)}))}))}}))},ttfb:function(e,n){n=n||{};var t=Ye("TTFB"),i=nn(e,t,_n,n.reportAllChanges);Bn((function(){var r=Ze();if(r){var o=r.responseStart;if(o<=0||o>performance.now())return;t.value=Math.max(o-Qe(),0),t.entries=[r],i(!0),Je((function(){t=Ye("TTFB",0),(i=nn(e,t,_n,n.reportAllChanges))(!0)}))}}))}};const Un="browser";var $n={exports:{}};!function(e,n){!function(t,i){var r="function",o="undefined",s="object",a="string",l="major",u="model",c="name",d="type",p="vendor",f="version",g="architecture",b="console",v="mobile",m="tablet",h="smarttv",w="wearable",y="embedded",E="Amazon",x="Apple",T="ASUS",k="BlackBerry",S="Browser",O="Chrome",I="Firefox",L="Google",A="Huawei",C="LG",j="Microsoft",N="Motorola",R="Opera",D="Samsung",M="Sharp",P="Sony",_="Xiaomi",B="Zebra",z="Facebook",F="Chromium OS",U="Mac OS",$=function(e){for(var n={},t=0;t<e.length;t++)n[e[t].toUpperCase()]=e[t];return n},V=function(e,n){return typeof e===a&&-1!==q(n).indexOf(q(e))},q=function(e){return e.toLowerCase()},G=function(e,n){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof n===o?e:e.substring(0,350)},W=function(e,n){for(var t,o,a,l,u,c,d=0;d<n.length&&!u;){var p=n[d],f=n[d+1];for(t=o=0;t<p.length&&!u&&p[t];)if(u=p[t++].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]==r?this[l[0]]=l[1].call(this,c):this[l[0]]=l[1]:3===l.length?typeof l[1]!==r||l[1].exec&&l[1].test?this[l[0]]=c?c.replace(l[1],l[2]):i:this[l[0]]=c?l[1].call(this,c,l[2]):i:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):i):this[l]=c||i;d+=2}},H=function(e,n){for(var t in n)if(typeof n[t]===s&&n[t].length>0){for(var r=0;r<n[t].length;r++)if(V(n[t][r],e))return"?"===t?i:t}else if(V(n[t],e))return"?"===t?i:t;return e},K={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"},X={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,f],[/opios[\/ ]+([\w\.]+)/i],[f,[c,R+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[c,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|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[c,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[c,"UC"+S]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[c,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure "+S],f],[/\bfocus\/([\w\.]+)/i],[f,[c,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[c,R+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[c,R+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[c,"MIUI "+S]],[/fxios\/([-\w\.]+)/i],[f,[c,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[c,"360 "+S]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 "+S],f],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[c,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,z],f],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[c,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[c,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[c,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[c,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,O+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[c,"Android "+S]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[c,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[f,H,{"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],[c,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[c,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,/panasonic;(viera)/i],[c,f],[/(cobalt)\/([\w\.]+)/i],[c,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,q]],[/((?:i[346]|x)86)[;\)]/i],[[g,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[g,/ower/,"",q]],[/(sun4\w)[;\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[g,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],[u,[p,D],[d,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[p,D],[d,v]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[p,x],[d,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[p,x],[d,m]],[/(macintosh);/i],[u,[p,x]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[p,M],[d,v]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[p,A],[d,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[p,A],[d,v]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: 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],[[u,/_/g," "],[p,_],[d,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[p,_],[d,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[p,"OPPO"],[d,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[p,"Vivo"],[d,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[p,"Realme"],[d,v]],[/\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],[u,[p,N],[d,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[p,N],[d,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[p,C],[d,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[p,C],[d,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[p,"Lenovo"],[d,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[p,"Nokia"],[d,v]],[/(pixel c)\b/i],[u,[p,L],[d,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[p,L],[d,v]],[/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],[u,[p,P],[d,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[p,P],[d,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[p,"OnePlus"],[d,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[p,E],[d,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[p,E],[d,v]],[/(playbook);[-\w\),; ]+(rim)/i],[u,p,[d,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[p,k],[d,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[p,T],[d,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[p,T],[d,v]],[/(nexus 9)/i],[u,[p,"HTC"],[d,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[u,/_/g," "],[d,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[p,"Acer"],[d,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[p,"Meizu"],[d,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,u,[d,v]],[/(kobo)\s(ereader|touch)/i,/(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],[p,u,[d,m]],[/(surface duo)/i],[u,[p,j],[d,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[p,"Fairphone"],[d,v]],[/(u304aa)/i],[u,[p,"AT&T"],[d,v]],[/\bsie-(\w*)/i],[u,[p,"Siemens"],[d,v]],[/\b(rct\w+) b/i],[u,[p,"RCA"],[d,m]],[/\b(venue[\d ]{2,7}) b/i],[u,[p,"Dell"],[d,m]],[/\b(q(?:mv|ta)\w+) b/i],[u,[p,"Verizon"],[d,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[p,"Barnes & Noble"],[d,m]],[/\b(tm\d{3}\w+) b/i],[u,[p,"NuVision"],[d,m]],[/\b(k88) b/i],[u,[p,"ZTE"],[d,m]],[/\b(nx\d{3}j) b/i],[u,[p,"ZTE"],[d,v]],[/\b(gen\d{3}) b.+49h/i],[u,[p,"Swiss"],[d,v]],[/\b(zur\d{3}) b/i],[u,[p,"Swiss"],[d,m]],[/\b((zeki)?tb.*\b) b/i],[u,[p,"Zeki"],[d,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],u,[d,m]],[/\b(ns-?\w{0,9}) b/i],[u,[p,"Insignia"],[d,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[p,"NextBook"],[d,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],u,[d,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],u,[d,v]],[/\b(ph-1) /i],[u,[p,"Essential"],[d,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[p,"Envizen"],[d,m]],[/\b(trio[-\w\. ]+) b/i],[u,[p,"MachSpeed"],[d,m]],[/\btu_(1491) b/i],[u,[p,"Rotor"],[d,m]],[/(shield[\w ]+) b/i],[u,[p,"Nvidia"],[d,m]],[/(sprint) (\w+)/i],[p,u,[d,v]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[p,j],[d,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[p,B],[d,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[p,B],[d,v]],[/smart-tv.+(samsung)/i],[p,[d,h]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[p,D],[d,h]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,C],[d,h]],[/(apple) ?tv/i],[p,[u,x+" TV"],[d,h]],[/crkey/i],[[u,O+"cast"],[p,L],[d,h]],[/droid.+aft(\w+)( bui|\))/i],[u,[p,E],[d,h]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[p,M],[d,h]],[/(bravia[\w ]+)( bui|\))/i],[u,[p,P],[d,h]],[/(mitv-\w{5}) bui/i],[u,[p,_],[d,h]],[/Hbbtv.*(technisat) (.*);/i],[p,u,[d,h]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,G],[u,G],[d,h]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,h]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,u,[d,b]],[/droid.+; (shield) bui/i],[u,[p,"Nvidia"],[d,b]],[/(playstation [345portablevi]+)/i],[u,[p,P],[d,b]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[p,j],[d,b]],[/((pebble))app/i],[p,u,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[p,x],[d,w]],[/droid.+; (glass) \d/i],[u,[p,L],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[u,[p,B],[d,w]],[/(quest( 2| pro)?)/i],[u,[p,z],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,y]],[/(aeobc)\b/i],[u,[p,E],[d,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[d,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[d,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,v]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[c,"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,/\b(libweb)/i],[c,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[c,[f,H,K]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,"Windows"],[f,H,K]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,U],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,c],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[c,f],[/\(bb(10);/i],[f,[c,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[c,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[c,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[c,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[c,O+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[c,F],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(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],[c,f],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[c,f]]},J=function(e,n){if(typeof e===s&&(n=e,e=i),!(this instanceof J))return new J(e,n).getResult();var b=typeof t!==o&&t.navigator?t.navigator:i,h=e||(b&&b.userAgent?b.userAgent:""),w=b&&b.userAgentData?b.userAgentData:i,y=n?function(e,n){var t={};for(var i in e)n[i]&&n[i].length%2==0?t[i]=n[i].concat(e[i]):t[i]=e[i];return t}(X,n):X,E=b&&b.userAgent==h;return this.getBrowser=function(){var e,n={};return n[c]=i,n[f]=i,W.call(n,h,y.browser),n[l]=typeof(e=n[f])===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i,E&&b&&b.brave&&typeof b.brave.isBrave==r&&(n[c]="Brave"),n},this.getCPU=function(){var e={};return e[g]=i,W.call(e,h,y.cpu),e},this.getDevice=function(){var e={};return e[p]=i,e[u]=i,e[d]=i,W.call(e,h,y.device),E&&!e[d]&&w&&w.mobile&&(e[d]=v),E&&"Macintosh"==e[u]&&b&&typeof b.standalone!==o&&b.maxTouchPoints&&b.maxTouchPoints>2&&(e[u]="iPad",e[d]=m),e},this.getEngine=function(){var e={};return e[c]=i,e[f]=i,W.call(e,h,y.engine),e},this.getOS=function(){var e={};return e[c]=i,e[f]=i,W.call(e,h,y.os),E&&!e[c]&&w&&"Unknown"!=w.platform&&(e[c]=w.platform.replace(/chrome os/i,F).replace(/macos/i,U)),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 h},this.setUA=function(e){return h=typeof e===a&&e.length>350?G(e,350):e,this},this.setUA(h),this};J.VERSION="1.0.36",J.BROWSER=$([c,f,l]),J.CPU=$([g]),J.DEVICE=$([u,p,d,b,v,h,m,w,y]),J.ENGINE=J.OS=$([c,f]),e.exports&&(n=e.exports=J),n.UAParser=J;var Z=typeof t!==o&&(t.jQuery||t.Zepto);if(Z&&!Z.ua){var Q=new J;Z.ua=Q.getResult(),Z.ua.get=function(){return Q.getUA()},Z.ua.set=function(e){Q.setUA(e);var n=Q.getResult();for(var t in n)Z.ua[t]=n[t]}}}("object"==typeof window?window:j)}($n,$n.exports);var Vn=$n.exports;const qn=()=>{const e=new Vn.UAParser,{name:n,version:t}=e.getBrowser(),{name:i,version:r}=e.getOS(),o=e.getUA(),s=navigator.language,a=navigator.userAgent.includes("Mobi"),l=function(){if(!n||!t)return;if("userAgentData"in navigator)return navigator.userAgentData.brands;return}(),u="unknown";return{browser:{name:null!=n?n:u,version:null!=t?t:u,os:`${null!=i?i:u} ${null!=r?r:u}`,userAgent:null!=o?o:u,language:null!=s?s:u,mobile:a,brands:null!=l?l:u}}},Gn=()=>({page:{url:location.href}}),Wn=[qn,Gn];function Hn(e){return{id:A(),attributes:e}}const Kn={name:"default"},Xn=()=>({k6:{isK6Browser:!0}});function Jn(e,n,t,i){return new(t||(t=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,a)}l((i=i.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class Zn extends Y{constructor(e){var n,t,i,r;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-fetch",this.version=ae,this.disabledUntil=new Date,this.rateLimitBackoffMs=null!==(n=e.defaultRateLimitBackoffMs)&&void 0!==n?n:5e3,this.getNow=null!==(t=e.getNow)&&void 0!==t?t:()=>Date.now(),this.promiseBuffer=I({size:null!==(i=e.bufferSize)&&void 0!==i?i:30,concurrency:null!==(r=e.concurrency)&&void 0!==r?r:5})}send(e){return Jn(this,void 0,void 0,(function*(){try{if(this.disabledUntil>new Date(this.getNow()))return this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`),Promise.resolve();yield this.promiseBuffer.add((()=>{var n,t,i;const r=JSON.stringify(ne(e)),{url:o,requestOptions:s,apiKey:a}=this.options,l=null!=s?s:{},{headers:u}=l,c=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)n.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(t[i[r]]=e[i[r]])}return t}(l,["headers"]);return fetch(o,Object.assign({method:"POST",headers:Object.assign(Object.assign(Object.assign({"Content-Type":"application/json"},null!=u?u:{}),a?{"x-api-key":a}:{}),(null===(n=this.config.experimentalSessions)||void 0===n?void 0:n.enabled)&&(null===(t=this.metas.value.session)||void 0===t?void 0:t.id)?{"x-faro-session-id":null===(i=this.metas.value.session)||void 0===i?void 0:i.id}:{}),body:r,keepalive:r.length<=6e4},null!=c?c:{})).then((e=>(429===e.status&&(this.disabledUntil=this.getRetryAfterDate(e),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),e.text().catch(O),e))).catch((e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(r),e)}))}))}catch(e){this.logError(e)}}))}getIgnoreUrls(){return[this.options.url]}isBatched(){return!0}getRetryAfterDate(e){const n=this.getNow(),t=e.headers.get("Retry-After");if(t){const e=Number(t);if(!isNaN(e))return new Date(1e3*e+n);const i=Date.parse(t);if(!isNaN(i))return new Date(i)}return new Date(n+this.rateLimitBackoffMs)}}function Qn(e){var n,t,i,r,o,s,a,u,c,d;const p=[],f=X(e.unpatchedConsole,e.internalLoggerLevel);return e.transports?((e.url||e.apiKey)&&f.error('if "transports" is defined, "url" and "apiKey" should not be defined'),p.push(...e.transports)):e.url?p.push(new Zn({url:e.url,apiKey:e.apiKey})):f.error('either "url" or "transports" must be defined'),{app:e.app,batching:Object.assign(Object.assign({},ge),e.batching),dedupe:null===(n=e.dedupe)||void 0===n||n,globalObjectKey:e.globalObjectKey||fe,instrumentations:null!==(t=e.instrumentations)&&void 0!==t?t:Fn(),internalLoggerLevel:null!==(i=e.internalLoggerLevel)&&void 0!==i?i:G,isolate:null!==(r=e.isolate)&&void 0!==r&&r,metas:function(){const n=Wn;return e.metas&&n.push(...e.metas),l(window.k6)?[...n,Xn]:n}(),parseStacktrace:ze,paused:null!==(o=e.paused)&&void 0!==o&&o,preventGlobalExposure:null!==(s=e.preventGlobalExposure)&&void 0!==s&&s,transports:p,unpatchedConsole:null!==(a=e.unpatchedConsole)&&void 0!==a?a:W,beforeSend:e.beforeSend,eventDomain:null!==(u=e.eventDomain)&&void 0!==u?u:Un,ignoreErrors:e.ignoreErrors,experimentalSessions:Object.assign({enabled:!1,persistent:!1,session:Yn()},e.experimentalSessions),session:null!==(c=e.session)&&void 0!==c?c:Hn(),user:e.user,view:null!==(d=e.view)&&void 0!==d?d:Kn}}function Yn(){const e=ye();return{id:Ee(e)?null==e?void 0:e.sessionId:Hn().id}}return e.BaseExtension=Q,e.BaseInstrumentation=se,e.BaseTransport=Y,e.ConsoleInstrumentation=Se,e.ConsoleTransport=class extends Y{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-console",this.version=ae}send(n){var t;return this.unpatchedConsole[null!==(t=this.options.level)&&void 0!==t?t:e.LogLevel.DEBUG]("New event",ne([n]))}},e.Conventions=be,e.ErrorsInstrumentation=$e,e.FetchTransport=Zn,e.SessionInstrumentation=ke,e.VERSION=ae,e.ViewInstrumentation=Ve,e.WebVitalsInstrumentation=zn,e.allLogLevels=S,e.browserMeta=qn,e.buildStackFrame=Pe,e.createInternalLogger=X,e.createPromiseBuffer=I,e.createSession=Hn,e.deepEqual=E,e.defaultEventDomain=Un,e.defaultExceptionType=te,e.defaultGlobalObjectKey=fe,e.defaultInternalLoggerLevel=G,e.defaultLogLevel=k,e.defaultMetas=Wn,e.defaultViewMeta=Kn,e.genShortID=A,e.getCurrentTimestamp=x,e.getDataFromSafariExtensions=_e,e.getInternalFaroFromGlobalObject=function(){return oe[le]},e.getStackFramesFromError=Be,e.getTransportBody=ne,e.getWebInstrumentations=Fn,e.globalObject=oe,e.initializeFaro=function(e){const n=Qn(e);if(n)return pe(n)},e.internalGlobalObjectKey=le,e.isArray=c,e.isBoolean=e=>n(e,"boolean"),e.isDomError=m,e.isDomException=h,e.isElement=e=>w&&i(e,Element),e.isElementDefined=w,e.isError=b,e.isErrorDefined=g,e.isErrorEvent=v,e.isEvent=f,e.isEventDefined=p,e.isFunction=u,e.isInstanceOf=i,e.isInt=e=>a(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=ce,e.isMap=e=>y&&i(e,Map),e.isMapDefined=y,e.isNull=o,e.isNumber=a,e.isObject=l,e.isPrimitive=d,e.isRegExp=e=>t(e,"RegExp"),e.isString=s,e.isSymbol=e=>n(e,"symbol"),e.isSyntheticEvent=e=>l(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>u(null==e?void 0:e.then),e.isToString=t,e.isTypeof=n,e.isUndefined=r,e.makeCoreConfig=Qn,e.noop=O,e.pageMeta=Gn,e.parseStacktrace=ze,e.setInternalFaroOnGlobalObject=ue,e.transportItemTypeToBodyKey=U,e}({});
@@ -3,7 +3,7 @@ import type { ConsoleInstrumentationOptions } from './types';
3
3
  export declare class ConsoleInstrumentation extends BaseInstrumentation {
4
4
  private options;
5
5
  readonly name = "@grafana/faro-web-sdk:instrumentation-console";
6
- readonly version = "1.2.2";
6
+ readonly version = "1.2.3";
7
7
  static defaultDisabledLevels: LogLevel[];
8
8
  constructor(options?: ConsoleInstrumentationOptions);
9
9
  initialize(): void;
@@ -1,6 +1,6 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class ErrorsInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-errors";
4
- readonly version = "1.2.2";
4
+ readonly version = "1.2.3";
5
5
  initialize(): void;
6
6
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class SessionInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-session";
4
- readonly version = "1.2.2";
4
+ readonly version = "1.2.3";
5
5
  private notifiedSession;
6
6
  private sessionUpdater;
7
7
  private sendSessionStartEvent;
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class ViewInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-view";
4
- readonly version = "1.2.2";
4
+ readonly version = "1.2.3";
5
5
  private notifiedView;
6
6
  private sendViewChangedEvent;
7
7
  initialize(): void;
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class WebVitalsInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-web-vitals";
4
- readonly version = "1.2.2";
4
+ readonly version = "1.2.3";
5
5
  static mapping: {
6
6
  cls: (onReport: import("web-vitals").CLSReportCallback, opts?: import("web-vitals").ReportOpts | undefined) => void;
7
7
  fcp: (onReport: import("web-vitals").FCPReportCallback, opts?: import("web-vitals").ReportOpts | undefined) => void;
@@ -4,7 +4,7 @@ import type { ConsoleTransportOptions } from './types';
4
4
  export declare class ConsoleTransport extends BaseTransport {
5
5
  private options;
6
6
  readonly name = "@grafana/faro-web-sdk:transport-console";
7
- readonly version = "1.2.2";
7
+ readonly version = "1.2.3";
8
8
  constructor(options?: ConsoleTransportOptions);
9
9
  send(item: TransportItem): void;
10
10
  }
@@ -4,7 +4,7 @@ import type { FetchTransportOptions } from './types';
4
4
  export declare class FetchTransport extends BaseTransport {
5
5
  private options;
6
6
  readonly name = "@grafana/faro-web-sdk:transport-fetch";
7
- readonly version = "1.2.2";
7
+ readonly version = "1.2.3";
8
8
  promiseBuffer: PromiseBuffer<Response | void>;
9
9
  private readonly rateLimitBackoffMs;
10
10
  private readonly getNow;
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.k6Meta = void 0;
4
4
  var k6Meta = function () {
5
5
  return {
6
- k6: {},
6
+ k6: {
7
+ isK6Browser: true,
8
+ },
7
9
  };
8
10
  };
9
11
  exports.k6Meta = k6Meta;
@@ -1 +1 @@
1
- {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../../src/metas/k6/meta.ts"],"names":[],"mappings":";;;AAEO,IAAM,MAAM,GAA+B;IAChD,OAAO;QACL,EAAE,EAAE,EAAE;KACP,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,MAAM,UAIjB","sourcesContent":["import type { Meta, MetaItem } from '@grafana/faro-core';\n\nexport const k6Meta: MetaItem<Pick<Meta, 'k6'>> = () => {\n return {\n k6: {},\n };\n};\n"]}
1
+ {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../../src/metas/k6/meta.ts"],"names":[],"mappings":";;;AAEO,IAAM,MAAM,GAA+B;IAChD,OAAO;QACL,EAAE,EAAE;YACF,WAAW,EAAE,IAAI;SAClB;KACF,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,MAAM,UAMjB","sourcesContent":["import type { Meta, MetaItem } from '@grafana/faro-core';\n\nexport const k6Meta: MetaItem<Pick<Meta, 'k6'>> = () => {\n return {\n k6: {\n isK6Browser: true,\n },\n };\n};\n"]}
@@ -115,7 +115,7 @@ var FetchTransport = /** @class */ (function (_super) {
115
115
  var _e = requestOptions !== null && requestOptions !== void 0 ? requestOptions : {}, headers = _e.headers, restOfRequestOptions = __rest(_e, ["headers"]);
116
116
  return fetch(url, __assign({ method: 'POST', headers: __assign(__assign(__assign({ 'Content-Type': 'application/json' }, (headers !== null && headers !== void 0 ? headers : {})), (apiKey ? { 'x-api-key': apiKey } : {})), (((_a = _this.config.experimentalSessions) === null || _a === void 0 ? void 0 : _a.enabled) && ((_b = _this.metas.value.session) === null || _b === void 0 ? void 0 : _b.id)
117
117
  ? { 'x-faro-session-id': (_c = _this.metas.value.session) === null || _c === void 0 ? void 0 : _c.id }
118
- : {})), body: body, keepalive: true }, (restOfRequestOptions !== null && restOfRequestOptions !== void 0 ? restOfRequestOptions : {})))
118
+ : {})), body: body, keepalive: body.length <= 60000 }, (restOfRequestOptions !== null && restOfRequestOptions !== void 0 ? restOfRequestOptions : {})))
119
119
  .then(function (response) {
120
120
  if (response.status === 429) {
121
121
  _this.disabledUntil = _this.getRetryAfterDate(response);
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../../src/transports/fetch/transport.ts"],"names":[],"mappings":"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","sourcesContent":["import { BaseTransport, createPromiseBuffer, getTransportBody, noop, PromiseBuffer, VERSION } from '@grafana/faro-core';\nimport type { TransportItem } from '@grafana/faro-core';\n\nimport type { FetchTransportOptions } from './types';\n\nconst DEFAULT_BUFFER_SIZE = 30;\nconst DEFAULT_CONCURRENCY = 5; // chrome supports 10 total, firefox 17\nconst DEFAULT_RATE_LIMIT_BACKOFF_MS = 5000;\n\nexport class FetchTransport extends BaseTransport {\n readonly name = '@grafana/faro-web-sdk:transport-fetch';\n readonly version = VERSION;\n\n promiseBuffer: PromiseBuffer<Response | void>;\n\n private readonly rateLimitBackoffMs: number;\n private readonly getNow: () => number;\n private disabledUntil: Date = new Date();\n\n constructor(private options: FetchTransportOptions) {\n super();\n\n this.rateLimitBackoffMs = options.defaultRateLimitBackoffMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS;\n this.getNow = options.getNow ?? (() => Date.now());\n\n this.promiseBuffer = createPromiseBuffer({\n size: options.bufferSize ?? DEFAULT_BUFFER_SIZE,\n concurrency: options.concurrency ?? DEFAULT_CONCURRENCY,\n });\n }\n\n async send(items: TransportItem[]): Promise<void> {\n try {\n if (this.disabledUntil > new Date(this.getNow())) {\n this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`);\n\n return Promise.resolve();\n }\n\n await this.promiseBuffer.add(() => {\n const body = JSON.stringify(getTransportBody(items));\n\n const { url, requestOptions, apiKey } = this.options;\n\n const { headers, ...restOfRequestOptions } = requestOptions ?? {};\n\n return fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(headers ?? {}),\n ...(apiKey ? { 'x-api-key': apiKey } : {}),\n ...(this.config.experimentalSessions?.enabled && this.metas.value.session?.id\n ? { 'x-faro-session-id': this.metas.value.session?.id }\n : {}),\n },\n body,\n keepalive: true,\n ...(restOfRequestOptions ?? {}),\n })\n .then((response) => {\n if (response.status === 429) {\n this.disabledUntil = this.getRetryAfterDate(response);\n this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`);\n }\n // read the body so the connection can be closed\n response.text().catch(noop);\n\n return response;\n })\n .catch((err) => {\n this.logError('Failed sending payload to the receiver\\n', JSON.parse(body), err);\n });\n });\n } catch (err) {\n this.logError(err);\n }\n }\n\n override getIgnoreUrls(): Array<string | RegExp> {\n return [this.options.url];\n }\n\n override isBatched(): boolean {\n return true;\n }\n\n private getRetryAfterDate(response: Response): Date {\n const now = this.getNow();\n const retryAfterHeader = response.headers.get('Retry-After');\n\n if (retryAfterHeader) {\n const delay = Number(retryAfterHeader);\n\n if (!isNaN(delay)) {\n return new Date(delay * 1000 + now);\n }\n\n const date = Date.parse(retryAfterHeader);\n\n if (!isNaN(date)) {\n return new Date(date);\n }\n }\n\n return new Date(now + this.rateLimitBackoffMs);\n }\n}\n"]}
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../../src/transports/fetch/transport.ts"],"names":[],"mappings":"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","sourcesContent":["import { BaseTransport, createPromiseBuffer, getTransportBody, noop, PromiseBuffer, VERSION } from '@grafana/faro-core';\nimport type { TransportItem } from '@grafana/faro-core';\n\nimport type { FetchTransportOptions } from './types';\n\nconst DEFAULT_BUFFER_SIZE = 30;\nconst DEFAULT_CONCURRENCY = 5; // chrome supports 10 total, firefox 17\nconst DEFAULT_RATE_LIMIT_BACKOFF_MS = 5000;\n\nexport class FetchTransport extends BaseTransport {\n readonly name = '@grafana/faro-web-sdk:transport-fetch';\n readonly version = VERSION;\n\n promiseBuffer: PromiseBuffer<Response | void>;\n\n private readonly rateLimitBackoffMs: number;\n private readonly getNow: () => number;\n private disabledUntil: Date = new Date();\n\n constructor(private options: FetchTransportOptions) {\n super();\n\n this.rateLimitBackoffMs = options.defaultRateLimitBackoffMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS;\n this.getNow = options.getNow ?? (() => Date.now());\n\n this.promiseBuffer = createPromiseBuffer({\n size: options.bufferSize ?? DEFAULT_BUFFER_SIZE,\n concurrency: options.concurrency ?? DEFAULT_CONCURRENCY,\n });\n }\n\n async send(items: TransportItem[]): Promise<void> {\n try {\n if (this.disabledUntil > new Date(this.getNow())) {\n this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`);\n\n return Promise.resolve();\n }\n\n await this.promiseBuffer.add(() => {\n const body = JSON.stringify(getTransportBody(items));\n\n const { url, requestOptions, apiKey } = this.options;\n\n const { headers, ...restOfRequestOptions } = requestOptions ?? {};\n\n return fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(headers ?? {}),\n ...(apiKey ? { 'x-api-key': apiKey } : {}),\n ...(this.config.experimentalSessions?.enabled && this.metas.value.session?.id\n ? { 'x-faro-session-id': this.metas.value.session?.id }\n : {}),\n },\n body,\n keepalive: body.length <= 60_000,\n ...(restOfRequestOptions ?? {}),\n })\n .then((response) => {\n if (response.status === 429) {\n this.disabledUntil = this.getRetryAfterDate(response);\n this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`);\n }\n // read the body so the connection can be closed\n response.text().catch(noop);\n\n return response;\n })\n .catch((err) => {\n this.logError('Failed sending payload to the receiver\\n', JSON.parse(body), err);\n });\n });\n } catch (err) {\n this.logError(err);\n }\n }\n\n override getIgnoreUrls(): Array<string | RegExp> {\n return [this.options.url];\n }\n\n override isBatched(): boolean {\n return true;\n }\n\n private getRetryAfterDate(response: Response): Date {\n const now = this.getNow();\n const retryAfterHeader = response.headers.get('Retry-After');\n\n if (retryAfterHeader) {\n const delay = Number(retryAfterHeader);\n\n if (!isNaN(delay)) {\n return new Date(delay * 1000 + now);\n }\n\n const date = Date.parse(retryAfterHeader);\n\n if (!isNaN(date)) {\n return new Date(date);\n }\n }\n\n return new Date(now + this.rateLimitBackoffMs);\n }\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  export const k6Meta = () => {
2
2
  return {
3
- k6: {},
3
+ k6: {
4
+ isK6Browser: true,
5
+ },
4
6
  };
5
7
  };
6
8
  //# sourceMappingURL=meta.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../../src/metas/k6/meta.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GAA+B,GAAG,EAAE;IACrD,OAAO;QACL,EAAE,EAAE,EAAE;KACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Meta, MetaItem } from '@grafana/faro-core';\n\nexport const k6Meta: MetaItem<Pick<Meta, 'k6'>> = () => {\n return {\n k6: {},\n };\n};\n"]}
1
+ {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../../src/metas/k6/meta.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GAA+B,GAAG,EAAE;IACrD,OAAO;QACL,EAAE,EAAE;YACF,WAAW,EAAE,IAAI;SAClB;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Meta, MetaItem } from '@grafana/faro-core';\n\nexport const k6Meta: MetaItem<Pick<Meta, 'k6'>> = () => {\n return {\n k6: {\n isK6Browser: true,\n },\n };\n};\n"]}
@@ -51,7 +51,7 @@ export class FetchTransport extends BaseTransport {
51
51
  const _d = requestOptions !== null && requestOptions !== void 0 ? requestOptions : {}, { headers } = _d, restOfRequestOptions = __rest(_d, ["headers"]);
52
52
  return fetch(url, Object.assign({ method: 'POST', headers: Object.assign(Object.assign(Object.assign({ 'Content-Type': 'application/json' }, (headers !== null && headers !== void 0 ? headers : {})), (apiKey ? { 'x-api-key': apiKey } : {})), (((_a = this.config.experimentalSessions) === null || _a === void 0 ? void 0 : _a.enabled) && ((_b = this.metas.value.session) === null || _b === void 0 ? void 0 : _b.id)
53
53
  ? { 'x-faro-session-id': (_c = this.metas.value.session) === null || _c === void 0 ? void 0 : _c.id }
54
- : {})), body, keepalive: true }, (restOfRequestOptions !== null && restOfRequestOptions !== void 0 ? restOfRequestOptions : {})))
54
+ : {})), body, keepalive: body.length <= 60000 }, (restOfRequestOptions !== null && restOfRequestOptions !== void 0 ? restOfRequestOptions : {})))
55
55
  .then((response) => {
56
56
  if (response.status === 429) {
57
57
  this.disabledUntil = this.getRetryAfterDate(response);
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../../src/transports/fetch/transport.ts"],"names":[],"mappings":"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","sourcesContent":["import { BaseTransport, createPromiseBuffer, getTransportBody, noop, PromiseBuffer, VERSION } from '@grafana/faro-core';\nimport type { TransportItem } from '@grafana/faro-core';\n\nimport type { FetchTransportOptions } from './types';\n\nconst DEFAULT_BUFFER_SIZE = 30;\nconst DEFAULT_CONCURRENCY = 5; // chrome supports 10 total, firefox 17\nconst DEFAULT_RATE_LIMIT_BACKOFF_MS = 5000;\n\nexport class FetchTransport extends BaseTransport {\n readonly name = '@grafana/faro-web-sdk:transport-fetch';\n readonly version = VERSION;\n\n promiseBuffer: PromiseBuffer<Response | void>;\n\n private readonly rateLimitBackoffMs: number;\n private readonly getNow: () => number;\n private disabledUntil: Date = new Date();\n\n constructor(private options: FetchTransportOptions) {\n super();\n\n this.rateLimitBackoffMs = options.defaultRateLimitBackoffMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS;\n this.getNow = options.getNow ?? (() => Date.now());\n\n this.promiseBuffer = createPromiseBuffer({\n size: options.bufferSize ?? DEFAULT_BUFFER_SIZE,\n concurrency: options.concurrency ?? DEFAULT_CONCURRENCY,\n });\n }\n\n async send(items: TransportItem[]): Promise<void> {\n try {\n if (this.disabledUntil > new Date(this.getNow())) {\n this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`);\n\n return Promise.resolve();\n }\n\n await this.promiseBuffer.add(() => {\n const body = JSON.stringify(getTransportBody(items));\n\n const { url, requestOptions, apiKey } = this.options;\n\n const { headers, ...restOfRequestOptions } = requestOptions ?? {};\n\n return fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(headers ?? {}),\n ...(apiKey ? { 'x-api-key': apiKey } : {}),\n ...(this.config.experimentalSessions?.enabled && this.metas.value.session?.id\n ? { 'x-faro-session-id': this.metas.value.session?.id }\n : {}),\n },\n body,\n keepalive: true,\n ...(restOfRequestOptions ?? {}),\n })\n .then((response) => {\n if (response.status === 429) {\n this.disabledUntil = this.getRetryAfterDate(response);\n this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`);\n }\n // read the body so the connection can be closed\n response.text().catch(noop);\n\n return response;\n })\n .catch((err) => {\n this.logError('Failed sending payload to the receiver\\n', JSON.parse(body), err);\n });\n });\n } catch (err) {\n this.logError(err);\n }\n }\n\n override getIgnoreUrls(): Array<string | RegExp> {\n return [this.options.url];\n }\n\n override isBatched(): boolean {\n return true;\n }\n\n private getRetryAfterDate(response: Response): Date {\n const now = this.getNow();\n const retryAfterHeader = response.headers.get('Retry-After');\n\n if (retryAfterHeader) {\n const delay = Number(retryAfterHeader);\n\n if (!isNaN(delay)) {\n return new Date(delay * 1000 + now);\n }\n\n const date = Date.parse(retryAfterHeader);\n\n if (!isNaN(date)) {\n return new Date(date);\n }\n }\n\n return new Date(now + this.rateLimitBackoffMs);\n }\n}\n"]}
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../../src/transports/fetch/transport.ts"],"names":[],"mappings":"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","sourcesContent":["import { BaseTransport, createPromiseBuffer, getTransportBody, noop, PromiseBuffer, VERSION } from '@grafana/faro-core';\nimport type { TransportItem } from '@grafana/faro-core';\n\nimport type { FetchTransportOptions } from './types';\n\nconst DEFAULT_BUFFER_SIZE = 30;\nconst DEFAULT_CONCURRENCY = 5; // chrome supports 10 total, firefox 17\nconst DEFAULT_RATE_LIMIT_BACKOFF_MS = 5000;\n\nexport class FetchTransport extends BaseTransport {\n readonly name = '@grafana/faro-web-sdk:transport-fetch';\n readonly version = VERSION;\n\n promiseBuffer: PromiseBuffer<Response | void>;\n\n private readonly rateLimitBackoffMs: number;\n private readonly getNow: () => number;\n private disabledUntil: Date = new Date();\n\n constructor(private options: FetchTransportOptions) {\n super();\n\n this.rateLimitBackoffMs = options.defaultRateLimitBackoffMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS;\n this.getNow = options.getNow ?? (() => Date.now());\n\n this.promiseBuffer = createPromiseBuffer({\n size: options.bufferSize ?? DEFAULT_BUFFER_SIZE,\n concurrency: options.concurrency ?? DEFAULT_CONCURRENCY,\n });\n }\n\n async send(items: TransportItem[]): Promise<void> {\n try {\n if (this.disabledUntil > new Date(this.getNow())) {\n this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`);\n\n return Promise.resolve();\n }\n\n await this.promiseBuffer.add(() => {\n const body = JSON.stringify(getTransportBody(items));\n\n const { url, requestOptions, apiKey } = this.options;\n\n const { headers, ...restOfRequestOptions } = requestOptions ?? {};\n\n return fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(headers ?? {}),\n ...(apiKey ? { 'x-api-key': apiKey } : {}),\n ...(this.config.experimentalSessions?.enabled && this.metas.value.session?.id\n ? { 'x-faro-session-id': this.metas.value.session?.id }\n : {}),\n },\n body,\n keepalive: body.length <= 60_000,\n ...(restOfRequestOptions ?? {}),\n })\n .then((response) => {\n if (response.status === 429) {\n this.disabledUntil = this.getRetryAfterDate(response);\n this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`);\n }\n // read the body so the connection can be closed\n response.text().catch(noop);\n\n return response;\n })\n .catch((err) => {\n this.logError('Failed sending payload to the receiver\\n', JSON.parse(body), err);\n });\n });\n } catch (err) {\n this.logError(err);\n }\n }\n\n override getIgnoreUrls(): Array<string | RegExp> {\n return [this.options.url];\n }\n\n override isBatched(): boolean {\n return true;\n }\n\n private getRetryAfterDate(response: Response): Date {\n const now = this.getNow();\n const retryAfterHeader = response.headers.get('Retry-After');\n\n if (retryAfterHeader) {\n const delay = Number(retryAfterHeader);\n\n if (!isNaN(delay)) {\n return new Date(delay * 1000 + now);\n }\n\n const date = Date.parse(retryAfterHeader);\n\n if (!isNaN(date)) {\n return new Date(date);\n }\n }\n\n return new Date(now + this.rateLimitBackoffMs);\n }\n}\n"]}
@@ -3,7 +3,7 @@ import type { ConsoleInstrumentationOptions } from './types';
3
3
  export declare class ConsoleInstrumentation extends BaseInstrumentation {
4
4
  private options;
5
5
  readonly name = "@grafana/faro-web-sdk:instrumentation-console";
6
- readonly version = "1.2.2";
6
+ readonly version = "1.2.3";
7
7
  static defaultDisabledLevels: LogLevel[];
8
8
  constructor(options?: ConsoleInstrumentationOptions);
9
9
  initialize(): void;
@@ -1,6 +1,6 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class ErrorsInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-errors";
4
- readonly version = "1.2.2";
4
+ readonly version = "1.2.3";
5
5
  initialize(): void;
6
6
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class SessionInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-session";
4
- readonly version = "1.2.2";
4
+ readonly version = "1.2.3";
5
5
  private notifiedSession;
6
6
  private sessionUpdater;
7
7
  private sendSessionStartEvent;
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class ViewInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-view";
4
- readonly version = "1.2.2";
4
+ readonly version = "1.2.3";
5
5
  private notifiedView;
6
6
  private sendViewChangedEvent;
7
7
  initialize(): void;
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class WebVitalsInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-web-vitals";
4
- readonly version = "1.2.2";
4
+ readonly version = "1.2.3";
5
5
  static mapping: {
6
6
  cls: (onReport: import("web-vitals").CLSReportCallback, opts?: import("web-vitals").ReportOpts | undefined) => void;
7
7
  fcp: (onReport: import("web-vitals").FCPReportCallback, opts?: import("web-vitals").ReportOpts | undefined) => void;
@@ -4,7 +4,7 @@ import type { ConsoleTransportOptions } from './types';
4
4
  export declare class ConsoleTransport extends BaseTransport {
5
5
  private options;
6
6
  readonly name = "@grafana/faro-web-sdk:transport-console";
7
- readonly version = "1.2.2";
7
+ readonly version = "1.2.3";
8
8
  constructor(options?: ConsoleTransportOptions);
9
9
  send(item: TransportItem): void;
10
10
  }
@@ -4,7 +4,7 @@ import type { FetchTransportOptions } from './types';
4
4
  export declare class FetchTransport extends BaseTransport {
5
5
  private options;
6
6
  readonly name = "@grafana/faro-web-sdk:transport-fetch";
7
- readonly version = "1.2.2";
7
+ readonly version = "1.2.3";
8
8
  promiseBuffer: PromiseBuffer<Response | void>;
9
9
  private readonly rateLimitBackoffMs;
10
10
  private readonly getNow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/faro-web-sdk",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Faro instrumentations, metas, transports for web.",
5
5
  "keywords": [
6
6
  "observability",
@@ -52,7 +52,7 @@
52
52
  "quality:circular-deps": "madge --circular ."
53
53
  },
54
54
  "dependencies": {
55
- "@grafana/faro-core": "^1.2.2",
55
+ "@grafana/faro-core": "^1.2.3",
56
56
  "ua-parser-js": "^1.0.32",
57
57
  "web-vitals": "^3.1.1"
58
58
  },
@@ -63,5 +63,5 @@
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "aa7fb430007d0bc6c4713c1cc7b827d3f27c061b"
66
+ "gitHead": "e15cdf130a4400c4e4f8d597b58a2dc7d488522a"
67
67
  }