/**
 * Copyright © Volker Schukai and all contributing authors, 2026. All rights reserved.
 * Node module: @schukai/monster
 *
 * This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
 * The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
 *
 * For those who do not wish to adhere to the AGPLv3, a commercial license is available.
 * Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
 * For more information about purchasing a commercial license, please contact Volker Schukai.
 */

import { addAttributeToken } from "../../../dom/attributes.mjs";
import { ATTRIBUTE_ERRORMESSAGE } from "../../../dom/constants.mjs";

export { ContextHelpStyleSheet };

/**
 * @private
 * @type {CSSStyleSheet}
 */
const ContextHelpStyleSheet = new CSSStyleSheet();

try {
	ContextHelpStyleSheet.insertRule(
		`
@layer contexthelp {
[data-monster-role=control]{outline:none;width:100%;box-sizing:border-box}[data-monster-role=control].flex{display:flex;flex-direction:row;align-items:center}:host{display:block;box-sizing:border-box}div[data-monster-role=popper]{box-sizing:border-box;display:none;opacity:1;padding:1.1em;max-width:var(--monster-popper-max-width,calc(100vw - 2rem));max-height:var(--monster-popper-max-height,calc(100vh - 2rem));z-index:var(--monster-z-index-modal);background:var(--monster-bg-color-primary-1);color:var(--monster-color-primary-1);border-radius:var(--monster-border-radius);border-width:var(--monster-border-width);border-style:var(--monster-border-style);border-color:var(--monster-bg-color-primary-4);box-shadow:var(--monster-box-shadow-1);justify-content:space-between;align-content:center;width:-moz-max-content;width:max-content;position:absolute;top:0;left:0;transition:opacity var(--monster-popper-fade-duration,.14s) var(--monster-popper-fade-timing,cubic-bezier(.2,0,0,1))}div[data-monster-role=popper][data-monster-appearance=opening]{opacity:0}div[data-monster-role=popper][data-monster-appearance=open]{opacity:1}@media (prefers-reduced-motion:reduce){div[data-monster-role=popper]{transition:none}}div[data-monster-role=popper]>[part=content]{overflow:auto;max-height:var(--monster-popper-content-max-height,calc(100vh - 4.2rem))}div[data-monster-role=popper]>[part=content][data-monster-overflow-mode=horizontal]{overflow-x:auto;overflow-y:visible;clip-path:none}div[data-monster-role=popper]>[part=content][data-monster-overflow-mode=visible]{overflow:visible;clip-path:none;max-width:none;max-height:none}div[data-monster-role=popper] div[data-monster-role=arrow]{position:absolute;width:calc(max(var(--monster-popper-witharrrow-distance), -1 * var(--monster-popper-witharrrow-distance))*2);height:calc(max(var(--monster-popper-witharrrow-distance), -1 * var(--monster-popper-witharrrow-distance))*2);z-index:-1;pointer-events:none;background:var(--monster-bg-color-primary-1)}[data-monster-role=control]{position:relative;margin:0;padding:0;line-height:1em}[data-monster-role=control] [data-monster-role=button]{display:inline-block;position:relative}:is([data-monster-role=control] [data-monster-role=button]) svg{cursor:pointer}:is([data-monster-role=control] [data-monster-role=button]) svg.hidden{visibility:hidden;cursor:default;pointer-events:none}div[data-monster-role=popper]{z-index:var(--monster-z-index-tooltip-overlay);max-width:min(var(--monster-popper-max-width,calc(100vw - 2rem)),32rem)}div[data-monster-role=popper]>[part=content]{display:block;max-width:100%;white-space:normal;text-wrap:pretty;word-break:break-word;overflow-wrap:anywhere}:host{display:inline-block;position:relative;margin:0 .2em;padding:0;vertical-align:bottom}:host([disabled]) [data-monster-role=button] svg{cursor:default;pointer-events:none}
}`,
		0,
	);
} catch (e) {
	addAttributeToken(
		document.getRootNode().querySelector("html"),
		ATTRIBUTE_ERRORMESSAGE,
		e + "",
	);
}
