Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../_virtual/_rolldown/runtime.cjs");
const require_safe_custom_element = require("../../shared/safe-custom-element.cjs");
const require_index = require("../../shared/tailwind-element/index.cjs");
const require_decorate = require("../../_virtual/_@oxc-project_runtime@0.127.0/helpers/decorate.cjs");
require("../lukso-icon/index.cjs");
const require_cn = require("../../shared/tools/cn.cjs");
require("../../shared/tools/index.cjs");
const require_style = require("./style.css?inline.cjs");
let lit = require("lit");
let lit_decorators_js = require("lit/decorators.js");
//#region src/components/lukso-qr-code/index.ts
var QRCodeStyling = null;
var DEFAULT_QR_OPTIONS = {
	dotsOptions: {
		color: "#243542",
		type: "rounded"
	},
	backgroundOptions: { color: "#f8fafb" },
	cornersSquareOptions: { type: "extra-rounded" },
	imageOptions: { margin: 5 }
};
var LuksoQrCode = class LuksoQrCode extends require_index.TailwindStyledElement(require_style.default) {
	constructor(..._args) {
		super(..._args);
		this.value = "";
		this.size = 280;
		this.image = void 0;
		this.options = {};
		this.customClass = void 0;
		this.isLoading = true;
		this.qrCodeInstance = null;
	}
	updated(changedProperties) {
		super.updated(changedProperties);
		if (changedProperties.has("value") && this.value) this.generateQrCode().catch((err) => {
			console.error("Failed to generate QR code:", err);
			this.isLoading = false;
		});
	}
	async generateQrCode() {
		const container = this.shadowRoot?.querySelector(".qr-code-container");
		if (!container) return;
		this.isLoading = true;
		if (!QRCodeStyling) try {
			QRCodeStyling = (await import("qr-code-styling")).default;
		} catch (e) {
			console.error("qr-code-styling not available:", e);
			this.isLoading = false;
			return;
		}
		if (this.qrCodeInstance) this.qrCodeInstance = null;
		this.qrCodeInstance = new QRCodeStyling({
			...DEFAULT_QR_OPTIONS,
			...this.options,
			width: this.size,
			height: this.size,
			type: "svg",
			data: this.value,
			image: this.image || void 0
		});
		container.innerHTML = "";
		this.qrCodeInstance.append(container);
		this.isLoading = false;
	}
	render() {
		return lit.html`
      <div
        class="${require_cn.cn(`relative flex items-center justify-center ${this.customClass}`)}"
      >
        <div
          class="qr-code-container flex items-center justify-center"
          style="min-height: ${this.size}px; min-width: ${this.size}px"
        ></div>
        <div class="absolute inset-0 flex items-center justify-center">
          ${this.isLoading ? lit.html`<div
                class="flex items-center justify-center"
                style="min-height: ${this.size}px"
              >
                <lukso-icon
                  name="progress-indicator-alt"
                  size="x-large"
                ></lukso-icon>
              </div>` : lit.html`<slot></slot>`}
        </div>
      </div>
    `;
	}
};
require_decorate.__decorate([(0, lit_decorators_js.property)({
	type: String,
	reflect: true
})], LuksoQrCode.prototype, "value", void 0);
require_decorate.__decorate([(0, lit_decorators_js.property)({
	type: Number,
	reflect: true
})], LuksoQrCode.prototype, "size", void 0);
require_decorate.__decorate([(0, lit_decorators_js.property)({
	type: String,
	reflect: true
})], LuksoQrCode.prototype, "image", void 0);
require_decorate.__decorate([(0, lit_decorators_js.property)({ type: Object })], LuksoQrCode.prototype, "options", void 0);
require_decorate.__decorate([(0, lit_decorators_js.property)({
	type: String,
	attribute: "custom-class",
	reflect: true
})], LuksoQrCode.prototype, "customClass", void 0);
require_decorate.__decorate([(0, lit_decorators_js.state)()], LuksoQrCode.prototype, "isLoading", void 0);
LuksoQrCode = require_decorate.__decorate([require_safe_custom_element.safeCustomElement("lukso-qr-code")], LuksoQrCode);
//#endregion
Object.defineProperty(exports, "LuksoQrCode", {
	enumerable: true,
	get: function() {
		return LuksoQrCode;
	}
});
