-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
Copy pathrom3.min.js
1 lines (1 loc) · 9.09 KB
/
rom3.min.js
1
"use strict";function _slicedToArray(n,e){return _arrayWithHoles(n)||_iterableToArrayLimit(n,e)||_unsupportedIterableToArray(n,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(n,e){if(n){if("string"==typeof n)return _arrayLikeToArray(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(n,e):void 0}}function _arrayLikeToArray(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function _iterableToArrayLimit(n,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(n)){var t=[],r=!0,o=!1,c=void 0;try{for(var i,s=n[Symbol.iterator]();!(r=(i=s.next()).done)&&(t.push(i.value),!e||t.length!==e);r=!0);}catch(n){o=!0,c=n}finally{try{r||null==s.return||s.return()}finally{if(o)throw c}}return t}}function _arrayWithHoles(n){if(Array.isArray(n))return n}!function(l){var n,i="https://devnull.perfops.net",t="https://rum-cdn.perfops.net/providers",r=3e5,c=3,s="test.resolver.perfops.net",a=3e5,o=2e4,p=6e4,d=3,u=15,f=6e4,h=3,m="desktop",b=Date.now(),g=A(16),e=-1!==function(){}.toString().indexOf("minified")?{logInfo:console.log,logError:console.error}:{logInfo:function(){},logError:function(){}},v=e.logInfo,w=e.logError,y=window.rum?window.rum.key:void 0;function j(n,e,t){m=t,h=Math.min(Math.max(function(n,e){return void 0!==window.rum&&void 0!==window.rum.config&&window.rum.config[e].repeats||n}(n,t),d),u),f=Math.min(Math.max(function(n,e){return void 0!==window.rum&&void 0!==window.rum.config&&window.rum.config[e].interval||n}(e,t),o),p)}function U(n){return Math.max(0,Number(n.toFixed(2)))}function S(t,n){var e=1<arguments.length&&void 0!==n?n:{},r=e.cb,c=void 0===r?function(){}:r,i=e.data,o=e.method,s=void 0===o?"GET":o,a=e.timeout,p=void 0===a?3e3:a,d=e.headers,u=void 0===d?{}:d;return new l(function(n,e){var o=new XMLHttpRequest;o.onload=function(){return n(o)},o.ontimeout=function(){e("timeout")},o.onerror=function(){var n="Unknown error happen when fetching ".concat(t);0!==o.status&&(n="Error happen when fetching ".concat(t,". Status ").concat(o.status,". Response: ").concat(o.statusText)),e(new Error(n))},o.open(s,t),u&&Object.entries(u).forEach(function(n){var e=_slicedToArray(n,2),t=e[0],r=e[1];o.setRequestHeader(t,r)}),o.timeout=p,c(o),o.send(i)})}function A(n){for(var e="abcdefghijklmnopqrstuvwxyz0123456789",t="",r=0;r<n;r++){var o=Math.floor(Math.random()*e.length);t+=e.charAt(o)}return t}function E(n){var e=n.interval?1e3*parseInt(n.interval):f;j(n.repeats?parseInt(n.repeats):h,e,n.mobile?"mobile":"desktop")}function T(){var e=0;setTimeout(function n(){(function(){var r="perfops-rum-clientdns",n=JSON.parse(window.localStorage.getItem(r));if(n&&n.expiry>Date.now())return l.resolve(n.data);for(var o=[],e=0;e<c;e++){var t="https://"+A(16)+"."+s;o.push(S(t))}return new l(function(e,t){l.all(o).then(function(n){var t=[];n.forEach(function(n){var e=JSON.parse(n.response);t.includes(e.resolver)||null===e.resolver||t.push(e.resolver)}),window.localStorage.setItem(r,JSON.stringify({data:t,expiry:Date.now()+a})),e(t)}).catch(function(n){t(n)})})})().then(function(c){(function(){var e="perfops-rum-resources",n=JSON.parse(window.localStorage.getItem(e));return n&&n.expiry>Date.now()?(n.config&&E(n.config),l.resolve(n.data)):S(t,{headers:{"X-Partner-Id":y||"perfops","X-Partner-Hostname":window.location.hostname||"unknown"}}).then(function(n){return JSON.parse(n.response)}).then(function(n){if(!n||!n.data)throw new Error("Empty response.data");return window.localStorage.setItem(e,JSON.stringify({data:n.data,config:n.config,expiry:Date.now()+r})),n.config&&E(n.config),n.data}).catch(function(){return[{id:17,cdnUrl:"https://edgecast-perfops.azureedge.net/500b-bench.jpg",p:0},{id:18,cdnUrl:"https://azure-perfops.azureedge.net/500b-bench.jpg",p:0},{id:89,cdnUrl:"https://25748s.ha.azioncdn.net/500b-az-bench.jpg",p:0},{id:93,cdnUrl:"https://staticperfops.cdn.hoy.sh/500b-bench.jpg",p:0},{id:96,cdnUrl:"https://cdn23602612.ahacdn.me/500b-bench.jpg",p:0},{id:100,cdnUrl:"https://pfps17ssl.cdnvideo.ru/500b-bench.jpg",p:0},{id:55,cdnUrl:"https://perfops.s.llnwi.net/500b-bench.jpg",p:1},{id:66,cdnUrl:"https://vodstreaming01.video.globo.com/500b-bench.jpg",p:0},{id:99,cdnUrl:"https://test-perfops.ecn.zenlayer.net/500b-bench.jpg",p:0},{id:85,cdnUrl:"https://proxy.canary.scrubbingcenter.com/test_image.png",p:0},{id:84,cdnUrl:"https://ultrawaf.canary.scrubbingcenter.com/test_image.png",p:0},{id:74,cdnUrl:"https://test-perfops.haproxy.com/500b-bench.jpg",p:0},{id:58,cdnUrl:"https://perfops-cds.s.llnwi.net/500b-bench.jpg",p:0},{id:72,cdnUrl:"https://rum.perfops.mdb.cdn.orange.com/500b-bench.jpg",p:0},{id:87,cdnUrl:"https://test-perfops.ldgslb.com/500b-bench.jpg",p:1},{id:20,cdnUrl:"https://cdnperf.cachefly.net/500b-bench.jpg",p:1},{id:9,cdnUrl:"https://1596384882.rsc.cdn77.org/500b-bench.jpg",p:1},{id:3,cdnUrl:"https://perfops.cloudflareperf.com/500b-cf-bench.jpg",p:1},{id:7,cdnUrl:"https://cpt96125.shopvoxpopulus.com/pics/500b-bench.jpg",p:1},{id:65,cdnUrl:"https://perfops.glbcdn.net/500b-bench.jpg",p:0},{id:40,cdnUrl:"https://perfops.swiftycdn.net/500b-sw-bench.jpg",p:0},{id:11,cdnUrl:"https://perfops1.b-cdn.net/500b-bunny-bench.jpg",p:1},{id:75,cdnUrl:"https://cdnperf-rum.quantil.com/500b-bench.jpg",p:0},{id:67,cdnUrl:"https://media-edge.1e100cdn.net/pics/500b-bench.jpg",p:0},{id:92,cdnUrl:"https://perfops.byte-test.com/500b-bench.jpg",p:1},{id:98,cdnUrl:"https://perfops2.byte-test.com/500b-bench.jpg",p:0},{id:77,cdnUrl:"https://cdnperf.qwilt.com/500b-bench.jpg",p:0},{id:97,cdnUrl:"https://medianova-cdnvperf.mncdn.com/500b-bench.jpg",p:0},{id:5,cdnUrl:"https://d3888oxgux3fey.cloudfront.net/500b-bench.jpg",p:1},{id:10,cdnUrl:"https://akamai-cdn.perfops.io/500b-bench.jpg",p:1},{id:12,cdnUrl:"https://cdn.jsdelivr.net/gh/jimaek/[email protected]/500b-bench.jpg",p:1},{id:83,cdnUrl:"https://medianova-cdnperf.mncdn.com/500b-bench.jpg",p:1},{id:2,cdnUrl:"https://ovh-cdn.perfops.io/500b-bench.jpg",p:1},{id:4,cdnUrl:"https://perfops-static.freetls.fastly.net/500b-bench.jpg",p:1},{id:8,cdnUrl:"https://perfops.gcorelabs.com/500b-bench.jpg",p:1},{id:76,cdnUrl:"https://img.perfops.net/500b-bench.jpg",p:0},{id:94,cdnUrl:"https://rum.perfops.cdb.cdn.orange.com/500b-bench.jpg",p:0},{id:35,cdnUrl:"https://cdn81795137.blazingcdn.net/500b-blz-bench.jpg",p:1},{id:15,cdnUrl:"https://cdnperf-rum.cdnetworks.net/500b-bench.jpg",p:1},{id:14,cdnUrl:"https://perfops.r.worldssl.net/500b-bench.jpg",p:1}]})})().then(function(n){var e={ua:navigator.userAgent,hostname:window.location.hostname,client:y,clientdns:c,platform:m,timeElapsed:0,sessionId:"",version:4},t=[];performance.clearResourceTimings();function r(){var n=t.splice(0,t.length);return function(n){var e=0,t=0;return n.forEach(function(n){n.up?2e3<n.time&&e++:t++}),t+e<n.length}(n)?function(n,e){return n.timeElapsed=Math.round((Date.now()-b)/1e3),n.sessionId=g,S("".concat(i,"/rum/v1"),{data:JSON.stringify({metadata:n,data:e}),method:"POST"}).catch(w)}(e,n):n}function o(n){return!(n.time<3||3e3<n.time)&&(2<=t.push(n)?r():void 0)}return function(n,r){return n.reduce(function(n,t){return n.then(function(e){return r(t).then(function(n){return e.push(n),e})})},l.resolve([]))}(n,function(n){return function(n){var c="".concat(n.cdnUrl,"?t=").concat(Date.now()),e=new URL(c).hostname,i={id:n.id,domain:e,online:navigator&&void 0!==navigator.onLine?Number(navigator.onLine):-1};return S(c).then(function(n){var e=performance.getEntriesByName(c)[0],t=U(e.domainLookupEnd-e.domainLookupStart),r=U(e.connectEnd-e.connectStart),o=0<r?U(e.connectEnd-e.secureConnectionStart):0;return 200<=n.status&&n.status<300&&(i=Object.assign({},i,{up:1,status:n.status,time:Number((e.responseEnd-e.requestStart).toFixed(2)),dnsLookupTime:t,tcpTime:r,sslTime:o,headers:n.getAllResponseHeaders()})),300<=n.status&&n.status<=500&&(i=Object.assign({},i,{up:0,status:n.status,dnsLookupTime:t,tcpTime:r,sslTime:o,headers:n.getAllResponseHeaders()})),i}).catch(function(){return Object.assign({},i,{up:0,status:0})})}(n).then(o)}).then(r)}).then(v,w).then(function(){(e+=1)<h&&setTimeout(n,f)})})},3e3)}j(f,h,"desktop"),n=function(){var n=["bot","headless","google","baidu","bing","msn","duckduckbot","teoma","slurp","yandex","phantomjs","pingdom","ahrefsbot"].join("|");if(new RegExp(n,"i").test(window.navigator.userAgent))console.warn("PerfOps RUM not launching due to suspicious userAgent:",window.navigator.userAgent);else if(void 0!==window.performance){if(performance.onresourcetimingbufferfull=function(){v("clear performance resource buffer"),performance.clearResourceTimings()},"function"==typeof l)return T();!function(n,e){var t=document.createElement("script"),r=!1;t.onreadystatechange=t.onload=function(){r||e(),r=!0},t.setAttribute("src",n),document.body.appendChild(t)}("https://cdn.perfops.net/npm/es6-promise-4.2.4/dist/es6-promise.min.js",function(){l=window.ES6Promise,T()})}},"complete"===document.readyState?n():window.addEventListener("load",n)}(window.Promise);