import { safeCustomElement } from "../../shared/safe-custom-element.js";
import { TailwindStyledElement } from "../../shared/tailwind-element/index.js";
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.127.0/helpers/decorate.js";
import style_default from "./style.css?inline.js";
import { html } from "lit";
import { property } from "lit/decorators.js";
import { unsafeHTML } from "lit/directives/unsafe-html.js";
import DOMPurify from "dompurify";
//#region src/components/lukso-sanitize/index.ts
/**
* Default DOMPurify options for lukso-sanitize component.
*/
var DEFAULT_OPTIONS = {
	ADD_ATTR: ["target"],
	CUSTOM_ELEMENT_HANDLING: {
		tagNameCheck: /^lukso-/,
		attributeNameCheck: /.*/
	}
};
/**
* Options to strip all HTML tags.
*/
var NO_HTML_TAGS_OPTIONS = { ALLOWED_TAGS: [] };
var LuksoSanitize = class LuksoSanitize extends TailwindStyledElement(style_default) {
	constructor(..._args) {
		super(..._args);
		this.htmlContent = "";
		this.isPre = false;
		this.stripHtmlTags = false;
	}
	sanitize() {
		if (this.stripHtmlTags) return DOMPurify.sanitize(this.htmlContent, NO_HTML_TAGS_OPTIONS);
		return DOMPurify.sanitize(this.htmlContent, DEFAULT_OPTIONS);
	}
	render() {
		return this.isPre ? html`<!-- prettier-ignore -->
          <div
      class='whitespace-pre-wrap'>${unsafeHTML(this.sanitize())}</div>` : html`${unsafeHTML(this.sanitize())}`;
	}
};
__decorate([property({
	type: String,
	attribute: "html-content"
})], LuksoSanitize.prototype, "htmlContent", void 0);
__decorate([property({
	type: Boolean,
	attribute: "is-pre"
})], LuksoSanitize.prototype, "isPre", void 0);
__decorate([property({
	type: Boolean,
	attribute: "strip-html-tags"
})], LuksoSanitize.prototype, "stripHtmlTags", void 0);
LuksoSanitize = __decorate([safeCustomElement("lukso-sanitize")], LuksoSanitize);
//#endregion
export { DEFAULT_OPTIONS, LuksoSanitize, NO_HTML_TAGS_OPTIONS };
