/*!
* github-buttons v2.29.1
* (c) 2024 なつき
* @license BSD-2-Clause
*/
var document = window.document;
var Math = window.Math;
var HTMLElement = window.HTMLElement;
var XMLHttpRequest = window.XMLHttpRequest;
var forEach = function(obj, func) {
for (var i = 0, len = obj.length; i < len; i++) {
func(obj[i]);
}
};
var createElementInDocument = function(document2) {
return function(tag, props, children) {
var el = document2.createElement(tag);
if (props != null) {
for (var prop in props) {
var val = props[prop];
if (val != null) {
if (el[prop] != null) {
el[prop] = val;
} else {
el.setAttribute(prop, val);
}
}
}
}
if (children != null) {
forEach(children, function(child) {
el.appendChild(typeof child === "string" ? document2.createTextNode(child) : child);
});
}
return el;
};
};
var createElement = createElementInDocument(document);
var dispatchOnce = function(func) {
var onceToken;
return function() {
if (!onceToken) {
onceToken = 1;
func.apply(this, arguments);
}
};
};
var hasOwnProperty = function(obj, prop) {
return {}.hasOwnProperty.call(obj, prop);
};
var toLowerCase = function(obj) {
return ("" + obj).toLowerCase();
};
var name = "github-buttons";
var version = "2.29.1";
var iframeURL = "https://" + /* istanbul ignore next */
("unpkg.com/" + name + "@" + version + "/dist") + "/buttons.html";
var domain = "github.com";
var apiBaseURL = "https://api." + domain;
var useXHR = XMLHttpRequest && "prototype" in XMLHttpRequest && "withCredentials" in XMLHttpRequest.prototype;
var useShadowDOM = useXHR && HTMLElement && "attachShadow" in HTMLElement.prototype && !("prototype" in HTMLElement.prototype.attachShadow);
var onEvent = function(target, eventName, func) {
if (target.addEventListener) {
target.addEventListener(eventName, func, false);
} else {
target.attachEvent("on" + eventName, func);
}
};
var offEvent = function(target, eventName, func) {
if (target.removeEventListener) {
target.removeEventListener(eventName, func, false);
} else {
target.detachEvent("on" + eventName, func);
}
};
var onceEvent = function(target, eventName, func) {
var callback = function() {
offEvent(target, eventName, callback);
return func.apply(this, arguments);
};
onEvent(target, eventName, callback);
};
var onceReadyStateChange = (
/* istanbul ignore next: IE lt 9 */
function(target, regex, func) {
if (target.readyState != null) {
var eventName = "readystatechange";
var callback = function() {
if (regex.test(target.readyState)) {
offEvent(target, eventName, callback);
return func.apply(this, arguments);
}
};
onEvent(target, eventName, callback);
}
}
);
var parseOptions = function(anchor) {
var options = {
href: anchor.href,
title: anchor.title,
"aria-label": anchor.getAttribute("aria-label")
};
forEach(["icon", "color-scheme", "text", "size", "show-count"], function(option) {
var attribute = "data-" + option;
options[attribute] = anchor.getAttribute(attribute);
});
if (options["data-text"] == null) {
options["data-text"] = anchor.textContent || anchor.innerText;
}
return options;
};
var buttonsCssText = "body{margin:0}a{text-decoration:none;outline:0}.widget{display:inline-block;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;font-size:0;line-height:0;white-space:nowrap}.btn,.social-count{position:relative;display:inline-block;display:inline-flex;height:14px;padding:2px 5px;font-size:11px;font-weight:600;line-height:14px;vertical-align:bottom;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-repeat:repeat-x;background-position:-1px -1px;background-size:110% 110%;border:1px solid}.btn{border-radius:.25em}.btn:not(:last-child){border-radius:.25em 0 0 .25em}.social-count{border-left:0;border-radius:0 .25em .25em 0}.widget-lg .btn,.widget-lg .social-count{height:16px;padding:5px 10px;font-size:12px;line-height:16px}.octicon{display:inline-block;vertical-align:text-top;fill:currentColor;overflow:visible}";
var light = `.btn:focus-visible,.social-count:focus-visible{outline:2px solid #0969da;outline-offset:-2px}.btn{color:#25292e;background-color:#ebf0f4;border-color:#d1d9e0;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg'%3e%3clinearGradient id='o' x2='0' y2='1'%3e%3cstop stop-color='%23f6f8fa'/%3e%3cstop offset='90%25' stop-color='%23ebf0f4'/%3e%3c/linearGradient%3e%3crect width='100%25' height='100%25' fill='url(%23o)'/%3e%3c/svg%3e");background-image:-moz-linear-gradient(top, #f6f8fa, #ebf0f4 90%);background-image:linear-gradient(180deg, #f6f8fa, #ebf0f4 90%);filter:progid:DXImageTransform.Microsoft.Gradient(startColorstr='#FFF6F8FA', endColorstr='#FFEAEFF3')}:root .btn{filter:none}.btn:hover,.btn:focus{background-color:#e5eaee;background-position:0 -0.5em;border-color:#d1d9e0;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg'%3e%3clinearGradient id='o' x2='0' y2='1'%3e%3cstop stop-color='%23eff2f5'/%3e%3cstop offset='90%25' stop-color='%23e5eaee'/%3e%3c/linearGradient%3e%3crect width='100%25' height='100%25' fill='url(%23o)'/%3e%3c/svg%3e");background-image:-moz-linear-gradient(top, #eff2f5, #e5eaee 90%);background-image:linear-gradient(180deg, #eff2f5, #e5eaee 90%);filter:progid:DXImageTransform.Microsoft.Gradient(startColorstr='#FFEFF2F5', endColorstr='#FFE4E9ED')}:root .btn:hover,:root .btn:focus{filter:none}.btn:active{background-color:#e6eaef;border-color:#d1d9e0;background-image:none;filter:none}.social-count{color:#25292e;background-color:#fff;border-color:#d1d9e0}.social-count:hover,.social-count:focus{color:#0969da}.octicon-heart{color:#bf3989}`;
var lightHighContrast = ".btn:focus-visible,.social-count:focus-visible{outline:2px solid #0349b4;outline-offset:-2px}.btn{color:#25292e;background-color:#e0e6eb;border-color:#454c54;background-image:none;filter:none}.btn:hover,.btn:focus{background-color:#d0d7e0;background-position:0 -0.5em;border-color:#454c54;background-image:none;filter:none}.btn:active{background-color:#d1d9e0;border-color:#454c54}.social-count{color:#25292e;background-color:#fff;border-color:#454c54}.social-count:hover,.social-count:focus{color:#023b95}.octicon-heart{color:#7d0c57}";
var dark = `.btn:focus-visible,.social-count:focus-visible{outline:2px solid #1f6feb;outline-offset:-2px}.btn{color:#f0f6fc;background-color:#1a2026;border-color:#3d444d;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg'%3e%3clinearGradient id='o' x2='0' y2='1'%3e%3cstop stop-color='%23212830'/%3e%3cstop offset='90%25' stop-color='%231a2026'/%3e%3c/linearGradient%3e%3crect width='100%25' height='100%25' fill='url(%23o)'/%3e%3c/svg%3e");background-image:-moz-linear-gradient(top, #212830, #1a2026 90%);background-image:linear-gradient(180deg, #212830, #1a2026 90%);filter:progid:DXImageTransform.Microsoft.Gradient(startColorstr='#FF212830', endColorstr='#FF191F25')}:root .btn{filter:none}.btn:hover,.btn:focus{background-color:#1f242c;background-position:0 -0.5em;border-color:#3d444d;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg'%3e%3clinearGradient id='o' x2='0' y2='1'%3e%3cstop stop-color='%23262c36'/%3e%3cstop offset='90%25' stop-color='%231f242c'/%3e%3c/linearGradient%3e%3crect width='100%25' height='100%25' fill='url(%23o)'/%3e%3c/svg%3e");background-image:-moz-linear-gradient(top, #262c36, #1f242c 90%);background-image:linear-gradient(180deg, #262c36, #1f242c 90%);filter:progid:DXImageTransform.Microsoft.Gradient(startColorstr='#FF262C36', endColorstr='#FF1E232B')}:root .btn:hover,:root .btn:focus{filter:none}.btn:active{background-color:#2a313c;border-color:#3d444d;background-image:none;filter:none}.social-count{color:#f0f6fc;background-color:#0d1117;border-color:#3d444d}.social-count:hover,.social-count:focus{color:#388bfd}.octicon-heart{color:#db61a2}`;
var darkDimmed = `.btn:focus-visible,.social-count:focus-visible{outline:2px solid #316dca;outline-offset:-2px}.btn{color:#d1d7e0;background-color:#232932;border-color:#3d444d;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg'%3e%3clinearGradient id='o' x2='0' y2='1'%3e%3cstop stop-color='%232a313c'/%3e%3cstop offset='90%25' stop-color='%23232932'/%3e%3c/linearGradient%3e%3crect width='100%25' height='100%25' fill='url(%23o)'/%3e%3c/svg%3e");background-image:-moz-linear-gradient(top, #2a313c, #232932 90%);background-image:linear-gradient(180deg, #2a313c, #232932 90%);filter:progid:DXImageTransform.Microsoft.Gradient(startColorstr='#FF2A313C', endColorstr='#FF222831')}:root .btn{filter:none}.btn:hover,.btn:focus{background-color:#282f38;background-position:0 -0.5em;border-color:#3d444d;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg'%3e%3clinearGradient id='o' x2='0' y2='1'%3e%3cstop stop-color='%232f3742'/%3e%3cstop offset='90%25' stop-color='%23282f38'/%3e%3c/linearGradient%3e%3crect width='100%25' height='100%25' fill='url(%23o)'/%3e%3c/svg%3e");background-image:-moz-linear-gradient(top, #2f3742, #282f38 90%);background-image:linear-gradient(180deg, #2f3742, #282f38 90%);filter:progid:DXImageTransform.Microsoft.Gradient(startColorstr='#FF2F3742', endColorstr='#FF272E37')}:root .btn:hover,:root .btn:focus{filter:none}.btn:active{background-color:#3d444d;border-color:#3d444d;background-image:none;filter:none}.social-count{color:#d1d7e0;background-color:#212830;border-color:#3d444d}.social-count:hover,.social-count:focus{color:#4184e4}.octicon-heart{color:#c96198}`;
var darkHighContrast = ".btn:focus-visible,.social-count:focus-visible{outline:2px solid #409eff;outline-offset:-2px}.btn{color:#fff;background-color:#262c36;border-color:#b7bdc8;background-image:none;filter:none}.btn:hover,.btn:focus{background-color:#232932;background-position:0 -0.5em;border-color:#b7bdc8;background-image:none;filter:none}.btn:active{background-color:#2f3742;border-color:#b7bdc8}.social-count{color:#fff;background-color:#010409;border-color:#b7bdc8}.social-count:hover,.social-count:focus{color:#5cacff}.octicon-heart{color:#ff90c8}";
var stringify = function(obj, sep, eq, encodeURIComponent) {
if (sep == null) {
sep = "&";
}
if (eq == null) {
eq = "=";
}
if (encodeURIComponent == null) {
encodeURIComponent = window.encodeURIComponent;
}
var params = [];
for (var name2 in obj) {
var value = obj[name2];
if (value != null) {
params.push(encodeURIComponent(name2) + eq + encodeURIComponent(value));
}
}
return params.join(sep);
};
var parse = function(str, sep, eq, decodeURIComponent) {
if (decodeURIComponent == null) {
decodeURIComponent = window.decodeURIComponent;
}
var obj = {};
forEach(str.split(sep), function(entry) {
if (entry !== "") {
var ref = entry.split(eq);
obj[decodeURIComponent(ref[0])] = ref[1] != null ? decodeURIComponent(ref.slice(1).join(eq)) : void 0;
}
});
return obj;
};
var widgetColorSchemes = {
light,
light_high_contrast: lightHighContrast,
dark,
dark_dimmed: darkDimmed,
dark_high_contrast: darkHighContrast
};
var getColorSchemeMediaQuery = function(systemColorScheme, widgetColorScheme) {
return "@media(prefers-color-scheme:" + systemColorScheme + "){" + widgetColorSchemes[hasOwnProperty(widgetColorSchemes, widgetColorScheme) ? widgetColorScheme : systemColorScheme] + "}";
};
var getColorScheme = function(declarations) {
if (declarations == null) {
return widgetColorSchemes.light;
}
if (hasOwnProperty(widgetColorSchemes, declarations)) {
return widgetColorSchemes[declarations];
}
var colorSchemes = parse(declarations, ";", ":", function(str) {
return str.replace(/^[ \t\n\f\r]+|[ \t\n\f\r]+$/g, "");
});
return widgetColorSchemes[hasOwnProperty(widgetColorSchemes, colorSchemes["no-preference"]) ? colorSchemes["no-preference"] : "light"] + getColorSchemeMediaQuery("light", colorSchemes.light) + getColorSchemeMediaQuery("dark", colorSchemes.dark);
};
var data = {
"comment-discussion": {
heights: {
"16": {
width: 16,
path: ''
}
}
},
download: {
heights: {
"16": {
width: 16,
path: ''
}
}
},
eye: {
heights: {
"16": {
width: 16,
path: ''
}
}
},
heart: {
heights: {
"16": {
width: 16,
path: ''
}
}
},
"issue-opened": {
heights: {
"16": {
width: 16,
path: ''
}
}
},
"mark-github": {
heights: {
"16": {
width: 16,
path: ''
}
}
},
"package": {
heights: {
"16": {
width: 16,
path: ''
}
}
},
play: {
heights: {
"16": {
width: 16,
path: ''
}
}
},
"repo-forked": {
heights: {
"16": {
width: 16,
path: ''
}
}
},
"repo-template": {
heights: {
"16": {
width: 16,
path: ''
}
}
},
star: {
heights: {
"16": {
width: 16,
path: ''
}
}
}
};
var octicon = function(icon, height) {
icon = toLowerCase(icon).replace(/^octicon-/, "");
if (!hasOwnProperty(data, icon)) {
icon = "mark-github";
}
var defaultHeight = height >= 24 && /* istanbul ignore next */
24 in data[icon].heights ? (
/* istanbul ignore next */
24
) : 16;
var svg = data[icon].heights[defaultHeight];
return '";
};
var queues = {};
var fetch = function(url, func) {
var queue = queues[url] || (queues[url] = []);
if (queue.push(func) > 1) {
return;
}
var callback = dispatchOnce(function() {
delete queues[url];
while (func = queue.shift()) {
func.apply(null, arguments);
}
});
if (useXHR) {
var xhr = new XMLHttpRequest();
onEvent(xhr, "abort", callback);
onEvent(xhr, "error", callback);
onEvent(xhr, "load", function() {
var data2;
try {
data2 = JSON.parse(this.responseText);
} catch (error) {
callback(error);
return;
}
callback(this.status !== 200, data2);
});
xhr.open("GET", url);
xhr.send();
} else {
var contentWindow = this || window;
contentWindow._ = function(json) {
contentWindow._ = null;
callback(json.meta.status !== 200, json.data);
};
var script = createElementInDocument(contentWindow.document)("script", {
async: true,
src: url + (url.indexOf("?") !== -1 ? "&" : "?") + "callback=_"
});
var onloadend = (
/* istanbul ignore next: IE lt 9 */
function() {
if (contentWindow._) {
contentWindow._({
meta: {}
});
}
}
);
onEvent(script, "load", onloadend);
onEvent(script, "error", onloadend);
onceReadyStateChange(script, /de|m/, onloadend);
contentWindow.document.getElementsByTagName("head")[0].appendChild(script);
}
};
var render$1 = function(root, options, func) {
var createElement2 = createElementInDocument(root.ownerDocument);
var style = root.appendChild(createElement2("style", {
type: "text/css"
}));
var cssText = buttonsCssText + getColorScheme(options["data-color-scheme"]);
if (style.styleSheet) {
style.styleSheet.cssText = cssText;
} else {
style.appendChild(root.ownerDocument.createTextNode(cssText));
}
var isLarge = toLowerCase(options["data-size"]) === "large";
var btn = createElement2("a", {
className: "btn",
href: options.href,
rel: "noopener",
target: "_blank",
title: options.title || void 0,
"aria-label": options["aria-label"] || void 0,
innerHTML: octicon(options["data-icon"], isLarge ? 16 : 14) + " "
}, [
createElement2("span", {}, [options["data-text"] || ""])
]);
var widget = root.appendChild(createElement2("div", {
className: "widget" + (isLarge ? " widget-lg" : "")
}, [
btn
]));
var hostname = btn.hostname.replace(/\.$/, "");
if (("." + hostname).substring(hostname.length - domain.length) !== "." + domain) {
btn.removeAttribute("href");
func(widget);
return;
}
var path = (" /" + btn.pathname).split(/\/+/);
if ((hostname === domain || hostname === "gist." + domain) && path[3] === "archive" || hostname === domain && path[3] === "releases" && (path[4] === "download" || path[4] === "latest" && path[5] === "download") || hostname === "codeload." + domain) {
btn.target = "_top";
}
if (toLowerCase(options["data-show-count"]) !== "true" || hostname !== domain || path[1] === "marketplace" || path[1] === "sponsors" || path[1] === "orgs" || path[1] === "users" || path[1] === "-") {
func(widget);
return;
}
var href, property;
if (!path[2] && path[1]) {
property = "followers";
href = "?tab=followers";
} else if (!path[3] && path[2]) {
property = "stargazers_count";
href = "/stargazers";
} else if (!path[4] && path[3] === "subscription") {
property = "subscribers_count";
href = "/watchers";
} else if (!path[4] && path[3] === "fork") {
property = "forks_count";
href = "/forks";
} else if (path[3] === "issues") {
property = "open_issues_count";
href = "/issues";
} else {
func(widget);
return;
}
var api = path[2] ? "/repos/" + path[1] + "/" + path[2] : "/users/" + path[1];
fetch.call(this, apiBaseURL + api, function(error, json) {
if (!error) {
var data2 = json[property];
widget.appendChild(createElement2("a", {
className: "social-count",
href: json.html_url + href,
rel: "noopener",
target: "_blank",
"aria-label": data2 + " " + property.replace(/_count$/, "").replace("_", " ").slice(0, data2 < 2 ? -1 : void 0) + " on GitHub"
}, [
("" + data2).replace(/\B(?=(\d{3})+(?!\d))/g, ",")
]));
}
func(widget);
});
};
var devicePixelRatio = window.devicePixelRatio || /* istanbul ignore next */
1;
var ceilPixel = function(px) {
return (devicePixelRatio > 1 ? Math.ceil(Math.round(px * devicePixelRatio) / devicePixelRatio * 2) / 2 : Math.ceil(px)) || 0;
};
var get = function(el) {
var width = el.offsetWidth;
var height = el.offsetHeight;
if (el.getBoundingClientRect) {
var boundingClientRect = el.getBoundingClientRect();
width = Math.max(width, ceilPixel(boundingClientRect.width));
height = Math.max(height, ceilPixel(boundingClientRect.height));
}
return [width, height];
};
var set = function(el, size) {
el.style.width = size[0] + "px";
el.style.height = size[1] + "px";
};
var render = function(options, func) {
if (options == null || func == null) {
return;
}
if (options.getAttribute) {
options = parseOptions(options);
}
if (useShadowDOM) {
var host = createElement("span");
render$1(host.attachShadow({ mode: "closed" }), options, function() {
func(host);
});
} else {
var iframe = createElement("iframe", {
src: "javascript:0",
title: options.title || void 0,
allowtransparency: true,
scrolling: "no",
frameBorder: 0
});
set(iframe, [0, 0]);
iframe.style.border = "none";
iframe.style.colorScheme = "light";
var callback = function() {
var contentWindow = iframe.contentWindow;
var body;
try {
body = contentWindow.document.body;
} catch (_) {
document.body.appendChild(iframe.parentNode.removeChild(iframe));
return;
}
offEvent(iframe, "load", callback);
render$1.call(contentWindow, body, options, function(widget) {
var size = get(widget);
iframe.parentNode.removeChild(iframe);
onceEvent(iframe, "load", function() {
set(iframe, size);
});
iframe.src = iframeURL + "#" + (iframe.name = stringify(options));
func(iframe);
});
};
onEvent(iframe, "load", callback);
document.body.appendChild(iframe);
}
};
export {
render
};