UNPKG

@grafana/faro-web-sdk

Version:

Faro instrumentations, metas, transports for web.

1 lines 92.7 kB
var GrafanaFaroWebSdk=function(e){"use strict";function t(e,t){return typeof e===t}function n(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function i(e,t){try{return e instanceof t}catch(e){return!1}}const r=e=>t(e,"null"),o=e=>t(e,"string"),s=e=>t(e,"number")&&!isNaN(e)||t(e,"bigint"),a=e=>t(e,"boolean"),u=e=>!r(e)&&t(e,"object"),c=e=>t(e,"function"),l=e=>n(e,"Array"),d=e=>!u(e)&&!c(e),f="undefined"!=typeof Event,p=e=>f&&i(e,Event),g="undefined"!=typeof Error,v=e=>g&&i(e,Error),m=e=>n(e,"ErrorEvent"),h=e=>n(e,"DOMError"),b=e=>n(e,"DOMException"),w="undefined"!=typeof Element,y="undefined"!=typeof Map;function S(e){return null==e||(l(e)||o(e)?0===e.length:!!u(e)&&0===Object.keys(e).length)}function T(e,n){if(e===n)return!0;if(t(e,"number")&&isNaN(e))return t(n,"number")&&isNaN(n);const i=l(e),r=l(n);if(i!==r)return!1;if(i&&r){const t=e.length;if(t!==n.length)return!1;for(let i=t;0!=i--;)if(!T(e[i],n[i]))return!1;return!0}const o=u(e),s=u(n);if(o!==s)return!1;if(e&&n&&o&&s){const t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!1;for(let e of t)if(!i.includes(e))return!1;for(let i of t)if(!T(e[i],n[i]))return!1;return!0}return!1}function E(){return Date.now()}function I(){return(new Date).toISOString()}function k(e){return new Date(e).toISOString()}var O;e.LogLevel=void 0,(O=e.LogLevel||(e.LogLevel={})).TRACE="trace",O.DEBUG="debug",O.INFO="info",O.LOG="log",O.WARN="warn",O.ERROR="error";const x=e.LogLevel.LOG,L=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function C(){}function A(e){const{size:t,concurrency:n}=e,i=[];let r=0;const o=()=>{if(r<n&&i.length){const{producer:e,resolve:t,reject:n}=i.shift();r++,e().then((e=>{r--,o(),t(e)}),(e=>{r--,o(),n(e)}))}};return{add:e=>{if(i.length+r>=t)throw new Error("Task buffer full");return new Promise(((t,n)=>{i.push({producer:e,resolve:t,reject:n}),o()}))}}}const P="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function M(e=10){return Array.from(Array(e)).map((()=>P[Math.floor(Math.random()*P.length)])).join("")}const N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;function j(e={}){return JSON.stringify(null!=e?e:{},function(){const e=new WeakSet;return function(t,n){if(u(n)&&null!==n){if(e.has(n))return null;e.add(n)}return n}}())}function _(e={}){const t={};for(const[n,i]of Object.entries(e))t[n]=u(i)&&null!==i?j(i):String(i);return t}class D{constructor(){this.subscribers=[]}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>this.unsubscribe(e)}}unsubscribe(e){this.subscribers=this.subscribers.filter((t=>t!==e))}notify(e){this.subscribers.forEach((t=>t(e)))}first(){const e=new D,t=t=>{e.notify(t),n.unsubscribe()},n=this.subscribe(t),i=e.unsubscribe.bind(e);return this.withUnsubscribeOverride(e,i,t)}takeWhile(e){const t=new D,n=i=>{e(i)?t.notify(i):t.unsubscribe(n)};this.subscribe(n);const i=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,i,n)}filter(e){const t=new D,n=n=>{e(n)&&t.notify(n)};this.subscribe(n);const i=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,i,n)}merge(...e){const t=new D,n=[];e.forEach((e=>{const i=e.subscribe((e=>{t.notify(e)}));n.push(i)}));const i=t.unsubscribeAll.bind(t);return t.unsubscribe=()=>{n.forEach((e=>e.unsubscribe())),i()},t}withUnsubscribeOverride(e,t,n){return e.unsubscribe=e=>{t(e),this.unsubscribe(n)},e}unsubscribeAll(){this.subscribers=[]}}class R{constructor(e,t){var n,i;this.signalBuffer=[],this.itemLimit=null!==(n=null==t?void 0:t.itemLimit)&&void 0!==n?n:50,this.sendTimeout=null!==(i=null==t?void 0:t.sendTimeout)&&void 0!==i?i:250,this.paused=(null==t?void 0:t.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 t=new Map;return e.forEach((e=>{const n=JSON.stringify(e.meta);let i=t.get(n);i=void 0===i?[e]:[...i,e],t.set(n,i)})),Array.from(t.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var U;e.TransportItemType=void 0,(U=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",U.LOG="log",U.MEASUREMENT="measurement",U.TRACE="trace",U.EVENT="event";const B={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function F(e,t,n,i){var r;t.debug("Initializing transports");const o=[];let s=n.paused,a=[];const u=e=>{let t=e;for(const e of a){const i=t.map(e).filter(Boolean);if(0===i.length)return[];t=z(i,n)}return t},c=e=>{const n=u(e);if(0!==n.length)for(const e of o)t.debug(`Transporting item using ${e.name}\n`,n),e.isBatched()&&e.send(n)};let l;(null===(r=n.batching)||void 0===r?void 0:r.enabled)&&(l=new R(c,{sendTimeout:n.batching.sendTimeout,itemLimit:n.batching.itemLimit,paused:s}));return{add:(...r)=>{t.debug("Adding transports"),r.forEach((r=>{t.debug(`Adding "${r.name}" transport`);o.some((e=>e===r))?t.warn(`Transport ${r.name} is already added`):(r.unpatchedConsole=e,r.internalLogger=t,r.config=n,r.metas=i,o.push(r))}))},addBeforeSendHooks:(...e)=>{t.debug("Adding beforeSendHooks\n",a),e.forEach((e=>{e&&a.push(e)}))},getBeforeSendHooks:()=>[...a],execute:e=>{var i;s||((null===(i=n.batching)||void 0===i?void 0:i.enabled)&&(null==l||l.addItem(e)),(e=>{var i,r;if((null===(i=n.batching)||void 0===i?void 0:i.enabled)&&o.every((e=>e.isBatched())))return;const[s]=u([e]);if(void 0!==s)for(const e of o)t.debug(`Transporting item using ${e.name}\n`,s),e.isBatched()?(null===(r=n.batching)||void 0===r?void 0:r.enabled)||e.send([s]):e.send(s)})(e))},isPaused:()=>s,pause:()=>{t.debug("Pausing transports"),null==l||l.pause(),s=!0},remove:(...e)=>{t.debug("Removing transports"),e.forEach((e=>{t.debug(`Removing "${e.name}" transport`);const n=o.indexOf(e);-1!==n?o.splice(n,1):t.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{a.filter((t=>!e.includes(t)))},get transports(){return[...o]},unpause:()=>{t.debug("Unpausing transports"),null==l||l.start(),s=!1}}}function z(t,n){if(n.preserveOriginalError)for(const n of t)n.type===e.TransportItemType.EXCEPTION&&delete n.payload.originalError;return t}var q;e.InternalLoggerLevel=void 0,(q=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[q.OFF=0]="OFF",q[q.ERROR=1]="ERROR",q[q.WARN=2]="WARN",q[q.INFO=3]="INFO",q[q.VERBOSE=4]="VERBOSE";const V={debug:C,error:C,info:C,prefix:"Faro",warn:C},$=e.InternalLoggerLevel.ERROR,G=Object.assign({},console);let H=G;function W(e){var t;return H=null!==(t=e.unpatchedConsole)&&void 0!==t?t:H,H}function K(t=G,n=$){const i=V;return n>e.InternalLoggerLevel.OFF&&(i.error=n>=e.InternalLoggerLevel.ERROR?function(...e){t.error(`${i.prefix}\n`,...e)}:C,i.warn=n>=e.InternalLoggerLevel.WARN?function(...e){t.warn(`${i.prefix}\n`,...e)}:C,i.info=n>=e.InternalLoggerLevel.INFO?function(...e){t.info(`${i.prefix}\n`,...e)}:C,i.debug=n>=e.InternalLoggerLevel.VERBOSE?function(...e){t.debug(`${i.prefix}\n`,...e)}:C),i}let X=V;function J(e,t){return X=K(e,t.internalLoggerLevel),X}class Z{constructor(){this.unpatchedConsole=G,this.internalLogger=V,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 Z{isBatched(){return!1}getIgnoreUrls(){return[]}}function Q(e,t){var n,i;if(void 0===t)return e;if(void 0===e)return{resourceSpans:t};const r=null===(n=e.resourceSpans)||void 0===n?void 0:n[0];if(void 0===r)return e;const o=(null==r?void 0:r.scopeSpans)||[],s=(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},r),{scopeSpans:[...o,...s]})]})}function ee(t){let n={meta:{}};return void 0!==t[0]&&(n.meta=t[0].meta),t.forEach((t=>{switch(t.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:const i=B[t.type],r=n[i];n=Object.assign(Object.assign({},n),{[i]:void 0===r?[t.payload]:[...r,t.payload]});break;case e.TransportItemType.TRACE:n=Object.assign(Object.assign({},n),{traces:Q(n.traces,t.payload.resourceSpans)})}})),n}const te="user-action-start",ne="user-action-end",ie="user-action-cancel",re="user-action-halt";const oe="Error",se=e=>e.map((e=>u(e)?j(e):String(e))).join(" ");let ae;function ue({internalLogger:t,config:n,metas:i,transports:s,tracesApi:a,actionBuffer:c,getMessage:d}){var f;t.debug("Initializing exceptions API");let p=null;ae=null!==(f=n.parseStacktrace)&&void 0!==f?f:ae;const g=e=>{t.debug("Changing stacktrace parser"),ae=null!=e?e:ae},{ignoreErrors:m=[],preserveOriginalError:h}=n;return g(n.parseStacktrace),{changeStacktraceParser:g,getStacktraceParser:()=>ae,pushError:(f,{skipDedupe:g,stackFrames:b,type:w,context:y,spanContext:E,timestampOverwriteMs:O,originalError:x}={})=>{if(!function(e,t){const{message:n,name:i,stack:r}=t;return s=e,a=n+" "+i+" "+r,s.some((e=>o(e)?a.includes(e):!!a.match(e)));var s,a}(m,null!=x?x:f))try{const o=_(Object.assign(Object.assign({},function(e){let t=e.cause;v(t)?t=e.cause.toString():null!==t&&(u(e.cause)||l(e.cause))?t=j(e.cause):null!=t&&(t=e.cause.toString());return null==t?{}:{cause:t}}(null!=x?x:f)),null!=y?y:{})),m={meta:i.value,payload:Object.assign(Object.assign({type:w||f.name||oe,value:f.message,timestamp:O?k(O):I(),trace:E?{trace_id:E.traceId,span_id:E.spanId}:a.getTraceContext()},S(o)?{}:{context:o}),h?{originalError:x}:{}),type:e.TransportItemType.EXCEPTION};(null==(b=null!=b?b:f.stack?null==ae?void 0:ae(f).frames:void 0)?void 0:b.length)&&(m.payload.stacktrace={frames:b});const L={type:m.payload.type,value:m.payload.value,stackTrace:m.payload.stacktrace,context:m.payload.context};if(!g&&n.dedupe&&!r(p)&&T(L,p))return void t.debug("Skipping error push because it is the same as the last one\n",m.payload);p=L,t.debug("Pushing exception\n",m);const C=d();C&&C.type===te?c.addItem(m):s.execute(m)}catch(e){t.error("Error pushing event",e)}}}}const ce=e=>e.map((e=>{try{return String(e)}catch(e){return""}})).join(" ");class le{constructor(){this.buffer=[]}addItem(e){this.buffer.push(e)}flushBuffer(e){if(c(e))for(const t of this.buffer)e(t);this.buffer.length=0}size(){return this.buffer.length}}function de({apiMessageBus:t,transports:n,config:i}){const r=new le,o=i.trackUserActionsExcludeItem;let s;t.subscribe((t=>{if(te!==t.type&&re!==t.type){if(t.type===ne){const{id:i,name:a}=t;return r.flushBuffer((t=>{if(function(t,n){return(null==n?void 0:n(t))||t.type===e.TransportItemType.MEASUREMENT&&"web-vitals"===t.payload.type}(t,o))return void n.execute(t);const r=Object.assign(Object.assign({},t),{payload:Object.assign(Object.assign({},t.payload),{action:{parentId:i,name:a}})});n.execute(r)})),void(s=void 0)}t.type===ie&&(s=void 0,r.flushBuffer((e=>{n.execute(e)})))}else s=t}));return{actionBuffer:r,getMessage:()=>s}}const fe=new D;function pe(t,n,i,s,a){n.debug("Initializing API");const{actionBuffer:u,getMessage:c}=de({apiMessageBus:fe,transports:a,config:i}),l=function(t,n,i,r,o){let s;return n.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,t)=>{n.debug("Initializing OpenTelemetry"),s={trace:e,context:t}},isOTELInitialized:()=>!!s,pushTraces:t=>{try{const i={type:e.TransportItemType.TRACE,payload:t,meta:r.value};n.debug("Pushing trace\n",i),o.execute(i)}catch(e){n.error("Error pushing trace\n",e)}}}}(0,n,0,s,a),d={unpatchedConsole:t,internalLogger:n,config:i,metas:s,transports:a,tracesApi:l,actionBuffer:u,getMessage:c};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),ue(d)),function({internalLogger:e,metas:t}){let n,i,r,s;e.debug("Initializing meta API");const a=e=>{i&&t.remove(i),i={user:e},t.add(i)},u=(e,i)=>{var r;const o=null==i?void 0:i.overrides,s=o?{overrides:Object.assign(Object.assign({},null===(r=null==n?void 0:n.session)||void 0===r?void 0:r.overrides),o)}:{};n&&t.remove(n),n={session:Object.assign(Object.assign({},S(e)?void 0:e),s)},t.add(n)},c=()=>t.value.session,l=()=>t.value.page;return{setUser:a,resetUser:a,setSession:u,resetSession:u,getSession:c,setView:(e,n)=>{var i;if((null==n?void 0:n.overrides)&&u(c(),{overrides:n.overrides}),(null===(i=null==r?void 0:r.view)||void 0===i?void 0:i.name)===(null==e?void 0:e.name))return;const o=r;r={view:e},t.add(r),o&&t.remove(o)},getView:()=>t.value.view,setPage:e=>{var n;const i=o(e)?Object.assign(Object.assign({},null!==(n=null==s?void 0:s.page)&&void 0!==n?n:l()),{id:e}):e;s&&t.remove(s),s={page:i},t.add(s)},getPage:l}}(d)),function({internalLogger:t,config:n,metas:i,transports:o,tracesApi:s,actionBuffer:a,getMessage:u}){var c;t.debug("Initializing logs API");let l=null;const d=null!==(c=n.logArgsSerializer)&&void 0!==c?c:ce;return{pushLog:(c,{context:f,level:p,skipDedupe:g,spanContext:v,timestampOverwriteMs:m}={})=>{try{const h=_(f),b={type:e.TransportItemType.LOG,payload:{message:d(c),level:null!=p?p:x,context:S(h)?void 0:h,timestamp:m?k(m):I(),trace:v?{trace_id:v.traceId,span_id:v.spanId}:s.getTraceContext()},meta:i.value},w={message:b.payload.message,level:b.payload.level,context:b.payload.context};if(!g&&n.dedupe&&!r(l)&&T(w,l))return void t.debug("Skipping log push because it is the same as the last one\n",b.payload);l=w,t.debug("Pushing log\n",b);const y=u();y&&y.type===te?a.addItem(b):o.execute(b)}catch(e){t.error("Error pushing log\n",e)}}}}(d)),function({internalLogger:t,config:n,metas:i,transports:o,tracesApi:s,actionBuffer:a,getMessage:u}){t.debug("Initializing measurements API");let c=null;return{pushMeasurement:(l,{skipDedupe:d,context:f,spanContext:p,timestampOverwriteMs:g}={})=>{try{const v=_(f),m={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},l),{trace:p?{trace_id:p.traceId,span_id:p.spanId}:s.getTraceContext(),timestamp:g?k(g):I(),context:S(v)?void 0:v}),meta:i.value},h={type:m.payload.type,values:m.payload.values,context:m.payload.context};if(!d&&n.dedupe&&!r(c)&&T(h,c))return void t.debug("Skipping measurement push because it is the same as the last one\n",m.payload);c=h,t.debug("Pushing measurement\n",m);const b=u();b&&b.type===te?a.addItem(m):o.execute(m)}catch(e){t.error("Error pushing measurement\n",e)}}}}(d)),function({internalLogger:t,config:n,metas:i,transports:o,tracesApi:s,actionBuffer:a,getMessage:u}){let c=null;return{pushEvent:(l,d,f,{skipDedupe:p,spanContext:g,timestampOverwriteMs:v,customPayloadTransformer:m=e=>e}={})=>{try{const h=_(d),b={meta:i.value,payload:m({name:l,domain:null!=f?f:n.eventDomain,attributes:S(h)?void 0:h,timestamp:v?k(v):I(),trace:g?{trace_id:g.traceId,span_id:g.spanId}:s.getTraceContext()}),type:e.TransportItemType.EVENT},w={name:b.payload.name,attributes:b.payload.attributes,domain:b.payload.domain};if(!p&&n.dedupe&&!r(c)&&T(w,c))return void t.debug("Skipping event push because it is the same as the last one\n",b.payload);c=w,t.debug("Pushing event\n",b);const y=u();y&&y.type===te?a.addItem(b):o.execute(b)}catch(e){t.error("Error pushing event",e)}}}}(d))}class ge extends Z{constructor(){super(...arguments),this.api={},this.transports={}}}const ve="1.19.0";const me="_faroInternal";function he(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(N,me,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function be(){return me in N}function we(t,n,i,r,o,s,a){return n.debug("Initializing Faro"),e.faro={api:s,config:i,instrumentations:a,internalLogger:n,metas:r,pause:o.pause,transports:o,unpatchedConsole:t,unpause:o.unpause},he(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 N)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(N,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}function ye(e){const t=W(e),n=J(t,e);if(be()&&!e.isolate)return void n.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');n.debug("Initializing");const i=function(e,t){let n=[],i=[];const r=()=>n.reduce(((e,t)=>Object.assign(e,c(t)?t():t)),{}),o=()=>{if(i.length){const e=r();i.forEach((t=>t(e)))}};return{add:(...e)=>{t.debug("Adding metas\n",e),n.push(...e),o()},remove:(...e)=>{t.debug("Removing metas\n",e),n=n.filter((t=>!e.includes(t))),o()},addListener:e=>{t.debug("Adding metas listener\n",e),i.push(e)},removeListener:e=>{t.debug("Removing metas listener\n",e),i=i.filter((t=>t!==e))},get value(){return r()}}}(0,n),r=F(t,n,e,i),o=pe(t,n,e,i,r),s=function(e,t,n,i,r,o){t.debug("Initializing instrumentations");const s=[];return{add:(...a)=>{t.debug("Adding instrumentations"),a.forEach((a=>{t.debug(`Adding "${a.name}" instrumentation`),s.some((e=>e.name===a.name))?t.warn(`Instrumentation ${a.name} is already added`):(a.unpatchedConsole=e,a.internalLogger=t,a.config=n,a.metas=i,a.transports=r,a.api=o,s.push(a),a.initialize())}))},get instrumentations(){return[...s]},remove:(...e)=>{t.debug("Removing instrumentations"),e.forEach((e=>{var n,i;t.debug(`Removing "${e.name}" instrumentation`);const r=s.reduce(((t,n,i)=>null===t&&n.name===e.name?i:null),null);null!==r?(null===(i=(n=s[r]).destroy)||void 0===i||i.call(n),s.splice(r,1)):t.warn(`Instrumentation "${e.name}" is not added`)}))}}}(t,n,e,i,r,o),a=we(t,n,e,i,r,o,s);return function(e){var t,n;const i={sdk:{version:ve},app:{bundleId:e.config.app.name&&(r=e.config.app.name,null==N?void 0:N[`__faroBundleId_${r}`])}};var r;const o=null===(t=e.config.sessionTracking)||void 0===t?void 0:t.session;o&&e.api.setSession(o),e.config.app&&(i.app=Object.assign(Object.assign({},e.config.app),i.app)),e.config.user&&(i.user=e.config.user),e.config.view&&(i.view=e.config.view),e.metas.add(i,...null!==(n=e.config.metas)&&void 0!==n?n:[])}(a),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend)}(a),function(e){e.instrumentations.add(...e.config.instrumentations)}(a),a}e.faro={};const Se="faro",Te={enabled:!0,sendTimeout:250,itemLimit:50},Ee="view_changed",Ie="session_start",ke="session_resume",Oe="session_extend",xe="service_name_override",Le="unknown";var Ce,Ae={exports:{}},Pe=Ae.exports;var Me=(Ce||(Ce=1,function(e,t){!function(n,i){var r="function",o="undefined",s="object",a="string",u="major",c="model",l="name",d="type",f="vendor",p="version",g="architecture",v="console",m="mobile",h="tablet",b="smarttv",w="wearable",y="embedded",S="Amazon",T="Apple",E="ASUS",I="BlackBerry",k="Browser",O="Chrome",x="Firefox",L="Google",C="Huawei",A="LG",P="Microsoft",M="Motorola",N="Opera",j="Samsung",_="Sharp",D="Sony",R="Xiaomi",U="Zebra",B="Facebook",F="Chromium OS",z="Mac OS",q=" Browser",V=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},$=function(e,t){return typeof e===a&&-1!==G(t).indexOf(G(e))},G=function(e){return e.toLowerCase()},H=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,500)},W=function(e,t){for(var n,o,a,u,c,l,d=0;d<t.length&&!c;){var f=t[d],p=t[d+1];for(n=o=0;n<f.length&&!c&&f[n];)if(c=f[n++].exec(e))for(a=0;a<p.length;a++)l=c[++o],typeof(u=p[a])===s&&u.length>0?2===u.length?typeof u[1]==r?this[u[0]]=u[1].call(this,l):this[u[0]]=u[1]:3===u.length?typeof u[1]!==r||u[1].exec&&u[1].test?this[u[0]]=l?l.replace(u[1],u[2]):i:this[u[0]]=l?u[1].call(this,l,u[2]):i:4===u.length&&(this[u[0]]=l?u[3].call(this,l.replace(u[1],u[2])):i):this[u]=l||i;d+=2}},K=function(e,t){for(var n in t)if(typeof t[n]===s&&t[n].length>0){for(var r=0;r<t[n].length;r++)if($(t[n][r],e))return"?"===n?i:n}else if($(t[n],e))return"?"===n?i:n;return t.hasOwnProperty("*")?t["*"]:e},X={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"},J={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,p],[/opios[\/ ]+([\w\.]+)/i],[p,[l,N+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[p,[l,N+" GX"]],[/\bopr\/([\w\.]+)/i],[p,[l,N]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[p,[l,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[p,[l,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[l,p],[/quark(?:pc)?\/([-\w\.]+)/i],[p,[l,"Quark"]],[/\bddg\/([\w\.]+)/i],[p,[l,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[l,"UC"+k]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[p,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[l,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[p,[l,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[p,[l,"Smart Lenovo "+k]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+k],p],[/\bfocus\/([\w\.]+)/i],[p,[l,x+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[l,N+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[l,N+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[l,"MIUI"+q]],[/fxios\/([\w\.-]+)/i],[p,[l,x]],[/\bqihoobrowser\/?([\w\.]*)/i],[p,[l,"360"]],[/\b(qq)\/([\w\.]+)/i],[[l,/(.+)/,"$1Browser"],p],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1"+q],p],[/samsungbrowser\/([\w\.]+)/i],[p,[l,j+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[p,[l,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[l,"Sogou Mobile"],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[l,p],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[l],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[p,l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,B],p],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[l,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[l,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[p,[l,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[l,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,O+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[l,"Android "+k]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[p,K,{"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],[l,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],p],[/(wolvic|librewolf)\/([\w\.]+)/i],[l,p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[l,x+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\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|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[l,[p,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[l,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,G]],[/((?: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/,"",G]],[/(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,G]]],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],[c,[f,j],[d,h]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[c,[f,j],[d,m]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[c,[f,T],[d,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[f,T],[d,h]],[/(macintosh);/i],[c,[f,T]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[f,_],[d,m]],[/(?:honor)([-\w ]+)[;\)]/i],[c,[f,"Honor"],[d,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[f,C],[d,h]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[c,[f,C],[d,m]],[/\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,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[c,/_/g," "],[f,R],[d,m]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[f,R],[d,h]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[f,"OPPO"],[d,m]],[/\b(opd2\d{3}a?) bui/i],[c,[f,"OPPO"],[d,h]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[f,"Vivo"],[d,m]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[c,[f,"Realme"],[d,m]],[/\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],[c,[f,M],[d,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[f,M],[d,h]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[f,A],[d,h]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[f,A],[d,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[f,"Lenovo"],[d,h]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[f,"Nokia"],[d,m]],[/(pixel c)\b/i],[c,[f,L],[d,h]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[f,L],[d,m]],[/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],[c,[f,D],[d,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[f,D],[d,h]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[f,"OnePlus"],[d,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[f,S],[d,h]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[f,S],[d,m]],[/(playbook);[-\w\),; ]+(rim)/i],[c,f,[d,h]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[f,I],[d,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[f,E],[d,h]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[f,E],[d,m]],[/(nexus 9)/i],[c,[f,"HTC"],[d,h]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[f,[c,/_/g," "],[d,m]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[c,[f,"TCL"],[d,h]],[/(itel) ((\w+))/i],[[f,G],c,[d,K,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[f,"Acer"],[d,h]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[f,"Meizu"],[d,m]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[c,[f,"Ulefone"],[d,m]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[c,[f,"Energizer"],[d,m]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[c,[f,"Cat"],[d,m]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[c,[f,"Smartfren"],[d,m]],[/droid.+; (a(?:015|06[35]|142p?))/i],[c,[f,"Nothing"],[d,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,c,[d,m]],[/(imo) (tab \w+)/i,/(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],[f,c,[d,h]],[/(surface duo)/i],[c,[f,P],[d,h]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[f,"Fairphone"],[d,m]],[/(u304aa)/i],[c,[f,"AT&T"],[d,m]],[/\bsie-(\w*)/i],[c,[f,"Siemens"],[d,m]],[/\b(rct\w+) b/i],[c,[f,"RCA"],[d,h]],[/\b(venue[\d ]{2,7}) b/i],[c,[f,"Dell"],[d,h]],[/\b(q(?:mv|ta)\w+) b/i],[c,[f,"Verizon"],[d,h]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[f,"Barnes & Noble"],[d,h]],[/\b(tm\d{3}\w+) b/i],[c,[f,"NuVision"],[d,h]],[/\b(k88) b/i],[c,[f,"ZTE"],[d,h]],[/\b(nx\d{3}j) b/i],[c,[f,"ZTE"],[d,m]],[/\b(gen\d{3}) b.+49h/i],[c,[f,"Swiss"],[d,m]],[/\b(zur\d{3}) b/i],[c,[f,"Swiss"],[d,h]],[/\b((zeki)?tb.*\b) b/i],[c,[f,"Zeki"],[d,h]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],c,[d,h]],[/\b(ns-?\w{0,9}) b/i],[c,[f,"Insignia"],[d,h]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[f,"NextBook"],[d,h]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],c,[d,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],c,[d,m]],[/\b(ph-1) /i],[c,[f,"Essential"],[d,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[f,"Envizen"],[d,h]],[/\b(trio[-\w\. ]+) b/i],[c,[f,"MachSpeed"],[d,h]],[/\btu_(1491) b/i],[c,[f,"Rotor"],[d,h]],[/(shield[\w ]+) b/i],[c,[f,"Nvidia"],[d,h]],[/(sprint) (\w+)/i],[f,c,[d,m]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[f,P],[d,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[f,U],[d,h]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[f,U],[d,m]],[/smart-tv.+(samsung)/i],[f,[d,b]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[f,j],[d,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,A],[d,b]],[/(apple) ?tv/i],[f,[c,T+" TV"],[d,b]],[/crkey/i],[[c,O+"cast"],[f,L],[d,b]],[/droid.+aft(\w+)( bui|\))/i],[c,[f,S],[d,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[c,[f,_],[d,b]],[/(bravia[\w ]+)( bui|\))/i],[c,[f,D],[d,b]],[/(mitv-\w{5}) bui/i],[c,[f,R],[d,b]],[/Hbbtv.*(technisat) (.*);/i],[f,c,[d,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[f,H],[c,H],[d,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,c,[d,v]],[/droid.+; (shield) bui/i],[c,[f,"Nvidia"],[d,v]],[/(playstation [345portablevi]+)/i],[c,[f,D],[d,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[f,P],[d,v]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[c,[f,j],[d,w]],[/((pebble))app/i],[f,c,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[c,[f,T],[d,w]],[/droid.+; (glass) \d/i],[c,[f,L],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[c,[f,U],[d,w]],[/droid.+; (glass) \d/i],[c,[f,L],[d,w]],[/(pico) (4|neo3(?: link|pro)?)/i],[f,c,[d,w]],[/; (quest( \d| pro)?)/i],[c,[f,B],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[d,y]],[/(aeobc)\b/i],[c,[f,S],[d,y]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[c,[d,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[d,h]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,h]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,m]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[l,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[l,p],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[l,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,p],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[l,[p,K,X]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,K,X],[l,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,z],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,p],[/\(bb(10);/i],[p,[l,I]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[l,x+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[l,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[l,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[l,O+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[l,F],p],[/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],[l,p],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[l,p]]},Z=function(e,t){if(typeof e===s&&(t=e,e=i),!(this instanceof Z))return new Z(e,t).getResult();var v=typeof n!==o&&n.navigator?n.navigator:i,b=e||(v&&v.userAgent?v.userAgent:""),w=v&&v.userAgentData?v.userAgentData:i,y=t?function(e,t){var n={};for(var i in e)t[i]&&t[i].length%2==0?n[i]=t[i].concat(e[i]):n[i]=e[i];return n}(J,t):J,S=v&&v.userAgent==b;return this.getBrowser=function(){var e,t={};return t[l]=i,t[p]=i,W.call(t,b,y.browser),t[u]=typeof(e=t[p])===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i,S&&v&&v.brave&&typeof v.brave.isBrave==r&&(t[l]="Brave"),t},this.getCPU=function(){var e={};return e[g]=i,W.call(e,b,y.cpu),e},this.getDevice=function(){var e={};return e[f]=i,e[c]=i,e[d]=i,W.call(e,b,y.device),S&&!e[d]&&w&&w.mobile&&(e[d]=m),S&&"Macintosh"==e[c]&&v&&typeof v.standalone!==o&&v.maxTouchPoints&&v.maxTouchPoints>2&&(e[c]="iPad",e[d]=h),e},this.getEngine=function(){var e={};return e[l]=i,e[p]=i,W.call(e,b,y.engine),e},this.getOS=function(){var e={};return e[l]=i,e[p]=i,W.call(e,b,y.os),S&&!e[l]&&w&&w.platform&&"Unknown"!=w.platform&&(e[l]=w.platform.replace(/chrome os/i,F).replace(/macos/i,z)),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 b},this.setUA=function(e){return b=typeof e===a&&e.length>500?H(e,500):e,this},this.setUA(b),this};Z.VERSION="1.0.40",Z.BROWSER=V([l,p,u]),Z.CPU=V([g]),Z.DEVICE=V([c,f,d,v,m,b,h,w,y]),Z.ENGINE=Z.OS=V([l,p]),e.exports&&(t=e.exports=Z),t.UAParser=Z;var Y=typeof n!==o&&(n.jQuery||n.Zepto);if(Y&&!Y.ua){var Q=new Z;Y.ua=Q.getResult(),Y.ua.get=function(){return Q.getUA()},Y.ua.set=function(e){Q.setUA(e);var t=Q.getResult();for(var n in t)Y.ua[n]=t[n]}}}("object"==typeof window?window:Pe)}(Ae,Ae.exports)),Ae.exports);const Ne=()=>{const e=new Me.UAParser,{name:t,version:n}=e.getBrowser(),{name:i,version:r}=e.getOS(),o=e.getUA(),s=navigator.language,a=navigator.userAgent.includes("Mobi"),u=function(){if(!t||!n)return;if("userAgentData"in navigator&&navigator.userAgentData)return navigator.userAgentData.brands;return}();return{browser:{name:null!=t?t:Le,version:null!=n?n:Le,os:`${null!=i?i:Le} ${null!=r?r:Le}`,userAgent:null!=o?o:Le,language:null!=s?s:Le,mobile:a,brands:null!=u?u:Le,viewportWidth:`${window.innerWidth}`,viewportHeight:`${window.innerHeight}`}}};function je(t){var n,i,r,o;return{id:null!==(o=null===(r=null===(i=null===(n=e.faro.config)||void 0===n?void 0:n.sessionTracking)||void 0===i?void 0:i.generateSessionId)||void 0===r?void 0:r.call(i))&&void 0!==o?o:M(),attributes:t}}const _e={session:"sessionStorage",local:"localStorage"};function De(t){var n;try{let e;e=window[t];const n="__faro_storage_test__";return e.setItem(n,n),e.removeItem(n),!0}catch(i){return null===(n=e.faro.internalLogger)||void 0===n||n.info(`Web storage of type ${t} is not available. Reason: ${i}`),!1}}function Re(e,t){return qe(t)?window[t].getItem(e):null}function Ue(e,t,n){if(qe(n))try{window[n].setItem(e,t)}catch(e){}}function Be(e,t){qe(t)&&window[t].removeItem(e)}const Fe=De(_e.local),ze=De(_e.session);function qe(e){return e===_e.local?Fe:e===_e.session&&ze}function Ve(e,t){let n,i=!1;const r=()=>{null!=n?(e(...n),n=null,setTimeout(r,t)):i=!1};return(...o)=>{i?n=o:(e(...o),i=!0,setTimeout(r,t))}}function $e(){return e.faro.transports.transports.flatMap((e=>e.getIgnoreUrls()))}function Ge(e=""){return $e().some((t=>e&&null!=e.match(t)))}function He(e){return o(e)?e:e instanceof URL?e.href:!S(e)&&c(null==e?void 0:e.toString)?e.toString():void 0}const We="com.grafana.faro.session",Ke=144e5,Xe=9e5,Je=Xe,Ze={enabled:!0,persistent:!1,maxSessionPersistenceTime:Je};function Ye(){var t,n,i;const r=e.faro.config.sessionTracking;let o=null!==(i=null!==(n=null===(t=null==r?void 0:r.sampler)||void 0===t?void 0:t.call(r,{metas:e.faro.metas.value}))&&void 0!==n?n:null==r?void 0:r.samplingRate)&&void 0!==i?i:1;if("number"!=typeof o){o=0}return Math.random()<o}function Qe({sessionId:t,started:n,lastActivity:i,isSampled:r=!0}={}){var o,s;const a=E(),u=null===(s=null===(o=e.faro.config)||void 0===o?void 0:o.sessionTracking)||void 0===s?void 0:s.generateSessionId;return null==t&&(t="function"==typeof u?u():M()),{sessionId:t,lastActivity:null!=i?i:a,started:null!=n?n:a,isSampled:r}}function et(e){if(null==e)return!1;const t=E();if(!(t-e.started<Ke))return!1;return t-e.lastActivity<Xe}function tt({fetchUserSession:t,storeUserSession:n}){return function({forceSessionExtend:i}={forceSessionExtend:!1}){var r,o,s;if(!t||!n)return;const a=e.faro.config.sessionTracking,u=null==a?void 0:a.persistent;if(u&&!Fe||!u&&!ze)return;const c=t();if(!1===i&&et(c))n(Object.assign(Object.assign({},c),{lastActivity:E()}));else{let t=nt(Qe({isSampled:Ye()}),c);n(t),null===(r=e.faro.api)||void 0===r||r.setSession(t.sessionMeta),null===(o=null==a?void 0:a.onSessionChange)||void 0===o||o.call(a,null!==(s=null==c?void 0:c.sessionMeta)&&void 0!==s?s:null,t.sessionMeta)}}}function nt(t,n){var i,r,o,s,a,u,c;const l=Object.assign(Object.assign({},t),{sessionMeta:{id:t.sessionId,attributes:Object.assign(Object.assign(Object.assign({},null===(r=null===(i=e.faro.config.sessionTracking)||void 0===i?void 0:i.session)||void 0===r?void 0:r.attributes),null!==(s=null===(o=e.faro.metas.value.session)||void 0===o?void 0:o.attributes)&&void 0!==s?s:{}),{isSampled:t.isSampled.toString()})}}),d=null!==(u=null===(a=e.faro.metas.value.session)||void 0===a?void 0:a.overrides)&&void 0!==u?u:null===(c=null==n?void 0:n.sessionMeta)||void 0===c?void 0:c.overrides;S(d)||(l.sessionMeta.overrides=d);const f=null==n?void 0:n.sessionId;return null!=f&&(l.sessionMeta.attributes.previousSession=f),l}function it({fetchUserSession:t,storeUserSession:n}){return function(i){const r=i.session,o=t();let s=null==r?void 0:r.id;const a=null==r?void 0:r.attributes,u=null==r?void 0:r.overrides,c=null==o?void 0:o.sessionMeta,l=null==c?void 0:c.overrides,d=!!u&&!T(u,l),f=!!a&&!T(a,null==c?void 0:c.attributes);if(!!r&&s!==(null==o?void 0:o.sessionId)||f||d){const t=nt(Qe({sessionId:s,isSampled:Ye()}),o);n(t),function(t,n={},i={}){var r,o,s;if(!t)return;const a=n.serviceName,u=null!==(s=null!==(r=i.serviceName)&&void 0!==r?r:null===(o=e.faro.metas.value.app)||void 0===o?void 0:o.name)&&void 0!==s?s:"";a&&a!==u&&e.faro.api.pushEvent(xe,{serviceName:a,previousServiceName:u})}(d,u,l),e.faro.api.setSession(t.sessionMeta)}}}class rt{constructor(){this.updateSession=Ve((()=>this.updateUserSession()),1e3),this.updateUserSession=tt({fetchUserSession:rt.fetchUserSession,storeUserSession:rt.storeUserSession}),this.init()}static removeUserSession(){Be(We,rt.storageTypeLocal)}static storeUserSession(e){Ue(We,j(e),rt.storageTypeLocal)}static fetchUserSession(){const e=Re(We,rt.storageTypeLocal);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.updateSession()})),e.faro.metas.addListener(it({fetchUserSession:rt.fetchUserSession,storeUserSession:rt.storeUserSession}))}}rt.storageTypeLocal=_e.local;class ot{constructor(){this.updateSession=Ve((()=>this.updateUserSession()),1e3),this.updateUserSession=tt({fetchUserSession:ot.fetchUserSession,storeUserSession:ot.storeUserSession}),this.init()}static removeUserSession(){Be(We,ot.storageTypeSession)}static storeUserSession(e){Ue(We,j(e),ot.storageTypeSession)}static fetchUserSession(){const e=Re(We,ot.storageTypeSession);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.updateSession()})),e.faro.metas.addListener(it({fetchUserSession:ot.fetchUserSession,storeUserSession:ot.storeUserSession}))}}function st(e){return(null==e?void 0:e.persistent)?rt:ot}ot.storageTypeSession=_e.session;class at extends ge{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=ve}sendSessionStartEvent(e){var t,n;const i=e.session;if(i&&i.id!==(null===(t=this.notifiedSession)||void 0===t?void 0:t.id)){if(this.notifiedSession&&this.notifiedSession.id===(null===(n=i.attributes)||void 0===n?void 0:n.previousSession))return this.api.pushEvent(Oe,{},void 0,{skipDedupe:!0}),void(this.notifiedSession=i);this.notifiedSession=i,this.api.pushEvent(Ie,{},void 0,{skipDedupe:!0})}}createInitialSession(e,t){var n,i,r,o,s,a;let u,c,l=e.fetchUserSession();if(t.persistent&&t.maxSessionPersistenceTime&&l){const e=E();l.lastActivity<e-t.maxSessionPersistenceTime&&(rt.removeUserSession(),l=null)}if(et(l)){const e=null==l?void 0:l.sessionId;c=Qe({sessionId:e,isSampled:l.isSampled||!1,started:null==l?void 0:l.started});const r=null==l?void 0:l.sessionMeta,o=Object.assign(Object.assign({},null===(n=t.session)||void 0===n?void 0:n.overrides),null==r?void 0:r.overrides);c.sessionMeta=Object.assign(Object.assign({},t.session),{id:e,attributes:Object.assign(Object.assign(Object.assign({},null===(i=t.session)||void 0===i?void 0:i.attributes),null==r?void 0:r.attributes),{isSampled:c.isSampled.toString()}),overrides:o}),u=ke}else{const e=null!==(o=null===(r=t.session)||void 0===r?void 0:r.id)&&void 0!==o?o:je().id;c=Qe({sessionId:e,isSampled:Ye()});const n=null===(s=t.session)||void 0===s?void 0:s.overrides;c.sessionMeta=Object.assign({id:e,attributes:Object.assign({isSampled:c.isSampled.toString()},null===(a=t.session)||void 0===a?void 0:a.attributes)},n?{overrides:n}:{}),u=Ie}return{initialSession:c,lifecycleType:u}}registerBeforeSendHook(e){var t;const{updateSession:n}=new e;null===(t=this.transports)||void 0===t||t.addBeforeSendHooks((e=>{var t,i,r;n();const o=null===(t=e.meta.session)||void 0===t?void 0:t.attributes;if(o&&"true"===(null==o?void 0:o.isSampled)){let t=JSON.parse(JSON.stringify(e));const n=null===(i=t.meta.session)||void 0===i?void 0:i.attributes;return null==n||delete n.isSampled,0===Object.keys(null!=n?n:{}).length&&(null===(r=t.meta.session)||void 0===r||delete r.attributes),t}return null}))}initialize(){this.logDebug("init session instrumentation");const e=this.config.sessionTracking;if(null==e?void 0:e.enabled){const t=st(e);this.registerBeforeSendHook(t);const{initialSession:n,lifecycleType:i}=this.createInitialSession(t,e);t.storeUserSession(n);const r=n.sessionMeta;this.notifiedSession=r,this.api.setSession(r),i===Ie&&this.api.pushEvent(Ie,{},void 0,{skipDedupe:!0}),i===ke&&this.api.pushEvent(ke,{},void 0,{skipDedupe:!0})}this.metas.addListener(this.sendSessionStartEvent.bind(this))}}const ut="DOMError",ct="DOMException",lt="Non-Error exception captured with keys:",dt="?",ft=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;const pt="\n",gt="eval",vt="?",mt="@",ht=/^\s*at (?:(.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,bt=/\((\S*)(?::(\d+))(?::(\d+))\)/,wt="eval",yt="address at ",St=yt.length,Tt=/^\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,Et=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,It=" > eval",kt="safari-extension",Ot="safari-web-extension",xt=/Minified React error #\d+;/i;function Lt(e,t,n,i){const r={filename:e||document.location.href,function:t||vt};return void 0!==n&&(r.lineno=n),void 0!==i&&(r.colno=i),r}function Ct(e,t){const n=null==e?void 0:e.includes(kt),i=!n&&(null==e?void 0:e.includes(Ot));return n||i?[(null==e?void 0:e.includes(mt))?e.split(mt)[0]:e,n?`${kt}:${t}`:`${Ot}:${t}`]:[e,t]}function At(e){let t=[];e.stacktrace?t=e.stacktrace.split(pt).filter(((e,t)=>t%2==0)):e.stack&&(t=e.stack.split(pt));const n=t.reduce(((t,n,i)=>{let r,o,a,u,c;if(r=ht.exec(n)){if(o=r[1],a=r[2],u=r[3],c=r[4],null==a?void 0:a.startsWith(wt)){const e=bt.exec(a);e&&(a=e[1],u=e[2],c=e[3])}a=(null==a?void 0:a.startsWith(yt))?a.substring(St):a,[o,a]=Ct(o,a)}else if(r=Tt.exec(n)){if(o=r[1],a=r[3],u=r[4],c=r[5],a&&a.includes(It)){const e=Et.exec(a);e&&(o=o||gt,a=e[1],u=e[2])}else 0===i&&!c&&s(e.columnNumber)&&(c=String(e.columnNumber+1));[o,a]=Ct(o,a)}return(a||o)&&t.push(Lt(a,o,u?Number(u):void 0,c?Number(c):void 0)),t}),[]);return xt.test(e.message)?n.slice(1):n}function Pt(e){return{frames:At(e)}}function Mt(e){let t,n,i,r,o=[];if(m(e)&&e.error)t=e.error.message,n=e.error.name,o=At(e.error);else if((i=h(e))||b(e)){const{name:r,message:o}=e;n=null!=r?r:i?ut:ct,t=o?`${n}: ${o}`:n}else v(e)?(t=e.message,o=At(e)):(u(e)||(r=p(e)))&&(n=r?e.constructor.name:void 0,t=`${lt} ${Object.keys(e)}`);return[t,n,o]}function Nt(e){const[t,n,i,r,s]=e;let a,u,c=[];const l=o(t),d=Lt(n,dt,i,r);return s||!l?([a,u,c]=Mt(null!=s?s:t),0===c.length&&(c=[d])):l&&([a,u]=function(e){var t,n;const i=e.match(ft),r=null!==(t=null==i?void 0:i[1])&&void 0!==t?t:oe;return[null!==(n=null==i?void 0:i[2])&&void 0!==n?n:e,r]}(t),c=[d]),{value:a,type:u,stackFrames:c}}function jt(e,t){return v(e[0])?Nt(e):{value:t(e)}}class _t extends ge{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=ve,this.errorSerializer=ce}initialize(){var t,n,i,r;this.options=Object.assign(Object.assign({},this.options),this.config.consoleInstrumentation);const o=(null===(t=this.options)||void 0===t?void 0:t.serializeErrors)||!!(null===(n=this.options)||void 0===n?void 0:n.errorSerializer);this.errorSerializer=o?null!==(r=null===(i=this.options)||void 0===i?void 0:i.errorSerializer)&&void 0!==r?r:se:ce,L.filter((e=>{var t,n;return!(null!==(n=null===(t=this.options)||void 0===t?void 0:t.disabledLevels)&&void 0!==n?n:_t.defaultDisabledLevels).includes(e)})).forEach((t=>{console[t]=(...n)=>{var i,r;try{if(t!==e.LogLevel.ERROR||(null===(i=this.options)||void 0===i?void 0:i.consoleErrorAsLog))if(t===e.LogLevel.ERROR&&(null===(r=this.options)||void 0===r?void 0:r.consoleErrorAsLog)){const{value:e,type:i,stackFrames:r}=jt(n,this.errorSerializer);this.api.pushLog(e?[_t.c