/**
 * Copyright IBM Corp. 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

//#region ../../node_modules/flatpickr/dist/esm/utils/dom.js
function toggleClass(elem, className, bool) {
	if (bool === true) return elem.classList.add(className);
	elem.classList.remove(className);
}
function createElement(tag, className, content) {
	var e = window.document.createElement(tag);
	className = className || "";
	content = content || "";
	e.className = className;
	if (content !== void 0) e.textContent = content;
	return e;
}
function clearNode(node) {
	while (node.firstChild) node.removeChild(node.firstChild);
}
function findParent(node, condition) {
	if (condition(node)) return node;
	else if (node.parentNode) return findParent(node.parentNode, condition);
}
function createNumberInput(inputClassName, opts) {
	var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown");
	if (navigator.userAgent.indexOf("MSIE 9.0") === -1) numInput.type = "number";
	else {
		numInput.type = "text";
		numInput.pattern = "\\d*";
	}
	if (opts !== void 0) for (var key in opts) numInput.setAttribute(key, opts[key]);
	wrapper.appendChild(numInput);
	wrapper.appendChild(arrowUp);
	wrapper.appendChild(arrowDown);
	return wrapper;
}
function getEventTarget(event) {
	try {
		if (typeof event.composedPath === "function") return event.composedPath()[0];
		return event.target;
	} catch (error) {
		return event.target;
	}
}
//#endregion
export { clearNode, createElement, createNumberInput, findParent, getEventTarget, toggleClass };

//# sourceMappingURL=dom.js.map