@grafana/faro-web-sdk 1.0.0-beta4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +2 -0
  2. package/dist/bundle/faro-web-sdk.iife.js +1 -1
  3. package/dist/cjs/config/getWebInstrumentations.js +1 -0
  4. package/dist/cjs/config/getWebInstrumentations.js.map +1 -1
  5. package/dist/cjs/config/makeCoreConfig.js +4 -4
  6. package/dist/cjs/config/makeCoreConfig.js.map +1 -1
  7. package/dist/cjs/index.js +6 -4
  8. package/dist/cjs/index.js.map +1 -1
  9. package/dist/cjs/instrumentations/console/instrumentation.js +2 -2
  10. package/dist/cjs/instrumentations/console/instrumentation.js.map +1 -1
  11. package/dist/cjs/instrumentations/errors/instrumentation.js +2 -2
  12. package/dist/cjs/instrumentations/errors/instrumentation.js.map +1 -1
  13. package/dist/cjs/instrumentations/errors/registerOnerror.js +2 -2
  14. package/dist/cjs/instrumentations/errors/registerOnerror.js.map +1 -1
  15. package/dist/cjs/instrumentations/errors/registerOnunhandledrejection.js +2 -2
  16. package/dist/cjs/instrumentations/errors/registerOnunhandledrejection.js.map +1 -1
  17. package/dist/cjs/instrumentations/index.js +3 -1
  18. package/dist/cjs/instrumentations/index.js.map +1 -1
  19. package/dist/cjs/instrumentations/session/instrumentation.js +3 -3
  20. package/dist/cjs/instrumentations/session/instrumentation.js.map +1 -1
  21. package/dist/cjs/instrumentations/view/index.js +6 -0
  22. package/dist/cjs/instrumentations/view/index.js.map +1 -0
  23. package/dist/cjs/instrumentations/view/instrumentation.js +44 -0
  24. package/dist/cjs/instrumentations/view/instrumentation.js.map +1 -0
  25. package/dist/cjs/instrumentations/webVitals/instrumentation.js +1 -1
  26. package/dist/cjs/instrumentations/webVitals/instrumentation.js.map +1 -1
  27. package/dist/cjs/metas/index.js +5 -1
  28. package/dist/cjs/metas/index.js.map +1 -1
  29. package/dist/cjs/{session.js → metas/session/createSession.js} +1 -1
  30. package/dist/cjs/metas/session/createSession.js.map +1 -0
  31. package/dist/cjs/metas/session/index.js +6 -0
  32. package/dist/cjs/metas/session/index.js.map +1 -0
  33. package/dist/cjs/metas/view/const.js +7 -0
  34. package/dist/cjs/metas/view/const.js.map +1 -0
  35. package/dist/cjs/metas/view/index.js +6 -0
  36. package/dist/cjs/metas/view/index.js.map +1 -0
  37. package/dist/cjs/transports/console/transport.js +1 -1
  38. package/dist/cjs/transports/console/transport.js.map +1 -1
  39. package/dist/cjs/transports/fetch/transport.js.map +1 -1
  40. package/dist/esm/config/getWebInstrumentations.js +2 -1
  41. package/dist/esm/config/getWebInstrumentations.js.map +1 -1
  42. package/dist/esm/config/makeCoreConfig.js +5 -5
  43. package/dist/esm/config/makeCoreConfig.js.map +1 -1
  44. package/dist/esm/index.js +3 -4
  45. package/dist/esm/index.js.map +1 -1
  46. package/dist/esm/instrumentations/console/instrumentation.js +2 -2
  47. package/dist/esm/instrumentations/console/instrumentation.js.map +1 -1
  48. package/dist/esm/instrumentations/errors/instrumentation.js +2 -2
  49. package/dist/esm/instrumentations/errors/instrumentation.js.map +1 -1
  50. package/dist/esm/instrumentations/errors/registerOnerror.js +2 -2
  51. package/dist/esm/instrumentations/errors/registerOnerror.js.map +1 -1
  52. package/dist/esm/instrumentations/errors/registerOnunhandledrejection.js +2 -2
  53. package/dist/esm/instrumentations/errors/registerOnunhandledrejection.js.map +1 -1
  54. package/dist/esm/instrumentations/index.js +1 -0
  55. package/dist/esm/instrumentations/index.js.map +1 -1
  56. package/dist/esm/instrumentations/session/instrumentation.js +3 -3
  57. package/dist/esm/instrumentations/session/instrumentation.js.map +1 -1
  58. package/dist/esm/instrumentations/view/index.js +2 -0
  59. package/dist/esm/instrumentations/view/index.js.map +1 -0
  60. package/dist/esm/instrumentations/view/instrumentation.js +22 -0
  61. package/dist/esm/instrumentations/view/instrumentation.js.map +1 -0
  62. package/dist/esm/instrumentations/webVitals/instrumentation.js +1 -1
  63. package/dist/esm/instrumentations/webVitals/instrumentation.js.map +1 -1
  64. package/dist/esm/metas/index.js +2 -0
  65. package/dist/esm/metas/index.js.map +1 -1
  66. package/dist/esm/{session.js → metas/session/createSession.js} +1 -1
  67. package/dist/esm/metas/session/createSession.js.map +1 -0
  68. package/dist/esm/metas/session/index.js +2 -0
  69. package/dist/esm/metas/session/index.js.map +1 -0
  70. package/dist/esm/metas/view/const.js +4 -0
  71. package/dist/esm/metas/view/const.js.map +1 -0
  72. package/dist/esm/metas/view/index.js +2 -0
  73. package/dist/esm/metas/view/index.js.map +1 -0
  74. package/dist/esm/transports/console/transport.js +1 -1
  75. package/dist/esm/transports/console/transport.js.map +1 -1
  76. package/dist/esm/transports/fetch/transport.js.map +1 -1
  77. package/dist/types/index.d.ts +4 -5
  78. package/dist/types/instrumentations/console/instrumentation.d.ts +1 -1
  79. package/dist/types/instrumentations/errors/instrumentation.d.ts +1 -1
  80. package/dist/types/instrumentations/errors/registerOnerror.d.ts +2 -2
  81. package/dist/types/instrumentations/errors/registerOnunhandledrejection.d.ts +2 -2
  82. package/dist/types/instrumentations/index.d.ts +1 -0
  83. package/dist/types/instrumentations/view/index.d.ts +1 -0
  84. package/dist/types/instrumentations/view/instrumentation.d.ts +8 -0
  85. package/dist/types/instrumentations/webVitals/instrumentation.d.ts +1 -1
  86. package/dist/types/metas/index.d.ts +2 -0
  87. package/dist/types/{session.d.ts → metas/session/createSession.d.ts} +0 -0
  88. package/dist/types/metas/session/index.d.ts +1 -0
  89. package/dist/types/metas/view/const.d.ts +3 -0
  90. package/dist/types/metas/view/index.d.ts +1 -0
  91. package/dist/types/transports/console/transport.d.ts +1 -1
  92. package/dist/types/transports/fetch/transport.d.ts +3 -3
  93. package/package.json +4 -4
  94. package/dist/cjs/session.js.map +0 -1
  95. package/dist/esm/session.js.map +0 -1
package/README.md CHANGED
@@ -19,11 +19,13 @@ Alternatively, you can use the CDN version of the library. See [use cdn library]
19
19
  - errors - captures unhandled top level exceptions
20
20
  - web-vitals - captures performance metrics reported by web vitals API
21
21
  - session - sends session start event
22
+ - view - sends view changed event
22
23
 
23
24
  ## Metas
24
25
 
25
26
  - browser - captures browser metadata: name, version, etc
26
27
  - page - captures current URL
28
+ - view - the web SDK enforces a `default` value for the view meta
27
29
 
28
30
  ## Transports
29
31
 
@@ -1 +1 @@
1
- var GrafanaFaroWebSdk=function(e){"use strict";var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t={exports:{}};!function(e,t){!function(n,i){var r="function",o="undefined",a="object",s="string",l="model",u="name",c="type",d="vendor",p="version",f="architecture",b="console",g="mobile",m="tablet",v="smarttv",h="wearable",w="embedded",y="Amazon",E="Apple",x="ASUS",k="BlackBerry",T="Browser",L="Chrome",S="Firefox",O="Google",I="Huawei",N="LG",R="Microsoft",A="Motorola",C="Opera",j="Samsung",D="Sharp",P="Sony",z="Xiaomi",M="Zebra",F="Facebook",$=function(e){for(var n={},t=0;t<e.length;t++)n[e[t].toUpperCase()]=e[t];return n},_=function(e,n){return typeof e===s&&-1!==B(n).indexOf(B(e))},B=function(e){return e.toLowerCase()},U=function(e,n){if(typeof e===s)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof n===o?e:e.substring(0,350)},q=function(e,n){for(var t,o,s,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;)if(u=p[t++].exec(e))for(s=0;s<f.length;s++)c=u[++o],typeof(l=f[s])===a&&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}},G=function(e,n){for(var t in n)if(typeof n[t]===a&&n[t].length>0){for(var r=0;r<n[t].length;r++)if(_(n[t][r],e))return"?"===t?i:t}else if(_(n[t],e))return"?"===t?i:t;return e},V={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"},W={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,p],[/opios[\/ ]+([\w\.]+)/i],[p,[u,C+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[u,C]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[u,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+T],p],[/\bfocus\/([\w\.]+)/i],[p,[u,S+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[u,C+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[u,C+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI "+T]],[/fxios\/([-\w\.]+)/i],[p,[u,S]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+T]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+T],p],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,F],p],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[u,L+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,L+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[u,"Android "+T]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[p,G,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[u,S+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,B]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",B]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,B]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[d,j],[c,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[d,j],[c,g]],[/\((ip(?:hone|od)[\w ]*);/i],[l,[d,E],[c,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[d,E],[c,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[d,I],[c,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[d,I],[c,g]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[l,/_/g," "],[d,z],[c,g]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[d,z],[c,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[d,"OPPO"],[c,g]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[d,"Vivo"],[c,g]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[l,[d,"Realme"],[c,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[l,[d,A],[c,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[d,A],[c,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[d,N],[c,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[d,N],[c,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[d,"Lenovo"],[c,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[d,"Nokia"],[c,g]],[/(pixel c)\b/i],[l,[d,O],[c,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[d,O],[c,g]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[d,P],[c,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[d,P],[c,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[d,"OnePlus"],[c,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[d,y],[c,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[d,y],[c,g]],[/(playbook);[-\w\),; ]+(rim)/i],[l,d,[c,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[d,k],[c,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[d,x],[c,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[d,x],[c,g]],[/(nexus 9)/i],[l,[d,"HTC"],[c,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[l,/_/g," "],[c,g]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[d,"Acer"],[c,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[d,"Meizu"],[c,g]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[d,D],[c,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,l,[c,g]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,l,[c,m]],[/(surface duo)/i],[l,[d,R],[c,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[d,"Fairphone"],[c,g]],[/(u304aa)/i],[l,[d,"AT&T"],[c,g]],[/\bsie-(\w*)/i],[l,[d,"Siemens"],[c,g]],[/\b(rct\w+) b/i],[l,[d,"RCA"],[c,m]],[/\b(venue[\d ]{2,7}) b/i],[l,[d,"Dell"],[c,m]],[/\b(q(?:mv|ta)\w+) b/i],[l,[d,"Verizon"],[c,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[d,"Barnes & Noble"],[c,m]],[/\b(tm\d{3}\w+) b/i],[l,[d,"NuVision"],[c,m]],[/\b(k88) b/i],[l,[d,"ZTE"],[c,m]],[/\b(nx\d{3}j) b/i],[l,[d,"ZTE"],[c,g]],[/\b(gen\d{3}) b.+49h/i],[l,[d,"Swiss"],[c,g]],[/\b(zur\d{3}) b/i],[l,[d,"Swiss"],[c,m]],[/\b((zeki)?tb.*\b) b/i],[l,[d,"Zeki"],[c,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],l,[c,m]],[/\b(ns-?\w{0,9}) b/i],[l,[d,"Insignia"],[c,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[d,"NextBook"],[c,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],l,[c,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],l,[c,g]],[/\b(ph-1) /i],[l,[d,"Essential"],[c,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[d,"Envizen"],[c,m]],[/\b(trio[-\w\. ]+) b/i],[l,[d,"MachSpeed"],[c,m]],[/\btu_(1491) b/i],[l,[d,"Rotor"],[c,m]],[/(shield[\w ]+) b/i],[l,[d,"Nvidia"],[c,m]],[/(sprint) (\w+)/i],[d,l,[c,g]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[d,R],[c,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[d,M],[c,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[d,M],[c,g]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,l,[c,b]],[/droid.+; (shield) bui/i],[l,[d,"Nvidia"],[c,b]],[/(playstation [345portablevi]+)/i],[l,[d,P],[c,b]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[d,R],[c,b]],[/smart-tv.+(samsung)/i],[d,[c,v]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[d,j],[c,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,N],[c,v]],[/(apple) ?tv/i],[d,[l,E+" TV"],[c,v]],[/crkey/i],[[l,L+"cast"],[d,O],[c,v]],[/droid.+aft(\w)( bui|\))/i],[l,[d,y],[c,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[d,D],[c,v]],[/(bravia[\w ]+)( bui|\))/i],[l,[d,P],[c,v]],[/(mitv-\w{5}) bui/i],[l,[d,z],[c,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,U],[l,U],[c,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[c,v]],[/((pebble))app/i],[d,l,[c,h]],[/droid.+; (glass) \d/i],[l,[d,O],[c,h]],[/droid.+; (wt63?0{2,3})\)/i],[l,[d,M],[c,h]],[/(quest( 2)?)/i],[l,[d,F],[c,h]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[c,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[l,[c,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[c,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[c,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[c,g]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[p,G,V]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[p,G,V]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,p],[/\(bb(10);/i],[p,[u,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[u,S+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[u,"webOS"]],[/crkey\/([\d\.]+)/i],[p,[u,L+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[u,"Chromium OS"],p],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,p],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,p]]},K=function(e,t){if(typeof e===a&&(t=e,e=i),!(this instanceof K))return new K(e,t).getResult();var r=e||(typeof n!==o&&n.navigator&&n.navigator.userAgent?n.navigator.userAgent:""),b=t?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}(W,t):W;return this.getBrowser=function(){var e,n={};return n[u]=i,n[p]=i,q.call(n,r,b.browser),n.major=typeof(e=n.version)===s?e.replace(/[^\d\.]/g,"").split(".")[0]:i,n},this.getCPU=function(){var e={};return e[f]=i,q.call(e,r,b.cpu),e},this.getDevice=function(){var e={};return e[d]=i,e[l]=i,e[c]=i,q.call(e,r,b.device),e},this.getEngine=function(){var e={};return e[u]=i,e[p]=i,q.call(e,r,b.engine),e},this.getOS=function(){var e={};return e[u]=i,e[p]=i,q.call(e,r,b.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=typeof e===s&&e.length>350?U(e,350):e,this},this.setUA(r),this};K.VERSION="1.0.32",K.BROWSER=$([u,p,"major"]),K.CPU=$([f]),K.DEVICE=$([l,d,c,b,g,v,m,h,w]),K.ENGINE=K.OS=$([u,p]),e.exports&&(t=e.exports=K),t.UAParser=K;var H=typeof n!==o&&(n.jQuery||n.Zepto);if(H&&!H.ua){var X=new K;H.ua=X.getResult(),H.ua.get=function(){return X.getUA()},H.ua.set=function(e){X.setUA(e);var n=X.getResult();for(var t in n)H.ua[t]=n[t]}}}("object"==typeof window?window:n)}(t,t.exports);const i="_faroInternal",r="undefined"==typeof window?global:window;function o(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(r,i,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function a(){return i in r}function s(n,t){return n.debug("Initializing Faro"),e.faro=t,o(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 r)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(r,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}e.faro={};class l{get faro(){return e.faro}logDebug(...e){var n,t;null===(t=null===(n=this.faro)||void 0===n?void 0:n.internalLogger)||void 0===t||t.debug(`${this.name}\n`,...e)}logInfo(...e){var n,t;null===(t=null===(n=this.faro)||void 0===n?void 0:n.internalLogger)||void 0===t||t.info(`${this.name}\n`,...e)}logWarn(...e){var n,t;null===(t=null===(n=this.faro)||void 0===n?void 0:n.internalLogger)||void 0===t||t.warn(`${this.name}\n`,...e)}logError(...e){var n,t;null===(t=null===(n=this.faro)||void 0===n?void 0:n.internalLogger)||void 0===t||t.error(`${this.name}\n`,...e)}}function u(e,n){return typeof e===n}function c(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function d(e,n){try{return e instanceof n}catch(e){return!1}}const p=e=>u(e,"undefined"),f=e=>u(e,"null"),b=e=>u(e,"string"),g=e=>u(e,"number")&&!isNaN(e)||u(e,"bigint"),m=e=>!f(e)&&u(e,"object"),v=e=>u(e,"function"),h=e=>c(e,"Array"),w=e=>!m(e)&&!v(e),y=!p(Event),E=e=>y&&d(e,Event),x="undefined"!=typeof Error,k=e=>x&&d(e,Error),T=e=>c(e,"ErrorEvent"),L=e=>c(e,"DOMError"),S=e=>c(e,"DOMException"),O="undefined"!=typeof Element,I="undefined"!=typeof Map;function N(e,n){if(e===n)return!0;if(u(e,"number")&&isNaN(e))return u(n,"number")&&isNaN(n);const t=h(e),i=h(n);if(t!==i)return!1;if(t&&i){const t=e.length;if(t!==n.length)return!1;for(let i=t;0!=i--;)if(!N(e[i],n[i]))return!1;return!0}const r=m(e),o=m(n);if(r!==o)return!1;if(e&&n&&r&&o){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(!N(e[i],n[i]))return!1;return!0}return!1}function R(){return(new Date).toISOString()}var A;e.LogLevel=void 0,(A=e.LogLevel||(e.LogLevel={})).TRACE="trace",A.DEBUG="debug",A.INFO="info",A.LOG="log",A.WARN="warn",A.ERROR="error";const C=e.LogLevel.LOG,j=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function D(){}function P(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 z="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function M(e=10){return Array.from(Array(e)).map((()=>z[Math.floor(Math.random()*z.length)])).join("")}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 $={[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=>b(e)?n.includes(e):!!n.match(e)))}(n,i))return null}return t}}class B extends l{getIgnoreUrls(){return[]}}function U(n){return{[$[n.type]]:n.type===e.TransportItemType.TRACE?n.payload:[n.payload],meta:n.meta}}const q="Error";let G;function V(n,t,i,r){n.debug("Initializing API");const o=function(n,t,i,r){let o;return n.debug("Initializing traces API"),{getOTEL:()=>o,getTraceContext:()=>{const e=null==o?void 0:o.trace.getSpanContext(o.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,t)=>{n.debug("Initializing OpenTelemetry"),o={trace:e,context:t}},isOTELInitialized:()=>!!o,pushTraces:t=>{try{const o={type:e.TransportItemType.TRACE,payload:t,meta:r.value};n.debug("Pushing trace\n",o),i.execute(o)}catch(e){n.error("Error pushing trace\n",e)}}}}(n,0,i,r);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o),function(n,t,i,r,o){var a;n.debug("Initializing exceptions API");let s=null;G=null!==(a=t.parseStacktrace)&&void 0!==a?a:G;const l=e=>{n.debug("Changing stacktrace parser"),G=null!=e?e:G};return l(t.parseStacktrace),{changeStacktraceParser:l,getStacktraceParser:()=>G,pushError:(a,{skipDedupe:l,stackFrames:u,type:c}={})=>{c=c||a.name||q;const d={meta:r.value,payload:{type:c,value:a.message,timestamp:R(),trace:o.getTraceContext()},type:e.TransportItemType.EXCEPTION};(null==(u=null!=u?u:a.stack?null==G?void 0:G(a).frames:void 0)?void 0:u.length)&&(d.payload.stacktrace={frames:u});const p={type:d.payload.type,value:d.payload.value,stackTrace:d.payload.stacktrace};l||!t.dedupe||f(s)||!N(p,s)?(s=p,n.debug("Pushing exception\n",d),i.execute(d)):n.debug("Skipping error push because it is the same as the last one\n",d.payload)}}}(n,t,i,r,o)),function(e,n,t,i){let r,o;e.debug("Initializing meta API");const a=e=>{o&&i.remove(o),o={user:e},i.add(o)},s=e=>{r&&i.remove(r),r={session:e},i.add(r)};return{setUser:a,resetUser:a,setSession:s,resetSession:s,getSession:()=>i.value.session}}(n,0,0,r)),function(n,t,i,r,o){n.debug("Initializing logs API");let a=null;return{pushLog:(s,{context:l,level:u,skipDedupe:c}={})=>{try{const d={type:e.TransportItemType.LOG,payload:{message:s.map((e=>{try{return String(e)}catch(e){return""}})).join(" "),level:null!=u?u:C,context:null!=l?l:{},timestamp:R(),trace:o.getTraceContext()},meta:r.value},p={message:d.payload.message,level:d.payload.level,context:d.payload.context};if(!c&&t.dedupe&&!f(a)&&N(p,a))return void n.debug("Skipping log push because it is the same as the last one\n",d.payload);a=p,n.debug("Pushing log\n",d),i.execute(d)}catch(e){n.error("Error pushing log\n",e)}}}}(n,t,i,r,o)),function(n,t,i,r,o){n.debug("Initializing measurements API");let a=null;return{pushMeasurement:(s,{skipDedupe:l}={})=>{try{const u={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},s),{trace:o.getTraceContext()}),meta:r.value},c={type:u.payload.type,values:u.payload.values};if(!l&&t.dedupe&&!f(a)&&N(c,a))return void n.debug("Skipping measurement push because it is the same as the last one\n",u.payload);a=c,n.debug("Pushing measurement\n",u),i.execute(u)}catch(e){n.error("Error pushing measurement\n",e)}}}}(n,t,i,r,o)),function(n,t,i,r,o){let a=null;return{pushEvent:(s,l,u,{skipDedupe:c}={})=>{try{const d={meta:r.value,payload:{name:s,domain:null!=u?u:t.eventDomain,attributes:l,timestamp:R(),trace:o.getTraceContext()},type:e.TransportItemType.EVENT},p={name:d.payload.name,attributes:d.payload.attributes,domain:d.payload.domain};if(!c&&t.dedupe&&!f(a)&&N(p,a))return void n.debug("Skipping event push because it is the same as the last one\n",d.payload);a=p,n.debug("Pushing event\n",d),i.execute(d)}catch(e){n.error("Error pushing event",e)}}}}(n,t,i,r,o))}class W extends l{}function K(e,n){e.debug("Initializing instrumentations");const t=[];return{add:(...n)=>{e.debug("Adding instrumentations"),n.forEach((n=>{e.debug(`Adding "${n.name}" instrumentation`);t.some((e=>e.name===n.name))?e.warn(`Transport ${n.name} is already added`):(t.push(n),n.initialize())}))},get instrumentations(){return[...t]},remove:(...n)=>{e.debug("Removing instrumentations"),n.forEach((n=>{var i,r;e.debug(`Removing "${n.name}" instrumentation`);const o=t.reduce(((e,t,i)=>null===e&&t.name===n.name?i:null),null);o?(null===(r=(i=t[o]).destroy)||void 0===r||r.call(i),t.splice(o,1)):e.warn(`Instrumentation "${n.name}" is not added`)}))}}}var H;e.InternalLoggerLevel=void 0,(H=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[H.OFF=0]="OFF",H[H.ERROR=1]="ERROR",H[H.WARN=2]="WARN",H[H.INFO=3]="INFO",H[H.VERBOSE=4]="VERBOSE";const X={debug:D,error:D,info:D,prefix:"Faro",warn:D},Z=e.InternalLoggerLevel.ERROR,J=Object.assign({},console);let Q=J;function Y(e){var n;return Q=null!==(n=e.unpatchedConsole)&&void 0!==n?n:Q,Q}function ee(n=J,t=Z){const i=X;return t>e.InternalLoggerLevel.OFF&&(i.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${i.prefix}\n`,...e)}:D,i.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${i.prefix}\n`,...e)}:D,i.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${i.prefix}\n`,...e)}:D,i.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${i.prefix}\n`,...e)}:D),i}let ne=X;function te(e,n){return ne=ee(e,n.internalLoggerLevel),ne}const ie="1.0.0-beta4";function re(e){const n=Y(e),t=te(n,e);if(t.debug("Initializing"),a()&&!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');const i=function(e,n){var t;let i=[],r=[];const o=()=>i.reduce(((e,n)=>Object.assign(e,v(n)?n():n)),{}),a=()=>{if(r.length){const e=o();r.forEach((n=>n(e)))}},s=(...n)=>{e.debug("Adding metas\n",n),i.push(...n),a()},l={sdk:{name:"@grafana/faro-core",version:ie,integrations:n.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}};return n.app&&(l.app=n.app),n.user&&(l.user=n.user),s(l,...null!==(t=n.metas)&&void 0!==t?t:[]),{add:s,remove:(...n)=>{e.debug("Removing metas\n",n),i=i.filter((e=>!n.includes(e))),a()},addListener:e=>{r.push(e)},removeListener:e=>{r=r.filter((n=>n!==e))},get value(){return o()}}}(t,e),r=function(e,n){e.debug("Initializing transports");const t=[];let i=n.paused,r=[];const o=(...n)=>{e.debug("Adding transports"),n.forEach((n=>{e.debug(`Adding "${n.name}" transport`),t.some((e=>e===n))?e.warn(`Transport ${n.name} is already added`):t.push(n)}))},a=(...n)=>{e.debug("Adding beforeSendHooks\n",r),n.forEach((e=>{e&&r.push(e)}))},s=(...n)=>{e.debug("Adding ignoreErrorsPatterns\n",n),n.forEach((e=>{e&&r.push(_(e))}))};return o(...n.transports),a(n.beforeSend),s(n.ignoreErrors),{add:o,addBeforeSendHooks:a,addIgnoreErrorsPatterns:s,getBeforeSendHooks:()=>[...r],execute:n=>{if(!i){let i=n;for(const e of r){const n=e(i);if(null===n)return;i=n}for(const n of t)e.debug(`Transporting item using ${n.name}\n`,i),n.send(i)}},isPaused:()=>i,pause:()=>{e.debug("Pausing transports"),i=!0},remove:(...n)=>{e.debug("Removing transports"),n.forEach((n=>{e.debug(`Removing "${n.name}" transport`);const i=t.indexOf(n);-1!==i?t.splice(i,1):e.warn(`Transport "${n.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{r.filter((n=>!e.includes(n)))},get transports(){return[...t]},unpause:()=>{e.debug("Unpausing transports"),i=!1}}}(t,e),o=V(t,e,r,i);e.session&&o.setSession(e.session);const l=s(t,{api:o,config:e,internalLogger:t,metas:i,pause:r.pause,transports:r,unpatchedConsole:n,unpause:r.unpause,instrumentations:K(t)});return l.instrumentations.add(...e.instrumentations),l}const oe="faro",ae={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start"}};class se extends W{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=t.exports.VERSION}sendSessionStartEvent(e){const n=e.session;n&&n!==this.notifiedSession&&(this.notifiedSession=n,this.faro.api.pushEvent(ae.EventNames.SESSION_START,{},void 0,{skipDedupe:!0}))}initialize(){this.sendSessionStartEvent(this.faro.metas.value),this.faro.metas.addListener(this.sendSessionStartEvent.bind(this))}}class le extends W{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=ie}initialize(){this.logDebug("Initializing\n",this.options),j.filter((e=>{var n;return!(null!==(n=this.options.disabledLevels)&&void 0!==n?n:le.defaultDisabledLevels).includes(e)})).forEach((e=>{console[e]=(...n)=>{try{this.faro.api.pushLog(n,{level:e})}catch(e){this.logError(e)}finally{this.faro.unpatchedConsole[e](...n)}}}))}}le.defaultDisabledLevels=[e.LogLevel.DEBUG,e.LogLevel.TRACE,e.LogLevel.LOG];const ue=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,ce=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,de=/\((\S*)(?::(\d+))(?::(\d+))\)/,pe="address at ",fe=pe.length,be=/^\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,ge=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,me="safari-extension",ve="safari-web-extension",he=/Minified React error #\d+;/i;function we(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 ye(e,n){const t=null==e?void 0:e.includes(me),i=!t&&(null==e?void 0:e.includes(ve));return t||i?[(null==e?void 0:e.includes("@"))?e.split("@")[0]:e,t?`${me}:${n}`:`${ve}:${n}`]:[e,n]}function Ee(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,a,s,l;if(r=ce.exec(t)){if(o=r[1],a=r[2],s=r[3],l=r[4],null==a?void 0:a.startsWith("eval")){const e=de.exec(a);e&&(a=e[1],s=e[2],l=e[3])}a=(null==a?void 0:a.startsWith(pe))?a.substring(fe):a,[o,a]=ye(o,a)}else if(r=be.exec(t)){if(o=r[1],a=r[3],s=r[4],l=r[5],a&&a.includes(" > eval")){const e=ge.exec(a);e&&(o=o||"eval",a=e[1],s=e[2])}else 0===i&&!l&&g(e.columnNumber)&&(l=String(e.columnNumber+1));[o,a]=ye(o,a)}return(a||o)&&n.push(we(a,o,s?Number(s):void 0,l?Number(l):void 0)),n}),[]);return he.test(e.message)?t.slice(1):t}function xe(e){return{frames:Ee(e)}}function ke(e){let n,t,i,r,o=[];if(T(e)&&e.error)n=e.error.message,t=e.error.name,o=Ee(e.error);else if((i=L(e))||S(e)){const{name:r,message:o}=e;t=null!=r?r:i?"DOMError":"DOMException",n=o?`${t}: ${o}`:t}else k(e)?(n=e.message,o=Ee(e)):(m(e)||(r=E(e)))&&(t=r?e.constructor.name:void 0,n=`Non-Error exception captured with keys: ${Object.keys(e)}`);return[n,t,o]}function Te(e){const n=window.onerror;window.onerror=(...t)=>{try{const[i,r,o,a,s]=t;let l,u,c=[];const d=b(i),p=we(r,"?",o,a);s||!d?([l,u,c]=ke(null!=s?s:i),0===c.length&&(c=[p])):d&&([l,u]=function(e){var n,t;const i=e.match(ue),r=null!==(n=null==i?void 0:i[1])&&void 0!==n?n:q;return[null!==(t=null==i?void 0:i[2])&&void 0!==t?t:e,r]}(i),c=[p]),l&&e.api.pushError(new Error(l),{type:u,stackFrames:c})}finally{null==n||n.apply(window,t)}}}class Le extends W{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=ie}initialize(){var e;this.logDebug("Initializing"),Te(this.faro),e=this.faro,window.addEventListener("unhandledrejection",(n=>{var t,i;let r,o,a=n;a.reason?a=n.reason:(null===(t=n.detail)||void 0===t?void 0:t.reason)&&(a=null===(i=n.detail)||void 0===i?void 0:i.reason),w(a)?(r=`Non-Error promise rejection captured with value: ${String(a)}`,o="UnhandledRejection"):[r,o]=ke(a),r&&e.api.pushError(new Error(r),{type:o})}))}}var Se,Oe,Ie,Ne,Re,Ae=-1,Ce=function(e){addEventListener("pageshow",(function(n){n.persisted&&(Ae=n.timeStamp,e(n))}),!0)},je=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},De=function(){var e=je();return e&&e.activationStart||0},Pe=function(e,n){var t=je(),i="navigate";return Ae>=0?i="back-forward-cache":t&&(i=document.prerendering||De()>0?"prerender":document.wasDiscarded?"restore":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}},ze=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){}},Me=function(e,n){var t=function t(i){"pagehide"!==i.type&&"hidden"!==document.visibilityState||(e(i),n&&(removeEventListener("visibilitychange",t,!0),removeEventListener("pagehide",t,!0)))};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},Fe=function(e,n,t,i){var r,o;return function(a){n.value>=0&&(a||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))}},$e=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},_e=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Be=-1,Ue=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},qe=function(e){"hidden"===document.visibilityState&&Be>-1&&(Be="visibilitychange"===e.type?e.timeStamp:0,Ve())},Ge=function(){addEventListener("visibilitychange",qe,!0),addEventListener("prerenderingchange",qe,!0)},Ve=function(){removeEventListener("visibilitychange",qe,!0),removeEventListener("prerenderingchange",qe,!0)},We=function(){return Be<0&&(Be=Ue(),Ge(),Ce((function(){setTimeout((function(){Be=Ue(),Ge()}),0)}))),{get firstHiddenTime(){return Be}}},Ke=function(e,n){n=n||{},_e((function(){var t,i=[1800,3e3],r=We(),o=Pe("FCP"),a=ze("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(a.disconnect(),e.startTime<r.firstHiddenTime&&(o.value=Math.max(e.startTime-De(),0),o.entries.push(e),t(!0)))}))}));a&&(t=Fe(e,o,i,n.reportAllChanges),Ce((function(r){o=Pe("FCP"),t=Fe(e,o,i,n.reportAllChanges),$e((function(){o.value=performance.now()-r.timeStamp,t(!0)}))})))}))},He={passive:!0,capture:!0},Xe=new Date,Ze=function(e,n){Se||(Se=n,Oe=e,Ie=new Date,Ye(removeEventListener),Je())},Je=function(){if(Oe>=0&&Oe<Ie-Xe){var e={entryType:"first-input",name:Se.type,target:Se.target,cancelable:Se.cancelable,startTime:Se.timeStamp,processingStart:Se.timeStamp+Oe};Ne.forEach((function(n){n(e)})),Ne=[]}},Qe=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(){Ze(e,n),r()},i=function(){r()},r=function(){removeEventListener("pointerup",t,He),removeEventListener("pointercancel",i,He)};addEventListener("pointerup",t,He),addEventListener("pointercancel",i,He)}(n,e):Ze(n,e)}},Ye=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,Qe,He)}))},en=0,nn=1/0,tn=0,rn=function(e){e.forEach((function(e){e.interactionId&&(nn=Math.min(nn,e.interactionId),tn=Math.max(tn,e.interactionId),en=tn?(tn-nn)/7+1:0)}))},on=function(){return Re?en:performance.interactionCount||0},an=function(){"interactionCount"in performance||Re||(Re=ze("event",rn,{type:"event",buffered:!0,durationThreshold:0}))},sn=0,ln=function(){return on()-sn},un=[],cn={},dn=function(e){var n=un[un.length-1],t=cn[e.interactionId];if(t||un.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]};cn[i.id]=i,un.push(i)}un.sort((function(e,n){return n.latency-e.latency})),un.splice(10).forEach((function(e){delete cn[e.id]}))}},pn={},fn=function e(n){document.prerendering?_e((function(){return e(n)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(n)}),!0):setTimeout(n,0)};class bn extends W{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=ie}initialize(){this.logDebug("Initializing"),Object.entries(bn.mapping).forEach((([e,n])=>{n((n=>{this.faro.api.pushMeasurement({type:"web-vitals",values:{[e]:n.value}})}))}))}}function gn(e={}){const n=[new Le,new bn,new se];return!1!==e.captureConsole&&n.push(new le({disabledLevels:e.captureConsoleDisabledLevels})),n}bn.mapping={cls:function(e,n){n=n||{},_e((function(){var t,i=[.1,.25],r=Pe("CLS"),o=-1,a=0,s=[],l=function(n){o>-1&&e(n)},u=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=s[0],i=s[s.length-1];a&&e.startTime-i.startTime<1e3&&e.startTime-n.startTime<5e3?(a+=e.value,s.push(e)):(a=e.value,s=[e]),a>r.value&&(r.value=a,r.entries=s,t())}}))},c=ze("layout-shift",u);c&&(t=Fe(l,r,i,n.reportAllChanges),Ke((function(e){o=e.value,r.value<0&&(r.value=0,t())})),Me((function(){u(c.takeRecords()),t(!0)})),Ce((function(){a=0,o=-1,r=Pe("CLS",0),t=Fe(l,r,i,n.reportAllChanges),$e((function(){return t()}))})))}))},fcp:Ke,fid:function(e,n){n=n||{},_e((function(){var t,i=[100,300],r=We(),o=Pe("FID"),a=function(e){e.startTime<r.firstHiddenTime&&(o.value=e.processingStart-e.startTime,o.entries.push(e),t(!0))},s=function(e){e.forEach(a)},l=ze("first-input",s);t=Fe(e,o,i,n.reportAllChanges),l&&Me((function(){s(l.takeRecords()),l.disconnect()}),!0),l&&Ce((function(){var r;o=Pe("FID"),t=Fe(e,o,i,n.reportAllChanges),Ne=[],Oe=-1,Se=null,Ye(addEventListener),r=a,Ne.push(r),Je()}))}))},inp:function(e,n){n=n||{},_e((function(){var t=[200,500];an();var i,r=Pe("INP"),o=function(e){e.forEach((function(e){e.interactionId&&dn(e),"first-input"===e.entryType&&!un.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(un.length-1,Math.floor(ln()/50)),un[n]);t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,i())},a=ze("event",o,{durationThreshold:n.durationThreshold||40});i=Fe(e,r,t,n.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),Me((function(){o(a.takeRecords()),r.value<0&&ln()>0&&(r.value=0,r.entries=[]),i(!0)})),Ce((function(){un=[],sn=on(),r=Pe("INP"),i=Fe(e,r,t,n.reportAllChanges)})))}))},lcp:function(e,n){n=n||{},_e((function(){var t,i=[2500,4e3],r=We(),o=Pe("LCP"),a=function(e){var n=e[e.length-1];if(n){var i=Math.max(n.startTime-De(),0);i<r.firstHiddenTime&&(o.value=i,o.entries=[n],t())}},s=ze("largest-contentful-paint",a);if(s){t=Fe(e,o,i,n.reportAllChanges);var l=function(){pn[o.id]||(a(s.takeRecords()),s.disconnect(),pn[o.id]=!0,t(!0))};["keydown","click"].forEach((function(e){addEventListener(e,l,{once:!0,capture:!0})})),Me(l,!0),Ce((function(r){o=Pe("LCP"),t=Fe(e,o,i,n.reportAllChanges),$e((function(){o.value=performance.now()-r.timeStamp,pn[o.id]=!0,t(!0)}))}))}}))},ttfb:function(e,n){n=n||{};var t=[800,1800],i=Pe("TTFB"),r=Fe(e,i,t,n.reportAllChanges);fn((function(){var o=je();if(o){var a=o.responseStart;if(a<=0||a>performance.now())return;i.value=Math.max(a-De(),0),i.entries=[o],r(!0),Ce((function(){i=Pe("TTFB",0),(r=Fe(e,i,t,n.reportAllChanges))(!0)}))}}))}};const mn="browser",vn=()=>{const e=new t.exports.UAParser,{name:n,version:i}=e.getBrowser(),{name:r,version:o}=e.getOS(),a="unknown";return{browser:{name:null!=n?n:a,version:null!=i?i:a,os:`${null!=r?r:a} ${null!=o?o:a}`,mobile:navigator.userAgent.includes("Mobi")}}},hn=()=>({page:{url:location.href}}),wn=[vn,hn];function yn(e){return{id:M(),attributes:e}}function En(e,n,t,i){return new(t||(t=Promise))((function(r,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(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(a,s)}l((i=i.apply(e,n||[])).next())}))}class xn extends B{constructor(e){var n,t,i,r;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-fetch",this.version=ie,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=P({size:null!==(i=e.bufferSize)&&void 0!==i?i:30,concurrency:null!==(r=e.concurrency)&&void 0!==r?r:5})}send(e){return En(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((()=>{const n=JSON.stringify(U(e)),{url:t,requestOptions:i,apiKey:r}=this.options,o=null!=i?i:{},{headers:a}=o,s=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}(o,["headers"]);return fetch(t,Object.assign({method:"POST",headers:Object.assign(Object.assign({"Content-Type":"application/json"},null!=a?a:{}),r?{"x-api-key":r}:{}),body:n,keepalive:!0},null!=s?s:{})).then((e=>(429===e.status&&(this.disabledUntil=this.getRetryAfterDate(e),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),e))).catch((e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(n),e)}))}))}catch(e){this.logError(e)}}))}getIgnoreUrls(){return[this.options.url]}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 kn(e){var n,t,i,r,o,a,s,l,u,c;const d=[],p=ee(e.unpatchedConsole,e.internalLoggerLevel);return e.transports?((e.url||e.apiKey)&&p.error('if "transports" is defined, "url" and "apiKey" should not be defined'),d.push(...e.transports)):e.url?d.push(new xn({url:e.url,apiKey:e.apiKey})):p.error('either "url" or "transports" must be defined'),{app:e.app,dedupe:null===(n=e.dedupe)||void 0===n||n,globalObjectKey:e.globalObjectKey||oe,instrumentations:null!==(t=e.instrumentations)&&void 0!==t?t:gn(),internalLoggerLevel:null!==(i=e.internalLoggerLevel)&&void 0!==i?i:Z,isolate:null!==(r=e.isolate)&&void 0!==r&&r,metas:null!==(o=e.metas)&&void 0!==o?o:wn,parseStacktrace:xe,paused:null!==(a=e.paused)&&void 0!==a&&a,preventGlobalExposure:null!==(s=e.preventGlobalExposure)&&void 0!==s&&s,transports:d,unpatchedConsole:null!==(l=e.unpatchedConsole)&&void 0!==l?l:J,beforeSend:e.beforeSend,ignoreErrors:e.ignoreErrors,session:null!==(u=e.session)&&void 0!==u?u:yn(),user:e.user,eventDomain:null!==(c=e.eventDomain)&&void 0!==c?c:mn}}return e.BaseExtension=l,e.BaseInstrumentation=W,e.BaseTransport=B,e.ConsoleInstrumentation=le,e.ConsoleTransport=class extends B{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-console",this.version=ie}send(n){var t;return this.faro.unpatchedConsole[null!==(t=this.options.level)&&void 0!==t?t:e.LogLevel.DEBUG]("New event",U(n))}},e.Conventions=ae,e.ErrorsInstrumentation=Le,e.FetchTransport=xn,e.VERSION=ie,e.WebVitalsInstrumentation=bn,e.allLogLevels=j,e.browserMeta=vn,e.buildStackFrame=we,e.createInternalLogger=ee,e.createPromiseBuffer=P,e.createSession=yn,e.deepEqual=N,e.defaultEventDomain=mn,e.defaultExceptionType=q,e.defaultGlobalObjectKey=oe,e.defaultInternalLoggerLevel=Z,e.defaultLogLevel=C,e.defaultMetas=wn,e.getCurrentTimestamp=R,e.getDataFromSafariExtensions=ye,e.getInternalFaroFromGlobalObject=function(){return r[i]},e.getStackFramesFromError=Ee,e.getTransportBody=U,e.getWebInstrumentations=gn,e.globalObject=r,e.initializeFaro=function(e){const n=kn(e);if(n)return re(n)},e.internalGlobalObjectKey=i,e.isArray=h,e.isBoolean=e=>u(e,"boolean"),e.isDomError=L,e.isDomException=S,e.isElement=e=>O&&d(e,Element),e.isElementDefined=O,e.isError=k,e.isErrorDefined=x,e.isErrorEvent=T,e.isEvent=E,e.isEventDefined=y,e.isFunction=v,e.isInstanceOf=d,e.isInt=e=>g(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=a,e.isMap=e=>I&&d(e,Map),e.isMapDefined=I,e.isNull=f,e.isNumber=g,e.isObject=m,e.isPrimitive=w,e.isRegExp=e=>c(e,"RegExp"),e.isString=b,e.isSymbol=e=>u(e,"symbol"),e.isSyntheticEvent=e=>m(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>v(null==e?void 0:e.then),e.isToString=c,e.isTypeof=u,e.isUndefined=p,e.makeCoreConfig=kn,e.noop=D,e.pageMeta=hn,e.parseStacktrace=xe,e.setInternalFaroOnGlobalObject=o,e.transportItemTypeToBodyKey=$,e}({});
1
+ var GrafanaFaroWebSdk=function(e){"use strict";var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t={},i={get exports(){return t},set exports(e){t=e}};function r(e,n){return typeof e===n}function o(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function a(e,n){try{return e instanceof n}catch(e){return!1}}!function(e,t){!function(n,i){var r="function",o="undefined",a="object",s="string",u="model",l="name",c="type",d="vendor",p="version",f="architecture",g="console",b="mobile",m="tablet",v="smarttv",h="wearable",w="embedded",y="Amazon",E="Apple",x="ASUS",k="BlackBerry",T="Browser",L="Chrome",S="Firefox",O="Google",I="Huawei",N="LG",C="Microsoft",R="Motorola",A="Opera",j="Samsung",D="Sharp",P="Sony",z="Xiaomi",M="Zebra",F="Facebook",_=function(e){for(var n={},t=0;t<e.length;t++)n[e[t].toUpperCase()]=e[t];return n},$=function(e,n){return typeof e===s&&-1!==B(n).indexOf(B(e))},B=function(e){return e.toLowerCase()},U=function(e,n){if(typeof e===s)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof n===o?e:e.substring(0,350)},V=function(e,n){for(var t,o,s,u,l,c,d=0;d<n.length&&!l;){var p=n[d],f=n[d+1];for(t=o=0;t<p.length&&!l;)if(l=p[t++].exec(e))for(s=0;s<f.length;s++)c=l[++o],typeof(u=f[s])===a&&u.length>0?2===u.length?typeof u[1]==r?this[u[0]]=u[1].call(this,c):this[u[0]]=u[1]:3===u.length?typeof u[1]!==r||u[1].exec&&u[1].test?this[u[0]]=c?c.replace(u[1],u[2]):i:this[u[0]]=c?u[1].call(this,c,u[2]):i:4===u.length&&(this[u[0]]=c?u[3].call(this,c.replace(u[1],u[2])):i):this[u]=c||i;d+=2}},q=function(e,n){for(var t in n)if(typeof n[t]===a&&n[t].length>0){for(var r=0;r<n[t].length;r++)if($(n[t][r],e))return"?"===t?i:t}else if($(n[t],e))return"?"===t?i:t;return e},G={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"},W={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,A+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[l,A]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[l,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[l,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[l,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[l,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[l,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+T],p],[/\bfocus\/([\w\.]+)/i],[p,[l,S+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[l,A+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[l,A+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[l,"MIUI "+T]],[/fxios\/([-\w\.]+)/i],[p,[l,S]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360 "+T]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1 "+T],p],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[l,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,F],p],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[l,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[l,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[l,L+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,L+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[l,"Android "+T]],[/(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,q,{"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],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[l,S+" 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],[l,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,B]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",B]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,B]]],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,[d,j],[c,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[d,j],[c,b]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[d,E],[c,b]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[d,E],[c,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[d,I],[c,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[d,I],[c,b]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[d,z],[c,b]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[d,z],[c,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,[d,"OPPO"],[c,b]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[d,"Vivo"],[c,b]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[d,"Realme"],[c,b]],[/\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,[d,R],[c,b]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[d,R],[c,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[d,N],[c,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[d,N],[c,b]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[d,"Lenovo"],[c,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[d,"Nokia"],[c,b]],[/(pixel c)\b/i],[u,[d,O],[c,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[d,O],[c,b]],[/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,[d,P],[c,b]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[d,P],[c,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[d,"OnePlus"],[c,b]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[d,y],[c,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[d,y],[c,b]],[/(playbook);[-\w\),; ]+(rim)/i],[u,d,[c,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[d,k],[c,b]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[d,x],[c,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[d,x],[c,b]],[/(nexus 9)/i],[u,[d,"HTC"],[c,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[u,/_/g," "],[c,b]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[d,"Acer"],[c,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[d,"Meizu"],[c,b]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[d,D],[c,b]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,u,[c,b]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,u,[c,m]],[/(surface duo)/i],[u,[d,C],[c,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[d,"Fairphone"],[c,b]],[/(u304aa)/i],[u,[d,"AT&T"],[c,b]],[/\bsie-(\w*)/i],[u,[d,"Siemens"],[c,b]],[/\b(rct\w+) b/i],[u,[d,"RCA"],[c,m]],[/\b(venue[\d ]{2,7}) b/i],[u,[d,"Dell"],[c,m]],[/\b(q(?:mv|ta)\w+) b/i],[u,[d,"Verizon"],[c,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[d,"Barnes & Noble"],[c,m]],[/\b(tm\d{3}\w+) b/i],[u,[d,"NuVision"],[c,m]],[/\b(k88) b/i],[u,[d,"ZTE"],[c,m]],[/\b(nx\d{3}j) b/i],[u,[d,"ZTE"],[c,b]],[/\b(gen\d{3}) b.+49h/i],[u,[d,"Swiss"],[c,b]],[/\b(zur\d{3}) b/i],[u,[d,"Swiss"],[c,m]],[/\b((zeki)?tb.*\b) b/i],[u,[d,"Zeki"],[c,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],u,[c,m]],[/\b(ns-?\w{0,9}) b/i],[u,[d,"Insignia"],[c,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[d,"NextBook"],[c,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],u,[c,b]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],u,[c,b]],[/\b(ph-1) /i],[u,[d,"Essential"],[c,b]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[d,"Envizen"],[c,m]],[/\b(trio[-\w\. ]+) b/i],[u,[d,"MachSpeed"],[c,m]],[/\btu_(1491) b/i],[u,[d,"Rotor"],[c,m]],[/(shield[\w ]+) b/i],[u,[d,"Nvidia"],[c,m]],[/(sprint) (\w+)/i],[d,u,[c,b]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[d,C],[c,b]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[d,M],[c,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[d,M],[c,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,u,[c,g]],[/droid.+; (shield) bui/i],[u,[d,"Nvidia"],[c,g]],[/(playstation [345portablevi]+)/i],[u,[d,P],[c,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[d,C],[c,g]],[/smart-tv.+(samsung)/i],[d,[c,v]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[d,j],[c,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,N],[c,v]],[/(apple) ?tv/i],[d,[u,E+" TV"],[c,v]],[/crkey/i],[[u,L+"cast"],[d,O],[c,v]],[/droid.+aft(\w)( bui|\))/i],[u,[d,y],[c,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[d,D],[c,v]],[/(bravia[\w ]+)( bui|\))/i],[u,[d,P],[c,v]],[/(mitv-\w{5}) bui/i],[u,[d,z],[c,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,U],[u,U],[c,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[c,v]],[/((pebble))app/i],[d,u,[c,h]],[/droid.+; (glass) \d/i],[u,[d,O],[c,h]],[/droid.+; (wt63?0{2,3})\)/i],[u,[d,M],[c,h]],[/(quest( 2)?)/i],[u,[d,F],[c,h]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[c,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[c,b]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[c,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[c,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[c,b]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[l,"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],[l,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[l,[p,q,G]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[l,"Windows"],[p,q,G]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,"Mac OS"],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,p],[/\(bb(10);/i],[p,[l,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[l,S+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[l,"webOS"]],[/crkey\/([\d\.]+)/i],[p,[l,L+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[l,"Chromium OS"],p],[/(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)/i,/(unix) ?([\w\.]*)/i],[l,p]]},K=function(e,t){if(typeof e===a&&(t=e,e=i),!(this instanceof K))return new K(e,t).getResult();var r=e||(typeof n!==o&&n.navigator&&n.navigator.userAgent?n.navigator.userAgent:""),g=t?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}(W,t):W;return this.getBrowser=function(){var e,n={};return n[l]=i,n[p]=i,V.call(n,r,g.browser),n.major=typeof(e=n.version)===s?e.replace(/[^\d\.]/g,"").split(".")[0]:i,n},this.getCPU=function(){var e={};return e[f]=i,V.call(e,r,g.cpu),e},this.getDevice=function(){var e={};return e[d]=i,e[u]=i,e[c]=i,V.call(e,r,g.device),e},this.getEngine=function(){var e={};return e[l]=i,e[p]=i,V.call(e,r,g.engine),e},this.getOS=function(){var e={};return e[l]=i,e[p]=i,V.call(e,r,g.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=typeof e===s&&e.length>350?U(e,350):e,this},this.setUA(r),this};K.VERSION="1.0.32",K.BROWSER=_([l,p,"major"]),K.CPU=_([f]),K.DEVICE=_([u,d,c,g,b,v,m,h,w]),K.ENGINE=K.OS=_([l,p]),e.exports&&(t=e.exports=K),t.UAParser=K;var H=typeof n!==o&&(n.jQuery||n.Zepto);if(H&&!H.ua){var X=new K;H.ua=X.getResult(),H.ua.get=function(){return X.getUA()},H.ua.set=function(e){X.setUA(e);var n=X.getResult();for(var t in n)H.ua[t]=n[t]}}}("object"==typeof window?window:n)}(i,t);const s=e=>r(e,"undefined"),u=e=>r(e,"null"),l=e=>r(e,"string"),c=e=>r(e,"number")&&!isNaN(e)||r(e,"bigint"),d=e=>!u(e)&&r(e,"object"),p=e=>r(e,"function"),f=e=>o(e,"Array"),g=e=>!d(e)&&!p(e),b=!s(Event),m=e=>b&&a(e,Event),v="undefined"!=typeof Error,h=e=>v&&a(e,Error),w=e=>o(e,"ErrorEvent"),y=e=>o(e,"DOMError"),E=e=>o(e,"DOMException"),x="undefined"!=typeof Element,k="undefined"!=typeof Map;function T(e,n){if(e===n)return!0;if(r(e,"number")&&isNaN(e))return r(n,"number")&&isNaN(n);const t=f(e),i=f(n);if(t!==i)return!1;if(t&&i){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=d(e),a=d(n);if(o!==a)return!1;if(e&&n&&o&&a){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 L(){return(new Date).toISOString()}var S;e.LogLevel=void 0,(S=e.LogLevel||(e.LogLevel={})).TRACE="trace",S.DEBUG="debug",S.INFO="info",S.LOG="log",S.WARN="warn",S.ERROR="error";const O=e.LogLevel.LOG,I=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function N(){}function C(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 R="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function A(e=10){return Array.from(Array(e)).map((()=>R[Math.floor(Math.random()*R.length)])).join("")}var j;e.TransportItemType=void 0,(j=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",j.LOG="log",j.MEASUREMENT="measurement",j.TRACE="trace",j.EVENT="event";const D={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function P(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=>l(e)?n.includes(e):!!n.match(e)))}(n,i))return null}return t}}var z;e.InternalLoggerLevel=void 0,(z=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[z.OFF=0]="OFF",z[z.ERROR=1]="ERROR",z[z.WARN=2]="WARN",z[z.INFO=3]="INFO",z[z.VERBOSE=4]="VERBOSE";const M={debug:N,error:N,info:N,prefix:"Faro",warn:N},F=e.InternalLoggerLevel.ERROR,_=Object.assign({},console);let $=_;function B(e){var n;return $=null!==(n=e.unpatchedConsole)&&void 0!==n?n:$,$}function U(n=_,t=F){const i=M;return t>e.InternalLoggerLevel.OFF&&(i.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${i.prefix}\n`,...e)}:N,i.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${i.prefix}\n`,...e)}:N,i.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${i.prefix}\n`,...e)}:N,i.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${i.prefix}\n`,...e)}:N),i}let V=M;function q(e,n){return V=U(e,n.internalLoggerLevel),V}class G{constructor(){this.unpatchedConsole=_,this.internalLogger=M,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 W extends G{getIgnoreUrls(){return[]}}function K(n){return{[D[n.type]]:n.type===e.TransportItemType.TRACE?n.payload:[n.payload],meta:n.meta}}const H="Error";let X;function Z(n,t,i,r,o){t.debug("Initializing API");const a=function(n,t,i,r,o){let a;return t.debug("Initializing traces API"),{getOTEL:()=>a,getTraceContext:()=>{const e=null==a?void 0:a.trace.getSpanContext(a.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),a={trace:e,context:n}},isOTELInitialized:()=>!!a,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,o);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a),function(n,t,i,r,o,a){var s;t.debug("Initializing exceptions API");let l=null;X=null!==(s=i.parseStacktrace)&&void 0!==s?s:X;const c=e=>{t.debug("Changing stacktrace parser"),X=null!=e?e:X};return c(i.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>X,pushError:(n,{skipDedupe:s,stackFrames:c,type:d}={})=>{d=d||n.name||H;const p={meta:r.value,payload:{type:d,value:n.message,timestamp:L(),trace:a.getTraceContext()},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==X?void 0:X(n).frames:void 0)?void 0:c.length)&&(p.payload.stacktrace={frames:c});const f={type:p.payload.type,value:p.payload.value,stackTrace:p.payload.stacktrace};s||!i.dedupe||u(l)||!T(f,l)?(l=f,t.debug("Pushing exception\n",p),o.execute(p)):t.debug("Skipping error push because it is the same as the last one\n",p.payload)}}}(0,t,i,r,o,a)),function(e,n,t,i,r){let o,a,s;n.debug("Initializing meta API");const u=e=>{a&&i.remove(a),a={user:e},i.add(a)},l=e=>{o&&i.remove(o),o={session:e},i.add(o)};return{setUser:u,resetUser:u,setSession:l,resetSession:l,getSession:()=>i.value.session,setView:e=>{s&&i.remove(s),s={view:e},i.add(s)},getView:()=>i.value.view}}(0,t,0,r)),function(n,t,i,r,o,a){t.debug("Initializing logs API");let s=null;return{pushLog:(n,{context:l,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:O,context:null!=l?l:{},timestamp:L(),trace:a.getTraceContext()},meta:r.value},f={message:p.payload.message,level:p.payload.level,context:p.payload.context};if(!d&&i.dedupe&&!u(s)&&T(f,s))return void t.debug("Skipping log push because it is the same as the last one\n",p.payload);s=f,t.debug("Pushing log\n",p),o.execute(p)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,i,r,o,a)),function(n,t,i,r,o,a){t.debug("Initializing measurements API");let s=null;return{pushMeasurement:(n,{skipDedupe:l}={})=>{try{const c={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:a.getTraceContext()}),meta:r.value},d={type:c.payload.type,values:c.payload.values};if(!l&&i.dedupe&&!u(s)&&T(d,s))return void t.debug("Skipping measurement push because it is the same as the last one\n",c.payload);s=d,t.debug("Pushing measurement\n",c),o.execute(c)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,i,r,o,a)),function(n,t,i,r,o,a){let s=null;return{pushEvent:(n,l,c,{skipDedupe:d}={})=>{try{const p={meta:r.value,payload:{name:n,domain:null!=c?c:i.eventDomain,attributes:l,timestamp:L(),trace:a.getTraceContext()},type:e.TransportItemType.EVENT},f={name:p.payload.name,attributes:p.payload.attributes,domain:p.payload.domain};if(!d&&i.dedupe&&!u(s)&&T(f,s))return void t.debug("Skipping event push because it is the same as the last one\n",p.payload);s=f,t.debug("Pushing event\n",p),o.execute(p)}catch(e){t.error("Error pushing event",e)}}}}(0,t,i,r,o,a))}const J="undefined"==typeof window?global:window;class Q extends G{constructor(){super(...arguments),this.api={},this.transports={}}}const Y="1.0.0";const ee="_faroInternal";function ne(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(J,ee,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function te(){return ee in J}function ie(n,t,i,r,o,a,s){return t.debug("Initializing Faro"),e.faro={api:a,config:i,instrumentations:s,internalLogger:t,metas:r,pause:o.pause,transports:o,unpatchedConsole:n,unpause:o.unpause},ne(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 J)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(J,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}function re(e){const n=B(e),t=q(n,e);if(te()&&!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,p(n)?n():n)),{}),a=()=>{if(r.length){const e=o();r.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),i.push(...e),a()},remove:(...e)=>{n.debug("Removing metas\n",e),i=i.filter((n=>!e.includes(n))),a()},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){n.debug("Initializing transports");const r=[];let o=t.paused,a=[];return{add:(...o)=>{n.debug("Adding transports"),o.forEach((o=>{n.debug(`Adding "${o.name}" transport`),r.some((e=>e===o))?n.warn(`Transport ${o.name} is already added`):(o.unpatchedConsole=e,o.internalLogger=n,o.config=t,o.metas=i,r.push(o))}))},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(P(e))}))},getBeforeSendHooks:()=>[...a],execute:e=>{if(!o){let t=e;for(const e of a){const n=e(t);if(null===n)return;t=n}for(const e of r)n.debug(`Transporting item using ${e.name}\n`,t),e.send(t)}},isPaused:()=>o,pause:()=>{n.debug("Pausing transports"),o=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach((e=>{n.debug(`Removing "${e.name}" transport`);const t=r.indexOf(e);-1!==t?r.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{a.filter((n=>!e.includes(n)))},get transports(){return[...r]},unpause:()=>{n.debug("Unpausing transports"),o=!1}}}(n,t,e,i),o=Z(0,t,e,i,r),a=function(e,n,t,i,r,o){n.debug("Initializing instrumentations");const a=[];return{add:(...s)=>{n.debug("Adding instrumentations"),s.forEach((s=>{n.debug(`Adding "${s.name}" instrumentation`),a.some((e=>e.name===s.name))?n.warn(`Instrumentation ${s.name} is already added`):(s.unpatchedConsole=e,s.internalLogger=n,s.config=t,s.metas=i,s.transports=r,s.api=o,a.push(s),s.initialize())}))},get instrumentations(){return[...a]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,i;n.debug(`Removing "${e.name}" instrumentation`);const r=a.reduce(((n,t,i)=>null===n&&t.name===e.name?i:null),null);r?(null===(i=(t=a[r]).destroy)||void 0===i||i.call(t),a.splice(r,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,i,r,o),s=ie(n,t,e,i,r,o,a);return function(e){var n;const t={sdk:{name:"@grafana/faro-core",version:Y,integrations:e.config.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}};e.config.session&&e.api.setSession(e.config.session),e.config.app&&(t.app=e.config.app),e.config.user&&(t.user=e.config.user),e.config.view&&(t.view=e.config.view),e.metas.add(t,...null!==(n=e.config.metas)&&void 0!==n?n:[])}(s),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(s),function(e){e.instrumentations.add(...e.config.instrumentations)}(s),s}e.faro={};const oe="faro",ae={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}};class se extends Q{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=t.VERSION}sendSessionStartEvent(e){const n=e.session;n&&n!==this.notifiedSession&&(this.notifiedSession=n,this.api.pushEvent(ae.EventNames.SESSION_START,{},void 0,{skipDedupe:!0}))}initialize(){this.sendSessionStartEvent(this.metas.value),this.metas.addListener(this.sendSessionStartEvent.bind(this))}}class ue extends Q{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=Y}initialize(){this.logDebug("Initializing\n",this.options),I.filter((e=>{var n;return!(null!==(n=this.options.disabledLevels)&&void 0!==n?n:ue.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)}}}))}}ue.defaultDisabledLevels=[e.LogLevel.DEBUG,e.LogLevel.TRACE,e.LogLevel.LOG];const le=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,ce=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,de=/\((\S*)(?::(\d+))(?::(\d+))\)/,pe="address at ",fe=pe.length,ge=/^\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,be=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,me="safari-extension",ve="safari-web-extension",he=/Minified React error #\d+;/i;function we(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 ye(e,n){const t=null==e?void 0:e.includes(me),i=!t&&(null==e?void 0:e.includes(ve));return t||i?[(null==e?void 0:e.includes("@"))?e.split("@")[0]:e,t?`${me}:${n}`:`${ve}:${n}`]:[e,n]}function Ee(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,a,s,u;if(r=ce.exec(t)){if(o=r[1],a=r[2],s=r[3],u=r[4],null==a?void 0:a.startsWith("eval")){const e=de.exec(a);e&&(a=e[1],s=e[2],u=e[3])}a=(null==a?void 0:a.startsWith(pe))?a.substring(fe):a,[o,a]=ye(o,a)}else if(r=ge.exec(t)){if(o=r[1],a=r[3],s=r[4],u=r[5],a&&a.includes(" > eval")){const e=be.exec(a);e&&(o=o||"eval",a=e[1],s=e[2])}else 0===i&&!u&&c(e.columnNumber)&&(u=String(e.columnNumber+1));[o,a]=ye(o,a)}return(a||o)&&n.push(we(a,o,s?Number(s):void 0,u?Number(u):void 0)),n}),[]);return he.test(e.message)?t.slice(1):t}function xe(e){return{frames:Ee(e)}}function ke(e){let n,t,i,r,o=[];if(w(e)&&e.error)n=e.error.message,t=e.error.name,o=Ee(e.error);else if((i=y(e))||E(e)){const{name:r,message:o}=e;t=null!=r?r:i?"DOMError":"DOMException",n=o?`${t}: ${o}`:t}else h(e)?(n=e.message,o=Ee(e)):(d(e)||(r=m(e)))&&(t=r?e.constructor.name:void 0,n=`Non-Error exception captured with keys: ${Object.keys(e)}`);return[n,t,o]}function Te(e){const n=window.onerror;window.onerror=(...t)=>{try{const[i,r,o,a,s]=t;let u,c,d=[];const p=l(i),f=we(r,"?",o,a);s||!p?([u,c,d]=ke(null!=s?s:i),0===d.length&&(d=[f])):p&&([u,c]=function(e){var n,t;const i=e.match(le),r=null!==(n=null==i?void 0:i[1])&&void 0!==n?n:H;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 Le extends Q{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=Y}initialize(){var e;this.logDebug("Initializing"),Te(this.api),e=this.api,window.addEventListener("unhandledrejection",(n=>{var t,i;let r,o,a=n;a.reason?a=n.reason:(null===(t=n.detail)||void 0===t?void 0:t.reason)&&(a=null===(i=n.detail)||void 0===i?void 0:i.reason),g(a)?(r=`Non-Error promise rejection captured with value: ${String(a)}`,o="UnhandledRejection"):[r,o]=ke(a),r&&e.pushError(new Error(r),{type:o})}))}}class Se extends Q{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=t.VERSION}sendViewChangedEvent(e){const n=e.view;n&&n!==this.notifiedView&&(this.notifiedView=n,this.api.pushEvent(ae.EventNames.VIEW_CHANGED,{},void 0,{skipDedupe:!0}))}initialize(){this.sendViewChangedEvent(this.metas.value),this.metas.addListener(this.sendViewChangedEvent.bind(this))}}var Oe,Ie,Ne,Ce,Re,Ae=-1,je=function(e){addEventListener("pageshow",(function(n){n.persisted&&(Ae=n.timeStamp,e(n))}),!0)},De=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},Pe=function(){var e=De();return e&&e.activationStart||0},ze=function(e,n){var t=De(),i="navigate";return Ae>=0?i="back-forward-cache":t&&(i=document.prerendering||Pe()>0?"prerender":document.wasDiscarded?"restore":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}},Me=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){}},Fe=function(e,n,t,i){var r,o;return function(a){n.value>=0&&(a||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))}},_e=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},$e=function(e){var n=function(n){"pagehide"!==n.type&&"hidden"!==document.visibilityState||e(n)};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Be=function(e){var n=!1;return function(t){n||(e(t),n=!0)}},Ue=-1,Ve=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},qe=function(e){"hidden"===document.visibilityState&&Ue>-1&&(Ue="visibilitychange"===e.type?e.timeStamp:0,We())},Ge=function(){addEventListener("visibilitychange",qe,!0),addEventListener("prerenderingchange",qe,!0)},We=function(){removeEventListener("visibilitychange",qe,!0),removeEventListener("prerenderingchange",qe,!0)},Ke=function(){return Ue<0&&(Ue=Ve(),Ge(),je((function(){setTimeout((function(){Ue=Ve(),Ge()}),0)}))),{get firstHiddenTime(){return Ue}}},He=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Xe=function(e,n){n=n||{},He((function(){var t,i=[1800,3e3],r=Ke(),o=ze("FCP"),a=Me("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(a.disconnect(),e.startTime<r.firstHiddenTime&&(o.value=Math.max(e.startTime-Pe(),0),o.entries.push(e),t(!0)))}))}));a&&(t=Fe(e,o,i,n.reportAllChanges),je((function(r){o=ze("FCP"),t=Fe(e,o,i,n.reportAllChanges),_e((function(){o.value=performance.now()-r.timeStamp,t(!0)}))})))}))},Ze={passive:!0,capture:!0},Je=new Date,Qe=function(e,n){Oe||(Oe=n,Ie=e,Ne=new Date,nn(removeEventListener),Ye())},Ye=function(){if(Ie>=0&&Ie<Ne-Je){var e={entryType:"first-input",name:Oe.type,target:Oe.target,cancelable:Oe.cancelable,startTime:Oe.timeStamp,processingStart:Oe.timeStamp+Ie};Ce.forEach((function(n){n(e)})),Ce=[]}},en=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(){Qe(e,n),r()},i=function(){r()},r=function(){removeEventListener("pointerup",t,Ze),removeEventListener("pointercancel",i,Ze)};addEventListener("pointerup",t,Ze),addEventListener("pointercancel",i,Ze)}(n,e):Qe(n,e)}},nn=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,en,Ze)}))},tn=0,rn=1/0,on=0,an=function(e){e.forEach((function(e){e.interactionId&&(rn=Math.min(rn,e.interactionId),on=Math.max(on,e.interactionId),tn=on?(on-rn)/7+1:0)}))},sn=function(){return Re?tn:performance.interactionCount||0},un=function(){"interactionCount"in performance||Re||(Re=Me("event",an,{type:"event",buffered:!0,durationThreshold:0}))},ln=0,cn=function(){return sn()-ln},dn=[],pn={},fn=function(e){var n=dn[dn.length-1],t=pn[e.interactionId];if(t||dn.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]};pn[i.id]=i,dn.push(i)}dn.sort((function(e,n){return n.latency-e.latency})),dn.splice(10).forEach((function(e){delete pn[e.id]}))}},gn={},bn=function e(n){document.prerendering?He((function(){return e(n)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(n)}),!0):setTimeout(n,0)};class mn extends Q{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=Y}initialize(){this.logDebug("Initializing"),Object.entries(mn.mapping).forEach((([e,n])=>{n((n=>{this.api.pushMeasurement({type:"web-vitals",values:{[e]:n.value}})}))}))}}function vn(e={}){const n=[new Le,new mn,new se,new Se];return!1!==e.captureConsole&&n.push(new ue({disabledLevels:e.captureConsoleDisabledLevels})),n}mn.mapping={cls:function(e,n){n=n||{},Xe(Be((function(){var t,i=[.1,.25],r=ze("CLS",0),o=0,a=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=a[0],t=a[a.length-1];o&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(o+=e.value,a.push(e)):(o=e.value,a=[e])}})),o>r.value&&(r.value=o,r.entries=a,t())},u=Me("layout-shift",s);u&&(t=Fe(e,r,i,n.reportAllChanges),$e((function(){s(u.takeRecords()),t(!0)})),je((function(){o=0,r=ze("CLS",0),t=Fe(e,r,i,n.reportAllChanges),_e((function(){return t()}))})),setTimeout(t,0))})))},fcp:Xe,fid:function(e,n){n=n||{},He((function(){var t,i=[100,300],r=Ke(),o=ze("FID"),a=function(e){e.startTime<r.firstHiddenTime&&(o.value=e.processingStart-e.startTime,o.entries.push(e),t(!0))},s=function(e){e.forEach(a)},u=Me("first-input",s);t=Fe(e,o,i,n.reportAllChanges),u&&$e(Be((function(){s(u.takeRecords()),u.disconnect()}))),u&&je((function(){var r;o=ze("FID"),t=Fe(e,o,i,n.reportAllChanges),Ce=[],Ie=-1,Oe=null,nn(addEventListener),r=a,Ce.push(r),Ye()}))}))},inp:function(e,n){n=n||{},He((function(){var t=[200,500];un();var i,r=ze("INP"),o=function(e){e.forEach((function(e){e.interactionId&&fn(e),"first-input"===e.entryType&&!dn.some((function(n){return n.entries.some((function(n){return e.duration===n.duration&&e.startTime===n.startTime}))}))&&fn(e)}));var n,t=(n=Math.min(dn.length-1,Math.floor(cn()/50)),dn[n]);t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,i())},a=Me("event",o,{durationThreshold:n.durationThreshold||40});i=Fe(e,r,t,n.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),$e((function(){o(a.takeRecords()),r.value<0&&cn()>0&&(r.value=0,r.entries=[]),i(!0)})),je((function(){dn=[],ln=sn(),r=ze("INP"),i=Fe(e,r,t,n.reportAllChanges)})))}))},lcp:function(e,n){n=n||{},He((function(){var t,i=[2500,4e3],r=Ke(),o=ze("LCP"),a=function(e){var n=e[e.length-1];if(n){var i=Math.max(n.startTime-Pe(),0);i<r.firstHiddenTime&&(o.value=i,o.entries=[n],t())}},s=Me("largest-contentful-paint",a);if(s){t=Fe(e,o,i,n.reportAllChanges);var u=Be((function(){gn[o.id]||(a(s.takeRecords()),s.disconnect(),gn[o.id]=!0,t(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,u,!0)})),$e(u),je((function(r){o=ze("LCP"),t=Fe(e,o,i,n.reportAllChanges),_e((function(){o.value=performance.now()-r.timeStamp,gn[o.id]=!0,t(!0)}))}))}}))},ttfb:function(e,n){n=n||{};var t=[800,1800],i=ze("TTFB"),r=Fe(e,i,t,n.reportAllChanges);bn((function(){var o=De();if(o){var a=o.responseStart;if(a<=0||a>performance.now())return;i.value=Math.max(a-Pe(),0),i.entries=[o],r(!0),je((function(){i=ze("TTFB",0),(r=Fe(e,i,t,n.reportAllChanges))(!0)}))}}))}};const hn="browser",wn=()=>{const e=new t.UAParser,{name:n,version:i}=e.getBrowser(),{name:r,version:o}=e.getOS(),a="unknown";return{browser:{name:null!=n?n:a,version:null!=i?i:a,os:`${null!=r?r:a} ${null!=o?o:a}`,mobile:navigator.userAgent.includes("Mobi")}}},yn=()=>({page:{url:location.href}}),En=[wn,yn];function xn(e){return{id:A(),attributes:e}}const kn={name:"default"};function Tn(e,n,t,i){return new(t||(t=Promise))((function(r,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}u((i=i.apply(e,n||[])).next())}))}class Ln extends W{constructor(e){var n,t,i,r;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-fetch",this.version=Y,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=C({size:null!==(i=e.bufferSize)&&void 0!==i?i:30,concurrency:null!==(r=e.concurrency)&&void 0!==r?r:5})}send(e){return Tn(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((()=>{const n=JSON.stringify(K(e)),{url:t,requestOptions:i,apiKey:r}=this.options,o=null!=i?i:{},{headers:a}=o,s=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}(o,["headers"]);return fetch(t,Object.assign({method:"POST",headers:Object.assign(Object.assign({"Content-Type":"application/json"},null!=a?a:{}),r?{"x-api-key":r}:{}),body:n,keepalive:!0},null!=s?s:{})).then((e=>(429===e.status&&(this.disabledUntil=this.getRetryAfterDate(e),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),e))).catch((e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(n),e)}))}))}catch(e){this.logError(e)}}))}getIgnoreUrls(){return[this.options.url]}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 Sn(e){var n,t,i,r,o,a,s,u,l,c,d;const p=[],f=U(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 Ln({url:e.url,apiKey:e.apiKey})):f.error('either "url" or "transports" must be defined'),{app:e.app,dedupe:null===(n=e.dedupe)||void 0===n||n,globalObjectKey:e.globalObjectKey||oe,instrumentations:null!==(t=e.instrumentations)&&void 0!==t?t:vn(),internalLoggerLevel:null!==(i=e.internalLoggerLevel)&&void 0!==i?i:F,isolate:null!==(r=e.isolate)&&void 0!==r&&r,metas:null!==(o=e.metas)&&void 0!==o?o:En,parseStacktrace:xe,paused:null!==(a=e.paused)&&void 0!==a&&a,preventGlobalExposure:null!==(s=e.preventGlobalExposure)&&void 0!==s&&s,transports:p,unpatchedConsole:null!==(u=e.unpatchedConsole)&&void 0!==u?u:_,beforeSend:e.beforeSend,eventDomain:null!==(l=e.eventDomain)&&void 0!==l?l:hn,ignoreErrors:e.ignoreErrors,session:null!==(c=e.session)&&void 0!==c?c:xn(),user:e.user,view:null!==(d=e.view)&&void 0!==d?d:kn}}return e.BaseExtension=G,e.BaseInstrumentation=Q,e.BaseTransport=W,e.ConsoleInstrumentation=ue,e.ConsoleTransport=class extends W{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-console",this.version=Y}send(n){var t;return this.unpatchedConsole[null!==(t=this.options.level)&&void 0!==t?t:e.LogLevel.DEBUG]("New event",K(n))}},e.Conventions=ae,e.ErrorsInstrumentation=Le,e.FetchTransport=Ln,e.VERSION=Y,e.ViewInstrumentation=Se,e.WebVitalsInstrumentation=mn,e.allLogLevels=I,e.browserMeta=wn,e.buildStackFrame=we,e.createInternalLogger=U,e.createPromiseBuffer=C,e.createSession=xn,e.deepEqual=T,e.defaultEventDomain=hn,e.defaultExceptionType=H,e.defaultGlobalObjectKey=oe,e.defaultInternalLoggerLevel=F,e.defaultLogLevel=O,e.defaultMetas=En,e.defaultViewMeta=kn,e.genShortID=A,e.getCurrentTimestamp=L,e.getDataFromSafariExtensions=ye,e.getInternalFaroFromGlobalObject=function(){return J[ee]},e.getStackFramesFromError=Ee,e.getTransportBody=K,e.getWebInstrumentations=vn,e.globalObject=J,e.initializeFaro=function(e){const n=Sn(e);if(n)return re(n)},e.internalGlobalObjectKey=ee,e.isArray=f,e.isBoolean=e=>r(e,"boolean"),e.isDomError=y,e.isDomException=E,e.isElement=e=>x&&a(e,Element),e.isElementDefined=x,e.isError=h,e.isErrorDefined=v,e.isErrorEvent=w,e.isEvent=m,e.isEventDefined=b,e.isFunction=p,e.isInstanceOf=a,e.isInt=e=>c(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=te,e.isMap=e=>k&&a(e,Map),e.isMapDefined=k,e.isNull=u,e.isNumber=c,e.isObject=d,e.isPrimitive=g,e.isRegExp=e=>o(e,"RegExp"),e.isString=l,e.isSymbol=e=>r(e,"symbol"),e.isSyntheticEvent=e=>d(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>p(null==e?void 0:e.then),e.isToString=o,e.isTypeof=r,e.isUndefined=s,e.makeCoreConfig=Sn,e.noop=N,e.pageMeta=yn,e.parseStacktrace=xe,e.setInternalFaroOnGlobalObject=ne,e.transportItemTypeToBodyKey=D,e}({});
@@ -8,6 +8,7 @@ function getWebInstrumentations(options) {
8
8
  new instrumentations_1.ErrorsInstrumentation(),
9
9
  new instrumentations_1.WebVitalsInstrumentation(),
10
10
  new instrumentations_1.SessionInstrumentation(),
11
+ new instrumentations_1.ViewInstrumentation(),
11
12
  ];
12
13
  if (options.captureConsole !== false) {
13
14
  instrumentations.push(new instrumentations_1.ConsoleInstrumentation({
@@ -1 +1 @@
1
- {"version":3,"file":"getWebInstrumentations.js","sourceRoot":"","sources":["../../../src/config/getWebInstrumentations.ts"],"names":[],"mappings":";;;AAEA,wDAK6B;AAG7B,SAAgB,sBAAsB,CAAC,OAA2C;IAA3C,wBAAA,EAAA,YAA2C;IAChF,IAAM,gBAAgB,GAAsB;QAC1C,IAAI,wCAAqB,EAAE;QAC3B,IAAI,2CAAwB,EAAE;QAC9B,IAAI,yCAAsB,EAAE;KAC7B,CAAC;IAEF,IAAI,OAAO,CAAC,cAAc,KAAK,KAAK,EAAE;QACpC,gBAAgB,CAAC,IAAI,CACnB,IAAI,yCAAsB,CAAC;YACzB,cAAc,EAAE,OAAO,CAAC,4BAA4B;SACrD,CAAC,CACH,CAAC;KACH;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAhBD,wDAgBC","sourcesContent":["import type { Instrumentation } from '@grafana/faro-core';\n\nimport {\n ConsoleInstrumentation,\n ErrorsInstrumentation,\n SessionInstrumentation,\n WebVitalsInstrumentation,\n} from '../instrumentations';\nimport type { GetWebInstrumentationsOptions } from './types';\n\nexport function getWebInstrumentations(options: GetWebInstrumentationsOptions = {}): Instrumentation[] {\n const instrumentations: Instrumentation[] = [\n new ErrorsInstrumentation(),\n new WebVitalsInstrumentation(),\n new SessionInstrumentation(),\n ];\n\n if (options.captureConsole !== false) {\n instrumentations.push(\n new ConsoleInstrumentation({\n disabledLevels: options.captureConsoleDisabledLevels,\n })\n );\n }\n\n return instrumentations;\n}\n"]}
1
+ {"version":3,"file":"getWebInstrumentations.js","sourceRoot":"","sources":["../../../src/config/getWebInstrumentations.ts"],"names":[],"mappings":";;;AAEA,wDAM6B;AAI7B,SAAgB,sBAAsB,CAAC,OAA2C;IAA3C,wBAAA,EAAA,YAA2C;IAChF,IAAM,gBAAgB,GAAsB;QAC1C,IAAI,wCAAqB,EAAE;QAC3B,IAAI,2CAAwB,EAAE;QAC9B,IAAI,yCAAsB,EAAE;QAC5B,IAAI,sCAAmB,EAAE;KAC1B,CAAC;IAEF,IAAI,OAAO,CAAC,cAAc,KAAK,KAAK,EAAE;QACpC,gBAAgB,CAAC,IAAI,CACnB,IAAI,yCAAsB,CAAC;YACzB,cAAc,EAAE,OAAO,CAAC,4BAA4B;SACrD,CAAC,CACH,CAAC;KACH;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAjBD,wDAiBC","sourcesContent":["import type { Instrumentation } from '@grafana/faro-core';\n\nimport {\n ConsoleInstrumentation,\n ErrorsInstrumentation,\n SessionInstrumentation,\n ViewInstrumentation,\n WebVitalsInstrumentation,\n} from '../instrumentations';\n\nimport type { GetWebInstrumentationsOptions } from './types';\n\nexport function getWebInstrumentations(options: GetWebInstrumentationsOptions = {}): Instrumentation[] {\n const instrumentations: Instrumentation[] = [\n new ErrorsInstrumentation(),\n new WebVitalsInstrumentation(),\n new SessionInstrumentation(),\n new ViewInstrumentation(),\n ];\n\n if (options.captureConsole !== false) {\n instrumentations.push(\n new ConsoleInstrumentation({\n disabledLevels: options.captureConsoleDisabledLevels,\n })\n );\n }\n\n return instrumentations;\n}\n"]}
@@ -5,11 +5,10 @@ var faro_core_1 = require("@grafana/faro-core");
5
5
  var consts_1 = require("../consts");
6
6
  var instrumentations_1 = require("../instrumentations");
7
7
  var metas_1 = require("../metas");
8
- var session_1 = require("../session");
9
8
  var transports_1 = require("../transports");
10
9
  var getWebInstrumentations_1 = require("./getWebInstrumentations");
11
10
  function makeCoreConfig(browserConfig) {
12
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
11
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
13
12
  var transports = [];
14
13
  var internalLogger = (0, faro_core_1.createInternalLogger)(browserConfig.unpatchedConsole, browserConfig.internalLoggerLevel);
15
14
  if (browserConfig.transports) {
@@ -41,10 +40,11 @@ function makeCoreConfig(browserConfig) {
41
40
  transports: transports,
42
41
  unpatchedConsole: (_h = browserConfig.unpatchedConsole) !== null && _h !== void 0 ? _h : faro_core_1.defaultUnpatchedConsole,
43
42
  beforeSend: browserConfig.beforeSend,
43
+ eventDomain: (_j = browserConfig.eventDomain) !== null && _j !== void 0 ? _j : consts_1.defaultEventDomain,
44
44
  ignoreErrors: browserConfig.ignoreErrors,
45
- session: (_j = browserConfig.session) !== null && _j !== void 0 ? _j : (0, session_1.createSession)(),
45
+ session: (_k = browserConfig.session) !== null && _k !== void 0 ? _k : (0, metas_1.createSession)(),
46
46
  user: browserConfig.user,
47
- eventDomain: (_k = browserConfig.eventDomain) !== null && _k !== void 0 ? _k : consts_1.defaultEventDomain,
47
+ view: (_l = browserConfig.view) !== null && _l !== void 0 ? _l : metas_1.defaultViewMeta,
48
48
  };
49
49
  }
50
50
  exports.makeCoreConfig = makeCoreConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"makeCoreConfig.js","sourceRoot":"","sources":["../../../src/config/makeCoreConfig.ts"],"names":[],"mappings":";;;AAAA,gDAK4B;AAG5B,oCAA+C;AAC/C,wDAAsD;AACtD,kCAAwC;AACxC,sCAA2C;AAC3C,4CAA+C;AAC/C,mEAAkE;AAGlE,SAAgB,cAAc,CAAC,aAA4B;;IACzD,IAAM,UAAU,GAAgB,EAAE,CAAC;IAEnC,IAAM,cAAc,GAAG,IAAA,gCAAoB,EAAC,aAAa,CAAC,gBAAgB,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAE/G,IAAI,aAAa,CAAC,UAAU,EAAE;QAC5B,IAAI,aAAa,CAAC,GAAG,IAAI,aAAa,CAAC,MAAM,EAAE;YAC7C,cAAc,CAAC,KAAK,CAAC,sEAAsE,CAAC,CAAC;SAC9F;QAED,UAAU,CAAC,IAAI,OAAf,UAAU,EAAS,aAAa,CAAC,UAAU,EAAE;KAC9C;SAAM,IAAI,aAAa,CAAC,GAAG,EAAE;QAC5B,UAAU,CAAC,IAAI,CACb,IAAI,2BAAc,CAAC;YACjB,GAAG,EAAE,aAAa,CAAC,GAAG;YACtB,MAAM,EAAE,aAAa,CAAC,MAAM;SAC7B,CAAC,CACH,CAAC;KACH;SAAM;QACL,cAAc,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;KACtE;IAED,OAAO;QACL,GAAG,EAAE,aAAa,CAAC,GAAG;QACtB,MAAM,EAAE,MAAA,aAAa,CAAC,MAAM,mCAAI,IAAI;QACpC,eAAe,EAAE,aAAa,CAAC,eAAe,IAAI,kCAAsB;QACxE,gBAAgB,EAAE,MAAA,aAAa,CAAC,gBAAgB,mCAAI,IAAA,+CAAsB,GAAE;QAC5E,mBAAmB,EAAE,MAAA,aAAa,CAAC,mBAAmB,mCAAI,sCAA0B;QACpF,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,KAAK;QACvC,KAAK,EAAE,MAAA,aAAa,CAAC,KAAK,mCAAI,oBAAY;QAC1C,eAAe,oCAAA;QACf,MAAM,EAAE,MAAA,aAAa,CAAC,MAAM,mCAAI,KAAK;QACrC,qBAAqB,EAAE,MAAA,aAAa,CAAC,qBAAqB,mCAAI,KAAK;QACnE,UAAU,YAAA;QACV,gBAAgB,EAAE,MAAA,aAAa,CAAC,gBAAgB,mCAAI,mCAAuB;QAE3E,UAAU,EAAE,aAAa,CAAC,UAAU;QACpC,YAAY,EAAE,aAAa,CAAC,YAAY;QACxC,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,IAAA,uBAAa,GAAE;QACjD,IAAI,EAAE,aAAa,CAAC,IAAI;QACxB,WAAW,EAAE,MAAA,aAAa,CAAC,WAAW,mCAAI,2BAAkB;KAC7D,CAAC;AACJ,CAAC;AA1CD,wCA0CC","sourcesContent":["import {\n createInternalLogger,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultUnpatchedConsole,\n} from '@grafana/faro-core';\nimport type { Config, Transport } from '@grafana/faro-core';\n\nimport { defaultEventDomain } from '../consts';\nimport { parseStacktrace } from '../instrumentations';\nimport { defaultMetas } from '../metas';\nimport { createSession } from '../session';\nimport { FetchTransport } from '../transports';\nimport { getWebInstrumentations } from './getWebInstrumentations';\nimport type { BrowserConfig } from './types';\n\nexport function makeCoreConfig(browserConfig: BrowserConfig): Config | undefined {\n const transports: Transport[] = [];\n\n const internalLogger = createInternalLogger(browserConfig.unpatchedConsole, browserConfig.internalLoggerLevel);\n\n if (browserConfig.transports) {\n if (browserConfig.url || browserConfig.apiKey) {\n internalLogger.error('if \"transports\" is defined, \"url\" and \"apiKey\" should not be defined');\n }\n\n transports.push(...browserConfig.transports);\n } else if (browserConfig.url) {\n transports.push(\n new FetchTransport({\n url: browserConfig.url,\n apiKey: browserConfig.apiKey,\n })\n );\n } else {\n internalLogger.error('either \"url\" or \"transports\" must be defined');\n }\n\n return {\n app: browserConfig.app,\n dedupe: browserConfig.dedupe ?? true,\n globalObjectKey: browserConfig.globalObjectKey || defaultGlobalObjectKey,\n instrumentations: browserConfig.instrumentations ?? getWebInstrumentations(),\n internalLoggerLevel: browserConfig.internalLoggerLevel ?? defaultInternalLoggerLevel,\n isolate: browserConfig.isolate ?? false,\n metas: browserConfig.metas ?? defaultMetas,\n parseStacktrace,\n paused: browserConfig.paused ?? false,\n preventGlobalExposure: browserConfig.preventGlobalExposure ?? false,\n transports,\n unpatchedConsole: browserConfig.unpatchedConsole ?? defaultUnpatchedConsole,\n\n beforeSend: browserConfig.beforeSend,\n ignoreErrors: browserConfig.ignoreErrors,\n session: browserConfig.session ?? createSession(),\n user: browserConfig.user,\n eventDomain: browserConfig.eventDomain ?? defaultEventDomain,\n };\n}\n"]}
1
+ {"version":3,"file":"makeCoreConfig.js","sourceRoot":"","sources":["../../../src/config/makeCoreConfig.ts"],"names":[],"mappings":";;;AAAA,gDAK4B;AAG5B,oCAA+C;AAC/C,wDAAsD;AACtD,kCAAwE;AACxE,4CAA+C;AAE/C,mEAAkE;AAGlE,SAAgB,cAAc,CAAC,aAA4B;;IACzD,IAAM,UAAU,GAAgB,EAAE,CAAC;IAEnC,IAAM,cAAc,GAAG,IAAA,gCAAoB,EAAC,aAAa,CAAC,gBAAgB,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAE/G,IAAI,aAAa,CAAC,UAAU,EAAE;QAC5B,IAAI,aAAa,CAAC,GAAG,IAAI,aAAa,CAAC,MAAM,EAAE;YAC7C,cAAc,CAAC,KAAK,CAAC,sEAAsE,CAAC,CAAC;SAC9F;QAED,UAAU,CAAC,IAAI,OAAf,UAAU,EAAS,aAAa,CAAC,UAAU,EAAE;KAC9C;SAAM,IAAI,aAAa,CAAC,GAAG,EAAE;QAC5B,UAAU,CAAC,IAAI,CACb,IAAI,2BAAc,CAAC;YACjB,GAAG,EAAE,aAAa,CAAC,GAAG;YACtB,MAAM,EAAE,aAAa,CAAC,MAAM;SAC7B,CAAC,CACH,CAAC;KACH;SAAM;QACL,cAAc,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;KACtE;IAED,OAAO;QACL,GAAG,EAAE,aAAa,CAAC,GAAG;QACtB,MAAM,EAAE,MAAA,aAAa,CAAC,MAAM,mCAAI,IAAI;QACpC,eAAe,EAAE,aAAa,CAAC,eAAe,IAAI,kCAAsB;QACxE,gBAAgB,EAAE,MAAA,aAAa,CAAC,gBAAgB,mCAAI,IAAA,+CAAsB,GAAE;QAC5E,mBAAmB,EAAE,MAAA,aAAa,CAAC,mBAAmB,mCAAI,sCAA0B;QACpF,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,KAAK;QACvC,KAAK,EAAE,MAAA,aAAa,CAAC,KAAK,mCAAI,oBAAY;QAC1C,eAAe,oCAAA;QACf,MAAM,EAAE,MAAA,aAAa,CAAC,MAAM,mCAAI,KAAK;QACrC,qBAAqB,EAAE,MAAA,aAAa,CAAC,qBAAqB,mCAAI,KAAK;QACnE,UAAU,YAAA;QACV,gBAAgB,EAAE,MAAA,aAAa,CAAC,gBAAgB,mCAAI,mCAAuB;QAE3E,UAAU,EAAE,aAAa,CAAC,UAAU;QACpC,WAAW,EAAE,MAAA,aAAa,CAAC,WAAW,mCAAI,2BAAkB;QAC5D,YAAY,EAAE,aAAa,CAAC,YAAY;QACxC,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,IAAA,qBAAa,GAAE;QACjD,IAAI,EAAE,aAAa,CAAC,IAAI;QACxB,IAAI,EAAE,MAAA,aAAa,CAAC,IAAI,mCAAI,uBAAe;KAC5C,CAAC;AACJ,CAAC;AA3CD,wCA2CC","sourcesContent":["import {\n createInternalLogger,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultUnpatchedConsole,\n} from '@grafana/faro-core';\nimport type { Config, Transport } from '@grafana/faro-core';\n\nimport { defaultEventDomain } from '../consts';\nimport { parseStacktrace } from '../instrumentations';\nimport { createSession, defaultMetas, defaultViewMeta } from '../metas';\nimport { FetchTransport } from '../transports';\n\nimport { getWebInstrumentations } from './getWebInstrumentations';\nimport type { BrowserConfig } from './types';\n\nexport function makeCoreConfig(browserConfig: BrowserConfig): Config | undefined {\n const transports: Transport[] = [];\n\n const internalLogger = createInternalLogger(browserConfig.unpatchedConsole, browserConfig.internalLoggerLevel);\n\n if (browserConfig.transports) {\n if (browserConfig.url || browserConfig.apiKey) {\n internalLogger.error('if \"transports\" is defined, \"url\" and \"apiKey\" should not be defined');\n }\n\n transports.push(...browserConfig.transports);\n } else if (browserConfig.url) {\n transports.push(\n new FetchTransport({\n url: browserConfig.url,\n apiKey: browserConfig.apiKey,\n })\n );\n } else {\n internalLogger.error('either \"url\" or \"transports\" must be defined');\n }\n\n return {\n app: browserConfig.app,\n dedupe: browserConfig.dedupe ?? true,\n globalObjectKey: browserConfig.globalObjectKey || defaultGlobalObjectKey,\n instrumentations: browserConfig.instrumentations ?? getWebInstrumentations(),\n internalLoggerLevel: browserConfig.internalLoggerLevel ?? defaultInternalLoggerLevel,\n isolate: browserConfig.isolate ?? false,\n metas: browserConfig.metas ?? defaultMetas,\n parseStacktrace,\n paused: browserConfig.paused ?? false,\n preventGlobalExposure: browserConfig.preventGlobalExposure ?? false,\n transports,\n unpatchedConsole: browserConfig.unpatchedConsole ?? defaultUnpatchedConsole,\n\n beforeSend: browserConfig.beforeSend,\n eventDomain: browserConfig.eventDomain ?? defaultEventDomain,\n ignoreErrors: browserConfig.ignoreErrors,\n session: browserConfig.session ?? createSession(),\n user: browserConfig.user,\n view: browserConfig.view ?? defaultViewMeta,\n };\n}\n"]}
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isInternalFaroOnGlobalObject = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.internalGlobalObjectKey = exports.globalObject = exports.getTransportBody = exports.getInternalFaroFromGlobalObject = exports.getCurrentTimestamp = exports.defaultLogLevel = exports.defaultInternalLoggerLevel = exports.defaultGlobalObjectKey = exports.defaultExceptionType = exports.deepEqual = exports.createPromiseBuffer = exports.createInternalLogger = exports.Conventions = exports.BaseTransport = exports.BaseInstrumentation = exports.BaseExtension = exports.allLogLevels = exports.faro = exports.FetchTransport = exports.ConsoleTransport = exports.createSession = exports.pageMeta = exports.defaultMetas = exports.browserMeta = exports.WebVitalsInstrumentation = exports.parseStacktrace = exports.getStackFramesFromError = exports.getDataFromSafariExtensions = exports.ErrorsInstrumentation = exports.ConsoleInstrumentation = exports.buildStackFrame = exports.initializeFaro = exports.defaultEventDomain = exports.makeCoreConfig = exports.getWebInstrumentations = void 0;
4
- exports.VERSION = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.setInternalFaroOnGlobalObject = exports.noop = exports.LogLevel = exports.InternalLoggerLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = void 0;
3
+ exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.internalGlobalObjectKey = exports.globalObject = exports.getTransportBody = exports.getInternalFaroFromGlobalObject = exports.getCurrentTimestamp = exports.genShortID = exports.defaultLogLevel = exports.defaultInternalLoggerLevel = exports.defaultGlobalObjectKey = exports.defaultExceptionType = exports.deepEqual = exports.createPromiseBuffer = exports.createInternalLogger = exports.Conventions = exports.BaseTransport = exports.BaseInstrumentation = exports.BaseExtension = exports.allLogLevels = exports.faro = exports.FetchTransport = exports.ConsoleTransport = exports.pageMeta = exports.defaultViewMeta = exports.defaultMetas = exports.createSession = exports.browserMeta = exports.WebVitalsInstrumentation = exports.ViewInstrumentation = exports.parseStacktrace = exports.getStackFramesFromError = exports.getDataFromSafariExtensions = exports.ErrorsInstrumentation = exports.ConsoleInstrumentation = exports.buildStackFrame = exports.initializeFaro = exports.defaultEventDomain = exports.makeCoreConfig = exports.getWebInstrumentations = void 0;
4
+ exports.VERSION = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.setInternalFaroOnGlobalObject = exports.noop = exports.LogLevel = exports.InternalLoggerLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInternalFaroOnGlobalObject = exports.isInt = exports.isInstanceOf = void 0;
5
5
  var config_1 = require("./config");
6
6
  Object.defineProperty(exports, "getWebInstrumentations", { enumerable: true, get: function () { return config_1.getWebInstrumentations; } });
7
7
  Object.defineProperty(exports, "makeCoreConfig", { enumerable: true, get: function () { return config_1.makeCoreConfig; } });
@@ -16,13 +16,14 @@ Object.defineProperty(exports, "ErrorsInstrumentation", { enumerable: true, get:
16
16
  Object.defineProperty(exports, "getDataFromSafariExtensions", { enumerable: true, get: function () { return instrumentations_1.getDataFromSafariExtensions; } });
17
17
  Object.defineProperty(exports, "getStackFramesFromError", { enumerable: true, get: function () { return instrumentations_1.getStackFramesFromError; } });
18
18
  Object.defineProperty(exports, "parseStacktrace", { enumerable: true, get: function () { return instrumentations_1.parseStacktrace; } });
19
+ Object.defineProperty(exports, "ViewInstrumentation", { enumerable: true, get: function () { return instrumentations_1.ViewInstrumentation; } });
19
20
  Object.defineProperty(exports, "WebVitalsInstrumentation", { enumerable: true, get: function () { return instrumentations_1.WebVitalsInstrumentation; } });
20
21
  var metas_1 = require("./metas");
21
22
  Object.defineProperty(exports, "browserMeta", { enumerable: true, get: function () { return metas_1.browserMeta; } });
23
+ Object.defineProperty(exports, "createSession", { enumerable: true, get: function () { return metas_1.createSession; } });
22
24
  Object.defineProperty(exports, "defaultMetas", { enumerable: true, get: function () { return metas_1.defaultMetas; } });
25
+ Object.defineProperty(exports, "defaultViewMeta", { enumerable: true, get: function () { return metas_1.defaultViewMeta; } });
23
26
  Object.defineProperty(exports, "pageMeta", { enumerable: true, get: function () { return metas_1.pageMeta; } });
24
- var session_1 = require("./session");
25
- Object.defineProperty(exports, "createSession", { enumerable: true, get: function () { return session_1.createSession; } });
26
27
  var transports_1 = require("./transports");
27
28
  Object.defineProperty(exports, "ConsoleTransport", { enumerable: true, get: function () { return transports_1.ConsoleTransport; } });
28
29
  Object.defineProperty(exports, "FetchTransport", { enumerable: true, get: function () { return transports_1.FetchTransport; } });
@@ -40,6 +41,7 @@ Object.defineProperty(exports, "defaultExceptionType", { enumerable: true, get:
40
41
  Object.defineProperty(exports, "defaultGlobalObjectKey", { enumerable: true, get: function () { return faro_core_1.defaultGlobalObjectKey; } });
41
42
  Object.defineProperty(exports, "defaultInternalLoggerLevel", { enumerable: true, get: function () { return faro_core_1.defaultInternalLoggerLevel; } });
42
43
  Object.defineProperty(exports, "defaultLogLevel", { enumerable: true, get: function () { return faro_core_1.defaultLogLevel; } });
44
+ Object.defineProperty(exports, "genShortID", { enumerable: true, get: function () { return faro_core_1.genShortID; } });
43
45
  Object.defineProperty(exports, "getCurrentTimestamp", { enumerable: true, get: function () { return faro_core_1.getCurrentTimestamp; } });
44
46
  Object.defineProperty(exports, "getInternalFaroFromGlobalObject", { enumerable: true, get: function () { return faro_core_1.getInternalFaroFromGlobalObject; } });
45
47
  Object.defineProperty(exports, "getTransportBody", { enumerable: true, get: function () { return faro_core_1.getTransportBody; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,mCAAkE;AAAzD,gHAAA,sBAAsB,OAAA;AAAE,wGAAA,cAAc,OAAA;AAG/C,mCAA8C;AAArC,4GAAA,kBAAkB,OAAA;AAE3B,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AAEvB,uDAQ4B;AAP1B,mHAAA,eAAe,OAAA;AACf,0HAAA,sBAAsB,OAAA;AACtB,yHAAA,qBAAqB,OAAA;AACrB,+HAAA,2BAA2B,OAAA;AAC3B,2HAAA,uBAAuB,OAAA;AACvB,mHAAA,eAAe,OAAA;AACf,4HAAA,wBAAwB,OAAA;AAI1B,iCAA8D;AAArD,oGAAA,WAAW,OAAA;AAAE,qGAAA,YAAY,OAAA;AAAE,iGAAA,QAAQ,OAAA;AAE5C,qCAA0C;AAAjC,wGAAA,aAAa,OAAA;AAEtB,2CAAgE;AAAvD,8GAAA,gBAAgB,OAAA;AAAE,4GAAA,cAAc,OAAA;AAQzC,gDAuD4B;AAtD1B,iGAAA,IAAI,OAAA;AACJ,yGAAA,YAAY,OAAA;AACZ,0GAAA,aAAa,OAAA;AACb,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AACb,wGAAA,WAAW,OAAA;AACX,iHAAA,oBAAoB,OAAA;AACpB,gHAAA,mBAAmB,OAAA;AACnB,sGAAA,SAAS,OAAA;AACT,iHAAA,oBAAoB,OAAA;AACpB,mHAAA,sBAAsB,OAAA;AACtB,uHAAA,0BAA0B,OAAA;AAC1B,4GAAA,eAAe,OAAA;AACf,gHAAA,mBAAmB,OAAA;AACnB,4HAAA,+BAA+B,OAAA;AAC/B,6GAAA,gBAAgB,OAAA;AAChB,yGAAA,YAAY,OAAA;AACZ,oHAAA,uBAAuB,OAAA;AACvB,oGAAA,OAAO,OAAA;AACP,sGAAA,SAAS,OAAA;AACT,uGAAA,UAAU,OAAA;AACV,2GAAA,cAAc,OAAA;AACd,sGAAA,SAAS,OAAA;AACT,6GAAA,gBAAgB,OAAA;AAChB,oGAAA,OAAO,OAAA;AACP,2GAAA,cAAc,OAAA;AACd,yGAAA,YAAY,OAAA;AACZ,oGAAA,OAAO,OAAA;AACP,2GAAA,cAAc,OAAA;AACd,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AACZ,kGAAA,KAAK,OAAA;AACL,yHAAA,4BAA4B,OAAA;AAC5B,kGAAA,KAAK,OAAA;AACL,yGAAA,YAAY,OAAA;AACZ,mGAAA,MAAM,OAAA;AACN,qGAAA,QAAQ,OAAA;AACR,qGAAA,QAAQ,OAAA;AACR,wGAAA,WAAW,OAAA;AACX,qGAAA,QAAQ,OAAA;AACR,qGAAA,QAAQ,OAAA;AACR,qGAAA,QAAQ,OAAA;AACR,6GAAA,gBAAgB,OAAA;AAChB,uGAAA,UAAU,OAAA;AACV,uGAAA,UAAU,OAAA;AACV,qGAAA,QAAQ,OAAA;AACR,wGAAA,WAAW,OAAA;AACX,gHAAA,mBAAmB,OAAA;AACnB,qGAAA,QAAQ,OAAA;AACR,iGAAA,IAAI,OAAA;AACJ,0HAAA,6BAA6B,OAAA;AAC7B,8GAAA,iBAAiB,OAAA;AACjB,uHAAA,0BAA0B,OAAA;AAC1B,oGAAA,OAAO,OAAA","sourcesContent":["export { getWebInstrumentations, makeCoreConfig } from './config';\nexport type { BrowserConfig } from './config';\n\nexport { defaultEventDomain } from './consts';\n\nexport { initializeFaro } from './initialize';\n\nexport {\n buildStackFrame,\n ConsoleInstrumentation,\n ErrorsInstrumentation,\n getDataFromSafariExtensions,\n getStackFramesFromError,\n parseStacktrace,\n WebVitalsInstrumentation,\n} from './instrumentations';\nexport type { ConsoleInstrumentationOptions, ErrorEvent, ExtendedPromiseRejectionEvent } from './instrumentations';\n\nexport { browserMeta, defaultMetas, pageMeta } from './metas';\n\nexport { createSession } from './session';\n\nexport { ConsoleTransport, FetchTransport } from './transports';\nexport type {\n ClockFn,\n ConsoleTransportOptions,\n FetchTransportOptions,\n FetchTransportRequestOptions,\n} from './transports';\n\nexport {\n faro,\n allLogLevels,\n BaseExtension,\n BaseInstrumentation,\n BaseTransport,\n Conventions,\n createInternalLogger,\n createPromiseBuffer,\n deepEqual,\n defaultExceptionType,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultLogLevel,\n getCurrentTimestamp,\n getInternalFaroFromGlobalObject,\n getTransportBody,\n globalObject,\n internalGlobalObjectKey,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isInternalFaroOnGlobalObject,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n InternalLoggerLevel,\n LogLevel,\n noop,\n setInternalFaroOnGlobalObject,\n TransportItemType,\n transportItemTypeToBodyKey,\n VERSION,\n} from '@grafana/faro-core';\n\nexport type {\n Faro,\n API,\n APIEvent,\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BeforeSendHook,\n BufferItem,\n Config,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n GlobalObject,\n Instrumentation,\n Instrumentations,\n InternalLogger,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n Meta,\n MetaAPI,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n OTELApi,\n Patterns,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n PushErrorOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n UnpatchedConsole,\n} from '@grafana/faro-core';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,mCAAkE;AAAzD,gHAAA,sBAAsB,OAAA;AAAE,wGAAA,cAAc,OAAA;AAG/C,mCAA8C;AAArC,4GAAA,kBAAkB,OAAA;AAE3B,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AAEvB,uDAS4B;AAR1B,mHAAA,eAAe,OAAA;AACf,0HAAA,sBAAsB,OAAA;AACtB,yHAAA,qBAAqB,OAAA;AACrB,+HAAA,2BAA2B,OAAA;AAC3B,2HAAA,uBAAuB,OAAA;AACvB,mHAAA,eAAe,OAAA;AACf,uHAAA,mBAAmB,OAAA;AACnB,4HAAA,wBAAwB,OAAA;AAI1B,iCAA8F;AAArF,oGAAA,WAAW,OAAA;AAAE,sGAAA,aAAa,OAAA;AAAE,qGAAA,YAAY,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,iGAAA,QAAQ,OAAA;AAE5E,2CAAgE;AAAvD,8GAAA,gBAAgB,OAAA;AAAE,4GAAA,cAAc,OAAA;AAQzC,gDAwD4B;AAvD1B,iGAAA,IAAI,OAAA;AACJ,yGAAA,YAAY,OAAA;AACZ,0GAAA,aAAa,OAAA;AACb,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AACb,wGAAA,WAAW,OAAA;AACX,iHAAA,oBAAoB,OAAA;AACpB,gHAAA,mBAAmB,OAAA;AACnB,sGAAA,SAAS,OAAA;AACT,iHAAA,oBAAoB,OAAA;AACpB,mHAAA,sBAAsB,OAAA;AACtB,uHAAA,0BAA0B,OAAA;AAC1B,4GAAA,eAAe,OAAA;AACf,uGAAA,UAAU,OAAA;AACV,gHAAA,mBAAmB,OAAA;AACnB,4HAAA,+BAA+B,OAAA;AAC/B,6GAAA,gBAAgB,OAAA;AAChB,yGAAA,YAAY,OAAA;AACZ,oHAAA,uBAAuB,OAAA;AACvB,oGAAA,OAAO,OAAA;AACP,sGAAA,SAAS,OAAA;AACT,uGAAA,UAAU,OAAA;AACV,2GAAA,cAAc,OAAA;AACd,sGAAA,SAAS,OAAA;AACT,6GAAA,gBAAgB,OAAA;AAChB,oGAAA,OAAO,OAAA;AACP,2GAAA,cAAc,OAAA;AACd,yGAAA,YAAY,OAAA;AACZ,oGAAA,OAAO,OAAA;AACP,2GAAA,cAAc,OAAA;AACd,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AACZ,kGAAA,KAAK,OAAA;AACL,yHAAA,4BAA4B,OAAA;AAC5B,kGAAA,KAAK,OAAA;AACL,yGAAA,YAAY,OAAA;AACZ,mGAAA,MAAM,OAAA;AACN,qGAAA,QAAQ,OAAA;AACR,qGAAA,QAAQ,OAAA;AACR,wGAAA,WAAW,OAAA;AACX,qGAAA,QAAQ,OAAA;AACR,qGAAA,QAAQ,OAAA;AACR,qGAAA,QAAQ,OAAA;AACR,6GAAA,gBAAgB,OAAA;AAChB,uGAAA,UAAU,OAAA;AACV,uGAAA,UAAU,OAAA;AACV,qGAAA,QAAQ,OAAA;AACR,wGAAA,WAAW,OAAA;AACX,gHAAA,mBAAmB,OAAA;AACnB,qGAAA,QAAQ,OAAA;AACR,iGAAA,IAAI,OAAA;AACJ,0HAAA,6BAA6B,OAAA;AAC7B,8GAAA,iBAAiB,OAAA;AACjB,uHAAA,0BAA0B,OAAA;AAC1B,oGAAA,OAAO,OAAA","sourcesContent":["export { getWebInstrumentations, makeCoreConfig } from './config';\nexport type { BrowserConfig } from './config';\n\nexport { defaultEventDomain } from './consts';\n\nexport { initializeFaro } from './initialize';\n\nexport {\n buildStackFrame,\n ConsoleInstrumentation,\n ErrorsInstrumentation,\n getDataFromSafariExtensions,\n getStackFramesFromError,\n parseStacktrace,\n ViewInstrumentation,\n WebVitalsInstrumentation,\n} from './instrumentations';\nexport type { ConsoleInstrumentationOptions, ErrorEvent, ExtendedPromiseRejectionEvent } from './instrumentations';\n\nexport { browserMeta, createSession, defaultMetas, defaultViewMeta, pageMeta } from './metas';\n\nexport { ConsoleTransport, FetchTransport } from './transports';\nexport type {\n ClockFn,\n ConsoleTransportOptions,\n FetchTransportOptions,\n FetchTransportRequestOptions,\n} from './transports';\n\nexport {\n faro,\n allLogLevels,\n BaseExtension,\n BaseInstrumentation,\n BaseTransport,\n Conventions,\n createInternalLogger,\n createPromiseBuffer,\n deepEqual,\n defaultExceptionType,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n getInternalFaroFromGlobalObject,\n getTransportBody,\n globalObject,\n internalGlobalObjectKey,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isInternalFaroOnGlobalObject,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n InternalLoggerLevel,\n LogLevel,\n noop,\n setInternalFaroOnGlobalObject,\n TransportItemType,\n transportItemTypeToBodyKey,\n VERSION,\n} from '@grafana/faro-core';\n\nexport type {\n Faro,\n API,\n APIEvent,\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BeforeSendHook,\n BufferItem,\n Config,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n Extension,\n GlobalObject,\n Instrumentation,\n Instrumentations,\n InternalLogger,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n Meta,\n MetaAPI,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n OTELApi,\n Patterns,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n PushErrorOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n UnpatchedConsole,\n} from '@grafana/faro-core';\n"]}
@@ -41,13 +41,13 @@ var ConsoleInstrumentation = /** @class */ (function (_super) {
41
41
  args[_i] = arguments[_i];
42
42
  }
43
43
  try {
44
- _this.faro.api.pushLog(args, { level: level });
44
+ _this.api.pushLog(args, { level: level });
45
45
  }
46
46
  catch (err) {
47
47
  _this.logError(err);
48
48
  }
49
49
  finally {
50
- (_a = _this.faro.unpatchedConsole)[level].apply(_a, args);
50
+ (_a = _this.unpatchedConsole)[level].apply(_a, args);
51
51
  }
52
52
  };
53
53
  });
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/console/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0F;AAI1F;IAA4C,0CAAmB;IAM7D,gCAAoB,OAA2C;QAA3C,wBAAA,EAAA,YAA2C;QAA/D,YACE,iBAAO,SACR;QAFmB,aAAO,GAAP,OAAO,CAAoC;QALtD,UAAI,GAAG,+CAA+C,CAAC;QACvD,aAAO,GAAG,mBAAO,CAAC;;IAM3B,CAAC;IAED,2CAAU,GAAV;QAAA,iBAiBC;QAhBC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE9C,wBAAY;aACT,MAAM,CAAC,UAAC,KAAK,YAAK,OAAA,CAAC,CAAC,MAAA,KAAI,CAAC,OAAO,CAAC,cAAc,mCAAI,sBAAsB,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA,EAAA,CAAC;aACjH,OAAO,CAAC,UAAC,KAAK;YACb,yCAAyC;YACzC,OAAO,CAAC,KAAK,CAAC,GAAG;;gBAAC,cAAO;qBAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;oBAAP,yBAAO;;gBACvB,IAAI;oBACF,KAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;iBACxC;gBAAC,OAAO,GAAG,EAAE;oBACZ,KAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;iBACpB;wBAAS;oBACR,CAAA,KAAA,KAAI,CAAC,IAAI,CAAC,gBAAgB,CAAA,CAAC,KAAK,CAAC,WAAI,IAAI,EAAE;iBAC5C;YACH,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC;IAvBM,4CAAqB,GAAe,CAAC,oBAAQ,CAAC,KAAK,EAAE,oBAAQ,CAAC,KAAK,EAAE,oBAAQ,CAAC,GAAG,CAAC,CAAC;IAwB5F,6BAAC;CAAA,AA5BD,CAA4C,+BAAmB,GA4B9D;AA5BY,wDAAsB","sourcesContent":["import { allLogLevels, BaseInstrumentation, LogLevel, VERSION } from '@grafana/faro-core';\n\nimport type { ConsoleInstrumentationOptions } from './types';\n\nexport class ConsoleInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-console';\n readonly version = VERSION;\n\n static defaultDisabledLevels: LogLevel[] = [LogLevel.DEBUG, LogLevel.TRACE, LogLevel.LOG];\n\n constructor(private options: ConsoleInstrumentationOptions = {}) {\n super();\n }\n\n initialize() {\n this.logDebug('Initializing\\n', this.options);\n\n allLogLevels\n .filter((level) => !(this.options.disabledLevels ?? ConsoleInstrumentation.defaultDisabledLevels).includes(level))\n .forEach((level) => {\n /* eslint-disable-next-line no-console */\n console[level] = (...args) => {\n try {\n this.faro.api.pushLog(args, { level });\n } catch (err) {\n this.logError(err);\n } finally {\n this.faro.unpatchedConsole[level](...args);\n }\n };\n });\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/console/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0F;AAI1F;IAA4C,0CAAmB;IAM7D,gCAAoB,OAA2C;QAA3C,wBAAA,EAAA,YAA2C;QAA/D,YACE,iBAAO,SACR;QAFmB,aAAO,GAAP,OAAO,CAAoC;QALtD,UAAI,GAAG,+CAA+C,CAAC;QACvD,aAAO,GAAG,mBAAO,CAAC;;IAM3B,CAAC;IAED,2CAAU,GAAV;QAAA,iBAiBC;QAhBC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE9C,wBAAY;aACT,MAAM,CAAC,UAAC,KAAK,YAAK,OAAA,CAAC,CAAC,MAAA,KAAI,CAAC,OAAO,CAAC,cAAc,mCAAI,sBAAsB,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA,EAAA,CAAC;aACjH,OAAO,CAAC,UAAC,KAAK;YACb,yCAAyC;YACzC,OAAO,CAAC,KAAK,CAAC,GAAG;;gBAAC,cAAO;qBAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;oBAAP,yBAAO;;gBACvB,IAAI;oBACF,KAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;iBACnC;gBAAC,OAAO,GAAG,EAAE;oBACZ,KAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;iBACpB;wBAAS;oBACR,CAAA,KAAA,KAAI,CAAC,gBAAgB,CAAA,CAAC,KAAK,CAAC,WAAI,IAAI,EAAE;iBACvC;YACH,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC;IAvBM,4CAAqB,GAAe,CAAC,oBAAQ,CAAC,KAAK,EAAE,oBAAQ,CAAC,KAAK,EAAE,oBAAQ,CAAC,GAAG,CAAC,CAAC;IAwB5F,6BAAC;CAAA,AA5BD,CAA4C,+BAAmB,GA4B9D;AA5BY,wDAAsB","sourcesContent":["import { allLogLevels, BaseInstrumentation, LogLevel, VERSION } from '@grafana/faro-core';\n\nimport type { ConsoleInstrumentationOptions } from './types';\n\nexport class ConsoleInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-console';\n readonly version = VERSION;\n\n static defaultDisabledLevels: LogLevel[] = [LogLevel.DEBUG, LogLevel.TRACE, LogLevel.LOG];\n\n constructor(private options: ConsoleInstrumentationOptions = {}) {\n super();\n }\n\n initialize() {\n this.logDebug('Initializing\\n', this.options);\n\n allLogLevels\n .filter((level) => !(this.options.disabledLevels ?? ConsoleInstrumentation.defaultDisabledLevels).includes(level))\n .forEach((level) => {\n /* eslint-disable-next-line no-console */\n console[level] = (...args) => {\n try {\n this.api.pushLog(args, { level });\n } catch (err) {\n this.logError(err);\n } finally {\n this.unpatchedConsole[level](...args);\n }\n };\n });\n }\n}\n"]}
@@ -29,8 +29,8 @@ var ErrorsInstrumentation = /** @class */ (function (_super) {
29
29
  }
30
30
  ErrorsInstrumentation.prototype.initialize = function () {
31
31
  this.logDebug('Initializing');
32
- (0, registerOnerror_1.registerOnerror)(this.faro);
33
- (0, registerOnunhandledrejection_1.registerOnunhandledrejection)(this.faro);
32
+ (0, registerOnerror_1.registerOnerror)(this.api);
33
+ (0, registerOnunhandledrejection_1.registerOnunhandledrejection)(this.api);
34
34
  };
35
35
  return ErrorsInstrumentation;
36
36
  }(faro_core_1.BaseInstrumentation));
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAAkE;AAElE,qDAAoD;AACpD,+EAA8E;AAE9E;IAA2C,yCAAmB;IAA9D;QAAA,qEAWC;QAVU,UAAI,GAAG,8CAA8C,CAAC;QACtD,aAAO,GAAG,mBAAO,CAAC;;IAS7B,CAAC;IAPC,0CAAU,GAAV;QACE,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAE9B,IAAA,iCAAe,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE3B,IAAA,2DAA4B,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IACH,4BAAC;AAAD,CAAC,AAXD,CAA2C,+BAAmB,GAW7D;AAXY,sDAAqB","sourcesContent":["import { BaseInstrumentation, VERSION } from '@grafana/faro-core';\n\nimport { registerOnerror } from './registerOnerror';\nimport { registerOnunhandledrejection } from './registerOnunhandledrejection';\n\nexport class ErrorsInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-errors';\n readonly version = VERSION;\n\n initialize(): void {\n this.logDebug('Initializing');\n\n registerOnerror(this.faro);\n\n registerOnunhandledrejection(this.faro);\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAAkE;AAElE,qDAAoD;AACpD,+EAA8E;AAE9E;IAA2C,yCAAmB;IAA9D;QAAA,qEAWC;QAVU,UAAI,GAAG,8CAA8C,CAAC;QACtD,aAAO,GAAG,mBAAO,CAAC;;IAS7B,CAAC;IAPC,0CAAU,GAAV;QACE,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAE9B,IAAA,iCAAe,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE1B,IAAA,2DAA4B,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IACH,4BAAC;AAAD,CAAC,AAXD,CAA2C,+BAAmB,GAW7D;AAXY,sDAAqB","sourcesContent":["import { BaseInstrumentation, VERSION } from '@grafana/faro-core';\n\nimport { registerOnerror } from './registerOnerror';\nimport { registerOnunhandledrejection } from './registerOnunhandledrejection';\n\nexport class ErrorsInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-errors';\n readonly version = VERSION;\n\n initialize(): void {\n this.logDebug('Initializing');\n\n registerOnerror(this.api);\n\n registerOnunhandledrejection(this.api);\n }\n}\n"]}
@@ -6,7 +6,7 @@ var const_1 = require("./const");
6
6
  var getErrorDetails_1 = require("./getErrorDetails");
7
7
  var getValueAndTypeFromMessage_1 = require("./getValueAndTypeFromMessage");
8
8
  var stackFrames_1 = require("./stackFrames");
9
- function registerOnerror(faro) {
9
+ function registerOnerror(api) {
10
10
  // The error event is a little bit different than other events when it comes to the listener
11
11
  // window.addEventListener does not provide all parameters, hence we need to use the window.onerror syntax
12
12
  // TODO: investigate https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror
@@ -35,7 +35,7 @@ function registerOnerror(faro) {
35
35
  stackFrames = [initialStackFrame];
36
36
  }
37
37
  if (value) {
38
- faro.api.pushError(new Error(value), { type: type, stackFrames: stackFrames });
38
+ api.pushError(new Error(value), { type: type, stackFrames: stackFrames });
39
39
  }
40
40
  }
41
41
  finally {
@@ -1 +1 @@
1
- {"version":3,"file":"registerOnerror.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/registerOnerror.ts"],"names":[],"mappings":";;;AAAA,gDAAoD;AAGpD,iCAAwC;AACxC,qDAAoD;AACpD,2EAA0E;AAC1E,6CAAgD;AAEhD,SAAgB,eAAe,CAAC,IAAU;IACxC,4FAA4F;IAC5F,0GAA0G;IAC1G,iGAAiG;IAEjG,IAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;IAElC,MAAM,CAAC,OAAO,GAAG;;QAAC,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,yBAAO;;QACvB,IAAI;YACK,IAAA,GAAG,GAAkC,IAAI,GAAtC,EAAE,MAAM,GAA0B,IAAI,GAA9B,EAAE,MAAM,GAAkB,IAAI,GAAtB,EAAE,KAAK,GAAW,IAAI,GAAf,EAAE,KAAK,GAAI,IAAI,GAAR,CAAS;YACjD,IAAI,KAAK,SAAoB,CAAC;YAC9B,IAAI,IAAI,SAAoB,CAAC;YAC7B,IAAI,WAAW,GAA0B,EAAE,CAAC;YAC5C,IAAM,aAAa,GAAG,IAAA,oBAAQ,EAAC,GAAG,CAAC,CAAC;YACpC,IAAM,iBAAiB,GAAG,IAAA,6BAAe,EAAC,MAAM,EAAE,qBAAa,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;YAEhF,IAAI,KAAK,IAAI,CAAC,aAAa,EAAE;gBAC3B,KAA6B,IAAA,iCAAe,EAAC,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG,CAAkB,CAAC,EAA5E,KAAK,QAAA,EAAE,IAAI,QAAA,EAAE,WAAW,QAAA,CAAqD;gBAE9E,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;oBAC5B,WAAW,GAAG,CAAC,iBAAiB,CAAC,CAAC;iBACnC;aACF;iBAAM,IAAI,aAAa,EAAE;gBACxB,KAAgB,IAAA,uDAA0B,EAAC,GAAG,CAAC,EAA9C,KAAK,QAAA,EAAE,IAAI,QAAA,CAAoC;gBAChD,WAAW,GAAG,CAAC,iBAAiB,CAAC,CAAC;aACnC;YAED,IAAI,KAAK,EAAE;gBACT,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,MAAA,EAAE,WAAW,aAAA,EAAE,CAAC,CAAC;aAC7D;SACF;gBAAS;YACR,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACjC;IACH,CAAC,CAAC;AACJ,CAAC;AAlCD,0CAkCC","sourcesContent":["import { Faro, isString } from '@grafana/faro-core';\nimport type { ExceptionStackFrame } from '@grafana/faro-core';\n\nimport { unknownString } from './const';\nimport { getErrorDetails } from './getErrorDetails';\nimport { getValueAndTypeFromMessage } from './getValueAndTypeFromMessage';\nimport { buildStackFrame } from './stackFrames';\n\nexport function registerOnerror(faro: Faro): void {\n // The error event is a little bit different than other events when it comes to the listener\n // window.addEventListener does not provide all parameters, hence we need to use the window.onerror syntax\n // TODO: investigate https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror\n\n const oldOnerror = window.onerror;\n\n window.onerror = (...args) => {\n try {\n const [evt, source, lineno, colno, error] = args;\n let value: string | undefined;\n let type: string | undefined;\n let stackFrames: ExceptionStackFrame[] = [];\n const eventIsString = isString(evt);\n const initialStackFrame = buildStackFrame(source, unknownString, lineno, colno);\n\n if (error || !eventIsString) {\n [value, type, stackFrames] = getErrorDetails((error ?? evt) as Error | Event);\n\n if (stackFrames.length === 0) {\n stackFrames = [initialStackFrame];\n }\n } else if (eventIsString) {\n [value, type] = getValueAndTypeFromMessage(evt);\n stackFrames = [initialStackFrame];\n }\n\n if (value) {\n faro.api.pushError(new Error(value), { type, stackFrames });\n }\n } finally {\n oldOnerror?.apply(window, args);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"registerOnerror.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/registerOnerror.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAG9C,iCAAwC;AACxC,qDAAoD;AACpD,2EAA0E;AAC1E,6CAAgD;AAEhD,SAAgB,eAAe,CAAC,GAAQ;IACtC,4FAA4F;IAC5F,0GAA0G;IAC1G,iGAAiG;IAEjG,IAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;IAElC,MAAM,CAAC,OAAO,GAAG;;QAAC,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,yBAAO;;QACvB,IAAI;YACK,IAAA,GAAG,GAAkC,IAAI,GAAtC,EAAE,MAAM,GAA0B,IAAI,GAA9B,EAAE,MAAM,GAAkB,IAAI,GAAtB,EAAE,KAAK,GAAW,IAAI,GAAf,EAAE,KAAK,GAAI,IAAI,GAAR,CAAS;YACjD,IAAI,KAAK,SAAoB,CAAC;YAC9B,IAAI,IAAI,SAAoB,CAAC;YAC7B,IAAI,WAAW,GAA0B,EAAE,CAAC;YAC5C,IAAM,aAAa,GAAG,IAAA,oBAAQ,EAAC,GAAG,CAAC,CAAC;YACpC,IAAM,iBAAiB,GAAG,IAAA,6BAAe,EAAC,MAAM,EAAE,qBAAa,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;YAEhF,IAAI,KAAK,IAAI,CAAC,aAAa,EAAE;gBAC3B,KAA6B,IAAA,iCAAe,EAAC,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG,CAAkB,CAAC,EAA5E,KAAK,QAAA,EAAE,IAAI,QAAA,EAAE,WAAW,QAAA,CAAqD;gBAE9E,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;oBAC5B,WAAW,GAAG,CAAC,iBAAiB,CAAC,CAAC;iBACnC;aACF;iBAAM,IAAI,aAAa,EAAE;gBACxB,KAAgB,IAAA,uDAA0B,EAAC,GAAG,CAAC,EAA9C,KAAK,QAAA,EAAE,IAAI,QAAA,CAAoC;gBAChD,WAAW,GAAG,CAAC,iBAAiB,CAAC,CAAC;aACnC;YAED,IAAI,KAAK,EAAE;gBACT,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,MAAA,EAAE,WAAW,aAAA,EAAE,CAAC,CAAC;aACxD;SACF;gBAAS;YACR,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACjC;IACH,CAAC,CAAC;AACJ,CAAC;AAlCD,0CAkCC","sourcesContent":["import { isString } from '@grafana/faro-core';\nimport type { API, ExceptionStackFrame } from '@grafana/faro-core';\n\nimport { unknownString } from './const';\nimport { getErrorDetails } from './getErrorDetails';\nimport { getValueAndTypeFromMessage } from './getValueAndTypeFromMessage';\nimport { buildStackFrame } from './stackFrames';\n\nexport function registerOnerror(api: API): void {\n // The error event is a little bit different than other events when it comes to the listener\n // window.addEventListener does not provide all parameters, hence we need to use the window.onerror syntax\n // TODO: investigate https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror\n\n const oldOnerror = window.onerror;\n\n window.onerror = (...args) => {\n try {\n const [evt, source, lineno, colno, error] = args;\n let value: string | undefined;\n let type: string | undefined;\n let stackFrames: ExceptionStackFrame[] = [];\n const eventIsString = isString(evt);\n const initialStackFrame = buildStackFrame(source, unknownString, lineno, colno);\n\n if (error || !eventIsString) {\n [value, type, stackFrames] = getErrorDetails((error ?? evt) as Error | Event);\n\n if (stackFrames.length === 0) {\n stackFrames = [initialStackFrame];\n }\n } else if (eventIsString) {\n [value, type] = getValueAndTypeFromMessage(evt);\n stackFrames = [initialStackFrame];\n }\n\n if (value) {\n api.pushError(new Error(value), { type, stackFrames });\n }\n } finally {\n oldOnerror?.apply(window, args);\n }\n };\n}\n"]}
@@ -4,7 +4,7 @@ exports.registerOnunhandledrejection = void 0;
4
4
  var faro_core_1 = require("@grafana/faro-core");
5
5
  var const_1 = require("./const");
6
6
  var getErrorDetails_1 = require("./getErrorDetails");
7
- function registerOnunhandledrejection(faro) {
7
+ function registerOnunhandledrejection(api) {
8
8
  window.addEventListener('unhandledrejection', function (evt) {
9
9
  var _a;
10
10
  var _b, _c;
@@ -25,7 +25,7 @@ function registerOnunhandledrejection(faro) {
25
25
  _a = (0, getErrorDetails_1.getErrorDetails)(error), value = _a[0], type = _a[1];
26
26
  }
27
27
  if (value) {
28
- faro.api.pushError(new Error(value), { type: type });
28
+ api.pushError(new Error(value), { type: type });
29
29
  }
30
30
  });
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"registerOnunhandledrejection.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/registerOnunhandledrejection.ts"],"names":[],"mappings":";;;AAAA,gDAAuD;AAEvD,iCAA0E;AAC1E,qDAAoD;AAGpD,SAAgB,4BAA4B,CAAC,IAAU;IACrD,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,UAAC,GAAkC;;;QAC/E,IAAI,KAAK,GAAG,GAAG,CAAC;QAEhB,IAAI,KAAK,CAAC,MAAM,EAAE;YAChB,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC;SACpB;aAAM,IAAI,MAAA,GAAG,CAAC,MAAM,0CAAE,MAAM,EAAE;YAC7B,KAAK,GAAG,MAAA,GAAG,CAAC,MAAM,0CAAE,MAAM,CAAC;SAC5B;QAED,IAAI,KAAyB,CAAC;QAC9B,IAAI,IAAwB,CAAC;QAE7B,IAAI,IAAA,uBAAW,EAAC,KAAK,CAAC,EAAE;YACtB,KAAK,GAAG,UAAG,+BAAuB,cAAI,MAAM,CAAC,KAAK,CAAC,CAAE,CAAC;YACtD,IAAI,GAAG,8BAAsB,CAAC;SAC/B;aAAM;YACL,KAAgB,IAAA,iCAAe,EAAC,KAAK,CAAC,EAArC,KAAK,QAAA,EAAE,IAAI,QAAA,CAA2B;SACxC;QAED,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;SAChD;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAxBD,oEAwBC","sourcesContent":["import { Faro, isPrimitive } from '@grafana/faro-core';\n\nimport { primitiveUnhandledType, primitiveUnhandledValue } from './const';\nimport { getErrorDetails } from './getErrorDetails';\nimport type { ExtendedPromiseRejectionEvent } from './types';\n\nexport function registerOnunhandledrejection(faro: Faro): void {\n window.addEventListener('unhandledrejection', (evt: ExtendedPromiseRejectionEvent) => {\n let error = evt;\n\n if (error.reason) {\n error = evt.reason;\n } else if (evt.detail?.reason) {\n error = evt.detail?.reason;\n }\n\n let value: string | undefined;\n let type: string | undefined;\n\n if (isPrimitive(error)) {\n value = `${primitiveUnhandledValue} ${String(error)}`;\n type = primitiveUnhandledType;\n } else {\n [value, type] = getErrorDetails(error);\n }\n\n if (value) {\n faro.api.pushError(new Error(value), { type });\n }\n });\n}\n"]}
1
+ {"version":3,"file":"registerOnunhandledrejection.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/registerOnunhandledrejection.ts"],"names":[],"mappings":";;;AAAA,gDAAiD;AAGjD,iCAA0E;AAC1E,qDAAoD;AAGpD,SAAgB,4BAA4B,CAAC,GAAQ;IACnD,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,UAAC,GAAkC;;;QAC/E,IAAI,KAAK,GAAG,GAAG,CAAC;QAEhB,IAAI,KAAK,CAAC,MAAM,EAAE;YAChB,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC;SACpB;aAAM,IAAI,MAAA,GAAG,CAAC,MAAM,0CAAE,MAAM,EAAE;YAC7B,KAAK,GAAG,MAAA,GAAG,CAAC,MAAM,0CAAE,MAAM,CAAC;SAC5B;QAED,IAAI,KAAyB,CAAC;QAC9B,IAAI,IAAwB,CAAC;QAE7B,IAAI,IAAA,uBAAW,EAAC,KAAK,CAAC,EAAE;YACtB,KAAK,GAAG,UAAG,+BAAuB,cAAI,MAAM,CAAC,KAAK,CAAC,CAAE,CAAC;YACtD,IAAI,GAAG,8BAAsB,CAAC;SAC/B;aAAM;YACL,KAAgB,IAAA,iCAAe,EAAC,KAAK,CAAC,EAArC,KAAK,QAAA,EAAE,IAAI,QAAA,CAA2B;SACxC;QAED,IAAI,KAAK,EAAE;YACT,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;SAC3C;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAxBD,oEAwBC","sourcesContent":["import { isPrimitive } from '@grafana/faro-core';\nimport type { API } from '@grafana/faro-core';\n\nimport { primitiveUnhandledType, primitiveUnhandledValue } from './const';\nimport { getErrorDetails } from './getErrorDetails';\nimport type { ExtendedPromiseRejectionEvent } from './types';\n\nexport function registerOnunhandledrejection(api: API): void {\n window.addEventListener('unhandledrejection', (evt: ExtendedPromiseRejectionEvent) => {\n let error = evt;\n\n if (error.reason) {\n error = evt.reason;\n } else if (evt.detail?.reason) {\n error = evt.detail?.reason;\n }\n\n let value: string | undefined;\n let type: string | undefined;\n\n if (isPrimitive(error)) {\n value = `${primitiveUnhandledValue} ${String(error)}`;\n type = primitiveUnhandledType;\n } else {\n [value, type] = getErrorDetails(error);\n }\n\n if (value) {\n api.pushError(new Error(value), { type });\n }\n });\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebVitalsInstrumentation = exports.parseStacktrace = exports.getStackFramesFromError = exports.getDataFromSafariExtensions = exports.ErrorsInstrumentation = exports.buildStackFrame = exports.ConsoleInstrumentation = exports.SessionInstrumentation = void 0;
3
+ exports.WebVitalsInstrumentation = exports.ViewInstrumentation = exports.parseStacktrace = exports.getStackFramesFromError = exports.getDataFromSafariExtensions = exports.ErrorsInstrumentation = exports.buildStackFrame = exports.ConsoleInstrumentation = exports.SessionInstrumentation = void 0;
4
4
  var session_1 = require("./session");
5
5
  Object.defineProperty(exports, "SessionInstrumentation", { enumerable: true, get: function () { return session_1.SessionInstrumentation; } });
6
6
  var console_1 = require("./console");
@@ -11,6 +11,8 @@ Object.defineProperty(exports, "ErrorsInstrumentation", { enumerable: true, get:
11
11
  Object.defineProperty(exports, "getDataFromSafariExtensions", { enumerable: true, get: function () { return errors_1.getDataFromSafariExtensions; } });
12
12
  Object.defineProperty(exports, "getStackFramesFromError", { enumerable: true, get: function () { return errors_1.getStackFramesFromError; } });
13
13
  Object.defineProperty(exports, "parseStacktrace", { enumerable: true, get: function () { return errors_1.parseStacktrace; } });
14
+ var view_1 = require("./view");
15
+ Object.defineProperty(exports, "ViewInstrumentation", { enumerable: true, get: function () { return view_1.ViewInstrumentation; } });
14
16
  var webVitals_1 = require("./webVitals");
15
17
  Object.defineProperty(exports, "WebVitalsInstrumentation", { enumerable: true, get: function () { return webVitals_1.WebVitalsInstrumentation; } });
16
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentations/index.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AAA1C,iHAAA,sBAAsB,OAAA;AAE/B,qCAAmD;AAA1C,iHAAA,sBAAsB,OAAA;AAG/B,mCAMkB;AALhB,yGAAA,eAAe,OAAA;AACf,+GAAA,qBAAqB,OAAA;AACrB,qHAAA,2BAA2B,OAAA;AAC3B,iHAAA,uBAAuB,OAAA;AACvB,yGAAA,eAAe,OAAA;AAIjB,yCAAuD;AAA9C,qHAAA,wBAAwB,OAAA","sourcesContent":["export { SessionInstrumentation } from './session';\n\nexport { ConsoleInstrumentation } from './console';\nexport type { ConsoleInstrumentationOptions } from './console';\n\nexport {\n buildStackFrame,\n ErrorsInstrumentation,\n getDataFromSafariExtensions,\n getStackFramesFromError,\n parseStacktrace,\n} from './errors';\nexport type { ErrorEvent, ExtendedPromiseRejectionEvent } from './errors';\n\nexport { WebVitalsInstrumentation } from './webVitals';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentations/index.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AAA1C,iHAAA,sBAAsB,OAAA;AAE/B,qCAAmD;AAA1C,iHAAA,sBAAsB,OAAA;AAG/B,mCAMkB;AALhB,yGAAA,eAAe,OAAA;AACf,+GAAA,qBAAqB,OAAA;AACrB,qHAAA,2BAA2B,OAAA;AAC3B,iHAAA,uBAAuB,OAAA;AACvB,yGAAA,eAAe,OAAA;AAIjB,+BAA6C;AAApC,2GAAA,mBAAmB,OAAA;AAE5B,yCAAuD;AAA9C,qHAAA,wBAAwB,OAAA","sourcesContent":["export { SessionInstrumentation } from './session';\n\nexport { ConsoleInstrumentation } from './console';\nexport type { ConsoleInstrumentationOptions } from './console';\n\nexport {\n buildStackFrame,\n ErrorsInstrumentation,\n getDataFromSafariExtensions,\n getStackFramesFromError,\n parseStacktrace,\n} from './errors';\nexport type { ErrorEvent, ExtendedPromiseRejectionEvent } from './errors';\n\nexport { ViewInstrumentation } from './view';\n\nexport { WebVitalsInstrumentation } from './webVitals';\n"]}
@@ -33,12 +33,12 @@ var SessionInstrumentation = /** @class */ (function (_super) {
33
33
  this.notifiedSession = session;
34
34
  // no need to add attributes and session id, they are included as part of meta
35
35
  // automatically
36
- this.faro.api.pushEvent(faro_core_1.Conventions.EventNames.SESSION_START, {}, undefined, { skipDedupe: true });
36
+ this.api.pushEvent(faro_core_1.Conventions.EventNames.SESSION_START, {}, undefined, { skipDedupe: true });
37
37
  }
38
38
  };
39
39
  SessionInstrumentation.prototype.initialize = function () {
40
- this.sendSessionStartEvent(this.faro.metas.value);
41
- this.faro.metas.addListener(this.sendSessionStartEvent.bind(this));
40
+ this.sendSessionStartEvent(this.metas.value);
41
+ this.metas.addListener(this.sendSessionStartEvent.bind(this));
42
42
  };
43
43
  return SessionInstrumentation;
44
44
  }(faro_core_1.BaseInstrumentation));
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/session/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AAEvC,gDAAyF;AAEzF,4CAA4C;AAC5C;IAA4C,0CAAmB;IAA/D;QAAA,qEAwBC;QAvBU,UAAI,GAAG,+CAA+C,CAAC;QACvD,aAAO,GAAG,sBAAO,CAAC;;IAsB7B,CAAC;IAhBS,sDAAqB,GAA7B,UAA8B,IAAU;QACtC,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,OAAO,IAAI,OAAO,KAAK,IAAI,CAAC,eAAe,EAAE;YAC/C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;YAC/B,8EAA8E;YAC9E,gBAAgB;YAChB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,uBAAW,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;SACpG;IACH,CAAC;IAED,2CAAU,GAAV;QACE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAElD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACrE,CAAC;IACH,6BAAC;AAAD,CAAC,AAxBD,CAA4C,+BAAmB,GAwB9D;AAxBY,wDAAsB","sourcesContent":["import { VERSION } from 'ua-parser-js';\n\nimport { BaseInstrumentation, Conventions, Meta, MetaSession } from '@grafana/faro-core';\n\n// all this does is send SESSION_START event\nexport class SessionInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-session';\n readonly version = VERSION;\n\n // previously notified session, to ensure we don't send session start\n // event twice for the same session\n private notifiedSession: MetaSession | undefined;\n\n private sendSessionStartEvent(meta: Meta): void {\n const session = meta.session;\n\n if (session && session !== this.notifiedSession) {\n this.notifiedSession = session;\n // no need to add attributes and session id, they are included as part of meta\n // automatically\n this.faro.api.pushEvent(Conventions.EventNames.SESSION_START, {}, undefined, { skipDedupe: true });\n }\n }\n\n initialize() {\n this.sendSessionStartEvent(this.faro.metas.value);\n\n this.faro.metas.addListener(this.sendSessionStartEvent.bind(this));\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/session/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AAEvC,gDAAyF;AAEzF,4CAA4C;AAC5C;IAA4C,0CAAmB;IAA/D;QAAA,qEAwBC;QAvBU,UAAI,GAAG,+CAA+C,CAAC;QACvD,aAAO,GAAG,sBAAO,CAAC;;IAsB7B,CAAC;IAhBS,sDAAqB,GAA7B,UAA8B,IAAU;QACtC,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,OAAO,IAAI,OAAO,KAAK,IAAI,CAAC,eAAe,EAAE;YAC/C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;YAC/B,8EAA8E;YAC9E,gBAAgB;YAChB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,uBAAW,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;SAC/F;IACH,CAAC;IAED,2CAAU,GAAV;QACE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE7C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IACH,6BAAC;AAAD,CAAC,AAxBD,CAA4C,+BAAmB,GAwB9D;AAxBY,wDAAsB","sourcesContent":["import { VERSION } from 'ua-parser-js';\n\nimport { BaseInstrumentation, Conventions, Meta, MetaSession } from '@grafana/faro-core';\n\n// all this does is send SESSION_START event\nexport class SessionInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-session';\n readonly version = VERSION;\n\n // previously notified session, to ensure we don't send session start\n // event twice for the same session\n private notifiedSession: MetaSession | undefined;\n\n private sendSessionStartEvent(meta: Meta): void {\n const session = meta.session;\n\n if (session && session !== this.notifiedSession) {\n this.notifiedSession = session;\n // no need to add attributes and session id, they are included as part of meta\n // automatically\n this.api.pushEvent(Conventions.EventNames.SESSION_START, {}, undefined, { skipDedupe: true });\n }\n }\n\n initialize() {\n this.sendSessionStartEvent(this.metas.value);\n\n this.metas.addListener(this.sendSessionStartEvent.bind(this));\n }\n}\n"]}