New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

perfume.js

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

perfume.js - npm Package Compare versions

Comparing version

to
2.0.0-rc.1

{
"name": "perfume.js/angular",
"version": "1.2.1",
"version": "2.0.0",
"peerDependencies": {

@@ -5,0 +5,0 @@ "@angular/common": "^6.0.0",

@@ -1,13 +0,6 @@

// Init Polyfill
import PerformanceObserverTTI from './tti-polyfill-starts';
var performanceTTI = new PerformanceObserverTTI();
performanceTTI.create();
// Import Polyfills
import 'first-input-delay';
import ttiPolyfill from 'tti-polyfill';
var Performance = /** @class */ (function () {
function Performance(config) {
this.config = config;
this.timeToInteractiveDuration = 0;
this.ttiPolyfill = ttiPolyfill;
}

@@ -34,9 +27,2 @@ /**

/**
* True if the browser supports the PerformanceLongTaskTiming interface.
* Support: developer.mozilla.org/en-US/docs/Web/API/PerformanceLongTaskTiming
*/
Performance.supportedLongTask = function () {
return 'PerformanceLongTaskTiming' in window;
};
/**
* When performance API available

@@ -71,16 +57,2 @@ * returns a DOMHighResTimeStamp, measured in milliseconds, accurate to five

/**
* The polyfill exposes a getFirstConsistentlyInteractive() method,
* which returns a promise that resolves with the TTI value.
*
* The getFirstConsistentlyInteractive() method accepts an optional
* startTime configuration option, allowing you to specify a lower bound
* for which you know your app cannot be interactive before.
* By default the polyfill uses DOMContentLoaded as the start time,
* but it's often more accurate to use something like the moment your hero elements
* are visible or the point when you know all your event listeners have been added.
*/
Performance.prototype.timeToInteractive = function (minValue) {
return this.ttiPolyfill.getFirstConsistentlyInteractive({ minValue: minValue });
};
/**
* Get the duration of the timing metric or -1 if there a measurement has

@@ -87,0 +59,0 @@ * not been made by the User Timing API

@@ -1,38 +0,3 @@

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
/*!
* Perfume.js v1.2.1 (http://zizzamia.github.io/perfume)
* Perfume.js v2.0.0 (http://zizzamia.github.io/perfume)
* Copyright 2018 The Perfume Authors (https://github.com/Zizzamia/perfume.js/graphs/contributors)

@@ -42,2 +7,3 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE)

*/
import { IdleQueue } from './idle-queue';
import EmulatedPerformance from './emulated-performance';

@@ -54,3 +20,2 @@ import Performance from './performance';

firstInputDelay: false,
timeToInteractive: false,
// Analytics

@@ -71,3 +36,2 @@ googleAnalytics: {

this.firstInputDelayDuration = 0;
this.timeToInteractiveDuration = 0;
this.isHidden = false;

@@ -93,30 +57,23 @@ this.logMetricWarn = 'Please provide a metric name';

// Init observe FCP and creates the Promise to observe metric
this.observeFirstContentfulPaint = new Promise(function (resolve) {
_this.logDebug('observeFirstContentfulPaint');
_this.observers.set('fcp', resolve);
_this.initFirstPaint();
});
if (this.config.firstPaint || this.config.firstContentfulPaint) {
this.observeFirstContentfulPaint = new Promise(function (resolve) {
_this.logDebug('observeFirstContentfulPaint');
_this.observers.set('fcp', resolve);
_this.initFirstPaint();
});
}
// FID needs to be initialized as soon as Perfume is available, which returns
// a Promise that can be observed
this.observeFirstInputDelay = new Promise(function (resolve) {
_this.observers.set('fid', resolve);
_this.initFirstInputDelay();
});
if (this.config.firstInputDelay) {
this.observeFirstInputDelay = new Promise(function (resolve) {
_this.observers.set('fid', resolve);
_this.initFirstInputDelay();
});
}
// Init visibilitychange listener
this.onVisibilityChange();
// Init observe TTI and creates the Promise to observe metric
this.observeTimeToInteractive = new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
var FCPDuration;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.observers.set('tti', resolve);
return [4 /*yield*/, this.observeFirstContentfulPaint];
case 1:
FCPDuration = _a.sent();
this.initTimeToInteractive(FCPDuration);
return [2 /*return*/];
}
});
}); });
// Ensures the queue is run immediately whenever the page
// is in a state where it might soon be unloaded.
// https://philipwalton.com/articles/idle-until-urgent/
this.queue = new IdleQueue({ ensureTasksRun: true });
}

@@ -147,2 +104,3 @@ /**

Perfume.prototype.end = function (metricName) {
var _this = this;
if (!this.checkMetricName(metricName)) {

@@ -162,6 +120,8 @@ return;

var duration2Decimal = parseFloat(duration.toFixed(2));
// Log to console, delete metric and send to analytics tracker
this.log(metricName, duration2Decimal);
this.metrics.delete(metricName);
this.sendTiming(metricName, duration2Decimal);
this.queue.pushTask(function () {
// Log to console, delete metric and send to analytics tracker
_this.log(metricName, duration2Decimal);
_this.sendTiming(metricName, duration2Decimal);
});
return duration2Decimal;

@@ -248,10 +208,12 @@ };

entries.forEach(function (performancePaintTiming) {
if (_this.config.firstPaint &&
performancePaintTiming.name === 'first-paint') {
_this.logMetric(performancePaintTiming.startTime, 'First Paint', 'firstPaint');
}
if (_this.config.firstContentfulPaint &&
performancePaintTiming.name === 'first-contentful-paint') {
_this.logMetric(performancePaintTiming.startTime, 'First Contentful Paint', 'firstContentfulPaint');
}
_this.queue.pushTask(function () {
if (_this.config.firstPaint &&
performancePaintTiming.name === 'first-paint') {
_this.logMetric(performancePaintTiming.startTime, 'First Paint', 'firstPaint');
}
if (_this.config.firstContentfulPaint &&
performancePaintTiming.name === 'first-contentful-paint') {
_this.logMetric(performancePaintTiming.startTime, 'First Contentful Paint', 'firstContentfulPaint');
}
});
});

@@ -271,15 +233,2 @@ };

};
Perfume.prototype.initTimeToInteractive = function (FCPDuration) {
var _this = this;
if (Performance.supported() &&
Performance.supportedPerformanceObserver() &&
Performance.supportedLongTask() &&
this.config.timeToInteractive &&
FCPDuration) {
// Get Time to Interactivite
this.perf.timeToInteractive(FCPDuration).then(function (time) {
_this.logMetric(time, 'Time to Interactive', 'timeToInteractive');
});
}
};
Perfume.prototype.initFirstInputDelay = function () {

@@ -290,3 +239,5 @@ var _this = this;

perfMetrics.onFirstInputDelay(function (duration, event) {
_this.logMetric(duration, 'First Input Delay', 'firstInputDelay');
_this.queue.pushTask(function () {
_this.logMetric(duration, 'First Input Delay', 'firstInputDelay');
});
});

@@ -328,6 +279,2 @@ }

}
if (metricName === 'timeToInteractive') {
this.timeToInteractiveDuration = duration2Decimal;
this.observers.get('tti')(duration2Decimal);
}
// Logs the metric in the internal console.log

@@ -334,0 +281,0 @@ this.log(logText, duration2Decimal);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Init Polyfill
var tti_polyfill_starts_1 = require("./tti-polyfill-starts");
var performanceTTI = new tti_polyfill_starts_1.default();
performanceTTI.create();
// Import Polyfills
require("first-input-delay");
var tti_polyfill_1 = require("tti-polyfill");
var Performance = /** @class */ (function () {
function Performance(config) {
this.config = config;
this.timeToInteractiveDuration = 0;
this.ttiPolyfill = tti_polyfill_1.default;
}

@@ -36,9 +29,2 @@ /**

/**
* True if the browser supports the PerformanceLongTaskTiming interface.
* Support: developer.mozilla.org/en-US/docs/Web/API/PerformanceLongTaskTiming
*/
Performance.supportedLongTask = function () {
return 'PerformanceLongTaskTiming' in window;
};
/**
* When performance API available

@@ -73,16 +59,2 @@ * returns a DOMHighResTimeStamp, measured in milliseconds, accurate to five

/**
* The polyfill exposes a getFirstConsistentlyInteractive() method,
* which returns a promise that resolves with the TTI value.
*
* The getFirstConsistentlyInteractive() method accepts an optional
* startTime configuration option, allowing you to specify a lower bound
* for which you know your app cannot be interactive before.
* By default the polyfill uses DOMContentLoaded as the start time,
* but it's often more accurate to use something like the moment your hero elements
* are visible or the point when you know all your event listeners have been added.
*/
Performance.prototype.timeToInteractive = function (minValue) {
return this.ttiPolyfill.getFirstConsistentlyInteractive({ minValue: minValue });
};
/**
* Get the duration of the timing metric or -1 if there a measurement has

@@ -89,0 +61,0 @@ * not been made by the User Timing API

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
/*!
* Perfume.js v1.2.1 (http://zizzamia.github.io/perfume)
* Perfume.js v2.0.0 (http://zizzamia.github.io/perfume)
* Copyright 2018 The Perfume Authors (https://github.com/Zizzamia/perfume.js/graphs/contributors)

@@ -44,2 +9,3 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE)

*/
var idle_queue_1 = require("./idle-queue");
var emulated_performance_1 = require("./emulated-performance");

@@ -56,3 +22,2 @@ var performance_1 = require("./performance");

firstInputDelay: false,
timeToInteractive: false,
// Analytics

@@ -73,3 +38,2 @@ googleAnalytics: {

this.firstInputDelayDuration = 0;
this.timeToInteractiveDuration = 0;
this.isHidden = false;

@@ -95,30 +59,23 @@ this.logMetricWarn = 'Please provide a metric name';

// Init observe FCP and creates the Promise to observe metric
this.observeFirstContentfulPaint = new Promise(function (resolve) {
_this.logDebug('observeFirstContentfulPaint');
_this.observers.set('fcp', resolve);
_this.initFirstPaint();
});
if (this.config.firstPaint || this.config.firstContentfulPaint) {
this.observeFirstContentfulPaint = new Promise(function (resolve) {
_this.logDebug('observeFirstContentfulPaint');
_this.observers.set('fcp', resolve);
_this.initFirstPaint();
});
}
// FID needs to be initialized as soon as Perfume is available, which returns
// a Promise that can be observed
this.observeFirstInputDelay = new Promise(function (resolve) {
_this.observers.set('fid', resolve);
_this.initFirstInputDelay();
});
if (this.config.firstInputDelay) {
this.observeFirstInputDelay = new Promise(function (resolve) {
_this.observers.set('fid', resolve);
_this.initFirstInputDelay();
});
}
// Init visibilitychange listener
this.onVisibilityChange();
// Init observe TTI and creates the Promise to observe metric
this.observeTimeToInteractive = new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
var FCPDuration;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.observers.set('tti', resolve);
return [4 /*yield*/, this.observeFirstContentfulPaint];
case 1:
FCPDuration = _a.sent();
this.initTimeToInteractive(FCPDuration);
return [2 /*return*/];
}
});
}); });
// Ensures the queue is run immediately whenever the page
// is in a state where it might soon be unloaded.
// https://philipwalton.com/articles/idle-until-urgent/
this.queue = new idle_queue_1.IdleQueue({ ensureTasksRun: true });
}

@@ -149,2 +106,3 @@ /**

Perfume.prototype.end = function (metricName) {
var _this = this;
if (!this.checkMetricName(metricName)) {

@@ -164,6 +122,8 @@ return;

var duration2Decimal = parseFloat(duration.toFixed(2));
// Log to console, delete metric and send to analytics tracker
this.log(metricName, duration2Decimal);
this.metrics.delete(metricName);
this.sendTiming(metricName, duration2Decimal);
this.queue.pushTask(function () {
// Log to console, delete metric and send to analytics tracker
_this.log(metricName, duration2Decimal);
_this.sendTiming(metricName, duration2Decimal);
});
return duration2Decimal;

@@ -250,10 +210,12 @@ };

entries.forEach(function (performancePaintTiming) {
if (_this.config.firstPaint &&
performancePaintTiming.name === 'first-paint') {
_this.logMetric(performancePaintTiming.startTime, 'First Paint', 'firstPaint');
}
if (_this.config.firstContentfulPaint &&
performancePaintTiming.name === 'first-contentful-paint') {
_this.logMetric(performancePaintTiming.startTime, 'First Contentful Paint', 'firstContentfulPaint');
}
_this.queue.pushTask(function () {
if (_this.config.firstPaint &&
performancePaintTiming.name === 'first-paint') {
_this.logMetric(performancePaintTiming.startTime, 'First Paint', 'firstPaint');
}
if (_this.config.firstContentfulPaint &&
performancePaintTiming.name === 'first-contentful-paint') {
_this.logMetric(performancePaintTiming.startTime, 'First Contentful Paint', 'firstContentfulPaint');
}
});
});

@@ -273,15 +235,2 @@ };

};
Perfume.prototype.initTimeToInteractive = function (FCPDuration) {
var _this = this;
if (performance_1.default.supported() &&
performance_1.default.supportedPerformanceObserver() &&
performance_1.default.supportedLongTask() &&
this.config.timeToInteractive &&
FCPDuration) {
// Get Time to Interactivite
this.perf.timeToInteractive(FCPDuration).then(function (time) {
_this.logMetric(time, 'Time to Interactive', 'timeToInteractive');
});
}
};
Perfume.prototype.initFirstInputDelay = function () {

@@ -292,3 +241,5 @@ var _this = this;

perfMetrics.onFirstInputDelay(function (duration, event) {
_this.logMetric(duration, 'First Input Delay', 'firstInputDelay');
_this.queue.pushTask(function () {
_this.logMetric(duration, 'First Input Delay', 'firstInputDelay');
});
});

@@ -330,6 +281,2 @@ }

}
if (metricName === 'timeToInteractive') {
this.timeToInteractiveDuration = duration2Decimal;
this.observers.get('tti')(duration2Decimal);
}
// Logs the metric in the internal console.log

@@ -336,0 +283,0 @@ this.log(logText, duration2Decimal);

@@ -1,2 +0,2 @@

import"first-input-delay";import ttiPolyfill from"tti-polyfill";var EmulatedPerformance=function(){function t(t){this.config=t}return t.prototype.now=function(){return Date.now()/1e3},t.prototype.mark=function(t,e){},t.prototype.measure=function(t,e){return this.getDurationByMetric(t,e)},t.prototype.firstContentfulPaint=function(t){var e=this;setTimeout(function(){t(e.getFirstPaint())})},t.prototype.getDurationByMetric=function(t,e){return e.end-e.start||0},t.prototype.getFirstPaint=function(){var t=window.performance.timing,e={duration:0,entryType:"paint",name:"first-contentful-paint",startTime:0};return t&&0!==t.navigationStart&&(e.startTime=Date.now()-t.navigationStart),[e]},t}(),PerformanceObserverTTI=function(){function t(){}return t.prototype.create=function(){var t=this;"PerformanceLongTaskTiming"in window&&(this.g=window.__tti={e:[]},this.g.o=new PerformanceObserver(function(e){t.g.e=t.g.e.concat(e.getEntries())}),this.g.o.observe({entryTypes:["longtask"]}))},t}(),performanceTTI=new PerformanceObserverTTI;performanceTTI.create();var Performance=function(){function t(t){this.config=t,this.timeToInteractiveDuration=0,this.ttiPolyfill=ttiPolyfill}return t.supported=function(){return window.performance&&!!performance.now&&!!performance.mark},t.supportedPerformanceObserver=function(){return window.chrome&&"PerformanceObserver"in window},t.supportedLongTask=function(){return"PerformanceLongTaskTiming"in window},t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,e){var i="mark_"+t+"_"+e;window.performance.mark(i)},t.prototype.measure=function(t,e){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.getDurationByMetric(t,e)},t.prototype.firstContentfulPaint=function(t){this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,t)),this.perfObserver.observe({entryTypes:["paint"]})},t.prototype.timeToInteractive=function(t){return this.ttiPolyfill.getFirstConsistentlyInteractive({minValue:t})},t.prototype.getDurationByMetric=function(t,e){var i=this.getMeasurementForGivenName(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.getMeasurementForGivenName=function(t){var e=window.performance.getEntriesByName(t);return e[e.length-1]},t.prototype.performanceObserverCb=function(t,e){var i=this,n=e.getEntries();t(n),n.forEach(function(t){i.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&i.perfObserver.disconnect()})},t}(),__awaiter=function(t,e,i,n){return new(i||(i=Promise))(function(r,o){function s(t){try{f(n.next(t))}catch(t){o(t)}}function a(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){t.done?r(t.value):new i(function(e){e(t.value)}).then(s,a)}f((n=n.apply(t,e||[])).next())})},__generator=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Perfume=function(){function t(t){void 0===t&&(t={});var e=this;this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,timeToInteractive:!1,googleAnalytics:{enable:!1,timingVar:"name"},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:18e3,warning:!1,debugging:!1},this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.timeToInteractiveDuration=0,this.isHidden=!1,this.logMetricWarn="Please provide a metric name",this.metrics=new Map,this.observers=new Map,this.didVisibilityChange=function(){document.hidden&&(e.isHidden=document.hidden)},this.config=Object.assign({},this.config,t),this.perf=Performance.supported()?new Performance(this.config):new EmulatedPerformance(this.config),Performance.supportedPerformanceObserver()||(this.perfEmulated=new EmulatedPerformance(this.config)),this.observeFirstContentfulPaint=new Promise(function(t){e.logDebug("observeFirstContentfulPaint"),e.observers.set("fcp",t),e.initFirstPaint()}),this.observeFirstInputDelay=new Promise(function(t){e.observers.set("fid",t),e.initFirstInputDelay()}),this.onVisibilityChange(),this.observeTimeToInteractive=new Promise(function(t){return __awaiter(e,void 0,void 0,function(){var e;return __generator(this,function(i){switch(i.label){case 0:return this.observers.set("tti",t),[4,this.observeFirstContentfulPaint];case 1:return e=i.sent(),this.initTimeToInteractive(e),[2]}})})})}return t.prototype.start=function(t){this.checkMetricName(t)&&(this.metrics.has(t)?this.logWarn(this.config.logPrefix,"Recording already started."):(this.metrics.set(t,{end:0,start:this.perf.now()}),this.perf.mark(t,"start"),this.isHidden=!1))},t.prototype.end=function(t){if(this.checkMetricName(t)){var e=this.metrics.get(t);if(e){e.end=this.perf.now(),this.perf.mark(t,"end");var i=this.perf.measure(t,e),n=parseFloat(i.toFixed(2));return this.log(t,n),this.metrics.delete(t),this.sendTiming(t,n),n}this.logWarn(this.config.logPrefix,"Recording already stopped.")}},t.prototype.endPaint=function(t){var e=this;return new Promise(function(i){setTimeout(function(){var n=e.end(t);i(n)})})},t.prototype.log=function(t,e){if(!this.isHidden&&this.config.logging)if(t){var i=e.toFixed(2),n="%c "+this.config.logPrefix+" "+t+" "+i+" ms";window.console.log(n,"color: #ff6d00;font-size:11px;")}else this.logWarn(this.config.logPrefix,this.logMetricWarn)},t.prototype.logDebug=function(t,e){void 0===e&&(e=""),this.config.debugging&&window.console.log("Perfume.js debugging "+t+":",e)},t.prototype.sendTiming=function(t,e){if(!this.isHidden&&(this.config.analyticsTracker&&this.config.analyticsTracker(t,e),this.config.googleAnalytics.enable))if(window.ga){var i=Math.round(e);window.ga("send","timing",t,this.config.googleAnalytics.timingVar,i)}else this.logWarn(this.config.logPrefix,"Google Analytics has not been loaded")},t.prototype.checkMetricName=function(t){return!!t||(this.logWarn(this.config.logPrefix,this.logMetricWarn),!1)},t.prototype.firstContentfulPaintCb=function(t){var e=this;this.logDebug("firstContentfulPaintCb",t),t.forEach(function(t){e.config.firstPaint&&"first-paint"===t.name&&e.logMetric(t.startTime,"First Paint","firstPaint"),e.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&e.logMetric(t.startTime,"First Contentful Paint","firstContentfulPaint")})},t.prototype.initFirstPaint=function(){this.logDebug("initFirstPaint"),Performance.supportedPerformanceObserver()?(this.logDebug("initFirstPaint.supportedPerformanceObserver"),this.perf.firstContentfulPaint(this.firstContentfulPaintCb.bind(this))):this.perfEmulated&&(this.logDebug("initFirstPaint.perfEmulated"),this.perfEmulated.firstContentfulPaint(this.firstContentfulPaintCb.bind(this)))},t.prototype.initTimeToInteractive=function(t){var e=this;Performance.supported()&&Performance.supportedPerformanceObserver()&&Performance.supportedLongTask()&&this.config.timeToInteractive&&t&&this.perf.timeToInteractive(t).then(function(t){e.logMetric(t,"Time to Interactive","timeToInteractive")})},t.prototype.initFirstInputDelay=function(){var t=this;Performance.supported()&&this.config.firstInputDelay&&perfMetrics.onFirstInputDelay(function(e,i){t.logMetric(e,"First Input Delay","firstInputDelay")})},t.prototype.onVisibilityChange=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.didVisibilityChange)},t.prototype.logMetric=function(t,e,i){var n=parseFloat(t.toFixed(2));n>this.config.maxMeasureTime||("firstPaint"===i&&(this.firstPaintDuration=n),"firstContentfulPaint"===i&&(this.firstContentfulPaintDuration=n,this.observers.get("fcp")(n)),"firstInputDelay"===i&&(this.firstInputDelayDuration=n,this.observers.get("fid")(n)),"timeToInteractive"===i&&(this.timeToInteractiveDuration=n,this.observers.get("tti")(n)),this.log(e,n),this.sendTiming(i,n))},t.prototype.logWarn=function(t,e){this.config.warning&&this.config.logging&&window.console.warn(t,e)},t}();export default Perfume;
import"first-input-delay";var now=function(){return+new Date},supportsRequestIdleCallback_="function"==typeof window.requestIdleCallback,IdleDealine=function(){function t(t){this.initTime_=t}return Object.defineProperty(t.prototype,"didTimeout",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype.timeRemaining=function(){return Math.max(0,50-(now()-this.initTime_))},t}(),requestIdleCallbackShim=function(t){var i=new IdleDealine(now());return setTimeout(function(){return t(i)},0)},cancelIdleCallbackShim=function(t){clearTimeout(t)},rIC=supportsRequestIdleCallback_?window.requestIdleCallback:requestIdleCallbackShim,cIC=supportsRequestIdleCallback_?window.cancelIdleCallback:cancelIdleCallbackShim,createQueueMicrotaskViaPromises=function(){return function(t){Promise.resolve().then(t)}},createQueueMicrotaskViaMutationObserver=function(){var t=0,i=[],e=new MutationObserver(function(){i.forEach(function(t){return t()}),i=[]}),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(e){i.push(e),n.data=String(++t%2)}},queueMicrotask="function"==typeof Promise&&Promise.toString().indexOf("[native code]")>-1?createQueueMicrotaskViaPromises():createQueueMicrotaskViaMutationObserver(),DEFAULT_MIN_TASK_TIME=0,isSafari_=!("object"!=typeof window.safari||!window.safari.pushNotification),IdleQueue=function(){function t(t){var i=void 0===t?{}:t,e=i.ensureTasksRun,n=void 0!==e&&e,r=i.defaultMinTaskTime,s=void 0===r?DEFAULT_MIN_TASK_TIME:r;this.taskQueue_=[],this.isProcessing_=!1,this.state_=null,this.idleCallbackHandle_=null,this.taskQueue_=[],this.isProcessing_=!1,this.state_=null,this.defaultMinTaskTime_=s,this.ensureTasksRun_=n,this.runTasksImmediately=this.runTasksImmediately.bind(this),this.runTasks_=this.runTasks_.bind(this),this.onVisibilityChange_=this.onVisibilityChange_.bind(this),this.ensureTasksRun_&&(addEventListener("visibilitychange",this.onVisibilityChange_,!0),isSafari_&&addEventListener("beforeunload",this.runTasksImmediately,!0))}return t.prototype.pushTask=function(t){this.addTask_(Array.prototype.push,t)},t.prototype.unshiftTask=function(t){this.addTask_(Array.prototype.unshift,t)},t.prototype.runTasksImmediately=function(){this.runTasks_()},t.prototype.hasPendingTasks=function(){return this.taskQueue_.length>0},t.prototype.clearPendingTasks=function(){this.taskQueue_=[],this.cancelScheduledRun_()},t.prototype.getState=function(){return this.state_},t.prototype.destroy=function(){this.taskQueue_=[],this.cancelScheduledRun_(),this.ensureTasksRun_&&(removeEventListener("visibilitychange",this.onVisibilityChange_,!0),isSafari_&&removeEventListener("beforeunload",this.runTasksImmediately,!0))},t.prototype.addTask_=function(t,i,e){var n=(void 0===e?{}:e).minTaskTime,r=void 0===n?this.defaultMinTaskTime_:n,s={time:now(),visibilityState:document.visibilityState};t.call(this.taskQueue_,{state:s,task:i,minTaskTime:r}),this.scheduleTasksToRun_()},t.prototype.scheduleTasksToRun_=function(){this.ensureTasksRun_&&"hidden"===document.visibilityState?queueMicrotask(this.runTasks_):this.idleCallbackHandle_||(this.idleCallbackHandle_=rIC(this.runTasks_))},t.prototype.runTasks_=function(t){if(this.cancelScheduledRun_(),!this.isProcessing_){for(this.isProcessing_=!0;this.hasPendingTasks()&&!shouldYield(t,this.taskQueue_[0].minTaskTime);){var i=this.taskQueue_.shift(),e=i.task,n=i.state;this.state_=n,e(n),this.state_=null}this.isProcessing_=!1,this.hasPendingTasks()&&this.scheduleTasksToRun_()}},t.prototype.cancelScheduledRun_=function(){cIC(this.idleCallbackHandle_),this.idleCallbackHandle_=null},t.prototype.onVisibilityChange_=function(){"hidden"===document.visibilityState&&this.runTasksImmediately()},t}(),shouldYield=function(t,i){return!!(t&&t.timeRemaining()<=i)},EmulatedPerformance=function(){function t(t){this.config=t}return t.prototype.now=function(){return Date.now()/1e3},t.prototype.mark=function(t,i){},t.prototype.measure=function(t,i){return this.getDurationByMetric(t,i)},t.prototype.firstContentfulPaint=function(t){var i=this;setTimeout(function(){t(i.getFirstPaint())})},t.prototype.getDurationByMetric=function(t,i){return i.end-i.start||0},t.prototype.getFirstPaint=function(){var t=window.performance.timing,i={duration:0,entryType:"paint",name:"first-contentful-paint",startTime:0};return t&&0!==t.navigationStart&&(i.startTime=Date.now()-t.navigationStart),[i]},t}(),Performance=function(){function t(t){this.config=t}return t.supported=function(){return window.performance&&!!performance.now&&!!performance.mark},t.supportedPerformanceObserver=function(){return window.chrome&&"PerformanceObserver"in window},t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,i){var e="mark_"+t+"_"+i;window.performance.mark(e)},t.prototype.measure=function(t,i){var e="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,e,n),this.getDurationByMetric(t,i)},t.prototype.firstContentfulPaint=function(t){this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,t)),this.perfObserver.observe({entryTypes:["paint"]})},t.prototype.getDurationByMetric=function(t,i){var e=this.getMeasurementForGivenName(t);return e&&"measure"===e.entryType?e.duration:-1},t.prototype.getMeasurementForGivenName=function(t){var i=window.performance.getEntriesByName(t);return i[i.length-1]},t.prototype.performanceObserverCb=function(t,i){var e=this,n=i.getEntries();t(n),n.forEach(function(t){e.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&e.perfObserver.disconnect()})},t}(),Perfume=function(){function t(t){void 0===t&&(t={});var i=this;this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,googleAnalytics:{enable:!1,timingVar:"name"},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:18e3,warning:!1,debugging:!1},this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.isHidden=!1,this.logMetricWarn="Please provide a metric name",this.metrics=new Map,this.observers=new Map,this.didVisibilityChange=function(){document.hidden&&(i.isHidden=document.hidden)},this.config=Object.assign({},this.config,t),this.perf=Performance.supported()?new Performance(this.config):new EmulatedPerformance(this.config),Performance.supportedPerformanceObserver()||(this.perfEmulated=new EmulatedPerformance(this.config)),(this.config.firstPaint||this.config.firstContentfulPaint)&&(this.observeFirstContentfulPaint=new Promise(function(t){i.logDebug("observeFirstContentfulPaint"),i.observers.set("fcp",t),i.initFirstPaint()})),this.config.firstInputDelay&&(this.observeFirstInputDelay=new Promise(function(t){i.observers.set("fid",t),i.initFirstInputDelay()})),this.onVisibilityChange(),this.queue=new IdleQueue({ensureTasksRun:!0})}return t.prototype.start=function(t){this.checkMetricName(t)&&(this.metrics.has(t)?this.logWarn(this.config.logPrefix,"Recording already started."):(this.metrics.set(t,{end:0,start:this.perf.now()}),this.perf.mark(t,"start"),this.isHidden=!1))},t.prototype.end=function(t){var i=this;if(this.checkMetricName(t)){var e=this.metrics.get(t);if(e){e.end=this.perf.now(),this.perf.mark(t,"end");var n=this.perf.measure(t,e),r=parseFloat(n.toFixed(2));return this.metrics.delete(t),this.queue.pushTask(function(){i.log(t,r),i.sendTiming(t,r)}),r}this.logWarn(this.config.logPrefix,"Recording already stopped.")}},t.prototype.endPaint=function(t){var i=this;return new Promise(function(e){setTimeout(function(){var n=i.end(t);e(n)})})},t.prototype.log=function(t,i){if(!this.isHidden&&this.config.logging)if(t){var e=i.toFixed(2),n="%c "+this.config.logPrefix+" "+t+" "+e+" ms";window.console.log(n,"color: #ff6d00;font-size:11px;")}else this.logWarn(this.config.logPrefix,this.logMetricWarn)},t.prototype.logDebug=function(t,i){void 0===i&&(i=""),this.config.debugging&&window.console.log("Perfume.js debugging "+t+":",i)},t.prototype.sendTiming=function(t,i){if(!this.isHidden&&(this.config.analyticsTracker&&this.config.analyticsTracker(t,i),this.config.googleAnalytics.enable))if(window.ga){var e=Math.round(i);window.ga("send","timing",t,this.config.googleAnalytics.timingVar,e)}else this.logWarn(this.config.logPrefix,"Google Analytics has not been loaded")},t.prototype.checkMetricName=function(t){return!!t||(this.logWarn(this.config.logPrefix,this.logMetricWarn),!1)},t.prototype.firstContentfulPaintCb=function(t){var i=this;this.logDebug("firstContentfulPaintCb",t),t.forEach(function(t){i.queue.pushTask(function(){i.config.firstPaint&&"first-paint"===t.name&&i.logMetric(t.startTime,"First Paint","firstPaint"),i.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&i.logMetric(t.startTime,"First Contentful Paint","firstContentfulPaint")})})},t.prototype.initFirstPaint=function(){this.logDebug("initFirstPaint"),Performance.supportedPerformanceObserver()?(this.logDebug("initFirstPaint.supportedPerformanceObserver"),this.perf.firstContentfulPaint(this.firstContentfulPaintCb.bind(this))):this.perfEmulated&&(this.logDebug("initFirstPaint.perfEmulated"),this.perfEmulated.firstContentfulPaint(this.firstContentfulPaintCb.bind(this)))},t.prototype.initFirstInputDelay=function(){var t=this;Performance.supported()&&this.config.firstInputDelay&&perfMetrics.onFirstInputDelay(function(i,e){t.queue.pushTask(function(){t.logMetric(i,"First Input Delay","firstInputDelay")})})},t.prototype.onVisibilityChange=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.didVisibilityChange)},t.prototype.logMetric=function(t,i,e){var n=parseFloat(t.toFixed(2));n>this.config.maxMeasureTime||("firstPaint"===e&&(this.firstPaintDuration=n),"firstContentfulPaint"===e&&(this.firstContentfulPaintDuration=n,this.observers.get("fcp")(n)),"firstInputDelay"===e&&(this.firstInputDelayDuration=n,this.observers.get("fid")(n)),this.log(i,n),this.sendTiming(e,n))},t.prototype.logWarn=function(t,i){this.config.warning&&this.config.logging&&window.console.warn(t,i)},t}();export default Perfume;
//# sourceMappingURL=perfume.es5.min.js.map

@@ -1,2 +0,2 @@

var Perfume=function(){"use strict";var t=function(){function t(t){this.config=t}return t.prototype.now=function(){return Date.now()/1e3},t.prototype.mark=function(t,e){},t.prototype.measure=function(t,e){return this.getDurationByMetric(t,e)},t.prototype.firstContentfulPaint=function(t){var e=this;setTimeout(function(){t(e.getFirstPaint())})},t.prototype.getDurationByMetric=function(t,e){return e.end-e.start||0},t.prototype.getFirstPaint=function(){var t=window.performance.timing,e={duration:0,entryType:"paint",name:"first-contentful-paint",startTime:0};return t&&0!==t.navigationStart&&(e.startTime=Date.now()-t.navigationStart),[e]},t}(),e=function(){function t(){}return t.prototype.create=function(){var t=this;"PerformanceLongTaskTiming"in window&&(this.g=window.__tti={e:[]},this.g.o=new PerformanceObserver(function(e){t.g.e=t.g.e.concat(e.getEntries())}),this.g.o.observe({entryTypes:["longtask"]}))},t}();!function(t,e){var n,i,r,o=[],s={passive:!0,capture:!0},a=new Date,u="pointerup",c="pointercancel";function f(t,o){n||(n=o,i=t,r=new Date,h(e),p())}function p(){i>=0&&i<r-a&&(o.forEach(function(t){t(i,n)}),o=[])}function l(n){if(n.cancelable){var i=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;"pointerdown"==n.type?function(n,i){function r(){f(n,i),a()}function o(){a()}function a(){e(u,r,s),e(c,o,s)}t(u,r,s),t(c,o,s)}(i,n):f(i,n)}}function h(t){["click","mousedown","keydown","touchstart","pointerdown"].forEach(function(e){t(e,l,s)})}h(t),self.perfMetrics=self.perfMetrics||{},self.perfMetrics.onFirstInputDelay=function(t){o.push(t),p()}}(addEventListener,removeEventListener);var n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i,r=(function(t){!function(){var e="undefined"!=typeof window&&window===this?this:void 0!==n&&null!=n?n:this,i="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){t!=Array.prototype&&t!=Object.prototype&&(t[e]=n.value)};function r(){r=function(){},e.Symbol||(e.Symbol=s)}var o=0;function s(t){return"jscomp_symbol_"+(t||"")+o++}function a(){r();var t=e.Symbol.iterator;t||(t=e.Symbol.iterator=e.Symbol("iterator")),"function"!=typeof Array.prototype[t]&&i(Array.prototype,t,{configurable:!0,writable:!0,value:function(){return u(this)}}),a=function(){}}function u(t){var n=0;return function(t){return a(),(t={next:t})[e.Symbol.iterator]=function(){return this},t}(function(){return n<t.length?{done:!1,value:t[n++]}:{done:!0}})}function c(t){a();var e=t[Symbol.iterator];return e?e.call(t):u(t)}function f(t){if(!(t instanceof Array)){t=c(t);for(var e,n=[];!(e=t.next()).done;)n.push(e.value);t=n}return t}var p=0;var l="img script iframe link audio video source".split(" ");function h(t,e){for(var n=(t=c(t)).next();!n.done;n=t.next())if(n=n.value,e.includes(n.nodeName.toLowerCase())||h(n.children,e))return!0;return!1}function d(t,e){if(2<t.length)return performance.now();for(var n=[],i=(e=c(e)).next();!i.done;i=e.next())i=i.value,n.push({timestamp:i.start,type:"requestStart"}),n.push({timestamp:i.end,type:"requestEnd"});for(i=(e=c(t)).next();!i.done;i=e.next())n.push({timestamp:i.value,type:"requestStart"});for(n.sort(function(t,e){return t.timestamp-e.timestamp}),t=t.length,e=n.length-1;0<=e;e--)switch(i=n[e],i.type){case"requestStart":t--;break;case"requestEnd":if(2<++t)return i.timestamp;break;default:throw Error("Internal Error: This should never happen")}return 0}function g(t){t=t||{},this.w=!!t.useMutationObserver,this.u=t.minValue||null,t=window.__tti&&window.__tti.e;var e=window.__tti&&window.__tti.o;this.a=t?t.map(function(t){return{start:t.startTime,end:t.startTime+t.duration}}):[],e&&e.disconnect(),this.b=[],this.f=new Map,this.j=null,this.v=-1/0,this.i=!1,this.h=this.c=this.s=null,function(t,e){var n=XMLHttpRequest.prototype.send,i=p++;XMLHttpRequest.prototype.send=function(r){for(var o=[],s=0;s<arguments.length;++s)o[s-0]=arguments[s];var a=this;return t(i),this.addEventListener("readystatechange",function(){4===a.readyState&&e(i)}),n.apply(this,o)}}(this.m.bind(this),this.l.bind(this)),function(t,e){var n=fetch;fetch=function(i){for(var r=[],o=0;o<arguments.length;++o)r[o-0]=arguments[o];return new Promise(function(i,o){var s=p++;t(s),n.apply(null,[].concat(f(r))).then(function(t){e(s),i(t)},function(t){e(t),o(t)})})}}(this.m.bind(this),this.l.bind(this)),function(t){t.c=new PerformanceObserver(function(e){for(var n=(e=c(e.getEntries())).next();!n.done;n=e.next())if("resource"===(n=n.value).entryType&&(t.b.push({start:n.fetchStart,end:n.responseEnd}),v(t,d(t.g,t.b)+5e3)),"longtask"===n.entryType){var i=n.startTime+n.duration;t.a.push({start:n.startTime,end:i}),v(t,i+5e3)}}),t.c.observe({entryTypes:["longtask","resource"]})}(this),this.w&&(this.h=function(t){var e=new MutationObserver(function(e){for(var n=(e=c(e)).next();!n.done;n=e.next())"childList"==(n=n.value).type&&h(n.addedNodes,l)?t(n):"attributes"==n.type&&l.includes(n.target.tagName.toLowerCase())&&t(n)});return e.observe(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]}),e}(this.B.bind(this)))}function m(t){t.i=!0;var e=0<t.a.length?t.a[t.a.length-1].end:0,n=d(t.g,t.b);v(t,Math.max(n+5e3,e))}function v(t,e){!t.i||t.v>e||(clearTimeout(t.j),t.j=setTimeout(function(){var e=performance.timing.navigationStart,n=d(t.g,t.b);e=(window.a&&window.a.A?1e3*window.a.A().C-e:0)||performance.timing.domContentLoadedEventEnd-e;if(t.u)var i=t.u;else performance.timing.domContentLoadedEventEnd?i=(i=performance.timing).domContentLoadedEventEnd-i.navigationStart:i=null;var r=performance.now();null===i&&v(t,Math.max(n+5e3,r+1e3));var o=t.a;5e3>r-n?n=null:n=5e3>r-(n=o.length?o[o.length-1].end:e)?null:Math.max(n,i),n&&(t.s(n),clearTimeout(t.j),t.i=!1,t.c&&t.c.disconnect(),t.h&&t.h.disconnect()),v(t,performance.now()+1e3)},e-performance.now()),t.v=e)}g.prototype.getFirstConsistentlyInteractive=function(){var t=this;return new Promise(function(e){t.s=e,"complete"==document.readyState?m(t):window.addEventListener("load",function(){m(t)})})},g.prototype.m=function(t){this.f.set(t,performance.now())},g.prototype.l=function(t){this.f.delete(t)},g.prototype.B=function(){v(this,performance.now()+5e3)},e.Object.defineProperties(g.prototype,{g:{configurable:!0,enumerable:!0,get:function(){return[].concat(f(this.f.values()))}}});var y={getFirstConsistentlyInteractive:function(t){return t=t||{},"PerformanceLongTaskTiming"in window?new g(t).getFirstConsistentlyInteractive():Promise.resolve(null)}};t.exports?t.exports=y:window.ttiPolyfill=y}()}(i={exports:{}},i.exports),i.exports);(new e).create();var o=function(){function t(t){this.config=t,this.timeToInteractiveDuration=0,this.ttiPolyfill=r}return t.supported=function(){return window.performance&&!!performance.now&&!!performance.mark},t.supportedPerformanceObserver=function(){return window.chrome&&"PerformanceObserver"in window},t.supportedLongTask=function(){return"PerformanceLongTaskTiming"in window},t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,e){var n="mark_"+t+"_"+e;window.performance.mark(n)},t.prototype.measure=function(t,e){var n="mark_"+t+"_start",i="mark_"+t+"_end";return window.performance.measure(t,n,i),this.getDurationByMetric(t,e)},t.prototype.firstContentfulPaint=function(t){this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,t)),this.perfObserver.observe({entryTypes:["paint"]})},t.prototype.timeToInteractive=function(t){return this.ttiPolyfill.getFirstConsistentlyInteractive({minValue:t})},t.prototype.getDurationByMetric=function(t,e){var n=this.getMeasurementForGivenName(t);return n&&"measure"===n.entryType?n.duration:-1},t.prototype.getMeasurementForGivenName=function(t){var e=window.performance.getEntriesByName(t);return e[e.length-1]},t.prototype.performanceObserverCb=function(t,e){var n=this,i=e.getEntries();t(i),i.forEach(function(t){n.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&n.perfObserver.disconnect()})},t}(),s=function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?r(t.value):new n(function(e){e(t.value)}).then(s,a)}u((i=i.apply(t,e||[])).next())})},a=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};return function(){function e(e){void 0===e&&(e={});var n=this;this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,timeToInteractive:!1,googleAnalytics:{enable:!1,timingVar:"name"},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:18e3,warning:!1,debugging:!1},this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.timeToInteractiveDuration=0,this.isHidden=!1,this.logMetricWarn="Please provide a metric name",this.metrics=new Map,this.observers=new Map,this.didVisibilityChange=function(){document.hidden&&(n.isHidden=document.hidden)},this.config=Object.assign({},this.config,e),this.perf=o.supported()?new o(this.config):new t(this.config),o.supportedPerformanceObserver()||(this.perfEmulated=new t(this.config)),this.observeFirstContentfulPaint=new Promise(function(t){n.logDebug("observeFirstContentfulPaint"),n.observers.set("fcp",t),n.initFirstPaint()}),this.observeFirstInputDelay=new Promise(function(t){n.observers.set("fid",t),n.initFirstInputDelay()}),this.onVisibilityChange(),this.observeTimeToInteractive=new Promise(function(t){return s(n,void 0,void 0,function(){var e;return a(this,function(n){switch(n.label){case 0:return this.observers.set("tti",t),[4,this.observeFirstContentfulPaint];case 1:return e=n.sent(),this.initTimeToInteractive(e),[2]}})})})}return e.prototype.start=function(t){this.checkMetricName(t)&&(this.metrics.has(t)?this.logWarn(this.config.logPrefix,"Recording already started."):(this.metrics.set(t,{end:0,start:this.perf.now()}),this.perf.mark(t,"start"),this.isHidden=!1))},e.prototype.end=function(t){if(this.checkMetricName(t)){var e=this.metrics.get(t);if(e){e.end=this.perf.now(),this.perf.mark(t,"end");var n=this.perf.measure(t,e),i=parseFloat(n.toFixed(2));return this.log(t,i),this.metrics.delete(t),this.sendTiming(t,i),i}this.logWarn(this.config.logPrefix,"Recording already stopped.")}},e.prototype.endPaint=function(t){var e=this;return new Promise(function(n){setTimeout(function(){var i=e.end(t);n(i)})})},e.prototype.log=function(t,e){if(!this.isHidden&&this.config.logging)if(t){var n=e.toFixed(2),i="%c "+this.config.logPrefix+" "+t+" "+n+" ms";window.console.log(i,"color: #ff6d00;font-size:11px;")}else this.logWarn(this.config.logPrefix,this.logMetricWarn)},e.prototype.logDebug=function(t,e){void 0===e&&(e=""),this.config.debugging&&window.console.log("Perfume.js debugging "+t+":",e)},e.prototype.sendTiming=function(t,e){if(!this.isHidden&&(this.config.analyticsTracker&&this.config.analyticsTracker(t,e),this.config.googleAnalytics.enable))if(window.ga){var n=Math.round(e);window.ga("send","timing",t,this.config.googleAnalytics.timingVar,n)}else this.logWarn(this.config.logPrefix,"Google Analytics has not been loaded")},e.prototype.checkMetricName=function(t){return!!t||(this.logWarn(this.config.logPrefix,this.logMetricWarn),!1)},e.prototype.firstContentfulPaintCb=function(t){var e=this;this.logDebug("firstContentfulPaintCb",t),t.forEach(function(t){e.config.firstPaint&&"first-paint"===t.name&&e.logMetric(t.startTime,"First Paint","firstPaint"),e.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&e.logMetric(t.startTime,"First Contentful Paint","firstContentfulPaint")})},e.prototype.initFirstPaint=function(){this.logDebug("initFirstPaint"),o.supportedPerformanceObserver()?(this.logDebug("initFirstPaint.supportedPerformanceObserver"),this.perf.firstContentfulPaint(this.firstContentfulPaintCb.bind(this))):this.perfEmulated&&(this.logDebug("initFirstPaint.perfEmulated"),this.perfEmulated.firstContentfulPaint(this.firstContentfulPaintCb.bind(this)))},e.prototype.initTimeToInteractive=function(t){var e=this;o.supported()&&o.supportedPerformanceObserver()&&o.supportedLongTask()&&this.config.timeToInteractive&&t&&this.perf.timeToInteractive(t).then(function(t){e.logMetric(t,"Time to Interactive","timeToInteractive")})},e.prototype.initFirstInputDelay=function(){var t=this;o.supported()&&this.config.firstInputDelay&&perfMetrics.onFirstInputDelay(function(e,n){t.logMetric(e,"First Input Delay","firstInputDelay")})},e.prototype.onVisibilityChange=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.didVisibilityChange)},e.prototype.logMetric=function(t,e,n){var i=parseFloat(t.toFixed(2));i>this.config.maxMeasureTime||("firstPaint"===n&&(this.firstPaintDuration=i),"firstContentfulPaint"===n&&(this.firstContentfulPaintDuration=i,this.observers.get("fcp")(i)),"firstInputDelay"===n&&(this.firstInputDelayDuration=i,this.observers.get("fid")(i)),"timeToInteractive"===n&&(this.timeToInteractiveDuration=i,this.observers.get("tti")(i)),this.log(e,i),this.sendTiming(n,i))},e.prototype.logWarn=function(t,e){this.config.warning&&this.config.logging&&window.console.warn(t,e)},e}()}();
var Perfume=function(){"use strict";var t,i,e,n,s=function(){return+new Date},r="function"==typeof window.requestIdleCallback,o=function(){function t(t){this.initTime_=t}return Object.defineProperty(t.prototype,"didTimeout",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype.timeRemaining=function(){return Math.max(0,50-(s()-this.initTime_))},t}(),a=r?window.requestIdleCallback:function(t){var i=new o(s());return setTimeout(function(){return t(i)},0)},u=r?window.cancelIdleCallback:function(t){clearTimeout(t)},f="function"==typeof Promise&&Promise.toString().indexOf("[native code]")>-1?function(t){Promise.resolve().then(t)}:(t=0,i=[],e=new MutationObserver(function(){i.forEach(function(t){return t()}),i=[]}),n=document.createTextNode(""),e.observe(n,{characterData:!0}),function(e){i.push(e),n.data=String(++t%2)}),c=0,h=!("object"!=typeof window.safari||!window.safari.pushNotification),l=function(){function t(t){var i=void 0===t?{}:t,e=i.ensureTasksRun,n=void 0!==e&&e,s=i.defaultMinTaskTime,r=void 0===s?c:s;this.taskQueue_=[],this.isProcessing_=!1,this.state_=null,this.idleCallbackHandle_=null,this.taskQueue_=[],this.isProcessing_=!1,this.state_=null,this.defaultMinTaskTime_=r,this.ensureTasksRun_=n,this.runTasksImmediately=this.runTasksImmediately.bind(this),this.runTasks_=this.runTasks_.bind(this),this.onVisibilityChange_=this.onVisibilityChange_.bind(this),this.ensureTasksRun_&&(addEventListener("visibilitychange",this.onVisibilityChange_,!0),h&&addEventListener("beforeunload",this.runTasksImmediately,!0))}return t.prototype.pushTask=function(t){this.addTask_(Array.prototype.push,t)},t.prototype.unshiftTask=function(t){this.addTask_(Array.prototype.unshift,t)},t.prototype.runTasksImmediately=function(){this.runTasks_()},t.prototype.hasPendingTasks=function(){return this.taskQueue_.length>0},t.prototype.clearPendingTasks=function(){this.taskQueue_=[],this.cancelScheduledRun_()},t.prototype.getState=function(){return this.state_},t.prototype.destroy=function(){this.taskQueue_=[],this.cancelScheduledRun_(),this.ensureTasksRun_&&(removeEventListener("visibilitychange",this.onVisibilityChange_,!0),h&&removeEventListener("beforeunload",this.runTasksImmediately,!0))},t.prototype.addTask_=function(t,i,e){var n=(void 0===e?{}:e).minTaskTime,r=void 0===n?this.defaultMinTaskTime_:n,o={time:s(),visibilityState:document.visibilityState};t.call(this.taskQueue_,{state:o,task:i,minTaskTime:r}),this.scheduleTasksToRun_()},t.prototype.scheduleTasksToRun_=function(){this.ensureTasksRun_&&"hidden"===document.visibilityState?f(this.runTasks_):this.idleCallbackHandle_||(this.idleCallbackHandle_=a(this.runTasks_))},t.prototype.runTasks_=function(t){if(this.cancelScheduledRun_(),!this.isProcessing_){for(this.isProcessing_=!0;this.hasPendingTasks()&&!p(t,this.taskQueue_[0].minTaskTime);){var i=this.taskQueue_.shift(),e=i.task,n=i.state;this.state_=n,e(n),this.state_=null}this.isProcessing_=!1,this.hasPendingTasks()&&this.scheduleTasksToRun_()}},t.prototype.cancelScheduledRun_=function(){u(this.idleCallbackHandle_),this.idleCallbackHandle_=null},t.prototype.onVisibilityChange_=function(){"hidden"===document.visibilityState&&this.runTasksImmediately()},t}(),p=function(t,i){return!!(t&&t.timeRemaining()<=i)},d=function(){function t(t){this.config=t}return t.prototype.now=function(){return Date.now()/1e3},t.prototype.mark=function(t,i){},t.prototype.measure=function(t,i){return this.getDurationByMetric(t,i)},t.prototype.firstContentfulPaint=function(t){var i=this;setTimeout(function(){t(i.getFirstPaint())})},t.prototype.getDurationByMetric=function(t,i){return i.end-i.start||0},t.prototype.getFirstPaint=function(){var t=window.performance.timing,i={duration:0,entryType:"paint",name:"first-contentful-paint",startTime:0};return t&&0!==t.navigationStart&&(i.startTime=Date.now()-t.navigationStart),[i]},t}();!function(t,i){var e,n,s,r=[],o={passive:!0,capture:!0},a=new Date,u="pointerup",f="pointercancel";function c(t,r){e||(e=r,n=t,s=new Date,p(i),h())}function h(){n>=0&&n<s-a&&(r.forEach(function(t){t(n,e)}),r=[])}function l(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,n){function s(){c(e,n),a()}function r(){a()}function a(){i(u,s,o),i(f,r,o)}t(u,s,o),t(f,r,o)}(n,e):c(n,e)}}function p(t){["click","mousedown","keydown","touchstart","pointerdown"].forEach(function(i){t(i,l,o)})}p(t),self.perfMetrics=self.perfMetrics||{},self.perfMetrics.onFirstInputDelay=function(t){r.push(t),h()}}(addEventListener,removeEventListener);var g=function(){function t(t){this.config=t}return t.supported=function(){return window.performance&&!!performance.now&&!!performance.mark},t.supportedPerformanceObserver=function(){return window.chrome&&"PerformanceObserver"in window},t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,i){var e="mark_"+t+"_"+i;window.performance.mark(e)},t.prototype.measure=function(t,i){var e="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,e,n),this.getDurationByMetric(t,i)},t.prototype.firstContentfulPaint=function(t){this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,t)),this.perfObserver.observe({entryTypes:["paint"]})},t.prototype.getDurationByMetric=function(t,i){var e=this.getMeasurementForGivenName(t);return e&&"measure"===e.entryType?e.duration:-1},t.prototype.getMeasurementForGivenName=function(t){var i=window.performance.getEntriesByName(t);return i[i.length-1]},t.prototype.performanceObserverCb=function(t,i){var e=this,n=i.getEntries();t(n),n.forEach(function(t){e.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&e.perfObserver.disconnect()})},t}();return function(){function t(t){void 0===t&&(t={});var i=this;this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,googleAnalytics:{enable:!1,timingVar:"name"},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:18e3,warning:!1,debugging:!1},this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.isHidden=!1,this.logMetricWarn="Please provide a metric name",this.metrics=new Map,this.observers=new Map,this.didVisibilityChange=function(){document.hidden&&(i.isHidden=document.hidden)},this.config=Object.assign({},this.config,t),this.perf=g.supported()?new g(this.config):new d(this.config),g.supportedPerformanceObserver()||(this.perfEmulated=new d(this.config)),(this.config.firstPaint||this.config.firstContentfulPaint)&&(this.observeFirstContentfulPaint=new Promise(function(t){i.logDebug("observeFirstContentfulPaint"),i.observers.set("fcp",t),i.initFirstPaint()})),this.config.firstInputDelay&&(this.observeFirstInputDelay=new Promise(function(t){i.observers.set("fid",t),i.initFirstInputDelay()})),this.onVisibilityChange(),this.queue=new l({ensureTasksRun:!0})}return t.prototype.start=function(t){this.checkMetricName(t)&&(this.metrics.has(t)?this.logWarn(this.config.logPrefix,"Recording already started."):(this.metrics.set(t,{end:0,start:this.perf.now()}),this.perf.mark(t,"start"),this.isHidden=!1))},t.prototype.end=function(t){var i=this;if(this.checkMetricName(t)){var e=this.metrics.get(t);if(e){e.end=this.perf.now(),this.perf.mark(t,"end");var n=this.perf.measure(t,e),s=parseFloat(n.toFixed(2));return this.metrics.delete(t),this.queue.pushTask(function(){i.log(t,s),i.sendTiming(t,s)}),s}this.logWarn(this.config.logPrefix,"Recording already stopped.")}},t.prototype.endPaint=function(t){var i=this;return new Promise(function(e){setTimeout(function(){var n=i.end(t);e(n)})})},t.prototype.log=function(t,i){if(!this.isHidden&&this.config.logging)if(t){var e=i.toFixed(2),n="%c "+this.config.logPrefix+" "+t+" "+e+" ms";window.console.log(n,"color: #ff6d00;font-size:11px;")}else this.logWarn(this.config.logPrefix,this.logMetricWarn)},t.prototype.logDebug=function(t,i){void 0===i&&(i=""),this.config.debugging&&window.console.log("Perfume.js debugging "+t+":",i)},t.prototype.sendTiming=function(t,i){if(!this.isHidden&&(this.config.analyticsTracker&&this.config.analyticsTracker(t,i),this.config.googleAnalytics.enable))if(window.ga){var e=Math.round(i);window.ga("send","timing",t,this.config.googleAnalytics.timingVar,e)}else this.logWarn(this.config.logPrefix,"Google Analytics has not been loaded")},t.prototype.checkMetricName=function(t){return!!t||(this.logWarn(this.config.logPrefix,this.logMetricWarn),!1)},t.prototype.firstContentfulPaintCb=function(t){var i=this;this.logDebug("firstContentfulPaintCb",t),t.forEach(function(t){i.queue.pushTask(function(){i.config.firstPaint&&"first-paint"===t.name&&i.logMetric(t.startTime,"First Paint","firstPaint"),i.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&i.logMetric(t.startTime,"First Contentful Paint","firstContentfulPaint")})})},t.prototype.initFirstPaint=function(){this.logDebug("initFirstPaint"),g.supportedPerformanceObserver()?(this.logDebug("initFirstPaint.supportedPerformanceObserver"),this.perf.firstContentfulPaint(this.firstContentfulPaintCb.bind(this))):this.perfEmulated&&(this.logDebug("initFirstPaint.perfEmulated"),this.perfEmulated.firstContentfulPaint(this.firstContentfulPaintCb.bind(this)))},t.prototype.initFirstInputDelay=function(){var t=this;g.supported()&&this.config.firstInputDelay&&perfMetrics.onFirstInputDelay(function(i,e){t.queue.pushTask(function(){t.logMetric(i,"First Input Delay","firstInputDelay")})})},t.prototype.onVisibilityChange=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.didVisibilityChange)},t.prototype.logMetric=function(t,i,e){var n=parseFloat(t.toFixed(2));n>this.config.maxMeasureTime||("firstPaint"===e&&(this.firstPaintDuration=n),"firstContentfulPaint"===e&&(this.firstContentfulPaintDuration=n,this.observers.get("fcp")(n)),"firstInputDelay"===e&&(this.firstInputDelayDuration=n,this.observers.get("fid")(n)),this.log(i,n),this.sendTiming(e,n))},t.prototype.logWarn=function(t,i){this.config.warning&&this.config.logging&&window.console.warn(t,i)},t}()}();
//# sourceMappingURL=perfume.iife.min.js.map

@@ -1,2 +0,2 @@

"use strict";function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}require("first-input-delay");var ttiPolyfill=_interopDefault(require("tti-polyfill")),EmulatedPerformance=function(){function t(t){this.config=t}return t.prototype.now=function(){return Date.now()/1e3},t.prototype.mark=function(t,e){},t.prototype.measure=function(t,e){return this.getDurationByMetric(t,e)},t.prototype.firstContentfulPaint=function(t){var e=this;setTimeout(function(){t(e.getFirstPaint())})},t.prototype.getDurationByMetric=function(t,e){return e.end-e.start||0},t.prototype.getFirstPaint=function(){var t=window.performance.timing,e={duration:0,entryType:"paint",name:"first-contentful-paint",startTime:0};return t&&0!==t.navigationStart&&(e.startTime=Date.now()-t.navigationStart),[e]},t}(),PerformanceObserverTTI=function(){function t(){}return t.prototype.create=function(){var t=this;"PerformanceLongTaskTiming"in window&&(this.g=window.__tti={e:[]},this.g.o=new PerformanceObserver(function(e){t.g.e=t.g.e.concat(e.getEntries())}),this.g.o.observe({entryTypes:["longtask"]}))},t}(),performanceTTI=new PerformanceObserverTTI;performanceTTI.create();var Performance=function(){function t(t){this.config=t,this.timeToInteractiveDuration=0,this.ttiPolyfill=ttiPolyfill}return t.supported=function(){return window.performance&&!!performance.now&&!!performance.mark},t.supportedPerformanceObserver=function(){return window.chrome&&"PerformanceObserver"in window},t.supportedLongTask=function(){return"PerformanceLongTaskTiming"in window},t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,e){var i="mark_"+t+"_"+e;window.performance.mark(i)},t.prototype.measure=function(t,e){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.getDurationByMetric(t,e)},t.prototype.firstContentfulPaint=function(t){this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,t)),this.perfObserver.observe({entryTypes:["paint"]})},t.prototype.timeToInteractive=function(t){return this.ttiPolyfill.getFirstConsistentlyInteractive({minValue:t})},t.prototype.getDurationByMetric=function(t,e){var i=this.getMeasurementForGivenName(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.getMeasurementForGivenName=function(t){var e=window.performance.getEntriesByName(t);return e[e.length-1]},t.prototype.performanceObserverCb=function(t,e){var i=this,n=e.getEntries();t(n),n.forEach(function(t){i.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&i.perfObserver.disconnect()})},t}(),__awaiter=function(t,e,i,n){return new(i||(i=Promise))(function(r,o){function s(t){try{f(n.next(t))}catch(t){o(t)}}function a(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){t.done?r(t.value):new i(function(e){e(t.value)}).then(s,a)}f((n=n.apply(t,e||[])).next())})},__generator=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Perfume=function(){function t(t){void 0===t&&(t={});var e=this;this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,timeToInteractive:!1,googleAnalytics:{enable:!1,timingVar:"name"},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:18e3,warning:!1,debugging:!1},this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.timeToInteractiveDuration=0,this.isHidden=!1,this.logMetricWarn="Please provide a metric name",this.metrics=new Map,this.observers=new Map,this.didVisibilityChange=function(){document.hidden&&(e.isHidden=document.hidden)},this.config=Object.assign({},this.config,t),this.perf=Performance.supported()?new Performance(this.config):new EmulatedPerformance(this.config),Performance.supportedPerformanceObserver()||(this.perfEmulated=new EmulatedPerformance(this.config)),this.observeFirstContentfulPaint=new Promise(function(t){e.logDebug("observeFirstContentfulPaint"),e.observers.set("fcp",t),e.initFirstPaint()}),this.observeFirstInputDelay=new Promise(function(t){e.observers.set("fid",t),e.initFirstInputDelay()}),this.onVisibilityChange(),this.observeTimeToInteractive=new Promise(function(t){return __awaiter(e,void 0,void 0,function(){var e;return __generator(this,function(i){switch(i.label){case 0:return this.observers.set("tti",t),[4,this.observeFirstContentfulPaint];case 1:return e=i.sent(),this.initTimeToInteractive(e),[2]}})})})}return t.prototype.start=function(t){this.checkMetricName(t)&&(this.metrics.has(t)?this.logWarn(this.config.logPrefix,"Recording already started."):(this.metrics.set(t,{end:0,start:this.perf.now()}),this.perf.mark(t,"start"),this.isHidden=!1))},t.prototype.end=function(t){if(this.checkMetricName(t)){var e=this.metrics.get(t);if(e){e.end=this.perf.now(),this.perf.mark(t,"end");var i=this.perf.measure(t,e),n=parseFloat(i.toFixed(2));return this.log(t,n),this.metrics.delete(t),this.sendTiming(t,n),n}this.logWarn(this.config.logPrefix,"Recording already stopped.")}},t.prototype.endPaint=function(t){var e=this;return new Promise(function(i){setTimeout(function(){var n=e.end(t);i(n)})})},t.prototype.log=function(t,e){if(!this.isHidden&&this.config.logging)if(t){var i=e.toFixed(2),n="%c "+this.config.logPrefix+" "+t+" "+i+" ms";window.console.log(n,"color: #ff6d00;font-size:11px;")}else this.logWarn(this.config.logPrefix,this.logMetricWarn)},t.prototype.logDebug=function(t,e){void 0===e&&(e=""),this.config.debugging&&window.console.log("Perfume.js debugging "+t+":",e)},t.prototype.sendTiming=function(t,e){if(!this.isHidden&&(this.config.analyticsTracker&&this.config.analyticsTracker(t,e),this.config.googleAnalytics.enable))if(window.ga){var i=Math.round(e);window.ga("send","timing",t,this.config.googleAnalytics.timingVar,i)}else this.logWarn(this.config.logPrefix,"Google Analytics has not been loaded")},t.prototype.checkMetricName=function(t){return!!t||(this.logWarn(this.config.logPrefix,this.logMetricWarn),!1)},t.prototype.firstContentfulPaintCb=function(t){var e=this;this.logDebug("firstContentfulPaintCb",t),t.forEach(function(t){e.config.firstPaint&&"first-paint"===t.name&&e.logMetric(t.startTime,"First Paint","firstPaint"),e.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&e.logMetric(t.startTime,"First Contentful Paint","firstContentfulPaint")})},t.prototype.initFirstPaint=function(){this.logDebug("initFirstPaint"),Performance.supportedPerformanceObserver()?(this.logDebug("initFirstPaint.supportedPerformanceObserver"),this.perf.firstContentfulPaint(this.firstContentfulPaintCb.bind(this))):this.perfEmulated&&(this.logDebug("initFirstPaint.perfEmulated"),this.perfEmulated.firstContentfulPaint(this.firstContentfulPaintCb.bind(this)))},t.prototype.initTimeToInteractive=function(t){var e=this;Performance.supported()&&Performance.supportedPerformanceObserver()&&Performance.supportedLongTask()&&this.config.timeToInteractive&&t&&this.perf.timeToInteractive(t).then(function(t){e.logMetric(t,"Time to Interactive","timeToInteractive")})},t.prototype.initFirstInputDelay=function(){var t=this;Performance.supported()&&this.config.firstInputDelay&&perfMetrics.onFirstInputDelay(function(e,i){t.logMetric(e,"First Input Delay","firstInputDelay")})},t.prototype.onVisibilityChange=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.didVisibilityChange)},t.prototype.logMetric=function(t,e,i){var n=parseFloat(t.toFixed(2));n>this.config.maxMeasureTime||("firstPaint"===i&&(this.firstPaintDuration=n),"firstContentfulPaint"===i&&(this.firstContentfulPaintDuration=n,this.observers.get("fcp")(n)),"firstInputDelay"===i&&(this.firstInputDelayDuration=n,this.observers.get("fid")(n)),"timeToInteractive"===i&&(this.timeToInteractiveDuration=n,this.observers.get("tti")(n)),this.log(e,n),this.sendTiming(i,n))},t.prototype.logWarn=function(t,e){this.config.warning&&this.config.logging&&window.console.warn(t,e)},t}();module.exports=Perfume;
"use strict";require("first-input-delay");var now=function(){return+new Date},supportsRequestIdleCallback_="function"==typeof window.requestIdleCallback,IdleDealine=function(){function t(t){this.initTime_=t}return Object.defineProperty(t.prototype,"didTimeout",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype.timeRemaining=function(){return Math.max(0,50-(now()-this.initTime_))},t}(),requestIdleCallbackShim=function(t){var e=new IdleDealine(now());return setTimeout(function(){return t(e)},0)},cancelIdleCallbackShim=function(t){clearTimeout(t)},rIC=supportsRequestIdleCallback_?window.requestIdleCallback:requestIdleCallbackShim,cIC=supportsRequestIdleCallback_?window.cancelIdleCallback:cancelIdleCallbackShim,createQueueMicrotaskViaPromises=function(){return function(t){Promise.resolve().then(t)}},createQueueMicrotaskViaMutationObserver=function(){var t=0,e=[],i=new MutationObserver(function(){e.forEach(function(t){return t()}),e=[]}),n=document.createTextNode("");return i.observe(n,{characterData:!0}),function(i){e.push(i),n.data=String(++t%2)}},queueMicrotask="function"==typeof Promise&&Promise.toString().indexOf("[native code]")>-1?createQueueMicrotaskViaPromises():createQueueMicrotaskViaMutationObserver(),DEFAULT_MIN_TASK_TIME=0,isSafari_=!("object"!=typeof window.safari||!window.safari.pushNotification),IdleQueue=function(){function t(t){var e=void 0===t?{}:t,i=e.ensureTasksRun,n=void 0!==i&&i,r=e.defaultMinTaskTime,s=void 0===r?DEFAULT_MIN_TASK_TIME:r;this.taskQueue_=[],this.isProcessing_=!1,this.state_=null,this.idleCallbackHandle_=null,this.taskQueue_=[],this.isProcessing_=!1,this.state_=null,this.defaultMinTaskTime_=s,this.ensureTasksRun_=n,this.runTasksImmediately=this.runTasksImmediately.bind(this),this.runTasks_=this.runTasks_.bind(this),this.onVisibilityChange_=this.onVisibilityChange_.bind(this),this.ensureTasksRun_&&(addEventListener("visibilitychange",this.onVisibilityChange_,!0),isSafari_&&addEventListener("beforeunload",this.runTasksImmediately,!0))}return t.prototype.pushTask=function(t){this.addTask_(Array.prototype.push,t)},t.prototype.unshiftTask=function(t){this.addTask_(Array.prototype.unshift,t)},t.prototype.runTasksImmediately=function(){this.runTasks_()},t.prototype.hasPendingTasks=function(){return this.taskQueue_.length>0},t.prototype.clearPendingTasks=function(){this.taskQueue_=[],this.cancelScheduledRun_()},t.prototype.getState=function(){return this.state_},t.prototype.destroy=function(){this.taskQueue_=[],this.cancelScheduledRun_(),this.ensureTasksRun_&&(removeEventListener("visibilitychange",this.onVisibilityChange_,!0),isSafari_&&removeEventListener("beforeunload",this.runTasksImmediately,!0))},t.prototype.addTask_=function(t,e,i){var n=(void 0===i?{}:i).minTaskTime,r=void 0===n?this.defaultMinTaskTime_:n,s={time:now(),visibilityState:document.visibilityState};t.call(this.taskQueue_,{state:s,task:e,minTaskTime:r}),this.scheduleTasksToRun_()},t.prototype.scheduleTasksToRun_=function(){this.ensureTasksRun_&&"hidden"===document.visibilityState?queueMicrotask(this.runTasks_):this.idleCallbackHandle_||(this.idleCallbackHandle_=rIC(this.runTasks_))},t.prototype.runTasks_=function(t){if(this.cancelScheduledRun_(),!this.isProcessing_){for(this.isProcessing_=!0;this.hasPendingTasks()&&!shouldYield(t,this.taskQueue_[0].minTaskTime);){var e=this.taskQueue_.shift(),i=e.task,n=e.state;this.state_=n,i(n),this.state_=null}this.isProcessing_=!1,this.hasPendingTasks()&&this.scheduleTasksToRun_()}},t.prototype.cancelScheduledRun_=function(){cIC(this.idleCallbackHandle_),this.idleCallbackHandle_=null},t.prototype.onVisibilityChange_=function(){"hidden"===document.visibilityState&&this.runTasksImmediately()},t}(),shouldYield=function(t,e){return!!(t&&t.timeRemaining()<=e)},EmulatedPerformance=function(){function t(t){this.config=t}return t.prototype.now=function(){return Date.now()/1e3},t.prototype.mark=function(t,e){},t.prototype.measure=function(t,e){return this.getDurationByMetric(t,e)},t.prototype.firstContentfulPaint=function(t){var e=this;setTimeout(function(){t(e.getFirstPaint())})},t.prototype.getDurationByMetric=function(t,e){return e.end-e.start||0},t.prototype.getFirstPaint=function(){var t=window.performance.timing,e={duration:0,entryType:"paint",name:"first-contentful-paint",startTime:0};return t&&0!==t.navigationStart&&(e.startTime=Date.now()-t.navigationStart),[e]},t}(),Performance=function(){function t(t){this.config=t}return t.supported=function(){return window.performance&&!!performance.now&&!!performance.mark},t.supportedPerformanceObserver=function(){return window.chrome&&"PerformanceObserver"in window},t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,e){var i="mark_"+t+"_"+e;window.performance.mark(i)},t.prototype.measure=function(t,e){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.getDurationByMetric(t,e)},t.prototype.firstContentfulPaint=function(t){this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,t)),this.perfObserver.observe({entryTypes:["paint"]})},t.prototype.getDurationByMetric=function(t,e){var i=this.getMeasurementForGivenName(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.getMeasurementForGivenName=function(t){var e=window.performance.getEntriesByName(t);return e[e.length-1]},t.prototype.performanceObserverCb=function(t,e){var i=this,n=e.getEntries();t(n),n.forEach(function(t){i.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&i.perfObserver.disconnect()})},t}(),Perfume=function(){function t(t){void 0===t&&(t={});var e=this;this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,googleAnalytics:{enable:!1,timingVar:"name"},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:18e3,warning:!1,debugging:!1},this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.isHidden=!1,this.logMetricWarn="Please provide a metric name",this.metrics=new Map,this.observers=new Map,this.didVisibilityChange=function(){document.hidden&&(e.isHidden=document.hidden)},this.config=Object.assign({},this.config,t),this.perf=Performance.supported()?new Performance(this.config):new EmulatedPerformance(this.config),Performance.supportedPerformanceObserver()||(this.perfEmulated=new EmulatedPerformance(this.config)),(this.config.firstPaint||this.config.firstContentfulPaint)&&(this.observeFirstContentfulPaint=new Promise(function(t){e.logDebug("observeFirstContentfulPaint"),e.observers.set("fcp",t),e.initFirstPaint()})),this.config.firstInputDelay&&(this.observeFirstInputDelay=new Promise(function(t){e.observers.set("fid",t),e.initFirstInputDelay()})),this.onVisibilityChange(),this.queue=new IdleQueue({ensureTasksRun:!0})}return t.prototype.start=function(t){this.checkMetricName(t)&&(this.metrics.has(t)?this.logWarn(this.config.logPrefix,"Recording already started."):(this.metrics.set(t,{end:0,start:this.perf.now()}),this.perf.mark(t,"start"),this.isHidden=!1))},t.prototype.end=function(t){var e=this;if(this.checkMetricName(t)){var i=this.metrics.get(t);if(i){i.end=this.perf.now(),this.perf.mark(t,"end");var n=this.perf.measure(t,i),r=parseFloat(n.toFixed(2));return this.metrics.delete(t),this.queue.pushTask(function(){e.log(t,r),e.sendTiming(t,r)}),r}this.logWarn(this.config.logPrefix,"Recording already stopped.")}},t.prototype.endPaint=function(t){var e=this;return new Promise(function(i){setTimeout(function(){var n=e.end(t);i(n)})})},t.prototype.log=function(t,e){if(!this.isHidden&&this.config.logging)if(t){var i=e.toFixed(2),n="%c "+this.config.logPrefix+" "+t+" "+i+" ms";window.console.log(n,"color: #ff6d00;font-size:11px;")}else this.logWarn(this.config.logPrefix,this.logMetricWarn)},t.prototype.logDebug=function(t,e){void 0===e&&(e=""),this.config.debugging&&window.console.log("Perfume.js debugging "+t+":",e)},t.prototype.sendTiming=function(t,e){if(!this.isHidden&&(this.config.analyticsTracker&&this.config.analyticsTracker(t,e),this.config.googleAnalytics.enable))if(window.ga){var i=Math.round(e);window.ga("send","timing",t,this.config.googleAnalytics.timingVar,i)}else this.logWarn(this.config.logPrefix,"Google Analytics has not been loaded")},t.prototype.checkMetricName=function(t){return!!t||(this.logWarn(this.config.logPrefix,this.logMetricWarn),!1)},t.prototype.firstContentfulPaintCb=function(t){var e=this;this.logDebug("firstContentfulPaintCb",t),t.forEach(function(t){e.queue.pushTask(function(){e.config.firstPaint&&"first-paint"===t.name&&e.logMetric(t.startTime,"First Paint","firstPaint"),e.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&e.logMetric(t.startTime,"First Contentful Paint","firstContentfulPaint")})})},t.prototype.initFirstPaint=function(){this.logDebug("initFirstPaint"),Performance.supportedPerformanceObserver()?(this.logDebug("initFirstPaint.supportedPerformanceObserver"),this.perf.firstContentfulPaint(this.firstContentfulPaintCb.bind(this))):this.perfEmulated&&(this.logDebug("initFirstPaint.perfEmulated"),this.perfEmulated.firstContentfulPaint(this.firstContentfulPaintCb.bind(this)))},t.prototype.initFirstInputDelay=function(){var t=this;Performance.supported()&&this.config.firstInputDelay&&perfMetrics.onFirstInputDelay(function(e,i){t.queue.pushTask(function(){t.logMetric(e,"First Input Delay","firstInputDelay")})})},t.prototype.onVisibilityChange=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.didVisibilityChange)},t.prototype.logMetric=function(t,e,i){var n=parseFloat(t.toFixed(2));n>this.config.maxMeasureTime||("firstPaint"===i&&(this.firstPaintDuration=n),"firstContentfulPaint"===i&&(this.firstContentfulPaintDuration=n,this.observers.get("fcp")(n)),"firstInputDelay"===i&&(this.firstInputDelayDuration=n,this.observers.get("fid")(n)),this.log(e,n),this.sendTiming(i,n))},t.prototype.logWarn=function(t,e){this.config.warning&&this.config.logging&&window.console.warn(t,e)},t}();module.exports=Perfume;
//# sourceMappingURL=perfume.min.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Perfume=e()}(this,function(){"use strict";var t=function(){function t(t){this.config=t}return t.prototype.now=function(){return Date.now()/1e3},t.prototype.mark=function(t,e){},t.prototype.measure=function(t,e){return this.getDurationByMetric(t,e)},t.prototype.firstContentfulPaint=function(t){var e=this;setTimeout(function(){t(e.getFirstPaint())})},t.prototype.getDurationByMetric=function(t,e){return e.end-e.start||0},t.prototype.getFirstPaint=function(){var t=window.performance.timing,e={duration:0,entryType:"paint",name:"first-contentful-paint",startTime:0};return t&&0!==t.navigationStart&&(e.startTime=Date.now()-t.navigationStart),[e]},t}(),e=function(){function t(){}return t.prototype.create=function(){var t=this;"PerformanceLongTaskTiming"in window&&(this.g=window.__tti={e:[]},this.g.o=new PerformanceObserver(function(e){t.g.e=t.g.e.concat(e.getEntries())}),this.g.o.observe({entryTypes:["longtask"]}))},t}();!function(t,e){var n,i,r,o=[],s={passive:!0,capture:!0},a=new Date,u="pointerup",f="pointercancel";function c(t,o){n||(n=o,i=t,r=new Date,h(e),p())}function p(){i>=0&&i<r-a&&(o.forEach(function(t){t(i,n)}),o=[])}function l(n){if(n.cancelable){var i=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;"pointerdown"==n.type?function(n,i){function r(){c(n,i),a()}function o(){a()}function a(){e(u,r,s),e(f,o,s)}t(u,r,s),t(f,o,s)}(i,n):c(i,n)}}function h(t){["click","mousedown","keydown","touchstart","pointerdown"].forEach(function(e){t(e,l,s)})}h(t),self.perfMetrics=self.perfMetrics||{},self.perfMetrics.onFirstInputDelay=function(t){o.push(t),p()}}(addEventListener,removeEventListener);var n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i,r=(function(t){!function(){var e="undefined"!=typeof window&&window===this?this:void 0!==n&&null!=n?n:this,i="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){t!=Array.prototype&&t!=Object.prototype&&(t[e]=n.value)};function r(){r=function(){},e.Symbol||(e.Symbol=s)}var o=0;function s(t){return"jscomp_symbol_"+(t||"")+o++}function a(){r();var t=e.Symbol.iterator;t||(t=e.Symbol.iterator=e.Symbol("iterator")),"function"!=typeof Array.prototype[t]&&i(Array.prototype,t,{configurable:!0,writable:!0,value:function(){return u(this)}}),a=function(){}}function u(t){var n=0;return function(t){return a(),(t={next:t})[e.Symbol.iterator]=function(){return this},t}(function(){return n<t.length?{done:!1,value:t[n++]}:{done:!0}})}function f(t){a();var e=t[Symbol.iterator];return e?e.call(t):u(t)}function c(t){if(!(t instanceof Array)){t=f(t);for(var e,n=[];!(e=t.next()).done;)n.push(e.value);t=n}return t}var p=0;var l="img script iframe link audio video source".split(" ");function h(t,e){for(var n=(t=f(t)).next();!n.done;n=t.next())if(n=n.value,e.includes(n.nodeName.toLowerCase())||h(n.children,e))return!0;return!1}function d(t,e){if(2<t.length)return performance.now();for(var n=[],i=(e=f(e)).next();!i.done;i=e.next())i=i.value,n.push({timestamp:i.start,type:"requestStart"}),n.push({timestamp:i.end,type:"requestEnd"});for(i=(e=f(t)).next();!i.done;i=e.next())n.push({timestamp:i.value,type:"requestStart"});for(n.sort(function(t,e){return t.timestamp-e.timestamp}),t=t.length,e=n.length-1;0<=e;e--)switch(i=n[e],i.type){case"requestStart":t--;break;case"requestEnd":if(2<++t)return i.timestamp;break;default:throw Error("Internal Error: This should never happen")}return 0}function m(t){t=t||{},this.w=!!t.useMutationObserver,this.u=t.minValue||null,t=window.__tti&&window.__tti.e;var e=window.__tti&&window.__tti.o;this.a=t?t.map(function(t){return{start:t.startTime,end:t.startTime+t.duration}}):[],e&&e.disconnect(),this.b=[],this.f=new Map,this.j=null,this.v=-1/0,this.i=!1,this.h=this.c=this.s=null,function(t,e){var n=XMLHttpRequest.prototype.send,i=p++;XMLHttpRequest.prototype.send=function(r){for(var o=[],s=0;s<arguments.length;++s)o[s-0]=arguments[s];var a=this;return t(i),this.addEventListener("readystatechange",function(){4===a.readyState&&e(i)}),n.apply(this,o)}}(this.m.bind(this),this.l.bind(this)),function(t,e){var n=fetch;fetch=function(i){for(var r=[],o=0;o<arguments.length;++o)r[o-0]=arguments[o];return new Promise(function(i,o){var s=p++;t(s),n.apply(null,[].concat(c(r))).then(function(t){e(s),i(t)},function(t){e(t),o(t)})})}}(this.m.bind(this),this.l.bind(this)),function(t){t.c=new PerformanceObserver(function(e){for(var n=(e=f(e.getEntries())).next();!n.done;n=e.next())if("resource"===(n=n.value).entryType&&(t.b.push({start:n.fetchStart,end:n.responseEnd}),v(t,d(t.g,t.b)+5e3)),"longtask"===n.entryType){var i=n.startTime+n.duration;t.a.push({start:n.startTime,end:i}),v(t,i+5e3)}}),t.c.observe({entryTypes:["longtask","resource"]})}(this),this.w&&(this.h=function(t){var e=new MutationObserver(function(e){for(var n=(e=f(e)).next();!n.done;n=e.next())"childList"==(n=n.value).type&&h(n.addedNodes,l)?t(n):"attributes"==n.type&&l.includes(n.target.tagName.toLowerCase())&&t(n)});return e.observe(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]}),e}(this.B.bind(this)))}function g(t){t.i=!0;var e=0<t.a.length?t.a[t.a.length-1].end:0,n=d(t.g,t.b);v(t,Math.max(n+5e3,e))}function v(t,e){!t.i||t.v>e||(clearTimeout(t.j),t.j=setTimeout(function(){var e=performance.timing.navigationStart,n=d(t.g,t.b);e=(window.a&&window.a.A?1e3*window.a.A().C-e:0)||performance.timing.domContentLoadedEventEnd-e;if(t.u)var i=t.u;else performance.timing.domContentLoadedEventEnd?i=(i=performance.timing).domContentLoadedEventEnd-i.navigationStart:i=null;var r=performance.now();null===i&&v(t,Math.max(n+5e3,r+1e3));var o=t.a;5e3>r-n?n=null:n=5e3>r-(n=o.length?o[o.length-1].end:e)?null:Math.max(n,i),n&&(t.s(n),clearTimeout(t.j),t.i=!1,t.c&&t.c.disconnect(),t.h&&t.h.disconnect()),v(t,performance.now()+1e3)},e-performance.now()),t.v=e)}m.prototype.getFirstConsistentlyInteractive=function(){var t=this;return new Promise(function(e){t.s=e,"complete"==document.readyState?g(t):window.addEventListener("load",function(){g(t)})})},m.prototype.m=function(t){this.f.set(t,performance.now())},m.prototype.l=function(t){this.f.delete(t)},m.prototype.B=function(){v(this,performance.now()+5e3)},e.Object.defineProperties(m.prototype,{g:{configurable:!0,enumerable:!0,get:function(){return[].concat(c(this.f.values()))}}});var y={getFirstConsistentlyInteractive:function(t){return t=t||{},"PerformanceLongTaskTiming"in window?new m(t).getFirstConsistentlyInteractive():Promise.resolve(null)}};t.exports?t.exports=y:window.ttiPolyfill=y}()}(i={exports:{}},i.exports),i.exports);(new e).create();var o=function(){function t(t){this.config=t,this.timeToInteractiveDuration=0,this.ttiPolyfill=r}return t.supported=function(){return window.performance&&!!performance.now&&!!performance.mark},t.supportedPerformanceObserver=function(){return window.chrome&&"PerformanceObserver"in window},t.supportedLongTask=function(){return"PerformanceLongTaskTiming"in window},t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,e){var n="mark_"+t+"_"+e;window.performance.mark(n)},t.prototype.measure=function(t,e){var n="mark_"+t+"_start",i="mark_"+t+"_end";return window.performance.measure(t,n,i),this.getDurationByMetric(t,e)},t.prototype.firstContentfulPaint=function(t){this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,t)),this.perfObserver.observe({entryTypes:["paint"]})},t.prototype.timeToInteractive=function(t){return this.ttiPolyfill.getFirstConsistentlyInteractive({minValue:t})},t.prototype.getDurationByMetric=function(t,e){var n=this.getMeasurementForGivenName(t);return n&&"measure"===n.entryType?n.duration:-1},t.prototype.getMeasurementForGivenName=function(t){var e=window.performance.getEntriesByName(t);return e[e.length-1]},t.prototype.performanceObserverCb=function(t,e){var n=this,i=e.getEntries();t(i),i.forEach(function(t){n.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&n.perfObserver.disconnect()})},t}(),s=function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?r(t.value):new n(function(e){e(t.value)}).then(s,a)}u((i=i.apply(t,e||[])).next())})},a=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};return function(){function e(e){void 0===e&&(e={});var n=this;this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,timeToInteractive:!1,googleAnalytics:{enable:!1,timingVar:"name"},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:18e3,warning:!1,debugging:!1},this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.timeToInteractiveDuration=0,this.isHidden=!1,this.logMetricWarn="Please provide a metric name",this.metrics=new Map,this.observers=new Map,this.didVisibilityChange=function(){document.hidden&&(n.isHidden=document.hidden)},this.config=Object.assign({},this.config,e),this.perf=o.supported()?new o(this.config):new t(this.config),o.supportedPerformanceObserver()||(this.perfEmulated=new t(this.config)),this.observeFirstContentfulPaint=new Promise(function(t){n.logDebug("observeFirstContentfulPaint"),n.observers.set("fcp",t),n.initFirstPaint()}),this.observeFirstInputDelay=new Promise(function(t){n.observers.set("fid",t),n.initFirstInputDelay()}),this.onVisibilityChange(),this.observeTimeToInteractive=new Promise(function(t){return s(n,void 0,void 0,function(){var e;return a(this,function(n){switch(n.label){case 0:return this.observers.set("tti",t),[4,this.observeFirstContentfulPaint];case 1:return e=n.sent(),this.initTimeToInteractive(e),[2]}})})})}return e.prototype.start=function(t){this.checkMetricName(t)&&(this.metrics.has(t)?this.logWarn(this.config.logPrefix,"Recording already started."):(this.metrics.set(t,{end:0,start:this.perf.now()}),this.perf.mark(t,"start"),this.isHidden=!1))},e.prototype.end=function(t){if(this.checkMetricName(t)){var e=this.metrics.get(t);if(e){e.end=this.perf.now(),this.perf.mark(t,"end");var n=this.perf.measure(t,e),i=parseFloat(n.toFixed(2));return this.log(t,i),this.metrics.delete(t),this.sendTiming(t,i),i}this.logWarn(this.config.logPrefix,"Recording already stopped.")}},e.prototype.endPaint=function(t){var e=this;return new Promise(function(n){setTimeout(function(){var i=e.end(t);n(i)})})},e.prototype.log=function(t,e){if(!this.isHidden&&this.config.logging)if(t){var n=e.toFixed(2),i="%c "+this.config.logPrefix+" "+t+" "+n+" ms";window.console.log(i,"color: #ff6d00;font-size:11px;")}else this.logWarn(this.config.logPrefix,this.logMetricWarn)},e.prototype.logDebug=function(t,e){void 0===e&&(e=""),this.config.debugging&&window.console.log("Perfume.js debugging "+t+":",e)},e.prototype.sendTiming=function(t,e){if(!this.isHidden&&(this.config.analyticsTracker&&this.config.analyticsTracker(t,e),this.config.googleAnalytics.enable))if(window.ga){var n=Math.round(e);window.ga("send","timing",t,this.config.googleAnalytics.timingVar,n)}else this.logWarn(this.config.logPrefix,"Google Analytics has not been loaded")},e.prototype.checkMetricName=function(t){return!!t||(this.logWarn(this.config.logPrefix,this.logMetricWarn),!1)},e.prototype.firstContentfulPaintCb=function(t){var e=this;this.logDebug("firstContentfulPaintCb",t),t.forEach(function(t){e.config.firstPaint&&"first-paint"===t.name&&e.logMetric(t.startTime,"First Paint","firstPaint"),e.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&e.logMetric(t.startTime,"First Contentful Paint","firstContentfulPaint")})},e.prototype.initFirstPaint=function(){this.logDebug("initFirstPaint"),o.supportedPerformanceObserver()?(this.logDebug("initFirstPaint.supportedPerformanceObserver"),this.perf.firstContentfulPaint(this.firstContentfulPaintCb.bind(this))):this.perfEmulated&&(this.logDebug("initFirstPaint.perfEmulated"),this.perfEmulated.firstContentfulPaint(this.firstContentfulPaintCb.bind(this)))},e.prototype.initTimeToInteractive=function(t){var e=this;o.supported()&&o.supportedPerformanceObserver()&&o.supportedLongTask()&&this.config.timeToInteractive&&t&&this.perf.timeToInteractive(t).then(function(t){e.logMetric(t,"Time to Interactive","timeToInteractive")})},e.prototype.initFirstInputDelay=function(){var t=this;o.supported()&&this.config.firstInputDelay&&perfMetrics.onFirstInputDelay(function(e,n){t.logMetric(e,"First Input Delay","firstInputDelay")})},e.prototype.onVisibilityChange=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.didVisibilityChange)},e.prototype.logMetric=function(t,e,n){var i=parseFloat(t.toFixed(2));i>this.config.maxMeasureTime||("firstPaint"===n&&(this.firstPaintDuration=i),"firstContentfulPaint"===n&&(this.firstContentfulPaintDuration=i,this.observers.get("fcp")(i)),"firstInputDelay"===n&&(this.firstInputDelayDuration=i,this.observers.get("fid")(i)),"timeToInteractive"===n&&(this.timeToInteractiveDuration=i,this.observers.get("tti")(i)),this.log(e,i),this.sendTiming(n,i))},e.prototype.logWarn=function(t,e){this.config.warning&&this.config.logging&&window.console.warn(t,e)},e}()});
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.Perfume=i()}(this,function(){"use strict";var t,i,e,n,s=function(){return+new Date},r="function"==typeof window.requestIdleCallback,o=function(){function t(t){this.initTime_=t}return Object.defineProperty(t.prototype,"didTimeout",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype.timeRemaining=function(){return Math.max(0,50-(s()-this.initTime_))},t}(),a=r?window.requestIdleCallback:function(t){var i=new o(s());return setTimeout(function(){return t(i)},0)},u=r?window.cancelIdleCallback:function(t){clearTimeout(t)},f="function"==typeof Promise&&Promise.toString().indexOf("[native code]")>-1?function(t){Promise.resolve().then(t)}:(t=0,i=[],e=new MutationObserver(function(){i.forEach(function(t){return t()}),i=[]}),n=document.createTextNode(""),e.observe(n,{characterData:!0}),function(e){i.push(e),n.data=String(++t%2)}),c=0,h=!("object"!=typeof window.safari||!window.safari.pushNotification),l=function(){function t(t){var i=void 0===t?{}:t,e=i.ensureTasksRun,n=void 0!==e&&e,s=i.defaultMinTaskTime,r=void 0===s?c:s;this.taskQueue_=[],this.isProcessing_=!1,this.state_=null,this.idleCallbackHandle_=null,this.taskQueue_=[],this.isProcessing_=!1,this.state_=null,this.defaultMinTaskTime_=r,this.ensureTasksRun_=n,this.runTasksImmediately=this.runTasksImmediately.bind(this),this.runTasks_=this.runTasks_.bind(this),this.onVisibilityChange_=this.onVisibilityChange_.bind(this),this.ensureTasksRun_&&(addEventListener("visibilitychange",this.onVisibilityChange_,!0),h&&addEventListener("beforeunload",this.runTasksImmediately,!0))}return t.prototype.pushTask=function(t){this.addTask_(Array.prototype.push,t)},t.prototype.unshiftTask=function(t){this.addTask_(Array.prototype.unshift,t)},t.prototype.runTasksImmediately=function(){this.runTasks_()},t.prototype.hasPendingTasks=function(){return this.taskQueue_.length>0},t.prototype.clearPendingTasks=function(){this.taskQueue_=[],this.cancelScheduledRun_()},t.prototype.getState=function(){return this.state_},t.prototype.destroy=function(){this.taskQueue_=[],this.cancelScheduledRun_(),this.ensureTasksRun_&&(removeEventListener("visibilitychange",this.onVisibilityChange_,!0),h&&removeEventListener("beforeunload",this.runTasksImmediately,!0))},t.prototype.addTask_=function(t,i,e){var n=(void 0===e?{}:e).minTaskTime,r=void 0===n?this.defaultMinTaskTime_:n,o={time:s(),visibilityState:document.visibilityState};t.call(this.taskQueue_,{state:o,task:i,minTaskTime:r}),this.scheduleTasksToRun_()},t.prototype.scheduleTasksToRun_=function(){this.ensureTasksRun_&&"hidden"===document.visibilityState?f(this.runTasks_):this.idleCallbackHandle_||(this.idleCallbackHandle_=a(this.runTasks_))},t.prototype.runTasks_=function(t){if(this.cancelScheduledRun_(),!this.isProcessing_){for(this.isProcessing_=!0;this.hasPendingTasks()&&!p(t,this.taskQueue_[0].minTaskTime);){var i=this.taskQueue_.shift(),e=i.task,n=i.state;this.state_=n,e(n),this.state_=null}this.isProcessing_=!1,this.hasPendingTasks()&&this.scheduleTasksToRun_()}},t.prototype.cancelScheduledRun_=function(){u(this.idleCallbackHandle_),this.idleCallbackHandle_=null},t.prototype.onVisibilityChange_=function(){"hidden"===document.visibilityState&&this.runTasksImmediately()},t}(),p=function(t,i){return!!(t&&t.timeRemaining()<=i)},d=function(){function t(t){this.config=t}return t.prototype.now=function(){return Date.now()/1e3},t.prototype.mark=function(t,i){},t.prototype.measure=function(t,i){return this.getDurationByMetric(t,i)},t.prototype.firstContentfulPaint=function(t){var i=this;setTimeout(function(){t(i.getFirstPaint())})},t.prototype.getDurationByMetric=function(t,i){return i.end-i.start||0},t.prototype.getFirstPaint=function(){var t=window.performance.timing,i={duration:0,entryType:"paint",name:"first-contentful-paint",startTime:0};return t&&0!==t.navigationStart&&(i.startTime=Date.now()-t.navigationStart),[i]},t}();!function(t,i){var e,n,s,r=[],o={passive:!0,capture:!0},a=new Date,u="pointerup",f="pointercancel";function c(t,r){e||(e=r,n=t,s=new Date,p(i),h())}function h(){n>=0&&n<s-a&&(r.forEach(function(t){t(n,e)}),r=[])}function l(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,n){function s(){c(e,n),a()}function r(){a()}function a(){i(u,s,o),i(f,r,o)}t(u,s,o),t(f,r,o)}(n,e):c(n,e)}}function p(t){["click","mousedown","keydown","touchstart","pointerdown"].forEach(function(i){t(i,l,o)})}p(t),self.perfMetrics=self.perfMetrics||{},self.perfMetrics.onFirstInputDelay=function(t){r.push(t),h()}}(addEventListener,removeEventListener);var g=function(){function t(t){this.config=t}return t.supported=function(){return window.performance&&!!performance.now&&!!performance.mark},t.supportedPerformanceObserver=function(){return window.chrome&&"PerformanceObserver"in window},t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,i){var e="mark_"+t+"_"+i;window.performance.mark(e)},t.prototype.measure=function(t,i){var e="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,e,n),this.getDurationByMetric(t,i)},t.prototype.firstContentfulPaint=function(t){this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,t)),this.perfObserver.observe({entryTypes:["paint"]})},t.prototype.getDurationByMetric=function(t,i){var e=this.getMeasurementForGivenName(t);return e&&"measure"===e.entryType?e.duration:-1},t.prototype.getMeasurementForGivenName=function(t){var i=window.performance.getEntriesByName(t);return i[i.length-1]},t.prototype.performanceObserverCb=function(t,i){var e=this,n=i.getEntries();t(n),n.forEach(function(t){e.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&e.perfObserver.disconnect()})},t}();return function(){function t(t){void 0===t&&(t={});var i=this;this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,googleAnalytics:{enable:!1,timingVar:"name"},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:18e3,warning:!1,debugging:!1},this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.isHidden=!1,this.logMetricWarn="Please provide a metric name",this.metrics=new Map,this.observers=new Map,this.didVisibilityChange=function(){document.hidden&&(i.isHidden=document.hidden)},this.config=Object.assign({},this.config,t),this.perf=g.supported()?new g(this.config):new d(this.config),g.supportedPerformanceObserver()||(this.perfEmulated=new d(this.config)),(this.config.firstPaint||this.config.firstContentfulPaint)&&(this.observeFirstContentfulPaint=new Promise(function(t){i.logDebug("observeFirstContentfulPaint"),i.observers.set("fcp",t),i.initFirstPaint()})),this.config.firstInputDelay&&(this.observeFirstInputDelay=new Promise(function(t){i.observers.set("fid",t),i.initFirstInputDelay()})),this.onVisibilityChange(),this.queue=new l({ensureTasksRun:!0})}return t.prototype.start=function(t){this.checkMetricName(t)&&(this.metrics.has(t)?this.logWarn(this.config.logPrefix,"Recording already started."):(this.metrics.set(t,{end:0,start:this.perf.now()}),this.perf.mark(t,"start"),this.isHidden=!1))},t.prototype.end=function(t){var i=this;if(this.checkMetricName(t)){var e=this.metrics.get(t);if(e){e.end=this.perf.now(),this.perf.mark(t,"end");var n=this.perf.measure(t,e),s=parseFloat(n.toFixed(2));return this.metrics.delete(t),this.queue.pushTask(function(){i.log(t,s),i.sendTiming(t,s)}),s}this.logWarn(this.config.logPrefix,"Recording already stopped.")}},t.prototype.endPaint=function(t){var i=this;return new Promise(function(e){setTimeout(function(){var n=i.end(t);e(n)})})},t.prototype.log=function(t,i){if(!this.isHidden&&this.config.logging)if(t){var e=i.toFixed(2),n="%c "+this.config.logPrefix+" "+t+" "+e+" ms";window.console.log(n,"color: #ff6d00;font-size:11px;")}else this.logWarn(this.config.logPrefix,this.logMetricWarn)},t.prototype.logDebug=function(t,i){void 0===i&&(i=""),this.config.debugging&&window.console.log("Perfume.js debugging "+t+":",i)},t.prototype.sendTiming=function(t,i){if(!this.isHidden&&(this.config.analyticsTracker&&this.config.analyticsTracker(t,i),this.config.googleAnalytics.enable))if(window.ga){var e=Math.round(i);window.ga("send","timing",t,this.config.googleAnalytics.timingVar,e)}else this.logWarn(this.config.logPrefix,"Google Analytics has not been loaded")},t.prototype.checkMetricName=function(t){return!!t||(this.logWarn(this.config.logPrefix,this.logMetricWarn),!1)},t.prototype.firstContentfulPaintCb=function(t){var i=this;this.logDebug("firstContentfulPaintCb",t),t.forEach(function(t){i.queue.pushTask(function(){i.config.firstPaint&&"first-paint"===t.name&&i.logMetric(t.startTime,"First Paint","firstPaint"),i.config.firstContentfulPaint&&"first-contentful-paint"===t.name&&i.logMetric(t.startTime,"First Contentful Paint","firstContentfulPaint")})})},t.prototype.initFirstPaint=function(){this.logDebug("initFirstPaint"),g.supportedPerformanceObserver()?(this.logDebug("initFirstPaint.supportedPerformanceObserver"),this.perf.firstContentfulPaint(this.firstContentfulPaintCb.bind(this))):this.perfEmulated&&(this.logDebug("initFirstPaint.perfEmulated"),this.perfEmulated.firstContentfulPaint(this.firstContentfulPaintCb.bind(this)))},t.prototype.initFirstInputDelay=function(){var t=this;g.supported()&&this.config.firstInputDelay&&perfMetrics.onFirstInputDelay(function(i,e){t.queue.pushTask(function(){t.logMetric(i,"First Input Delay","firstInputDelay")})})},t.prototype.onVisibilityChange=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.didVisibilityChange)},t.prototype.logMetric=function(t,i,e){var n=parseFloat(t.toFixed(2));n>this.config.maxMeasureTime||("firstPaint"===e&&(this.firstPaintDuration=n),"firstContentfulPaint"===e&&(this.firstContentfulPaintDuration=n,this.observers.get("fcp")(n)),"firstInputDelay"===e&&(this.firstInputDelayDuration=n,this.observers.get("fid")(n)),this.log(i,n),this.sendTiming(e,n))},t.prototype.logWarn=function(t,i){this.config.warning&&this.config.logging&&window.console.warn(t,i)},t}()});
//# sourceMappingURL=perfume.umd.min.js.map

@@ -9,3 +9,2 @@ import 'first-input-delay';

firstContentfulPaint(cb: any): any;
timeToInteractive?(minValue: number): Promise<number>;
}

@@ -29,9 +28,2 @@ export default class Performance implements IPerformance {

static supportedPerformanceObserver(): boolean;
/**
* True if the browser supports the PerformanceLongTaskTiming interface.
* Support: developer.mozilla.org/en-US/docs/Web/API/PerformanceLongTaskTiming
*/
static supportedLongTask(): boolean;
timeToInteractiveDuration: number;
private ttiPolyfill;
private perfObserver;

@@ -56,14 +48,2 @@ constructor(config: IPerfumeConfig);

/**
* The polyfill exposes a getFirstConsistentlyInteractive() method,
* which returns a promise that resolves with the TTI value.
*
* The getFirstConsistentlyInteractive() method accepts an optional
* startTime configuration option, allowing you to specify a lower bound
* for which you know your app cannot be interactive before.
* By default the polyfill uses DOMContentLoaded as the start time,
* but it's often more accurate to use something like the moment your hero elements
* are visible or the point when you know all your event listeners have been added.
*/
timeToInteractive(minValue: number): Promise<number>;
/**
* Get the duration of the timing metric or -1 if there a measurement has

@@ -70,0 +50,0 @@ * not been made by the User Timing API

@@ -5,3 +5,2 @@ export interface IPerfumeConfig {

firstPaint: boolean;
timeToInteractive: boolean;
analyticsTracker?: (metricName: string, duration: number) => void;

@@ -19,3 +18,2 @@ googleAnalytics: IGoogleAnalyticsConfig;

firstPaint?: boolean;
timeToInteractive?: boolean;
analyticsTracker?: (metricName: string, duration: number) => void;

@@ -53,8 +51,7 @@ googleAnalytics?: IGoogleAnalyticsConfig;

firstInputDelayDuration: number;
observeFirstContentfulPaint: Promise<number>;
observeFirstInputDelay: Promise<number>;
observeTimeToInteractive?: Promise<number>;
timeToInteractiveDuration: number;
observeFirstContentfulPaint?: Promise<number>;
observeFirstInputDelay?: Promise<number>;
private isHidden;
private logMetricWarn;
private queue;
private metrics;

@@ -97,3 +94,2 @@ private observers;

private initFirstPaint;
private initTimeToInteractive;
private initFirstInputDelay;

@@ -100,0 +96,0 @@ /**

{
"name": "perfume.js",
"version": "1.2.1",
"description": "JavaScript library for measuring Short and Long Script, First Contentful Paint (FCP), Time to Interactive (TTI), Component First Paint (CFM), annotating them to the DevTools timeline and reporting the results to Google Analytics.",
"version": "2.0.0-rc.1",
"description": "JavaScript library that measures First (Contentful) Paint (FP/FCP) and First Input Delay (FID). Annotates components’ performance for Vanilla and Angular applications, into the DevTools timeline. Reports all the results to Google Analytics or your favorite tracking tool.",
"keywords": [

@@ -10,3 +10,2 @@ "performance-metrics",

"javascript-library",
"time-to-interactive",
"first-contentful-paint",

@@ -73,2 +72,3 @@ "devtools",

"/docs/",
"idle-queue.ts",
"/node_modules/"

@@ -86,2 +86,3 @@ ],

"/docs/",
"idle-queue.ts",
"/node_modules/",

@@ -129,4 +130,4 @@ "/test/"

"first-input-delay": "^0.1.3",
"tti-polyfill": "^0.2.2"
"idlize": "^0.1.0"
}
}
<a href="http://www.perfumejs.com/">
<img src="https://github.com/Zizzamia/perfume.js/blob/master/docs/src/assets/perfume-logo-v1-2-0.png" align="left" width="262" />
<img src="https://github.com/Zizzamia/perfume.js/blob/master/docs/src/assets/perfume-logo-v2-0-0.png" align="left" width="262" />
</a>
# [Perfume.js v1.2.1](http://perfumejs.com)
# [Perfume.js v2.0.0](http://perfumejs.com)

@@ -10,3 +10,3 @@ [![NPM version](https://badge.fury.io/js/perfume.js.svg)](https://www.npmjs.org/package/perfume.js) [![Build Status](https://travis-ci.org/Zizzamia/perfume.js.svg?branch=master)](https://travis-ci.org/Zizzamia/perfume.js) [![NPM Downloads](http://img.shields.io/npm/dm/perfume.js.svg)](https://www.npmjs.org/package/perfume.js) [![Test Coverage](https://api.codeclimate.com/v1/badges/f813d2f45b274d93b8c5/test_coverage)](https://codeclimate.com/github/Zizzamia/perfume.js/test_coverage) [![JS gzip size](https://img.badgesize.io/https://unpkg.com/perfume.js?compression=gzip&label=JS+gzip+size)](https://unpkg.com/perfume.js)

> JavaScript library that measures <b>First (Contentful) Paint</b> (<a href="https://medium.com/@zizzamia/first-contentful-paint-with-a-touch-of-perfume-js-cd11dfd2e18f" target="_blank">FP/FCP</a>), <b>Time to Interactive</b> (<a href="https://medium.com/@zizzamia/time-to-interactive-with-rum-862ba874392c" target="_blank">TTI</a>) and First Input Delay (FID). Annotates components’ performance for <b>Vanilla</b> and <b>Angular</b> applications, into the DevTools timeline. Reports all the results to Google Analytics or your favorite tracking tool.
> JavaScript library that measures <b>First (Contentful) Paint</b> (<a href="https://medium.com/@zizzamia/first-contentful-paint-with-a-touch-of-perfume-js-cd11dfd2e18f" target="_blank">FP/FCP</a>) and First Input Delay (FID). Annotates components’ performance for <b>Vanilla</b> and <b>Angular</b> applications, into the DevTools timeline. Reports all the results to Google Analytics or your favorite tracking tool.

@@ -25,3 +25,2 @@ <br />

* First Input Delay (FID)
* Time to Interactive ([TTI](https://medium.com/@zizzamia/time-to-interactive-with-rum-862ba874392c))

@@ -91,17 +90,2 @@ ![Performance Metrics load timeline](https://github.com/Zizzamia/perfume.js/blob/master/docs/src/assets/perf-metrics-load-timeline.png)

### Time to Interactive ([TTI](https://medium.com/@zizzamia/time-to-interactive-with-rum-862ba874392c))
The metric marks the point at which your application is both visually rendered and capable of reliably responding to user input. An application could be unable to respond to user input for a couple of reasons:
* The JavaScript needed to make the components on the page work hasn't yet loaded;
* There are long tasks blocking the main thread.
The **TTI** metric identifies the point at which the page's initial JavaScript is loaded and the main thread is idle (free of long tasks).
```javascript
const perfume = new Perfume({
timeToInteractive: true
});
// Perfume.js: Time to interactive 2452.07 ms
```
### Annotate metrics in the DevTools

@@ -231,14 +215,18 @@

const options = {
// Metrics
firstContentfulPaint: false,
firstPaint: false,
firstContentfulPaint: false,
firstInputDelay: false,
timeToInteractive: false,
// Analytics
analyticsTracker: undefined,
googleAnalytics: {
enable: false,
timingVar: 'name'
timingVar: 'name',
},
// Logging
logPrefix: 'Perfume.js:',
logging: true,
logPrefix: 'Perfume.js:',
warning: false
maxMeasureTime: 18000,
warning: false,
debugging: false,
};

@@ -262,3 +250,2 @@ ```

perfume.firstInputDelayDuration;
perfume.timeToInteractiveDuration;

@@ -268,3 +255,2 @@ // Aync Values

const durationFID = await perfume.observeFirstInputDelay;
const durationTTI = await perfume.observeTimeToInteractive;

@@ -271,0 +257,0 @@ // Send Custom User timing measure to Google Analytics

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet