function classArray(e) {
	return e.trim().split(/^|\s+/);
}
function classList(e) {
	return e.classList || new ClassList(e);
}
function ClassList(r) {
	this._node = r, this._names = classArray(r.getAttribute("class") || "");
}
ClassList.prototype = {
	add: function(e) {
		this._names.indexOf(e) < 0 && (this._names.push(e), this._node.setAttribute("class", this._names.join(" ")));
	},
	remove: function(e) {
		var r = this._names.indexOf(e);
		r >= 0 && (this._names.splice(r, 1), this._node.setAttribute("class", this._names.join(" ")));
	},
	contains: function(e) {
		return this._names.indexOf(e) >= 0;
	}
};
function classedAdd(e, i) {
	for (var a = classList(e), o = -1, s = i.length; ++o < s;) a.add(i[o]);
}
function classedRemove(e, i) {
	for (var a = classList(e), o = -1, s = i.length; ++o < s;) a.remove(i[o]);
}
function classedTrue(e) {
	return function() {
		classedAdd(this, e);
	};
}
function classedFalse(e) {
	return function() {
		classedRemove(this, e);
	};
}
function classedFunction(e, r) {
	return function() {
		(r.apply(this, arguments) ? classedAdd : classedRemove)(this, e);
	};
}
function classed_default(i, a) {
	var o = classArray(i + "");
	if (arguments.length < 2) {
		for (var c = classList(this.node()), l = -1, u = o.length; ++l < u;) if (!c.contains(o[l])) return !1;
		return !0;
	}
	return this.each((typeof a == "function" ? classedFunction : a ? classedTrue : classedFalse)(o, a));
}
export { classed_default as default };
