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by jsDelivr using Terser v5.39.0.\n * Original file: /npm/github-calendar@2.3.4/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\n\nvar parse = require(\"github-calendar-parser\"),\n    $ = require(\"elly\"),\n    addSubtractDate = require(\"add-subtract-date\"),\n    formatoid = require(\"formatoid\");\n\nvar DATE_FORMAT1 = \"MMM D, YYYY\",\n    DATE_FORMAT2 = \"MMMM D\";\n\nvar MONTH_NAMES = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\n\nfunction printDayCount(dayCount) {\n    return dayCount + \" \" + (dayCount === 1 ? \"day\" : \"days\");\n}\n\nfunction addTooltips(container) {\n    var tooltip = document.createElement(\"div\");\n    tooltip.classList.add(\"day-tooltip\");\n    container.appendChild(tooltip);\n\n    // Add mouse event listener to show & hide tooltip\n    var days = container.querySelectorAll(\".js-calendar-graph-svg rect.ContributionCalendar-day\");\n    days.forEach(function (day) {\n        day.addEventListener(\"mouseenter\", function (e) {\n            var contribCount = e.target.getAttribute(\"data-count\");\n            if (contribCount === \"0\") {\n                contribCount = \"No contributions\";\n            } else if (contribCount === \"1\") {\n                contribCount = \"1 contribution\";\n            } else {\n                contribCount = contribCount + \" contributions\";\n            }\n            var date = new Date(e.target.getAttribute(\"data-date\"));\n            var dateText = MONTH_NAMES[date.getUTCMonth()] + \" \" + date.getUTCDate() + \", \" + date.getUTCFullYear();\n            tooltip.innerHTML = \"<strong>\" + contribCount + \"</strong> on \" + dateText;\n            tooltip.classList.add(\"is-visible\");\n            var size = e.target.getBoundingClientRect(),\n                leftPos = size.left + window.pageXOffset - tooltip.offsetWidth / 2 + size.width / 2,\n                topPos = size.bottom + window.pageYOffset - tooltip.offsetHeight - 2 * size.height;\n            tooltip.style.top = topPos + \"px\";\n            tooltip.style.left = leftPos + \"px\";\n        });\n        day.addEventListener(\"mouseleave\", function () {\n            tooltip.classList.remove(\"is-visible\");\n        });\n    });\n}\n\n/**\n * GitHubCalendar\n * Brings the contributions calendar from GitHub (provided username) into your page.\n *\n * @name GitHubCalendar\n * @function\n * @param {String|HTMLElement} container The calendar container (query selector or the element itself).\n * @param {String} username The GitHub username.\n * @param {Object} options An object containing the following fields:\n *\n *    - `summary_text` (String): The text that appears under the calendar (defaults to: `\"Summary of\n *      pull requests, issues opened, and commits made by <username>\"`).\n *    - `proxy` (Function): A function that receives as argument the username (string) and should return a promise resolving the HTML content of the contributions page.\n *      The default is using @Bloggify's APIs.\n *    - `global_stats` (Boolean): If `false`, the global stats (total, longest and current streaks) will not be calculated and displayed. By default this is enabled.\n *    - `responsive` (Boolean): If `true`, the graph is changed to scale with the container. Custom CSS should be applied to the element to scale it appropriately. By default this is disabled.\n *    - `tooltips` (Boolean): If `true`, tooltips will be shown when hovered over calendar days. By default this is disabled.\n *    - `cache` (Number) The cache time in seconds.\n *\n * @return {Promise} A promise returned by the `fetch()` call.\n */\nmodule.exports = function GitHubCalendar(container, username, options) {\n\n    container = $(container);\n\n    options = options || {};\n    options.summary_text = options.summary_text || \"Summary of pull requests, issues opened, and commits made by <a href=\\\"https://github.com/\" + username + \"\\\" target=\\\"blank\\\">@\" + username + \"</a>\";\n    options.cache = (options.cache || 24 * 60 * 60) * 1000;\n\n    if (options.global_stats === false) {\n        container.style.minHeight = \"175px\";\n    }\n\n    var cacheKeys = {\n        content: \"gh_calendar_content.\" + username,\n        expire_at: \"gh_calendar_expire.\" + username\n\n        // We need a proxy for CORS\n    };options.proxy = options.proxy || function (username) {\n        return fetch(\"https://api.bloggify.net/gh-calendar/?username=\" + username).then(function (r) {\n            return r.text();\n        });\n    };\n\n    options.getCalendar = options.getCalendar || function (username) {\n        if (options.cache && Date.now() < +localStorage.getItem(cacheKeys.expire_at)) {\n            var content = localStorage.getItem(cacheKeys.content);\n            if (content) {\n                return Promise.resolve(content);\n            }\n        }\n\n        return options.proxy(username).then(function (body) {\n            if (options.cache) {\n                localStorage.setItem(cacheKeys.content, body);\n                localStorage.setItem(cacheKeys.expire_at, Date.now() + options.cache);\n            }\n            return body;\n        });\n    };\n\n    var fetchCalendar = function fetchCalendar() {\n        return options.getCalendar(username).then(function (body) {\n            var div = document.createElement(\"div\");\n            div.innerHTML = body;\n            var cal = div.querySelector(\".js-yearly-contributions\");\n            $(\".position-relative h2\", cal).remove();\n            //cal.querySelector(\".float-left.text-gray\").innerHTML = options.summary_text\n\n            // Remove 3d visualiser div\n            var _iteratorNormalCompletion = true;\n            var _didIteratorError = false;\n            var _iteratorError = undefined;\n\n            try {\n                for (var _iterator = div.querySelectorAll(\"a\")[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n                    var a = _step.value;\n\n                    if (a.textContent.includes(\"View your contributions in 3D, VR and IRL!\")) {\n                        a.parentElement.remove();\n                    }\n                }\n\n                // If 'include-fragment' with spinner img loads instead of the svg, fetchCalendar again\n            } catch (err) {\n                _didIteratorError = true;\n                _iteratorError = err;\n            } finally {\n                try {\n                    if (!_iteratorNormalCompletion && _iterator.return) {\n                        _iterator.return();\n                    }\n                } finally {\n                    if (_didIteratorError) {\n                        throw _iteratorError;\n                    }\n                }\n            }\n\n            if (cal.querySelector(\"include-fragment\")) {\n                setTimeout(fetchCalendar, 500);\n            } else {\n                // If options includes responsive, SVG element has to be manipulated to be made responsive\n                if (options.responsive === true) {\n                    var svg = cal.querySelector(\"table.js-calendar-graph-table\");\n                    // Get the width/height properties and use them to create the viewBox\n                    var width = svg.getAttribute(\"width\");\n                    var height = svg.getAttribute(\"height\");\n                    // Remove height property entirely\n                    svg.removeAttribute(\"height\");\n                    // Width property should be set to 100% to fill entire container\n                    svg.setAttribute(\"width\", \"100%\");\n                    // Add a viewBox property based on the former width/height\n                    svg.setAttribute(\"viewBox\", \"0 0 \" + width + \" \" + height);\n                }\n\n                if (options.global_stats !== false) {\n                    var parsed = parse(cal.innerHTML),\n                        currentStreakInfo = parsed.current_streak ? formatoid(parsed.current_streak_range[0], DATE_FORMAT2) + \" &ndash; \" + formatoid(parsed.current_streak_range[1], DATE_FORMAT2) : parsed.last_contributed ? \"Last contributed in \" + formatoid(parsed.last_contributed, DATE_FORMAT2) + \".\" : \"Rock - Hard Place\",\n                        longestStreakInfo = parsed.longest_streak ? formatoid(parsed.longest_streak_range[0], DATE_FORMAT2) + \" &ndash; \" + formatoid(parsed.longest_streak_range[1], DATE_FORMAT2) : parsed.last_contributed ? \"Last contributed in \" + formatoid(parsed.last_contributed, DATE_FORMAT2) + \".\" : \"Rock - Hard Place\",\n                        firstCol = $(\"<div>\", {\n                        \"class\": \"contrib-column contrib-column-first table-column\",\n                        html: \"<span class=\\\"text-muted\\\">Contributions in the last year</span>\\n                               <span class=\\\"contrib-number\\\">\" + parsed.last_year + \" total</span>\\n                               <span class=\\\"text-muted\\\">\" + formatoid(addSubtractDate.add(addSubtractDate.subtract(new Date(), 1, \"year\"), 1, \"day\"), DATE_FORMAT1) + \" &ndash; \" + formatoid(new Date(), DATE_FORMAT1) + \"</span>\"\n                    }),\n                        secondCol = $(\"<div>\", {\n                        \"class\": \"contrib-column table-column\",\n                        html: \"<span class=\\\"text-muted\\\">Longest streak</span>\\n                               <span class=\\\"contrib-number\\\">\" + printDayCount(parsed.longest_streak) + \"</span>\\n                               <span class=\\\"text-muted\\\">\" + longestStreakInfo + \"</span>\"\n                    }),\n                        thirdCol = $(\"<div>\", {\n                        \"class\": \"contrib-column table-column\",\n                        html: \"<span class=\\\"text-muted\\\">Current streak</span>\\n                               <span class=\\\"contrib-number\\\">\" + printDayCount(parsed.current_streak) + \"</span>\\n                               <span class=\\\"text-muted\\\">\" + currentStreakInfo + \"</span>\"\n                    });\n\n                    cal.appendChild(firstCol);\n                    cal.appendChild(secondCol);\n                    cal.appendChild(thirdCol);\n                }\n\n                container.innerHTML = cal.innerHTML;\n\n                // If options includes tooltips, add tooltips listeners to SVG\n                if (options.tooltips === true) {\n                    addTooltips(container);\n                }\n            }\n        }).catch(function (e) {\n            return console.error(e);\n        });\n    };\n\n    return fetchCalendar();\n};"]}