Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@codersrank/skills-chart

Package Overview
Dependencies
Maintainers
5
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codersrank/skills-chart - npm Package Compare versions

Comparing version 0.9.6 to 0.9.7

64

cjs/codersrank-skills-chart.js

@@ -42,3 +42,3 @@ "use strict";

var STYLES = ":host{--font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;--svg-width:100%;--svg-height:auto;--axis-bg-color:rgba(0, 0, 0, 0.35);--hidden-area-color:#ddd;--label-text-color:inherit;--label-font-size:10px;--label-font-weight:500;--legend-text-color:inherit;--legend-disabled-text-color:#ccc;--legend-font-size:14px;--preloader-color:#72a0a8;--tooltip-font-size:12px;--tooltip-total-font-size:16px;--tooltip-total-font-weight:bold;width:100%;display:block;position:relative;box-sizing:border-box}.codersrank-skills-chart{font-family:var(--font-family);position:relative}.codersrank-skills-chart-preloader{position:absolute;left:50%;top:50%;width:32px;height:32px;margin:-16px 0 0 -16px;border:3px solid var(--preloader-color);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;box-sizing:border-box;-webkit-animation:preloader 1s infinite linear;animation:preloader 1s infinite linear}.codersrank-skills-chart-svg{position:relative}.codersrank-skills-chart svg{width:var(--svg-width);height:var(--svg-height);display:block}.codersrank-skills-chart polygon{transition-duration:150ms}.codersrank-skills-chart-current-line{stroke:rgba(0,0,0,.25);stroke-width:1px}.codersrank-skills-chart-hidden{fill:var(--hidden-area-color)!important}.codersrank-skills-chart-axis{margin-bottom:36px;height:1px;background:var(--axis-bg-color);color:inherit;display:flex;font-size:var(--label-font-size);font-weight:var(--label-font-weight);justify-content:space-between;line-height:1;color:var(--label-text-color)}.codersrank-skills-chart-axis>span{padding-top:10px;width:0;display:flex;align-items:flex-start;justify-content:center;white-space:nowrap}.codersrank-skills-chart-axis>span:first-child{justify-content:flex-start}.codersrank-skills-chart-axis>span:last-child{justify-content:flex-end}.codersrank-skills-chart-tooltip{pointer-events:none;text-align:left;line-height:1.4;position:absolute;background:#000;border-radius:4px;color:#fff;font-family:var(--font-family);padding:8px;font-size:var(--tooltip-font-size);white-space:nowrap;pointer-events:none;top:50%;transform:translateX(-100%) translateY(-50%);margin-left:-10px}.codersrank-skills-chart-tooltip-right{margin-left:10px;transform:translateY(-50%)}.codersrank-skills-chart-tooltip-label{color:rgba(255,255,255,.75)}.codersrank-skills-chart-tooltip-total{font-size:var(--tooltip-total-font-size);font-weight:var(--tooltip-total-font-weight)}.codersrank-skills-chart-tooltip-list{list-style:none;margin:0;padding:0}.codersrank-skills-chart-tooltip-list span{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:4px}.codersrank-skills-chart-legend{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;font-size:var(--legend-font-size);width:100%;color:var(--legend-text-color);margin-top:36px}.codersrank-skills-chart-legend-button{color:inherit;width:auto;-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;background-color:transparent;border-radius:0;border:none;outline:0!important;cursor:pointer;font-family:inherit;font-size:inherit;box-shadow:none!important;display:flex;align-items:center;font-weight:500;transition-duration:.2s;padding:4px 8px}.codersrank-skills-chart-legend-button span{transition-duration:.2s;width:14px;height:14px;margin-right:4px;border-radius:50%}.codersrank-skills-chart-legend-button-hidden{color:var(--legend-disabled-text-color)}.codersrank-skills-chart-legend-button-hidden span{background-color:var(--legend-disabled-text-color)!important}@-webkit-keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}";
var STYLES = ":host{--font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;--svg-width:100%;--svg-height:auto;--axis-bg-color:rgba(0, 0, 0, 0.35);--hidden-area-color:#ddd;--label-text-color:inherit;--label-font-size:10px;--label-font-weight:500;--legend-text-color:inherit;--legend-disabled-text-color:#ccc;--legend-font-size:14px;--preloader-color:#72a0a8;--tooltip-font-size:12px;--tooltip-total-font-size:16px;--tooltip-total-font-weight:bold;--other-skills-area-color:#bbb;width:100%;display:block;position:relative;box-sizing:border-box}.codersrank-skills-chart{font-family:var(--font-family);position:relative}.codersrank-skills-chart-preloader{position:absolute;left:50%;top:50%;width:32px;height:32px;margin:-16px 0 0 -16px;border:3px solid var(--preloader-color);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;box-sizing:border-box;-webkit-animation:preloader 1s infinite linear;animation:preloader 1s infinite linear}.codersrank-skills-chart-svg{position:relative}.codersrank-skills-chart svg{width:var(--svg-width);height:var(--svg-height);display:block}.codersrank-skills-chart polygon{transition-duration:150ms}.codersrank-skills-chart-current-line{stroke:rgba(0,0,0,.25);stroke-width:1px}.codersrank-skills-chart-hidden{fill:var(--hidden-area-color)!important}.codersrank-skills-chart-axis{margin-bottom:36px;height:1px;background:var(--axis-bg-color);color:inherit;display:flex;font-size:var(--label-font-size);font-weight:var(--label-font-weight);justify-content:space-between;line-height:1;color:var(--label-text-color)}.codersrank-skills-chart-axis>span{padding-top:10px;width:0;display:flex;align-items:flex-start;justify-content:center;white-space:nowrap}.codersrank-skills-chart-axis>span:first-child{justify-content:flex-start}.codersrank-skills-chart-axis>span:last-child{justify-content:flex-end}.codersrank-skills-chart-tooltip{pointer-events:none;text-align:left;line-height:1.4;position:absolute;background:#000;border-radius:4px;color:#fff;font-family:var(--font-family);padding:8px;font-size:var(--tooltip-font-size);white-space:nowrap;pointer-events:none;top:50%;transform:translateX(-100%) translateY(-50%);margin-left:-10px}.codersrank-skills-chart-tooltip-right{margin-left:10px;transform:translateY(-50%)}.codersrank-skills-chart-tooltip-label{color:rgba(255,255,255,.75)}.codersrank-skills-chart-tooltip-total{font-size:var(--tooltip-total-font-size);font-weight:var(--tooltip-total-font-weight)}.codersrank-skills-chart-tooltip-list{list-style:none;margin:0;padding:0}.codersrank-skills-chart-tooltip-list span{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:4px}.codersrank-skills-chart-legend{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;font-size:var(--legend-font-size);width:100%;color:var(--legend-text-color);margin-top:36px}.codersrank-skills-chart-legend-button{color:inherit;width:auto;-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;background-color:transparent;border-radius:0;border:none;outline:0!important;cursor:pointer;font-family:inherit;font-size:inherit;box-shadow:none!important;display:flex;align-items:center;font-weight:500;transition-duration:.2s;padding:4px 8px}.codersrank-skills-chart-legend-button span{transition-duration:.2s;width:14px;height:14px;margin-right:4px;border-radius:50%}.codersrank-skills-chart-legend-button-hidden{color:var(--legend-disabled-text-color)}.codersrank-skills-chart-legend-button-hidden span{background-color:var(--legend-disabled-text-color)!important}@-webkit-keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}";
var tempDiv = document.createElement('div'); // eslint-disable-next-line

@@ -81,6 +81,49 @@

return _this;
}
} // eslint-disable-next-line
var _proto = CodersRankSkillsChart.prototype;
_proto.getHighestScore = function getHighestScore(scores) {
var score = 0;
var date = null;
scores.forEach(function (scoreData) {
var summ = 0;
scoreData.languages.forEach(function (langData) {
summ += langData.score;
});
if (summ > score) {
score = summ;
date = scoreData.date;
}
});
return {
score: score,
date: date
};
};
_proto.emitData = function emitData(data) {
if (data === void 0) {
data = {};
}
var scores = data.scores || {};
var event = new CustomEvent('data', {
detail: {
scores: scores,
highest: this.getHighestScore(scores)
}
});
this.dispatchEvent(event);
};
_proto.emitError = function emitError(err) {
var event = new CustomEvent('error', {
detail: err
});
this.dispatchEvent(event);
};
// eslint-disable-next-line

@@ -154,7 +197,11 @@ _proto.formatLabel = function formatLabel(label) {

(0, _fetchData.fetchData)(username).then(function (data) {
_this2.data = (0, _getChartData.getChartData)(data.scores, _this2.displaySkills);
_this2.emitData(data);
_this2.data = (0, _getChartData.getChartData)(data.scores, _this2.displaySkills, _this2.showOtherSkills);
_this2.state = STATE_SUCCESS;
_this2.render();
})["catch"](function () {
})["catch"](function (err) {
_this2.emitError(err);
_this2.state = STATE_ERROR;

@@ -403,2 +450,9 @@

}, {
key: "showOtherSkills",
get: function get() {
var showOtherSkills = this.getAttribute('show-other-skills');
if (showOtherSkills === '' || showOtherSkills === 'true') return true;
return false;
}
}, {
key: "tooltip",

@@ -444,3 +498,3 @@ get: function get() {

get: function get() {
return ['username', 'svg-width', 'svg-height', 'legend', 'labels', 'skills'];
return ['username', 'svg-width', 'svg-height', 'legend', 'labels', 'skills', 'show-other-skills'];
}

@@ -447,0 +501,0 @@ }]);

5

cjs/shared/fetch-data.js

@@ -17,2 +17,6 @@ "use strict";

}).then(function (data) {
if (data && data.code === 400) {
return Promise.reject(data);
}
cache[username] = data;

@@ -22,3 +26,2 @@ return data;

// eslint-disable-next-line
console.error(err);
return Promise.reject(err);

@@ -25,0 +28,0 @@ });

@@ -8,3 +8,3 @@ "use strict";

var getChartData = function getChartData(data, displaySkills) {
var getChartData = function getChartData(data, displaySkills, showOtherSkills) {
if (data === void 0) {

@@ -18,2 +18,6 @@ data = [];

if (showOtherSkills === void 0) {
showOtherSkills = false;
}
var scoresData = [].concat(data);

@@ -53,6 +57,30 @@ scoresData.reverse();

});
var otherDataset;
if (showOtherSkills) {
var values = [];
scoresData.forEach(function (score) {
var otherScore = 0;
score.languages.forEach(function (langData) {
if (!languagesList.includes(langData.language)) {
otherScore += langData.score;
}
});
values.push(otherScore);
});
otherDataset = {
label: 'Other',
color: 'var(--other-skills-area-color)',
values: values
};
}
datasets.sort(function (a, b) {
if (b.label === 'Other') return -1;
return a.label > b.label ? 1 : -1;
});
if (otherDataset) {
datasets.push(otherDataset);
}
return {

@@ -59,0 +87,0 @@ labels: labels,

/**
* Codersrank Activity Widget 0.9.6
* Codersrank Activity Widget 0.9.7
* undefined

@@ -10,3 +10,3 @@ * https://github.com/codersrank-org/skills-chart-widget#readme

*
* Released on: October 27, 2020
* Released on: November 2, 2020
*/

@@ -162,2 +162,6 @@

}).then(function (data) {
if (data && data.code === 400) {
return Promise.reject(data);
}
cache[username] = data;

@@ -167,3 +171,2 @@ return data;

// eslint-disable-next-line
console.error(err);
return Promise.reject(err);

@@ -618,3 +621,3 @@ });

var getChartData = function getChartData(data, displaySkills) {
var getChartData = function getChartData(data, displaySkills, showOtherSkills) {
if (data === void 0) {

@@ -628,2 +631,6 @@ data = [];

if (showOtherSkills === void 0) {
showOtherSkills = false;
}
var scoresData = [].concat(data);

@@ -663,6 +670,30 @@ scoresData.reverse();

});
var otherDataset;
if (showOtherSkills) {
var values = [];
scoresData.forEach(function (score) {
var otherScore = 0;
score.languages.forEach(function (langData) {
if (!languagesList.includes(langData.language)) {
otherScore += langData.score;
}
});
values.push(otherScore);
});
otherDataset = {
label: 'Other',
color: 'var(--other-skills-area-color)',
values: values
};
}
datasets.sort(function (a, b) {
if (b.label === 'Other') return -1;
return a.label > b.label ? 1 : -1;
});
if (otherDataset) {
datasets.push(otherDataset);
}
return {

@@ -684,3 +715,3 @@ labels: labels,

var STYLES = ":host{--font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;--svg-width:100%;--svg-height:auto;--axis-bg-color:rgba(0, 0, 0, 0.35);--hidden-area-color:#ddd;--label-text-color:inherit;--label-font-size:10px;--label-font-weight:500;--legend-text-color:inherit;--legend-disabled-text-color:#ccc;--legend-font-size:14px;--preloader-color:#72a0a8;--tooltip-font-size:12px;--tooltip-total-font-size:16px;--tooltip-total-font-weight:bold;width:100%;display:block;position:relative;box-sizing:border-box}.codersrank-skills-chart{font-family:var(--font-family);position:relative}.codersrank-skills-chart-preloader{position:absolute;left:50%;top:50%;width:32px;height:32px;margin:-16px 0 0 -16px;border:3px solid var(--preloader-color);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;box-sizing:border-box;-webkit-animation:preloader 1s infinite linear;animation:preloader 1s infinite linear}.codersrank-skills-chart-svg{position:relative}.codersrank-skills-chart svg{width:var(--svg-width);height:var(--svg-height);display:block}.codersrank-skills-chart polygon{transition-duration:150ms}.codersrank-skills-chart-current-line{stroke:rgba(0,0,0,.25);stroke-width:1px}.codersrank-skills-chart-hidden{fill:var(--hidden-area-color)!important}.codersrank-skills-chart-axis{margin-bottom:36px;height:1px;background:var(--axis-bg-color);color:inherit;display:flex;font-size:var(--label-font-size);font-weight:var(--label-font-weight);justify-content:space-between;line-height:1;color:var(--label-text-color)}.codersrank-skills-chart-axis>span{padding-top:10px;width:0;display:flex;align-items:flex-start;justify-content:center;white-space:nowrap}.codersrank-skills-chart-axis>span:first-child{justify-content:flex-start}.codersrank-skills-chart-axis>span:last-child{justify-content:flex-end}.codersrank-skills-chart-tooltip{pointer-events:none;text-align:left;line-height:1.4;position:absolute;background:#000;border-radius:4px;color:#fff;font-family:var(--font-family);padding:8px;font-size:var(--tooltip-font-size);white-space:nowrap;pointer-events:none;top:50%;transform:translateX(-100%) translateY(-50%);margin-left:-10px}.codersrank-skills-chart-tooltip-right{margin-left:10px;transform:translateY(-50%)}.codersrank-skills-chart-tooltip-label{color:rgba(255,255,255,.75)}.codersrank-skills-chart-tooltip-total{font-size:var(--tooltip-total-font-size);font-weight:var(--tooltip-total-font-weight)}.codersrank-skills-chart-tooltip-list{list-style:none;margin:0;padding:0}.codersrank-skills-chart-tooltip-list span{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:4px}.codersrank-skills-chart-legend{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;font-size:var(--legend-font-size);width:100%;color:var(--legend-text-color);margin-top:36px}.codersrank-skills-chart-legend-button{color:inherit;width:auto;-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;background-color:transparent;border-radius:0;border:none;outline:0!important;cursor:pointer;font-family:inherit;font-size:inherit;box-shadow:none!important;display:flex;align-items:center;font-weight:500;transition-duration:.2s;padding:4px 8px}.codersrank-skills-chart-legend-button span{transition-duration:.2s;width:14px;height:14px;margin-right:4px;border-radius:50%}.codersrank-skills-chart-legend-button-hidden{color:var(--legend-disabled-text-color)}.codersrank-skills-chart-legend-button-hidden span{background-color:var(--legend-disabled-text-color)!important}@-webkit-keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}";
var STYLES = ":host{--font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;--svg-width:100%;--svg-height:auto;--axis-bg-color:rgba(0, 0, 0, 0.35);--hidden-area-color:#ddd;--label-text-color:inherit;--label-font-size:10px;--label-font-weight:500;--legend-text-color:inherit;--legend-disabled-text-color:#ccc;--legend-font-size:14px;--preloader-color:#72a0a8;--tooltip-font-size:12px;--tooltip-total-font-size:16px;--tooltip-total-font-weight:bold;--other-skills-area-color:#bbb;width:100%;display:block;position:relative;box-sizing:border-box}.codersrank-skills-chart{font-family:var(--font-family);position:relative}.codersrank-skills-chart-preloader{position:absolute;left:50%;top:50%;width:32px;height:32px;margin:-16px 0 0 -16px;border:3px solid var(--preloader-color);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;box-sizing:border-box;-webkit-animation:preloader 1s infinite linear;animation:preloader 1s infinite linear}.codersrank-skills-chart-svg{position:relative}.codersrank-skills-chart svg{width:var(--svg-width);height:var(--svg-height);display:block}.codersrank-skills-chart polygon{transition-duration:150ms}.codersrank-skills-chart-current-line{stroke:rgba(0,0,0,.25);stroke-width:1px}.codersrank-skills-chart-hidden{fill:var(--hidden-area-color)!important}.codersrank-skills-chart-axis{margin-bottom:36px;height:1px;background:var(--axis-bg-color);color:inherit;display:flex;font-size:var(--label-font-size);font-weight:var(--label-font-weight);justify-content:space-between;line-height:1;color:var(--label-text-color)}.codersrank-skills-chart-axis>span{padding-top:10px;width:0;display:flex;align-items:flex-start;justify-content:center;white-space:nowrap}.codersrank-skills-chart-axis>span:first-child{justify-content:flex-start}.codersrank-skills-chart-axis>span:last-child{justify-content:flex-end}.codersrank-skills-chart-tooltip{pointer-events:none;text-align:left;line-height:1.4;position:absolute;background:#000;border-radius:4px;color:#fff;font-family:var(--font-family);padding:8px;font-size:var(--tooltip-font-size);white-space:nowrap;pointer-events:none;top:50%;transform:translateX(-100%) translateY(-50%);margin-left:-10px}.codersrank-skills-chart-tooltip-right{margin-left:10px;transform:translateY(-50%)}.codersrank-skills-chart-tooltip-label{color:rgba(255,255,255,.75)}.codersrank-skills-chart-tooltip-total{font-size:var(--tooltip-total-font-size);font-weight:var(--tooltip-total-font-weight)}.codersrank-skills-chart-tooltip-list{list-style:none;margin:0;padding:0}.codersrank-skills-chart-tooltip-list span{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:4px}.codersrank-skills-chart-legend{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;font-size:var(--legend-font-size);width:100%;color:var(--legend-text-color);margin-top:36px}.codersrank-skills-chart-legend-button{color:inherit;width:auto;-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;background-color:transparent;border-radius:0;border:none;outline:0!important;cursor:pointer;font-family:inherit;font-size:inherit;box-shadow:none!important;display:flex;align-items:center;font-weight:500;transition-duration:.2s;padding:4px 8px}.codersrank-skills-chart-legend-button span{transition-duration:.2s;width:14px;height:14px;margin-right:4px;border-radius:50%}.codersrank-skills-chart-legend-button-hidden{color:var(--legend-disabled-text-color)}.codersrank-skills-chart-legend-button-hidden span{background-color:var(--legend-disabled-text-color)!important}@-webkit-keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}";
var tempDiv = document.createElement('div'); // eslint-disable-next-line

@@ -723,6 +754,49 @@

return _this;
}
} // eslint-disable-next-line
var _proto = CodersRankSkillsChart.prototype;
_proto.getHighestScore = function getHighestScore(scores) {
var score = 0;
var date = null;
scores.forEach(function (scoreData) {
var summ = 0;
scoreData.languages.forEach(function (langData) {
summ += langData.score;
});
if (summ > score) {
score = summ;
date = scoreData.date;
}
});
return {
score: score,
date: date
};
};
_proto.emitData = function emitData(data) {
if (data === void 0) {
data = {};
}
var scores = data.scores || {};
var event = new CustomEvent('data', {
detail: {
scores: scores,
highest: this.getHighestScore(scores)
}
});
this.dispatchEvent(event);
};
_proto.emitError = function emitError(err) {
var event = new CustomEvent('error', {
detail: err
});
this.dispatchEvent(event);
};
// eslint-disable-next-line

@@ -796,7 +870,11 @@ _proto.formatLabel = function formatLabel(label) {

fetchData(username).then(function (data) {
_this2.data = getChartData(data.scores, _this2.displaySkills);
_this2.emitData(data);
_this2.data = getChartData(data.scores, _this2.displaySkills, _this2.showOtherSkills);
_this2.state = STATE_SUCCESS;
_this2.render();
})["catch"](function () {
})["catch"](function (err) {
_this2.emitError(err);
_this2.state = STATE_ERROR;

@@ -1045,2 +1123,9 @@

}, {
key: "showOtherSkills",
get: function get() {
var showOtherSkills = this.getAttribute('show-other-skills');
if (showOtherSkills === '' || showOtherSkills === 'true') return true;
return false;
}
}, {
key: "tooltip",

@@ -1086,3 +1171,3 @@ get: function get() {

get: function get() {
return ['username', 'svg-width', 'svg-height', 'legend', 'labels', 'skills'];
return ['username', 'svg-width', 'svg-height', 'legend', 'labels', 'skills', 'show-other-skills'];
}

@@ -1089,0 +1174,0 @@ }]);

/**
* Codersrank Activity Widget 0.9.6
* Codersrank Activity Widget 0.9.7
* undefined

@@ -10,6 +10,6 @@ * https://github.com/codersrank-org/skills-chart-widget#readme

*
* Released on: October 27, 2020
* Released on: November 2, 2020
*/
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function i(e,t,n){return(i=a()?Reflect.construct:function(e,t,n){var a=[null];a.push.apply(a,t);var i=new(Function.bind.apply(e,a));return n&&r(i,n.prototype),i}).apply(null,arguments)}function o(e){var t="function"==typeof Map?new Map:void 0;return(o=function(e){if(null===e||(a=e,-1===Function.toString.call(a).indexOf("[native code]")))return e;var a;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return i(e,arguments,n(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),r(o,e)})(e)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var l={},c=function(e){var t=void 0===e?{}:e,n=t.data,r=t.svgWidth,a=t.svgHeight,i=t.legend,o=t.labels,s=t.preloader,l=t.hiddenDatasets,c=t.highlightedDatasetLabel,d=t.visibleLabels,u=t.currentIndex,h=t.formatLabel,f=n.datasets,p=n.labels,g=function(){var e=function(){var e=[];return f.filter((function(e){return!l.includes(e.label)})).forEach((function(t){t.values.forEach((function(t,n){e[n]||(e[n]=0),e[n]+=t}))})),e}(),t=[];if(!f.length)return t;var n=f[0].values.map((function(){return 0})),i=Math.max.apply(Math,e);return f.filter((function(e){return!l.includes(e.label)})).forEach((function(e){var o=e.label,s=e.values,l=e.color,c=s.map((function(e,t){n[t]+=e;var o=n[t];return t/(s.length-1)*r+" "+(a-o/i*a)}));c.push(r+" "+a+" 0 "+a),t.push({label:o,points:c.join(" "),color:l})})),t.reverse()}(),b=function(){var e=[];if(!f.length)return e;var t=f[0].values;return t.forEach((function(n,a){var i=a/(t.length-1)*r;e.push(i)})),e}();return'\n <div class="codersrank-skills-chart">\n <div class="codersrank-skills-chart-svg">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="'+r+'"\n height="'+a+'"\n viewBox="0 0 '+r+" "+a+'"\n preserveAspectRatio="none"\n >\n '+g.map((function(e){return'\n <polygon\n fill="'+e.color+'"\n fillRule="evenodd"\n points="'+e.points+'"\n data-label="'+e.label+'"\n class="'+(c&&c!==e.label?"codersrank-skills-chart-hidden":"")+'"\n />\n '})).join("")+"\n "+b.map((function(e,t){return'\n <line\n data-index="'+t+'"\n fill="#000"\n x1="'+e+'"\n y1="0"\n x2="'+e+'"\n y2="'+a+'"\n class="'+(u===t?"codersrank-skills-chart-current-line":"")+'"\n />\n '})).join("")+"\n </svg>\n "+(s?'\n <div class="codersrank-skills-chart-preloader"></div>\n ':"")+"\n </div>\n "+(o?'\n <div class="codersrank-skills-chart-axis">\n '+p.map((function(e){return"\n <span>\n "+(d.includes(e)?"\n <span>"+h(e)+"</span>\n ":"")+"\n </span>\n "})).join("")+"\n </div>\n ":"")+"\n "+(i?'\n <div class="codersrank-skills-chart-legend">\n '+f.map((function(e){return'\n <button\n data-label="'+e.label+'"\n class="codersrank-skills-chart-legend-button '+(l.includes(e.label)?"codersrank-skills-chart-legend-button-hidden":"")+'"\n type="button"\n >\n <span style="background-color: '+e.color+'"></span>\n '+e.label+"\n </button>\n "})).join("")+"\n </div>\n ":"")+"\n </div>\n "},d={"1C Enterprise":"#814CCC",ABAP:"#E8274B",ActionScript:"#882B0F",Ada:"#02f88c",Agda:"#315665","AGS Script":"#B9D9FF",Alloy:"#64C800",AMPL:"#E6EFBB",AngelScript:"#C7D7DC",ANTLR:"#9DC3FF","API Blueprint":"#2ACCA8",APL:"#5A8164",AppleScript:"#101F1F",Arc:"#aa2afe",ASP:"#6a40fd",AspectJ:"#a957b0",Assembly:"#6E4C13",Asymptote:"#4a0c0c",ATS:"#1ac620",AutoHotkey:"#6594b9",AutoIt:"#1C3552",Ballerina:"#FF5000",Batchfile:"#C1F12E",BlitzMax:"#cd6400",Boo:"#d4bec1",Brainfuck:"#2F2530",C:"#555555","C#":"#178600","C++":"#f34b7d",Ceylon:"#dfa535",Chapel:"#8dc63f",Cirru:"#ccccff",Clarion:"#db901e",Clean:"#3F85AF",Click:"#E4E6F3",Clojure:"#db5855",CoffeeScript:"#244776",ColdFusion:"#ed2cd6","Common Lisp":"#3fb68b","Common Workflow Language":"#B5314C","Component Pascal":"#B0CE4E",Crystal:"#000100",CSS:"#563d7c",Cuda:"#3A4E3A",D:"#ba595e",Dart:"#00B4AB",DataWeave:"#003a52",DM:"#447265",Dockerfile:"#384d54",Dogescript:"#cca760",Dylan:"#6c616e",E:"#ccce35",eC:"#913960",ECL:"#8a1267",Eiffel:"#946d57",Elixir:"#6e4a7e",Elm:"#60B5CC","Emacs Lisp":"#c065db",EmberScript:"#FFF4F3",EQ:"#a78649",Erlang:"#B83998","F#":"#b845fc","F*":"#572e30",Factor:"#636746",Fancy:"#7b9db4",Fantom:"#14253c",FLUX:"#88ccff",Forth:"#341708",Fortran:"#4d41b1",FreeMarker:"#0050b2",Frege:"#00cafe","Game Maker Language":"#71b417",GDScript:"#355570",Genie:"#fb855d",Gherkin:"#5B2063",Glyph:"#c1ac7f",Gnuplot:"#f0a9f0",Go:"#00ADD8",Golo:"#88562A",Gosu:"#82937f","Grammatical Framework":"#79aa7a",Groovy:"#e69f56",Hack:"#878787",Harbour:"#0e60e3",Haskell:"#5e5086",Haxe:"#df7900",HiveQL:"#dce200",HTML:"#e34c26",Hy:"#7790B2",IDL:"#a3522f",Idris:"#b30000",Io:"#a9188d",Ioke:"#078193",Isabelle:"#FEFE00",J:"#9EEDFF",Java:"#b07219",JavaScript:"#f1e05a",Jolie:"#843179",JSONiq:"#40d47e",Jsonnet:"#0064bd",Julia:"#a270ba","Jupyter Notebook":"#DA5B0B",Kotlin:"#F18E33",KRL:"#28430A",Lasso:"#999999",Lex:"#DBCA00",LFE:"#4C3023",LiveScript:"#499886",LLVM:"#185619",LOLCODE:"#cc9900",LookML:"#652B81",LSL:"#3d9970",Lua:"#000080",Makefile:"#427819",Mask:"#f97732",MATLAB:"#e16737",Max:"#c4a79c",MAXScript:"#00a6a6",mcfunction:"#E22837",Mercury:"#ff2b2b",Meson:"#007800",Metal:"#8f14e9",Mirah:"#c7a938","Modula-3":"#223388",MQL4:"#62A8D6",MQL5:"#4A76B8",MTML:"#b7e1f4",NCL:"#28431f",Nearley:"#990000",Nemerle:"#3d3c6e",nesC:"#94B0C7",NetLinx:"#0aa0ff","NetLinx+ERB":"#747faa",NetLogo:"#ff6375",NewLisp:"#87AED7",Nextflow:"#3ac486",Nim:"#37775b",Nit:"#009917",Nix:"#7e7eff",Nu:"#c9df40","Objective-C":"#438eff","Objective-C++":"#6866fb","Objective-J":"#ff0c5a",OCaml:"#3be133",Omgrofl:"#cabbff",ooc:"#b0b77e",Opal:"#f7ede0",Oxygene:"#cdd0e3",Oz:"#fab738",P4:"#7055b5",Pan:"#cc0000",Papyrus:"#6600cc",Parrot:"#f3ca0a",Pascal:"#E3F171",Pawn:"#dbb284",Pep8:"#C76F5B",Perl:"#0298c3","Perl 6":"#0000fb",PHP:"#4F5D95",PigLatin:"#fcd7de",Pike:"#005390",PLSQL:"#dad8d8",PogoScript:"#d80074",PostScript:"#da291c",PowerBuilder:"#8f0f8d",PowerShell:"#012456",Processing:"#0096D8",Prolog:"#74283c","Propeller Spin":"#7fa2a7",Puppet:"#302B6D",PureBasic:"#5a6986",PureScript:"#1D222D",Python:"#3572A5",q:"#0040cd",QML:"#44a51c",Quake:"#882233",R:"#198CE7",Racket:"#3c5caa",Ragel:"#9d5200",RAML:"#77d9fb",Rascal:"#fffaa0",Rebol:"#358a5b",Red:"#f50000","Ren'Py":"#ff7f7f",Ring:"#2D54CB",Roff:"#ecdebe",Rouge:"#cc0088",Ruby:"#701516",RUNOFF:"#665a4e",Rust:"#dea584",SaltStack:"#646464",SAS:"#B34936",Scala:"#c22d40",Scheme:"#1e4aec",sed:"#64b970",Self:"#0579aa",Shell:"#89e051",Shen:"#120F14",Slash:"#007eff",Slice:"#003fa2",Smalltalk:"#596706",Solidity:"#AA6746",SourcePawn:"#5c7611",SQF:"#3F3F3F",Squirrel:"#800000","SRecode Template":"#348a34",Stan:"#b2011d","Standard ML":"#dc566d",SuperCollider:"#46390b",Swift:"#ffac45",SystemVerilog:"#DAE1C2",Tcl:"#e4cc98",Terra:"#00004c",TeX:"#3D6117","TI Program":"#A0AA87",Turing:"#cf142b",TypeScript:"#2b7489",UnrealScript:"#a54c4d",Vala:"#fbe5cd",VCL:"#148AA8",Verilog:"#b2b7f8",VHDL:"#adb2cb","Vim script":"#199f4b","Visual Basic":"#945db7",Volt:"#1F1F1F",Vue:"#2c3e50",wdl:"#42f1f4",WebAssembly:"#04133b",wisp:"#7582D1",X10:"#4B6BEF",xBase:"#403a40",XC:"#99DA07",XQuery:"#5232e7",XSLT:"#EB8CEB",Yacc:"#4B6C4B",YARA:"#220000",YASnippet:"#32AB90",ZAP:"#0d665e",Zephir:"#118f9e",Zig:"#ec915c",ZIL:"#dc75e5",Other:"#bbb"},u={"#76CA61":"#fff","#24565A":"#fff","#FDD835":"#000","#50B0BA":"#fff","#FF5858":"#fff","#B0753F":"#fff","#25CDEB":"#000","#387EED":"#fff","#ED3DC6":"#fff","#512DA8":"#fff"};var h=function(e){return d[e]?d[e]:function(e,t){void 0===e&&(e=""),void 0===t&&(t=!0);var n,r,a=(n=function(e){for(var t=0,n=0;n<e.length;n+=1)t=e.charCodeAt(n)+((t<<5)-t);return t}(e),r=(16777215&n).toString(16).toUpperCase(),"00000".substring(0,6-r.length)+r);if(!t)return("#"+a).toLowerCase();var i=parseInt(a,16),o=Object.keys(u).map((function(e){return parseInt(e.replace("#",""),16)})).reduce((function(e,t){return Math.abs(t-i)<Math.abs(e-i)?t:e})).toString(16);return["#"+o,u["#"+o.toUpperCase()]]}(e,!1)},f=function(e){return Math.round(e)},p="codersrank-skills-chart",g=document.createElement("div"),b=function(n){var r,a;function i(){var e;return(e=n.call(this)||this).shadowEl=e.attachShadow({mode:"closed"}),e.stylesEl=document.createElement("style"),e.stylesEl.textContent=":host{--font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;--svg-width:100%;--svg-height:auto;--axis-bg-color:rgba(0, 0, 0, 0.35);--hidden-area-color:#ddd;--label-text-color:inherit;--label-font-size:10px;--label-font-weight:500;--legend-text-color:inherit;--legend-disabled-text-color:#ccc;--legend-font-size:14px;--preloader-color:#72a0a8;--tooltip-font-size:12px;--tooltip-total-font-size:16px;--tooltip-total-font-weight:bold;width:100%;display:block;position:relative;box-sizing:border-box}.codersrank-skills-chart{font-family:var(--font-family);position:relative}.codersrank-skills-chart-preloader{position:absolute;left:50%;top:50%;width:32px;height:32px;margin:-16px 0 0 -16px;border:3px solid var(--preloader-color);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;box-sizing:border-box;-webkit-animation:preloader 1s infinite linear;animation:preloader 1s infinite linear}.codersrank-skills-chart-svg{position:relative}.codersrank-skills-chart svg{width:var(--svg-width);height:var(--svg-height);display:block}.codersrank-skills-chart polygon{transition-duration:150ms}.codersrank-skills-chart-current-line{stroke:rgba(0,0,0,.25);stroke-width:1px}.codersrank-skills-chart-hidden{fill:var(--hidden-area-color)!important}.codersrank-skills-chart-axis{margin-bottom:36px;height:1px;background:var(--axis-bg-color);color:inherit;display:flex;font-size:var(--label-font-size);font-weight:var(--label-font-weight);justify-content:space-between;line-height:1;color:var(--label-text-color)}.codersrank-skills-chart-axis>span{padding-top:10px;width:0;display:flex;align-items:flex-start;justify-content:center;white-space:nowrap}.codersrank-skills-chart-axis>span:first-child{justify-content:flex-start}.codersrank-skills-chart-axis>span:last-child{justify-content:flex-end}.codersrank-skills-chart-tooltip{pointer-events:none;text-align:left;line-height:1.4;position:absolute;background:#000;border-radius:4px;color:#fff;font-family:var(--font-family);padding:8px;font-size:var(--tooltip-font-size);white-space:nowrap;pointer-events:none;top:50%;transform:translateX(-100%) translateY(-50%);margin-left:-10px}.codersrank-skills-chart-tooltip-right{margin-left:10px;transform:translateY(-50%)}.codersrank-skills-chart-tooltip-label{color:rgba(255,255,255,.75)}.codersrank-skills-chart-tooltip-total{font-size:var(--tooltip-total-font-size);font-weight:var(--tooltip-total-font-weight)}.codersrank-skills-chart-tooltip-list{list-style:none;margin:0;padding:0}.codersrank-skills-chart-tooltip-list span{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:4px}.codersrank-skills-chart-legend{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;font-size:var(--legend-font-size);width:100%;color:var(--legend-text-color);margin-top:36px}.codersrank-skills-chart-legend-button{color:inherit;width:auto;-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;background-color:transparent;border-radius:0;border:none;outline:0!important;cursor:pointer;font-family:inherit;font-size:inherit;box-shadow:none!important;display:flex;align-items:center;font-weight:500;transition-duration:.2s;padding:4px 8px}.codersrank-skills-chart-legend-button span{transition-duration:.2s;width:14px;height:14px;margin-right:4px;border-radius:50%}.codersrank-skills-chart-legend-button-hidden{color:var(--legend-disabled-text-color)}.codersrank-skills-chart-legend-button-hidden span{background-color:var(--legend-disabled-text-color)!important}@-webkit-keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}",e.shadowEl.appendChild(e.stylesEl),e.onMouseEnter=e.onMouseEnter.bind(s(e)),e.onMouseLeave=e.onMouseLeave.bind(s(e)),e.onClick=e.onClick.bind(s(e)),e.formatLabel=e.formatLabel.bind(s(e)),e.onSVGMouseEnter=e.onSVGMouseEnter.bind(s(e)),e.onSVGMouseMove=e.onSVGMouseMove.bind(s(e)),e.onSVGMouseLeave=e.onSVGMouseLeave.bind(s(e)),e.linesOffsets=[],e.currentIndex=null,e.hiddenDatasets=[],e.highlightedDatasetLabel=null,e.highlightedDatasetTimeout=null,e.maxLabels=8,e.mounted=!1,e.state=0,e.data={labels:[],datasets:[]},e}a=n,(r=i).prototype=Object.create(a.prototype),r.prototype.constructor=r,r.__proto__=a;var o,d,u,p=i.prototype;return p.formatLabel=function(e){return e?Intl.DateTimeFormat("en",{year:"numeric",month:"short"}).format(new Date(e)):""},p.render=function(){var e=this.username,n=this.mounted,r=this.state,a=this.shadowEl,i={data:this.data,svgWidth:this.svgWidth,svgHeight:this.svgHeight,legend:this.legend,labels:this.labels,hiddenDatasets:this.hiddenDatasets,highlightedDatasetLabel:this.highlightedDatasetLabel,visibleLabels:this.visibleLabels,currentIndex:this.currentIndex,formatLabel:this.formatLabel};if(this.detachSVGEvents(),e&&n){3===r?g.innerHTML=c(i):2===r?g.innerHTML="":0!==r&&1!==r||(g.innerHTML=function(e){return c(t({},e,{preloader:!0,data:{labels:[],datasets:[]}}))}(i));var o=a.querySelector(".codersrank-skills-chart");o&&o.parentNode.removeChild(o),(o=g.querySelector(".codersrank-skills-chart"))&&(this.widgetEl=o,a.appendChild(o),this.attachSVGEvents())}},p.loadAndRender=function(){var e=this,t=this.username;this.state=1,this.render(),function(e){return l[e]?Promise.resolve(l[e]):fetch("https://grpcgateway.codersrank.io/candidate/"+e+"/GetScoreProgress",{method:"GET",headers:{"Content-Type":"application/json"}}).then((function(e){return e.json()})).then((function(t){return l[e]=t,t})).catch((function(e){return console.error(e),Promise.reject(e)}))}(t).then((function(t){e.data=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=[]);var n=[].concat(e);n.reverse();var r=[];n.forEach((function(e){e.languages.forEach((function(e){t.length>0&&!t.map((function(e){return e.toLowerCase()})).includes(e.language.toLowerCase())||r.includes(e.language)||r.push(e.language)}))}));var a=n.map((function(e){return e.date})),i=r.map((function(e){var t=[];return n.forEach((function(n){var r=n.languages.filter((function(t){return t.language===e}))[0];t.push(r?r.score:0)})),{label:e,color:h(e),values:t}}));return i.sort((function(e,t){return"Other"===t.label?-1:e.label>t.label?1:-1})),{labels:a,datasets:i}}(t.scores,e.displaySkills),e.state=3,e.render()})).catch((function(){e.state=2,e.render()}))},p.tooltipText=function(){var e=this,t=this.currentIndex,n=this.data,r=n.datasets,a=n.labels;if(null===t)return"";var i=0,o=r.filter((function(n){return!e.hiddenDatasets.includes(n.label)&&n.values[t]})).map((function(e){return{color:e.color,label:e.label,value:e.values[t]}}));return o.forEach((function(e){i+=e.value})),'\n <div class="codersrank-skills-chart-tooltip-label">'+this.formatLabel(a[t])+'</div>\n <div class="codersrank-skills-chart-tooltip-total">'+(f(i)+" exp. points")+"</div>\n "+(o.length>0?'\n <ul class="codersrank-skills-chart-tooltip-list">\n '+o.map((function(e){var t=e.label,n=e.color,r=e.value;return'\n <li><span style="background-color: '+n+';"></span>'+(t+": "+f(r))+"</li>\n "})).join("")+"\n </ul>":"")+"\n "},p.showTooltip=function(){var e=this;if(this.tooltip)if(this.data.datasets.filter((function(t){return!e.hiddenDatasets.includes(t.label)})).length){var t=this.shadowEl.querySelector(".codersrank-skills-chart-current-line");t&&t.classList.remove("codersrank-skills-chart-current-line");var n=this.shadowEl.querySelector('line[data-index="'+this.currentIndex+'"]');if(n){n.classList.add("codersrank-skills-chart-current-line");var r=this.widgetEl.querySelector(".codersrank-skills-chart-tooltip");r?r.innerHTML=this.tooltipText():(g.innerHTML='\n <div class="codersrank-skills-chart-tooltip">\n '+this.tooltipText()+"\n </div>\n ",r=g.querySelector(".codersrank-skills-chart-tooltip"),this.widgetEl.querySelector(".codersrank-skills-chart-svg").appendChild(r));var a=this.widgetEl.getBoundingClientRect(),i=n.getBoundingClientRect().left-a.left;i<180?r.classList.add("codersrank-skills-chart-tooltip-right"):r.classList.remove("codersrank-skills-chart-tooltip-right"),r.style.left=i+"px"}}else this.hideTooltip()},p.hideTooltip=function(){if(this.tooltip){var e=this.shadowEl.querySelector(".codersrank-skills-chart-current-line");e&&e.classList.remove("codersrank-skills-chart-current-line");var t=this.shadowEl.querySelector(".codersrank-skills-chart-tooltip");t&&this.widgetEl.querySelector(".codersrank-skills-chart-svg").removeChild(t)}},p.toggleDataset=function(e){this.hiddenDatasets.includes(e)?this.hiddenDatasets.splice(this.hiddenDatasets.indexOf(e),1):(this.hiddenDatasets.push(e),this.highlightedDatasetLabel=null),this.render()},p.onClick=function(e){var t;if("BUTTON"===e.target.tagName?t=e.target:e.target.parentNode&&"BUTTON"===e.target.parentNode.tagName&&(t=e.target.parentNode),t){var n=t.getAttribute("data-label");this.toggleDataset(n)}},p.onMouseEnter=function(e){var t;if(this.widgetEl&&("BUTTON"===e.target.tagName&&(t=e.target),t)){var n=t.getAttribute("data-label");if(n){this.highlightedDatasetLabel=n;var r=this.widgetEl.querySelector('polygon[data-label="'+n+'"]');if(r){clearTimeout(this.highlightedDatasetTimeout);for(var a=this.widgetEl.querySelectorAll("polygon"),i=0;i<a.length;i+=1)a[i].classList.add("codersrank-skills-chart-hidden");r.classList.remove("codersrank-skills-chart-hidden")}}}},p.onMouseLeave=function(e){var t=this;"BUTTON"===e.target.tagName&&(this.highlightedDatasetTimeout=setTimeout((function(){if(t.widgetEl){var e=t.widgetEl.querySelectorAll("polygon");if(e)for(var n=0;n<e.length;n+=1)e[n].classList.remove("codersrank-skills-chart-hidden")}}),100))},p.calcLinesOffsets=function(){var e=this.widgetEl.querySelectorAll("line");this.linesOffsets=[];for(var t=0;t<e.length;t+=1)this.linesOffsets.push(e[t].getBoundingClientRect().left)},p.onSVGMouseEnter=function(){this.tooltip&&this.calcLinesOffsets()},p.onSVGMouseMove=function(e){if(this.tooltip){var t=e.pageX;void 0===t&&(t=0);var n=this.linesOffsets.map((function(e){return Math.abs(t-e)})),r=Math.min.apply(Math,n),a=n.indexOf(r);this.currentIndex=a,this.showTooltip()}},p.onSVGMouseLeave=function(){this.tooltip&&(this.currentIndex=null,this.hideTooltip())},p.attachSVGEvents=function(){if(this.widgetEl){var e=this.widgetEl.querySelector("svg");e&&(e.addEventListener("mouseenter",this.onSVGMouseEnter),e.addEventListener("mousemove",this.onSVGMouseMove),e.addEventListener("mouseleave",this.onSVGMouseLeave))}},p.detachSVGEvents=function(){if(this.widgetEl){var e=this.widgetEl.querySelector("svg");e&&(e.removeEventListener("mouseenter",this.onSVGMouseEnter),e.removeEventListener("mousemove",this.onSVGMouseMove),e.removeEventListener("mouseleave",this.onSVGMouseLeave))}},p.attributeChangedCallback=function(){this.mounted&&this.loadAndRender()},p.connectedCallback=function(){this.width=this.offsetWidth,this.mounted=!0,this.loadAndRender(),this.shadowEl.addEventListener("click",this.onClick,!0),this.shadowEl.addEventListener("mouseenter",this.onMouseEnter,!0),this.shadowEl.addEventListener("mouseleave",this.onMouseLeave,!0)},p.disconnectedCallback=function(){this.mounted=!1,this.shadowEl.removeEventListener("click",this.onClick),this.shadowEl.removeEventListener("mouseenter",this.onMouseEnter),this.shadowEl.removeEventListener("mouseleave",this.onMouseLeave),this.detachSVGEvents()},o=i,u=[{key:"observedAttributes",get:function(){return["username","svg-width","svg-height","legend","labels","skills"]}}],(d=[{key:"visibleLabels",get:function(){if(!this.maxLabels||this.data.labels.length<=this.maxLabels)return this.data.labels;var e=Math.ceil(this.data.labels.length/this.maxLabels);return this.data.labels.filter((function(t,n){return n%e==0}))}},{key:"displaySkills",get:function(){var e=this.getAttribute("skills")||"";return"string"!=typeof e?[]:e.split(",").map((function(e){return e.trim()})).filter((function(e){return!!e}))}},{key:"tooltip",get:function(){var e=this.getAttribute("tooltip");return""===e||"true"===e}},{key:"username",get:function(){return this.getAttribute("username")}},{key:"svgWidth",get:function(){return parseInt(this.getAttribute("svg-width")||0,10)||640}},{key:"svgHeight",get:function(){return parseInt(this.getAttribute("svg-height")||0,10)||320}},{key:"legend",get:function(){var e=this.getAttribute("legend");return""===e||"true"===e}},{key:"labels",get:function(){var e=this.getAttribute("labels");return""===e||"true"===e}}])&&e(o.prototype,d),u&&e(o,u),i}(o(HTMLElement));window.customElements&&!window.customElements.get(p)&&window.customElements.define(p,b)}));
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function i(e,t,n){return(i=a()?Reflect.construct:function(e,t,n){var a=[null];a.push.apply(a,t);var i=new(Function.bind.apply(e,a));return n&&r(i,n.prototype),i}).apply(null,arguments)}function o(e){var t="function"==typeof Map?new Map:void 0;return(o=function(e){if(null===e||(a=e,-1===Function.toString.call(a).indexOf("[native code]")))return e;var a;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return i(e,arguments,n(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),r(o,e)})(e)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var l={},c=function(e){var t=void 0===e?{}:e,n=t.data,r=t.svgWidth,a=t.svgHeight,i=t.legend,o=t.labels,s=t.preloader,l=t.hiddenDatasets,c=t.highlightedDatasetLabel,d=t.visibleLabels,u=t.currentIndex,h=t.formatLabel,f=n.datasets,p=n.labels,g=function(){var e=function(){var e=[];return f.filter((function(e){return!l.includes(e.label)})).forEach((function(t){t.values.forEach((function(t,n){e[n]||(e[n]=0),e[n]+=t}))})),e}(),t=[];if(!f.length)return t;var n=f[0].values.map((function(){return 0})),i=Math.max.apply(Math,e);return f.filter((function(e){return!l.includes(e.label)})).forEach((function(e){var o=e.label,s=e.values,l=e.color,c=s.map((function(e,t){n[t]+=e;var o=n[t];return t/(s.length-1)*r+" "+(a-o/i*a)}));c.push(r+" "+a+" 0 "+a),t.push({label:o,points:c.join(" "),color:l})})),t.reverse()}(),b=function(){var e=[];if(!f.length)return e;var t=f[0].values;return t.forEach((function(n,a){var i=a/(t.length-1)*r;e.push(i)})),e}();return'\n <div class="codersrank-skills-chart">\n <div class="codersrank-skills-chart-svg">\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="'+r+'"\n height="'+a+'"\n viewBox="0 0 '+r+" "+a+'"\n preserveAspectRatio="none"\n >\n '+g.map((function(e){return'\n <polygon\n fill="'+e.color+'"\n fillRule="evenodd"\n points="'+e.points+'"\n data-label="'+e.label+'"\n class="'+(c&&c!==e.label?"codersrank-skills-chart-hidden":"")+'"\n />\n '})).join("")+"\n "+b.map((function(e,t){return'\n <line\n data-index="'+t+'"\n fill="#000"\n x1="'+e+'"\n y1="0"\n x2="'+e+'"\n y2="'+a+'"\n class="'+(u===t?"codersrank-skills-chart-current-line":"")+'"\n />\n '})).join("")+"\n </svg>\n "+(s?'\n <div class="codersrank-skills-chart-preloader"></div>\n ':"")+"\n </div>\n "+(o?'\n <div class="codersrank-skills-chart-axis">\n '+p.map((function(e){return"\n <span>\n "+(d.includes(e)?"\n <span>"+h(e)+"</span>\n ":"")+"\n </span>\n "})).join("")+"\n </div>\n ":"")+"\n "+(i?'\n <div class="codersrank-skills-chart-legend">\n '+f.map((function(e){return'\n <button\n data-label="'+e.label+'"\n class="codersrank-skills-chart-legend-button '+(l.includes(e.label)?"codersrank-skills-chart-legend-button-hidden":"")+'"\n type="button"\n >\n <span style="background-color: '+e.color+'"></span>\n '+e.label+"\n </button>\n "})).join("")+"\n </div>\n ":"")+"\n </div>\n "},d={"1C Enterprise":"#814CCC",ABAP:"#E8274B",ActionScript:"#882B0F",Ada:"#02f88c",Agda:"#315665","AGS Script":"#B9D9FF",Alloy:"#64C800",AMPL:"#E6EFBB",AngelScript:"#C7D7DC",ANTLR:"#9DC3FF","API Blueprint":"#2ACCA8",APL:"#5A8164",AppleScript:"#101F1F",Arc:"#aa2afe",ASP:"#6a40fd",AspectJ:"#a957b0",Assembly:"#6E4C13",Asymptote:"#4a0c0c",ATS:"#1ac620",AutoHotkey:"#6594b9",AutoIt:"#1C3552",Ballerina:"#FF5000",Batchfile:"#C1F12E",BlitzMax:"#cd6400",Boo:"#d4bec1",Brainfuck:"#2F2530",C:"#555555","C#":"#178600","C++":"#f34b7d",Ceylon:"#dfa535",Chapel:"#8dc63f",Cirru:"#ccccff",Clarion:"#db901e",Clean:"#3F85AF",Click:"#E4E6F3",Clojure:"#db5855",CoffeeScript:"#244776",ColdFusion:"#ed2cd6","Common Lisp":"#3fb68b","Common Workflow Language":"#B5314C","Component Pascal":"#B0CE4E",Crystal:"#000100",CSS:"#563d7c",Cuda:"#3A4E3A",D:"#ba595e",Dart:"#00B4AB",DataWeave:"#003a52",DM:"#447265",Dockerfile:"#384d54",Dogescript:"#cca760",Dylan:"#6c616e",E:"#ccce35",eC:"#913960",ECL:"#8a1267",Eiffel:"#946d57",Elixir:"#6e4a7e",Elm:"#60B5CC","Emacs Lisp":"#c065db",EmberScript:"#FFF4F3",EQ:"#a78649",Erlang:"#B83998","F#":"#b845fc","F*":"#572e30",Factor:"#636746",Fancy:"#7b9db4",Fantom:"#14253c",FLUX:"#88ccff",Forth:"#341708",Fortran:"#4d41b1",FreeMarker:"#0050b2",Frege:"#00cafe","Game Maker Language":"#71b417",GDScript:"#355570",Genie:"#fb855d",Gherkin:"#5B2063",Glyph:"#c1ac7f",Gnuplot:"#f0a9f0",Go:"#00ADD8",Golo:"#88562A",Gosu:"#82937f","Grammatical Framework":"#79aa7a",Groovy:"#e69f56",Hack:"#878787",Harbour:"#0e60e3",Haskell:"#5e5086",Haxe:"#df7900",HiveQL:"#dce200",HTML:"#e34c26",Hy:"#7790B2",IDL:"#a3522f",Idris:"#b30000",Io:"#a9188d",Ioke:"#078193",Isabelle:"#FEFE00",J:"#9EEDFF",Java:"#b07219",JavaScript:"#f1e05a",Jolie:"#843179",JSONiq:"#40d47e",Jsonnet:"#0064bd",Julia:"#a270ba","Jupyter Notebook":"#DA5B0B",Kotlin:"#F18E33",KRL:"#28430A",Lasso:"#999999",Lex:"#DBCA00",LFE:"#4C3023",LiveScript:"#499886",LLVM:"#185619",LOLCODE:"#cc9900",LookML:"#652B81",LSL:"#3d9970",Lua:"#000080",Makefile:"#427819",Mask:"#f97732",MATLAB:"#e16737",Max:"#c4a79c",MAXScript:"#00a6a6",mcfunction:"#E22837",Mercury:"#ff2b2b",Meson:"#007800",Metal:"#8f14e9",Mirah:"#c7a938","Modula-3":"#223388",MQL4:"#62A8D6",MQL5:"#4A76B8",MTML:"#b7e1f4",NCL:"#28431f",Nearley:"#990000",Nemerle:"#3d3c6e",nesC:"#94B0C7",NetLinx:"#0aa0ff","NetLinx+ERB":"#747faa",NetLogo:"#ff6375",NewLisp:"#87AED7",Nextflow:"#3ac486",Nim:"#37775b",Nit:"#009917",Nix:"#7e7eff",Nu:"#c9df40","Objective-C":"#438eff","Objective-C++":"#6866fb","Objective-J":"#ff0c5a",OCaml:"#3be133",Omgrofl:"#cabbff",ooc:"#b0b77e",Opal:"#f7ede0",Oxygene:"#cdd0e3",Oz:"#fab738",P4:"#7055b5",Pan:"#cc0000",Papyrus:"#6600cc",Parrot:"#f3ca0a",Pascal:"#E3F171",Pawn:"#dbb284",Pep8:"#C76F5B",Perl:"#0298c3","Perl 6":"#0000fb",PHP:"#4F5D95",PigLatin:"#fcd7de",Pike:"#005390",PLSQL:"#dad8d8",PogoScript:"#d80074",PostScript:"#da291c",PowerBuilder:"#8f0f8d",PowerShell:"#012456",Processing:"#0096D8",Prolog:"#74283c","Propeller Spin":"#7fa2a7",Puppet:"#302B6D",PureBasic:"#5a6986",PureScript:"#1D222D",Python:"#3572A5",q:"#0040cd",QML:"#44a51c",Quake:"#882233",R:"#198CE7",Racket:"#3c5caa",Ragel:"#9d5200",RAML:"#77d9fb",Rascal:"#fffaa0",Rebol:"#358a5b",Red:"#f50000","Ren'Py":"#ff7f7f",Ring:"#2D54CB",Roff:"#ecdebe",Rouge:"#cc0088",Ruby:"#701516",RUNOFF:"#665a4e",Rust:"#dea584",SaltStack:"#646464",SAS:"#B34936",Scala:"#c22d40",Scheme:"#1e4aec",sed:"#64b970",Self:"#0579aa",Shell:"#89e051",Shen:"#120F14",Slash:"#007eff",Slice:"#003fa2",Smalltalk:"#596706",Solidity:"#AA6746",SourcePawn:"#5c7611",SQF:"#3F3F3F",Squirrel:"#800000","SRecode Template":"#348a34",Stan:"#b2011d","Standard ML":"#dc566d",SuperCollider:"#46390b",Swift:"#ffac45",SystemVerilog:"#DAE1C2",Tcl:"#e4cc98",Terra:"#00004c",TeX:"#3D6117","TI Program":"#A0AA87",Turing:"#cf142b",TypeScript:"#2b7489",UnrealScript:"#a54c4d",Vala:"#fbe5cd",VCL:"#148AA8",Verilog:"#b2b7f8",VHDL:"#adb2cb","Vim script":"#199f4b","Visual Basic":"#945db7",Volt:"#1F1F1F",Vue:"#2c3e50",wdl:"#42f1f4",WebAssembly:"#04133b",wisp:"#7582D1",X10:"#4B6BEF",xBase:"#403a40",XC:"#99DA07",XQuery:"#5232e7",XSLT:"#EB8CEB",Yacc:"#4B6C4B",YARA:"#220000",YASnippet:"#32AB90",ZAP:"#0d665e",Zephir:"#118f9e",Zig:"#ec915c",ZIL:"#dc75e5",Other:"#bbb"},u={"#76CA61":"#fff","#24565A":"#fff","#FDD835":"#000","#50B0BA":"#fff","#FF5858":"#fff","#B0753F":"#fff","#25CDEB":"#000","#387EED":"#fff","#ED3DC6":"#fff","#512DA8":"#fff"};var h=function(e){return d[e]?d[e]:function(e,t){void 0===e&&(e=""),void 0===t&&(t=!0);var n,r,a=(n=function(e){for(var t=0,n=0;n<e.length;n+=1)t=e.charCodeAt(n)+((t<<5)-t);return t}(e),r=(16777215&n).toString(16).toUpperCase(),"00000".substring(0,6-r.length)+r);if(!t)return("#"+a).toLowerCase();var i=parseInt(a,16),o=Object.keys(u).map((function(e){return parseInt(e.replace("#",""),16)})).reduce((function(e,t){return Math.abs(t-i)<Math.abs(e-i)?t:e})).toString(16);return["#"+o,u["#"+o.toUpperCase()]]}(e,!1)},f=function(e){return Math.round(e)},p="codersrank-skills-chart",g=document.createElement("div"),b=function(n){var r,a;function i(){var e;return(e=n.call(this)||this).shadowEl=e.attachShadow({mode:"closed"}),e.stylesEl=document.createElement("style"),e.stylesEl.textContent=":host{--font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;--svg-width:100%;--svg-height:auto;--axis-bg-color:rgba(0, 0, 0, 0.35);--hidden-area-color:#ddd;--label-text-color:inherit;--label-font-size:10px;--label-font-weight:500;--legend-text-color:inherit;--legend-disabled-text-color:#ccc;--legend-font-size:14px;--preloader-color:#72a0a8;--tooltip-font-size:12px;--tooltip-total-font-size:16px;--tooltip-total-font-weight:bold;--other-skills-area-color:#bbb;width:100%;display:block;position:relative;box-sizing:border-box}.codersrank-skills-chart{font-family:var(--font-family);position:relative}.codersrank-skills-chart-preloader{position:absolute;left:50%;top:50%;width:32px;height:32px;margin:-16px 0 0 -16px;border:3px solid var(--preloader-color);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;box-sizing:border-box;-webkit-animation:preloader 1s infinite linear;animation:preloader 1s infinite linear}.codersrank-skills-chart-svg{position:relative}.codersrank-skills-chart svg{width:var(--svg-width);height:var(--svg-height);display:block}.codersrank-skills-chart polygon{transition-duration:150ms}.codersrank-skills-chart-current-line{stroke:rgba(0,0,0,.25);stroke-width:1px}.codersrank-skills-chart-hidden{fill:var(--hidden-area-color)!important}.codersrank-skills-chart-axis{margin-bottom:36px;height:1px;background:var(--axis-bg-color);color:inherit;display:flex;font-size:var(--label-font-size);font-weight:var(--label-font-weight);justify-content:space-between;line-height:1;color:var(--label-text-color)}.codersrank-skills-chart-axis>span{padding-top:10px;width:0;display:flex;align-items:flex-start;justify-content:center;white-space:nowrap}.codersrank-skills-chart-axis>span:first-child{justify-content:flex-start}.codersrank-skills-chart-axis>span:last-child{justify-content:flex-end}.codersrank-skills-chart-tooltip{pointer-events:none;text-align:left;line-height:1.4;position:absolute;background:#000;border-radius:4px;color:#fff;font-family:var(--font-family);padding:8px;font-size:var(--tooltip-font-size);white-space:nowrap;pointer-events:none;top:50%;transform:translateX(-100%) translateY(-50%);margin-left:-10px}.codersrank-skills-chart-tooltip-right{margin-left:10px;transform:translateY(-50%)}.codersrank-skills-chart-tooltip-label{color:rgba(255,255,255,.75)}.codersrank-skills-chart-tooltip-total{font-size:var(--tooltip-total-font-size);font-weight:var(--tooltip-total-font-weight)}.codersrank-skills-chart-tooltip-list{list-style:none;margin:0;padding:0}.codersrank-skills-chart-tooltip-list span{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:4px}.codersrank-skills-chart-legend{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;font-size:var(--legend-font-size);width:100%;color:var(--legend-text-color);margin-top:36px}.codersrank-skills-chart-legend-button{color:inherit;width:auto;-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;background-color:transparent;border-radius:0;border:none;outline:0!important;cursor:pointer;font-family:inherit;font-size:inherit;box-shadow:none!important;display:flex;align-items:center;font-weight:500;transition-duration:.2s;padding:4px 8px}.codersrank-skills-chart-legend-button span{transition-duration:.2s;width:14px;height:14px;margin-right:4px;border-radius:50%}.codersrank-skills-chart-legend-button-hidden{color:var(--legend-disabled-text-color)}.codersrank-skills-chart-legend-button-hidden span{background-color:var(--legend-disabled-text-color)!important}@-webkit-keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}",e.shadowEl.appendChild(e.stylesEl),e.onMouseEnter=e.onMouseEnter.bind(s(e)),e.onMouseLeave=e.onMouseLeave.bind(s(e)),e.onClick=e.onClick.bind(s(e)),e.formatLabel=e.formatLabel.bind(s(e)),e.onSVGMouseEnter=e.onSVGMouseEnter.bind(s(e)),e.onSVGMouseMove=e.onSVGMouseMove.bind(s(e)),e.onSVGMouseLeave=e.onSVGMouseLeave.bind(s(e)),e.linesOffsets=[],e.currentIndex=null,e.hiddenDatasets=[],e.highlightedDatasetLabel=null,e.highlightedDatasetTimeout=null,e.maxLabels=8,e.mounted=!1,e.state=0,e.data={labels:[],datasets:[]},e}a=n,(r=i).prototype=Object.create(a.prototype),r.prototype.constructor=r,r.__proto__=a;var o,d,u,p=i.prototype;return p.getHighestScore=function(e){var t=0,n=null;return e.forEach((function(e){var r=0;e.languages.forEach((function(e){r+=e.score})),r>t&&(t=r,n=e.date)})),{score:t,date:n}},p.emitData=function(e){void 0===e&&(e={});var t=e.scores||{},n=new CustomEvent("data",{detail:{scores:t,highest:this.getHighestScore(t)}});this.dispatchEvent(n)},p.emitError=function(e){var t=new CustomEvent("error",{detail:e});this.dispatchEvent(t)},p.formatLabel=function(e){return e?Intl.DateTimeFormat("en",{year:"numeric",month:"short"}).format(new Date(e)):""},p.render=function(){var e=this.username,n=this.mounted,r=this.state,a=this.shadowEl,i={data:this.data,svgWidth:this.svgWidth,svgHeight:this.svgHeight,legend:this.legend,labels:this.labels,hiddenDatasets:this.hiddenDatasets,highlightedDatasetLabel:this.highlightedDatasetLabel,visibleLabels:this.visibleLabels,currentIndex:this.currentIndex,formatLabel:this.formatLabel};if(this.detachSVGEvents(),e&&n){3===r?g.innerHTML=c(i):2===r?g.innerHTML="":0!==r&&1!==r||(g.innerHTML=function(e){return c(t({},e,{preloader:!0,data:{labels:[],datasets:[]}}))}(i));var o=a.querySelector(".codersrank-skills-chart");o&&o.parentNode.removeChild(o),(o=g.querySelector(".codersrank-skills-chart"))&&(this.widgetEl=o,a.appendChild(o),this.attachSVGEvents())}},p.loadAndRender=function(){var e=this,t=this.username;this.state=1,this.render(),function(e){return l[e]?Promise.resolve(l[e]):fetch("https://grpcgateway.codersrank.io/candidate/"+e+"/GetScoreProgress",{method:"GET",headers:{"Content-Type":"application/json"}}).then((function(e){return e.json()})).then((function(t){return t&&400===t.code?Promise.reject(t):(l[e]=t,t)})).catch((function(e){return Promise.reject(e)}))}(t).then((function(t){e.emitData(t),e.data=function(e,t,n){void 0===e&&(e=[]),void 0===t&&(t=[]),void 0===n&&(n=!1);var r=[].concat(e);r.reverse();var a=[];r.forEach((function(e){e.languages.forEach((function(e){t.length>0&&!t.map((function(e){return e.toLowerCase()})).includes(e.language.toLowerCase())||a.includes(e.language)||a.push(e.language)}))}));var i,o=r.map((function(e){return e.date})),s=a.map((function(e){var t=[];return r.forEach((function(n){var r=n.languages.filter((function(t){return t.language===e}))[0];t.push(r?r.score:0)})),{label:e,color:h(e),values:t}}));if(n){var l=[];r.forEach((function(e){var t=0;e.languages.forEach((function(e){a.includes(e.language)||(t+=e.score)})),l.push(t)})),i={label:"Other",color:"var(--other-skills-area-color)",values:l}}return s.sort((function(e,t){return e.label>t.label?1:-1})),i&&s.push(i),{labels:o,datasets:s}}(t.scores,e.displaySkills,e.showOtherSkills),e.state=3,e.render()})).catch((function(t){e.emitError(t),e.state=2,e.render()}))},p.tooltipText=function(){var e=this,t=this.currentIndex,n=this.data,r=n.datasets,a=n.labels;if(null===t)return"";var i=0,o=r.filter((function(n){return!e.hiddenDatasets.includes(n.label)&&n.values[t]})).map((function(e){return{color:e.color,label:e.label,value:e.values[t]}}));return o.forEach((function(e){i+=e.value})),'\n <div class="codersrank-skills-chart-tooltip-label">'+this.formatLabel(a[t])+'</div>\n <div class="codersrank-skills-chart-tooltip-total">'+(f(i)+" exp. points")+"</div>\n "+(o.length>0?'\n <ul class="codersrank-skills-chart-tooltip-list">\n '+o.map((function(e){var t=e.label,n=e.color,r=e.value;return'\n <li><span style="background-color: '+n+';"></span>'+(t+": "+f(r))+"</li>\n "})).join("")+"\n </ul>":"")+"\n "},p.showTooltip=function(){var e=this;if(this.tooltip)if(this.data.datasets.filter((function(t){return!e.hiddenDatasets.includes(t.label)})).length){var t=this.shadowEl.querySelector(".codersrank-skills-chart-current-line");t&&t.classList.remove("codersrank-skills-chart-current-line");var n=this.shadowEl.querySelector('line[data-index="'+this.currentIndex+'"]');if(n){n.classList.add("codersrank-skills-chart-current-line");var r=this.widgetEl.querySelector(".codersrank-skills-chart-tooltip");r?r.innerHTML=this.tooltipText():(g.innerHTML='\n <div class="codersrank-skills-chart-tooltip">\n '+this.tooltipText()+"\n </div>\n ",r=g.querySelector(".codersrank-skills-chart-tooltip"),this.widgetEl.querySelector(".codersrank-skills-chart-svg").appendChild(r));var a=this.widgetEl.getBoundingClientRect(),i=n.getBoundingClientRect().left-a.left;i<180?r.classList.add("codersrank-skills-chart-tooltip-right"):r.classList.remove("codersrank-skills-chart-tooltip-right"),r.style.left=i+"px"}}else this.hideTooltip()},p.hideTooltip=function(){if(this.tooltip){var e=this.shadowEl.querySelector(".codersrank-skills-chart-current-line");e&&e.classList.remove("codersrank-skills-chart-current-line");var t=this.shadowEl.querySelector(".codersrank-skills-chart-tooltip");t&&this.widgetEl.querySelector(".codersrank-skills-chart-svg").removeChild(t)}},p.toggleDataset=function(e){this.hiddenDatasets.includes(e)?this.hiddenDatasets.splice(this.hiddenDatasets.indexOf(e),1):(this.hiddenDatasets.push(e),this.highlightedDatasetLabel=null),this.render()},p.onClick=function(e){var t;if("BUTTON"===e.target.tagName?t=e.target:e.target.parentNode&&"BUTTON"===e.target.parentNode.tagName&&(t=e.target.parentNode),t){var n=t.getAttribute("data-label");this.toggleDataset(n)}},p.onMouseEnter=function(e){var t;if(this.widgetEl&&("BUTTON"===e.target.tagName&&(t=e.target),t)){var n=t.getAttribute("data-label");if(n){this.highlightedDatasetLabel=n;var r=this.widgetEl.querySelector('polygon[data-label="'+n+'"]');if(r){clearTimeout(this.highlightedDatasetTimeout);for(var a=this.widgetEl.querySelectorAll("polygon"),i=0;i<a.length;i+=1)a[i].classList.add("codersrank-skills-chart-hidden");r.classList.remove("codersrank-skills-chart-hidden")}}}},p.onMouseLeave=function(e){var t=this;"BUTTON"===e.target.tagName&&(this.highlightedDatasetTimeout=setTimeout((function(){if(t.widgetEl){var e=t.widgetEl.querySelectorAll("polygon");if(e)for(var n=0;n<e.length;n+=1)e[n].classList.remove("codersrank-skills-chart-hidden")}}),100))},p.calcLinesOffsets=function(){var e=this.widgetEl.querySelectorAll("line");this.linesOffsets=[];for(var t=0;t<e.length;t+=1)this.linesOffsets.push(e[t].getBoundingClientRect().left)},p.onSVGMouseEnter=function(){this.tooltip&&this.calcLinesOffsets()},p.onSVGMouseMove=function(e){if(this.tooltip){var t=e.pageX;void 0===t&&(t=0);var n=this.linesOffsets.map((function(e){return Math.abs(t-e)})),r=Math.min.apply(Math,n),a=n.indexOf(r);this.currentIndex=a,this.showTooltip()}},p.onSVGMouseLeave=function(){this.tooltip&&(this.currentIndex=null,this.hideTooltip())},p.attachSVGEvents=function(){if(this.widgetEl){var e=this.widgetEl.querySelector("svg");e&&(e.addEventListener("mouseenter",this.onSVGMouseEnter),e.addEventListener("mousemove",this.onSVGMouseMove),e.addEventListener("mouseleave",this.onSVGMouseLeave))}},p.detachSVGEvents=function(){if(this.widgetEl){var e=this.widgetEl.querySelector("svg");e&&(e.removeEventListener("mouseenter",this.onSVGMouseEnter),e.removeEventListener("mousemove",this.onSVGMouseMove),e.removeEventListener("mouseleave",this.onSVGMouseLeave))}},p.attributeChangedCallback=function(){this.mounted&&this.loadAndRender()},p.connectedCallback=function(){this.width=this.offsetWidth,this.mounted=!0,this.loadAndRender(),this.shadowEl.addEventListener("click",this.onClick,!0),this.shadowEl.addEventListener("mouseenter",this.onMouseEnter,!0),this.shadowEl.addEventListener("mouseleave",this.onMouseLeave,!0)},p.disconnectedCallback=function(){this.mounted=!1,this.shadowEl.removeEventListener("click",this.onClick),this.shadowEl.removeEventListener("mouseenter",this.onMouseEnter),this.shadowEl.removeEventListener("mouseleave",this.onMouseLeave),this.detachSVGEvents()},o=i,u=[{key:"observedAttributes",get:function(){return["username","svg-width","svg-height","legend","labels","skills","show-other-skills"]}}],(d=[{key:"visibleLabels",get:function(){if(!this.maxLabels||this.data.labels.length<=this.maxLabels)return this.data.labels;var e=Math.ceil(this.data.labels.length/this.maxLabels);return this.data.labels.filter((function(t,n){return n%e==0}))}},{key:"displaySkills",get:function(){var e=this.getAttribute("skills")||"";return"string"!=typeof e?[]:e.split(",").map((function(e){return e.trim()})).filter((function(e){return!!e}))}},{key:"showOtherSkills",get:function(){var e=this.getAttribute("show-other-skills");return""===e||"true"===e}},{key:"tooltip",get:function(){var e=this.getAttribute("tooltip");return""===e||"true"===e}},{key:"username",get:function(){return this.getAttribute("username")}},{key:"svgWidth",get:function(){return parseInt(this.getAttribute("svg-width")||0,10)||640}},{key:"svgHeight",get:function(){return parseInt(this.getAttribute("svg-height")||0,10)||320}},{key:"legend",get:function(){var e=this.getAttribute("legend");return""===e||"true"===e}},{key:"labels",get:function(){var e=this.getAttribute("labels");return""===e||"true"===e}}])&&e(o.prototype,d),u&&e(o,u),i}(o(HTMLElement));window.customElements&&!window.customElements.get(p)&&window.customElements.define(p,b)}));
//# sourceMappingURL=codersrank-skills-chart.min.js.map

@@ -34,3 +34,3 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

var STYLES = ":host{--font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;--svg-width:100%;--svg-height:auto;--axis-bg-color:rgba(0, 0, 0, 0.35);--hidden-area-color:#ddd;--label-text-color:inherit;--label-font-size:10px;--label-font-weight:500;--legend-text-color:inherit;--legend-disabled-text-color:#ccc;--legend-font-size:14px;--preloader-color:#72a0a8;--tooltip-font-size:12px;--tooltip-total-font-size:16px;--tooltip-total-font-weight:bold;width:100%;display:block;position:relative;box-sizing:border-box}.codersrank-skills-chart{font-family:var(--font-family);position:relative}.codersrank-skills-chart-preloader{position:absolute;left:50%;top:50%;width:32px;height:32px;margin:-16px 0 0 -16px;border:3px solid var(--preloader-color);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;box-sizing:border-box;-webkit-animation:preloader 1s infinite linear;animation:preloader 1s infinite linear}.codersrank-skills-chart-svg{position:relative}.codersrank-skills-chart svg{width:var(--svg-width);height:var(--svg-height);display:block}.codersrank-skills-chart polygon{transition-duration:150ms}.codersrank-skills-chart-current-line{stroke:rgba(0,0,0,.25);stroke-width:1px}.codersrank-skills-chart-hidden{fill:var(--hidden-area-color)!important}.codersrank-skills-chart-axis{margin-bottom:36px;height:1px;background:var(--axis-bg-color);color:inherit;display:flex;font-size:var(--label-font-size);font-weight:var(--label-font-weight);justify-content:space-between;line-height:1;color:var(--label-text-color)}.codersrank-skills-chart-axis>span{padding-top:10px;width:0;display:flex;align-items:flex-start;justify-content:center;white-space:nowrap}.codersrank-skills-chart-axis>span:first-child{justify-content:flex-start}.codersrank-skills-chart-axis>span:last-child{justify-content:flex-end}.codersrank-skills-chart-tooltip{pointer-events:none;text-align:left;line-height:1.4;position:absolute;background:#000;border-radius:4px;color:#fff;font-family:var(--font-family);padding:8px;font-size:var(--tooltip-font-size);white-space:nowrap;pointer-events:none;top:50%;transform:translateX(-100%) translateY(-50%);margin-left:-10px}.codersrank-skills-chart-tooltip-right{margin-left:10px;transform:translateY(-50%)}.codersrank-skills-chart-tooltip-label{color:rgba(255,255,255,.75)}.codersrank-skills-chart-tooltip-total{font-size:var(--tooltip-total-font-size);font-weight:var(--tooltip-total-font-weight)}.codersrank-skills-chart-tooltip-list{list-style:none;margin:0;padding:0}.codersrank-skills-chart-tooltip-list span{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:4px}.codersrank-skills-chart-legend{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;font-size:var(--legend-font-size);width:100%;color:var(--legend-text-color);margin-top:36px}.codersrank-skills-chart-legend-button{color:inherit;width:auto;-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;background-color:transparent;border-radius:0;border:none;outline:0!important;cursor:pointer;font-family:inherit;font-size:inherit;box-shadow:none!important;display:flex;align-items:center;font-weight:500;transition-duration:.2s;padding:4px 8px}.codersrank-skills-chart-legend-button span{transition-duration:.2s;width:14px;height:14px;margin-right:4px;border-radius:50%}.codersrank-skills-chart-legend-button-hidden{color:var(--legend-disabled-text-color)}.codersrank-skills-chart-legend-button-hidden span{background-color:var(--legend-disabled-text-color)!important}@-webkit-keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}";
var STYLES = ":host{--font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;--svg-width:100%;--svg-height:auto;--axis-bg-color:rgba(0, 0, 0, 0.35);--hidden-area-color:#ddd;--label-text-color:inherit;--label-font-size:10px;--label-font-weight:500;--legend-text-color:inherit;--legend-disabled-text-color:#ccc;--legend-font-size:14px;--preloader-color:#72a0a8;--tooltip-font-size:12px;--tooltip-total-font-size:16px;--tooltip-total-font-weight:bold;--other-skills-area-color:#bbb;width:100%;display:block;position:relative;box-sizing:border-box}.codersrank-skills-chart{font-family:var(--font-family);position:relative}.codersrank-skills-chart-preloader{position:absolute;left:50%;top:50%;width:32px;height:32px;margin:-16px 0 0 -16px;border:3px solid var(--preloader-color);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;box-sizing:border-box;-webkit-animation:preloader 1s infinite linear;animation:preloader 1s infinite linear}.codersrank-skills-chart-svg{position:relative}.codersrank-skills-chart svg{width:var(--svg-width);height:var(--svg-height);display:block}.codersrank-skills-chart polygon{transition-duration:150ms}.codersrank-skills-chart-current-line{stroke:rgba(0,0,0,.25);stroke-width:1px}.codersrank-skills-chart-hidden{fill:var(--hidden-area-color)!important}.codersrank-skills-chart-axis{margin-bottom:36px;height:1px;background:var(--axis-bg-color);color:inherit;display:flex;font-size:var(--label-font-size);font-weight:var(--label-font-weight);justify-content:space-between;line-height:1;color:var(--label-text-color)}.codersrank-skills-chart-axis>span{padding-top:10px;width:0;display:flex;align-items:flex-start;justify-content:center;white-space:nowrap}.codersrank-skills-chart-axis>span:first-child{justify-content:flex-start}.codersrank-skills-chart-axis>span:last-child{justify-content:flex-end}.codersrank-skills-chart-tooltip{pointer-events:none;text-align:left;line-height:1.4;position:absolute;background:#000;border-radius:4px;color:#fff;font-family:var(--font-family);padding:8px;font-size:var(--tooltip-font-size);white-space:nowrap;pointer-events:none;top:50%;transform:translateX(-100%) translateY(-50%);margin-left:-10px}.codersrank-skills-chart-tooltip-right{margin-left:10px;transform:translateY(-50%)}.codersrank-skills-chart-tooltip-label{color:rgba(255,255,255,.75)}.codersrank-skills-chart-tooltip-total{font-size:var(--tooltip-total-font-size);font-weight:var(--tooltip-total-font-weight)}.codersrank-skills-chart-tooltip-list{list-style:none;margin:0;padding:0}.codersrank-skills-chart-tooltip-list span{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:4px}.codersrank-skills-chart-legend{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;font-size:var(--legend-font-size);width:100%;color:var(--legend-text-color);margin-top:36px}.codersrank-skills-chart-legend-button{color:inherit;width:auto;-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;background-color:transparent;border-radius:0;border:none;outline:0!important;cursor:pointer;font-family:inherit;font-size:inherit;box-shadow:none!important;display:flex;align-items:center;font-weight:500;transition-duration:.2s;padding:4px 8px}.codersrank-skills-chart-legend-button span{transition-duration:.2s;width:14px;height:14px;margin-right:4px;border-radius:50%}.codersrank-skills-chart-legend-button-hidden{color:var(--legend-disabled-text-color)}.codersrank-skills-chart-legend-button-hidden span{background-color:var(--legend-disabled-text-color)!important}@-webkit-keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}";
var tempDiv = document.createElement('div'); // eslint-disable-next-line

@@ -73,6 +73,49 @@

return _this;
}
} // eslint-disable-next-line
var _proto = CodersRankSkillsChart.prototype;
_proto.getHighestScore = function getHighestScore(scores) {
var score = 0;
var date = null;
scores.forEach(function (scoreData) {
var summ = 0;
scoreData.languages.forEach(function (langData) {
summ += langData.score;
});
if (summ > score) {
score = summ;
date = scoreData.date;
}
});
return {
score: score,
date: date
};
};
_proto.emitData = function emitData(data) {
if (data === void 0) {
data = {};
}
var scores = data.scores || {};
var event = new CustomEvent('data', {
detail: {
scores: scores,
highest: this.getHighestScore(scores)
}
});
this.dispatchEvent(event);
};
_proto.emitError = function emitError(err) {
var event = new CustomEvent('error', {
detail: err
});
this.dispatchEvent(event);
};
// eslint-disable-next-line

@@ -146,7 +189,11 @@ _proto.formatLabel = function formatLabel(label) {

fetchData(username).then(function (data) {
_this2.data = getChartData(data.scores, _this2.displaySkills);
_this2.emitData(data);
_this2.data = getChartData(data.scores, _this2.displaySkills, _this2.showOtherSkills);
_this2.state = STATE_SUCCESS;
_this2.render();
})["catch"](function () {
})["catch"](function (err) {
_this2.emitError(err);
_this2.state = STATE_ERROR;

@@ -395,2 +442,9 @@

}, {
key: "showOtherSkills",
get: function get() {
var showOtherSkills = this.getAttribute('show-other-skills');
if (showOtherSkills === '' || showOtherSkills === 'true') return true;
return false;
}
}, {
key: "tooltip",

@@ -436,3 +490,3 @@ get: function get() {

get: function get() {
return ['username', 'svg-width', 'svg-height', 'legend', 'labels', 'skills'];
return ['username', 'svg-width', 'svg-height', 'legend', 'labels', 'skills', 'show-other-skills'];
}

@@ -439,0 +493,0 @@ }]);

@@ -12,2 +12,6 @@ var cache = {};

}).then(function (data) {
if (data && data.code === 400) {
return Promise.reject(data);
}
cache[username] = data;

@@ -17,5 +21,4 @@ return data;

// eslint-disable-next-line
console.error(err);
return Promise.reject(err);
});
};
import { getColor } from './get-color';
export var getChartData = function getChartData(data, displaySkills) {
export var getChartData = function getChartData(data, displaySkills, showOtherSkills) {
if (data === void 0) {

@@ -11,2 +11,6 @@ data = [];

if (showOtherSkills === void 0) {
showOtherSkills = false;
}
var scoresData = [].concat(data);

@@ -46,6 +50,30 @@ scoresData.reverse();

});
var otherDataset;
if (showOtherSkills) {
var values = [];
scoresData.forEach(function (score) {
var otherScore = 0;
score.languages.forEach(function (langData) {
if (!languagesList.includes(langData.language)) {
otherScore += langData.score;
}
});
values.push(otherScore);
});
otherDataset = {
label: 'Other',
color: 'var(--other-skills-area-color)',
values: values
};
}
datasets.sort(function (a, b) {
if (b.label === 'Other') return -1;
return a.label > b.label ? 1 : -1;
});
if (otherDataset) {
datasets.push(otherDataset);
}
return {

@@ -52,0 +80,0 @@ labels: labels,

{
"name": "@codersrank/skills-chart",
"version": "0.9.6",
"version": "0.9.7",
"description": "CodersRank skills chart widget",

@@ -5,0 +5,0 @@ "main": "cjs/codersrank-skills-chart.js",

@@ -47,11 +47,12 @@ # CodersRank Skills Chart Widget

| Name | Type | Default | Description |
| ------------ | --------- | ------- | ----------------------------------------------------------------------------------------- |
| `username` | `string` | | Your [CodersRank](https://codersrank.io) username |
| `labels` | `boolean` | `false` | Display chart labels (chart axis with dates) |
| `legend` | `boolean` | `false` | Display legend below the chart |
| `tooltip` | `boolean` | `false` | Enables tooltip with number of activities per day |
| `skills` | `string` | | Allows to specify skills to display in chart. For example `skills="JavaScript, Vue, CSS"` |
| `svg-width` | `number` | `640` | Render width of chart's SVG element. Ideally should match actual chart width |
| `svg-height` | `number` | `320` | Render height of chart's SVG element. Ideally should match actual chart height |
| Name | Type | Default | Description |
| ------------------- | --------- | ------- | ----------------------------------------------------------------------------------------- |
| `username` | `string` | | Your [CodersRank](https://codersrank.io) username |
| `labels` | `boolean` | `false` | Display chart labels (chart axis with dates) |
| `legend` | `boolean` | `false` | Display legend below the chart |
| `tooltip` | `boolean` | `false` | Enables tooltip with number of activities per day |
| `skills` | `string` | | Allows to specify skills to display in chart. For example `skills="JavaScript, Vue, CSS"` |
| `svg-width` | `number` | `640` | Render width of chart's SVG element. Ideally should match actual chart width |
| `svg-height` | `number` | `320` | Render height of chart's SVG element. Ideally should match actual chart height |
| `show-other-skills` | `boolean` | `false` | Group skills not specified in `skills` property under the "Other" chart area |

@@ -92,3 +93,57 @@ For example, to enable labels, legend and tooltip:

| `--tooltip-total-font-weight` | `bold` |
| `--other-skills-area-color` | `#bbb` |
For example, to change legend text color to `red` and font-size to `12px`, add this to CSS stylesheet:
```css
codersrank-skills-chart {
--legend-text-color: red;
--legend-font-size: 12px;
}
```
## Events
Widget element supports the following events:
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Detail</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>error</code></td>
<td>Will be fired on data request error</td>
<td>`event.detail` will contain an error object</td>
</tr>
<tr>
<td><code>data</code></td>
<td>Will be fired right after data request</td>
<td>
`event.detail` will contain an object with `highest` and `scores` properties.
<p>`highest` object contains information about when user had the highest score</p>
<p>`scores` array contains information about skills scores by dates</p>
</td>
</tr>
</tbody>
</table>
For example:
```html
<codersrank-skills-chart id="skills-chart" skils="..."></codersrank-skills-chart>
```
```js
function onData(event) {
const highest = event.detail.highest;
console.log(`Highest score was ${highest.score} on ${highest.date}`);
}
document.querySelector('#skills-chart').addEventListener('data', onData);
```
## Contribution

@@ -95,0 +150,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc