import { t as B } from "./index.esm-0G7eAEV5.js";
import { t as _sfc_main$1 } from "./SecondaryButton-ub85RH3e.js";
import { $ as $number, A as _sfc_main$6, M as _sfc_main$4, S as _sfc_main$3, dt as _sfc_main$2, it as chunkArray, u as _sfc_main$5, z as http_default } from "../ssr.js";
import { t as _sfc_main$7 } from "./AdminLayout-eZgRfDMK.js";
import { usePage } from "@inertiajs/vue3";
import { notify } from "notiwind";
import { Fragment, createBlock, createCommentVNode, createTextVNode, createVNode, nextTick, onMounted, openBlock, ref, renderList, resolveComponent, toDisplayString, unref, useSSRContext, watch, withCtx } from "vue";
import { useI18n } from "vue-i18n";
import { ssrInterpolate, ssrRenderAttr, ssrRenderClass, ssrRenderComponent, ssrRenderList, ssrRenderStyle } from "vue/server-renderer";
import debounce from "lodash/debounce.js";
import JsBarcode from "jsbarcode";
import QRCode from "qrcode";
//#region resources/js/Pages/Sma/Product/Label.vue
var _sfc_main = /* @__PURE__ */ Object.assign({ layout: _sfc_main$7 }, {
	__name: "Label",
	__ssrInlineRender: true,
	props: ["brand", "category"],
	setup(__props) {
		const page = usePage();
		const { t } = useI18n();
		const labels = ref([]);
		const result = ref([]);
		const search = ref(null);
		const products = ref([]);
		const loaded = ref(false);
		const selected_template = ref({});
		const options = ref({
			template: null,
			label_width: null,
			label_heigh: null,
			page_break: false,
			barcode_height: 30,
			check_promo: false,
			show_site_name: true,
			show_product_name: false,
			show_product_price: true,
			show_product_image: false
		});
		const templates = [
			{
				value: "40",
				label: t("40 per sheet (A4) (1.799in x 1.003in)"),
				width: 1.799 * 96,
				height: 1.003 * 96,
				page: "A4",
				barcode_height: 25,
				vertical_gap: 15
			},
			{
				value: "30",
				label: t("30 per sheet (2.625in x 1in)"),
				width: 2.625 * 96,
				height: 96,
				page: "A4",
				barcode_height: 25,
				vertical_gap: 15
			},
			{
				value: "24",
				label: t("24 per sheet (A4) (2.48in x 1.334in)"),
				width: 2.48 * 96,
				height: 1.334 * 96,
				page: "A4",
				barcode_height: 40,
				vertical_gap: 10
			},
			{
				value: "20",
				label: t("20 per sheet (4in x 1in)"),
				width: 384,
				height: 96,
				page: "A4",
				barcode_height: 25,
				vertical_gap: 15,
				image: "start"
			},
			{
				value: "18",
				label: t("18 per sheet (A4) (2.5in x 1.835in)"),
				width: 2.5 * 96,
				height: 1.835 * 96,
				page: "A4",
				barcode_height: 50,
				vertical_gap: 10
			},
			{
				value: "12",
				label: t("12 per sheet (A4) (2.5in x 2.834in)"),
				width: 2.5 * 96,
				height: 2.834 * 96,
				page: "A4",
				barcode_height: 60,
				vertical_gap: 5
			},
			{
				value: "10",
				label: t("10 per sheet (4in x 2in)"),
				width: 384,
				height: 192,
				page: "A4",
				barcode_height: 60,
				vertical_gap: 30,
				image: "start"
			},
			{
				value: "1",
				label: t("Custom")
			}
		];
		watch(search, debounce(searchProduct, 500));
		onMounted(() => {
			let form = localStorage.getItem("labels.form");
			if (form) {
				form = JSON.parse(form);
				products.value = [...form.products];
				options.value = { ...form.options };
			} else options.value.template = "24";
		});
		const generateQR = async (text) => {
			try {
				return await QRCode.toString(text, { type: "svg" });
			} catch (err) {
				console.error(err);
				return `<span class="text-red-500">${err.toString()}</span>`;
			}
		};
		async function saveForm() {
			const form = {
				products: [...products.value],
				options: { ...options.value }
			};
			localStorage.setItem("labels.form", JSON.stringify(form));
		}
		async function searchProduct(q) {
			await http_default.post(B("search.products", {
				search: q,
				type: "sale"
			})).then((res) => {
				if (res.data.length == 1) addProduct(res.data[0]);
				else result.value = res.data;
			}).catch();
		}
		async function addProduct(product) {
			if (!products.value.find((p) => p.id == product.id)) {
				product = await http_default.get(B("products.show", product.id)).then((r) => r.data);
				const qrcode = await generateQR(product.code);
				products.value = [...products.value, {
					qrcode,
					id: product.id,
					code: product.code,
					name: product.name,
					photo: product.photo,
					symbology: product.symbology,
					price: $number(product.price),
					quantity: product.stocks?.reduce((a, s) => Number(s.balance) + a, 0) || 1
				}];
			}
			saveForm();
			await nextTick();
			search.value = "";
			document.getElementById("product-search").focus();
		}
		function removeItem(product) {
			products.value = [...products.value.filter((i) => i.id != product.id)];
			saveForm();
		}
		function reset() {
			loaded.value = false;
			products.value = [];
			options.value = {
				template: null,
				label_width: null,
				label_heigh: null,
				page_break: false,
				check_promo: false,
				show_site_name: true,
				show_product_name: false,
				show_product_price: true,
				show_product_image: false
			};
			saveForm();
		}
		function showForm() {
			loaded.value = false;
			window.scrollTo(0, 0);
		}
		async function load() {
			if (products.value.length < 1) {
				notify({
					group: "main",
					type: "error",
					title: t("Please add at least one product!")
				});
				return;
			}
			if (!options.value.template) {
				notify({
					group: "main",
					type: "error",
					title: t("Please select template!")
				});
				return;
			}
			if (products.value.reduce((a, p) => Number(p.quantity) + a, 0) > 1e3) {
				notify({
					group: "main",
					type: "error",
					title: t("Maximum 1000 labels can be printed at a time!")
				});
				return;
			}
			selected_template.value = templates.find((t) => t.value == options.value.template);
			loaded.value = true;
			labels.value = [];
			products.value.forEach((p) => {
				for (let i = 0; i < p.quantity; i++) labels.value = [...labels.value, p];
			});
			if (options.value.template && options.value.template != "1") labels.value = chunkArray(labels.value, Number(options.value.template));
			await nextTick();
			JsBarcode(".barcode").init();
			window.scrollTo(0, 0);
		}
		function print() {
			window.print();
		}
		return (_ctx, _push, _parent, _attrs) => {
			const _component_Head = resolveComponent("Head");
			const _component_Icon = resolveComponent("Icon");
			_push(`<!--[-->`);
			_push(ssrRenderComponent(_component_Head, null, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(`<title${_scopeId}>${ssrInterpolate(_ctx.$t("Product Labels"))}</title>`);
					else return [createVNode("title", null, toDisplayString(_ctx.$t("Product Labels")), 1)];
				}),
				_: 1
			}, _parent));
			_push(`<div class="px-0 pt-6 pb-0 sm:px-6 sm:py-8 lg:px-8">`);
			if (!loaded.value) _push(ssrRenderComponent(unref(_sfc_main$2), { onSubmitted: load }, {
				title: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(`${ssrInterpolate(_ctx.$t("Product Labels"))}`);
					else return [createTextVNode(toDisplayString(_ctx.$t("Product Labels")), 1)];
				}),
				description: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(`${ssrInterpolate(_ctx.$t("Please add products the below to print label."))}`);
					else return [createTextVNode(toDisplayString(_ctx.$t("Please add products the below to print label.")), 1)];
				}),
				form: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) {
						_push(`<div class="col-span-full rounded-sm border border-gray-200 p-6 dark:border-gray-700"${_scopeId}><div class="relative"${_scopeId}>`);
						_push(ssrRenderComponent(unref(_sfc_main$3), {
							id: "product-search",
							label: "",
							modelValue: search.value,
							"onUpdate:modelValue": ($event) => search.value = $event,
							placeholder: _ctx.$t("Scan barcode or type to search")
						}, null, _parent, _scopeId));
						if (search.value && result.value && result.value.length) {
							_push(`<div class="absolute start-0 end-0 top-full z-10 mt-2 max-h-96 overflow-y-auto rounded-md bg-white py-1 ring-1 ring-gray-200 dark:bg-gray-700 dark:ring-gray-700"${_scopeId}><!--[-->`);
							ssrRenderList(result.value, (p) => {
								_push(`<button type="button" class="w-full px-4 py-1.5 text-start hover:bg-gray-100 dark:hover:bg-gray-900"${_scopeId}>${ssrInterpolate(p.name)}</button>`);
							});
							_push(`<!--]--></div>`);
						} else _push(`<!---->`);
						_push(`</div>`);
						if (products.value && products.value.length) {
							_push(`<div${_scopeId}><h4 class="mt-6 mb-3 text-lg font-bold"${_scopeId}>${ssrInterpolate(_ctx.$t("Products"))}</h4><table class="w-full divide-y divide-gray-200 dark:divide-gray-700"${_scopeId}><!--[-->`);
							ssrRenderList(products.value, (product, index) => {
								_push(`<tr class="hover:bg-gray-50 dark:hover:bg-gray-800"${_scopeId}><td class="p-2"${_scopeId}>${ssrInterpolate(product.name)}</td><td class="w-36 px-2 py-1.5"${_scopeId}>`);
								_push(ssrRenderComponent(unref(_sfc_main$3), {
									min: 1,
									type: "number",
									modelValue: products.value[index].quantity,
									"onUpdate:modelValue": ($event) => products.value[index].quantity = $event,
									onChange: saveForm
								}, null, _parent, _scopeId));
								_push(`</td><td class="w-6 py-1 ps-4 pe-2"${_scopeId}><button type="button" class="text-red-500 hover:text-red-700"${_scopeId}>`);
								_push(ssrRenderComponent(_component_Icon, { name: "trash" }, null, _parent, _scopeId));
								_push(`</button></td></tr>`);
							});
							_push(`<!--]--></table></div>`);
						} else _push(`<!---->`);
						_push(`</div><div class="col-span-full"${_scopeId}>`);
						_push(ssrRenderComponent(unref(_sfc_main$4), {
							json: "",
							id: "template",
							onChange: saveForm,
							label: _ctx.$t("Template"),
							suggestions: templates,
							modelValue: options.value.template,
							"onUpdate:modelValue": ($event) => options.value.template = $event
						}, null, _parent, _scopeId));
						_push(`</div>`);
						if (options.value.template == "1") {
							_push(`<!--[--><div class="col-span-6 sm:col-span-3"${_scopeId}>`);
							_push(ssrRenderComponent(unref(_sfc_main$3), {
								onChange: saveForm,
								label: _ctx.$t("Label Width") + " (in)",
								min: .05,
								type: "number",
								modelValue: options.value.label_width,
								"onUpdate:modelValue": ($event) => options.value.label_width = $event
							}, null, _parent, _scopeId));
							_push(`</div><div class="col-span-6 sm:col-span-3"${_scopeId}>`);
							_push(ssrRenderComponent(unref(_sfc_main$3), {
								onChange: saveForm,
								label: _ctx.$t("Label Height") + " (in)",
								min: .05,
								type: "number",
								modelValue: options.value.label_height,
								"onUpdate:modelValue": ($event) => options.value.label_height = $event
							}, null, _parent, _scopeId));
							_push(`</div><div class="col-span-6 sm:col-span-3"${_scopeId}>`);
							_push(ssrRenderComponent(unref(_sfc_main$4), {
								json: true,
								onChange: saveForm,
								id: "barcode_height",
								label: _ctx.$t("Barcode Height"),
								suggestions: [
									{
										value: 20,
										label: "20px"
									},
									{
										value: 25,
										label: "25px"
									},
									{
										value: 30,
										label: "30px"
									},
									{
										value: 40,
										label: "40px"
									},
									{
										value: 50,
										label: "50px"
									},
									{
										value: 60,
										label: "60px"
									},
									{
										value: 80,
										label: "80px"
									},
									{
										value: 100,
										label: "100px"
									}
								],
								modelValue: options.value.barcode_height,
								"onUpdate:modelValue": ($event) => options.value.barcode_height = $event
							}, null, _parent, _scopeId));
							_push(`</div><div class="col-span-full"${_scopeId}>`);
							_push(ssrRenderComponent(unref(_sfc_main$5), {
								id: "page_break",
								modelValue: options.value.page_break,
								"onUpdate:modelValue": ($event) => options.value.page_break = $event,
								label: _ctx.$t("Add page break after each label"),
								onChange: saveForm
							}, null, _parent, _scopeId));
							_push(`</div><!--]-->`);
						} else _push(`<!---->`);
						_push(`<div class="col-span-full flex flex-wrap gap-x-10 gap-y-4 overflow-x-auto rounded-md border border-gray-200 p-4 dark:border-gray-700"${_scopeId}>`);
						_push(ssrRenderComponent(unref(_sfc_main$5), {
							onChange: saveForm,
							id: "show_site_name",
							label: _ctx.$t("Show Site Name"),
							modelValue: options.value.show_site_name,
							"onUpdate:modelValue": ($event) => options.value.show_site_name = $event
						}, null, _parent, _scopeId));
						_push(ssrRenderComponent(unref(_sfc_main$5), {
							onChange: saveForm,
							id: "show_product_price",
							label: _ctx.$t("Show Product Price"),
							modelValue: options.value.show_product_price,
							"onUpdate:modelValue": ($event) => options.value.show_product_price = $event
						}, null, _parent, _scopeId));
						_push(ssrRenderComponent(unref(_sfc_main$5), {
							onChange: saveForm,
							id: "show_product_name",
							label: _ctx.$t("Show Product Name"),
							modelValue: options.value.show_product_name,
							"onUpdate:modelValue": ($event) => options.value.show_product_name = $event
						}, null, _parent, _scopeId));
						_push(ssrRenderComponent(unref(_sfc_main$5), {
							onChange: saveForm,
							id: "show_product_image",
							label: _ctx.$t("Show Product Image"),
							modelValue: options.value.show_product_image,
							"onUpdate:modelValue": ($event) => options.value.show_product_image = $event
						}, null, _parent, _scopeId));
						_push(ssrRenderComponent(unref(_sfc_main$5), {
							onChange: saveForm,
							id: "qrcode",
							label: _ctx.$t("Show code as QRCode"),
							modelValue: options.value.qrcode,
							"onUpdate:modelValue": ($event) => options.value.qrcode = $event
						}, null, _parent, _scopeId));
						_push(ssrRenderComponent(unref(_sfc_main$5), {
							onChange: saveForm,
							id: "check_promo",
							label: _ctx.$t("Check for Promotions"),
							modelValue: options.value.check_promo,
							"onUpdate:modelValue": ($event) => options.value.check_promo = $event
						}, null, _parent, _scopeId));
						_push(`</div>`);
					} else return [
						createVNode("div", { class: "col-span-full rounded-sm border border-gray-200 p-6 dark:border-gray-700" }, [createVNode("div", { class: "relative" }, [createVNode(unref(_sfc_main$3), {
							id: "product-search",
							label: "",
							modelValue: search.value,
							"onUpdate:modelValue": ($event) => search.value = $event,
							placeholder: _ctx.$t("Scan barcode or type to search")
						}, null, 8, [
							"modelValue",
							"onUpdate:modelValue",
							"placeholder"
						]), search.value && result.value && result.value.length ? (openBlock(), createBlock("div", {
							key: 0,
							class: "absolute start-0 end-0 top-full z-10 mt-2 max-h-96 overflow-y-auto rounded-md bg-white py-1 ring-1 ring-gray-200 dark:bg-gray-700 dark:ring-gray-700"
						}, [(openBlock(true), createBlock(Fragment, null, renderList(result.value, (p) => {
							return openBlock(), createBlock("button", {
								key: p.id,
								type: "button",
								onClick: ($event) => addProduct(p),
								class: "w-full px-4 py-1.5 text-start hover:bg-gray-100 dark:hover:bg-gray-900"
							}, toDisplayString(p.name), 9, ["onClick"]);
						}), 128))])) : createCommentVNode("", true)]), products.value && products.value.length ? (openBlock(), createBlock("div", { key: 0 }, [createVNode("h4", { class: "mt-6 mb-3 text-lg font-bold" }, toDisplayString(_ctx.$t("Products")), 1), createVNode("table", { class: "w-full divide-y divide-gray-200 dark:divide-gray-700" }, [(openBlock(true), createBlock(Fragment, null, renderList(products.value, (product, index) => {
							return openBlock(), createBlock("tr", {
								key: product.code,
								class: "hover:bg-gray-50 dark:hover:bg-gray-800"
							}, [
								createVNode("td", { class: "p-2" }, toDisplayString(product.name), 1),
								createVNode("td", { class: "w-36 px-2 py-1.5" }, [createVNode(unref(_sfc_main$3), {
									min: 1,
									type: "number",
									modelValue: products.value[index].quantity,
									"onUpdate:modelValue": ($event) => products.value[index].quantity = $event,
									onChange: saveForm
								}, null, 8, ["modelValue", "onUpdate:modelValue"])]),
								createVNode("td", { class: "w-6 py-1 ps-4 pe-2" }, [createVNode("button", {
									type: "button",
									onClick: ($event) => removeItem(product),
									class: "text-red-500 hover:text-red-700"
								}, [createVNode(_component_Icon, { name: "trash" })], 8, ["onClick"])])
							]);
						}), 128))])])) : createCommentVNode("", true)]),
						createVNode("div", { class: "col-span-full" }, [createVNode(unref(_sfc_main$4), {
							json: "",
							id: "template",
							onChange: saveForm,
							label: _ctx.$t("Template"),
							suggestions: templates,
							modelValue: options.value.template,
							"onUpdate:modelValue": ($event) => options.value.template = $event
						}, null, 8, [
							"label",
							"modelValue",
							"onUpdate:modelValue"
						])]),
						options.value.template == "1" ? (openBlock(), createBlock(Fragment, { key: 0 }, [
							createVNode("div", { class: "col-span-6 sm:col-span-3" }, [createVNode(unref(_sfc_main$3), {
								onChange: saveForm,
								label: _ctx.$t("Label Width") + " (in)",
								min: .05,
								type: "number",
								modelValue: options.value.label_width,
								"onUpdate:modelValue": ($event) => options.value.label_width = $event
							}, null, 8, [
								"label",
								"modelValue",
								"onUpdate:modelValue"
							])]),
							createVNode("div", { class: "col-span-6 sm:col-span-3" }, [createVNode(unref(_sfc_main$3), {
								onChange: saveForm,
								label: _ctx.$t("Label Height") + " (in)",
								min: .05,
								type: "number",
								modelValue: options.value.label_height,
								"onUpdate:modelValue": ($event) => options.value.label_height = $event
							}, null, 8, [
								"label",
								"modelValue",
								"onUpdate:modelValue"
							])]),
							createVNode("div", { class: "col-span-6 sm:col-span-3" }, [createVNode(unref(_sfc_main$4), {
								json: true,
								onChange: saveForm,
								id: "barcode_height",
								label: _ctx.$t("Barcode Height"),
								suggestions: [
									{
										value: 20,
										label: "20px"
									},
									{
										value: 25,
										label: "25px"
									},
									{
										value: 30,
										label: "30px"
									},
									{
										value: 40,
										label: "40px"
									},
									{
										value: 50,
										label: "50px"
									},
									{
										value: 60,
										label: "60px"
									},
									{
										value: 80,
										label: "80px"
									},
									{
										value: 100,
										label: "100px"
									}
								],
								modelValue: options.value.barcode_height,
								"onUpdate:modelValue": ($event) => options.value.barcode_height = $event
							}, null, 8, [
								"label",
								"modelValue",
								"onUpdate:modelValue"
							])]),
							createVNode("div", { class: "col-span-full" }, [createVNode(unref(_sfc_main$5), {
								id: "page_break",
								modelValue: options.value.page_break,
								"onUpdate:modelValue": ($event) => options.value.page_break = $event,
								label: _ctx.$t("Add page break after each label"),
								onChange: saveForm
							}, null, 8, [
								"modelValue",
								"onUpdate:modelValue",
								"label"
							])])
						], 64)) : createCommentVNode("", true),
						createVNode("div", { class: "col-span-full flex flex-wrap gap-x-10 gap-y-4 overflow-x-auto rounded-md border border-gray-200 p-4 dark:border-gray-700" }, [
							createVNode(unref(_sfc_main$5), {
								onChange: saveForm,
								id: "show_site_name",
								label: _ctx.$t("Show Site Name"),
								modelValue: options.value.show_site_name,
								"onUpdate:modelValue": ($event) => options.value.show_site_name = $event
							}, null, 8, [
								"label",
								"modelValue",
								"onUpdate:modelValue"
							]),
							createVNode(unref(_sfc_main$5), {
								onChange: saveForm,
								id: "show_product_price",
								label: _ctx.$t("Show Product Price"),
								modelValue: options.value.show_product_price,
								"onUpdate:modelValue": ($event) => options.value.show_product_price = $event
							}, null, 8, [
								"label",
								"modelValue",
								"onUpdate:modelValue"
							]),
							createVNode(unref(_sfc_main$5), {
								onChange: saveForm,
								id: "show_product_name",
								label: _ctx.$t("Show Product Name"),
								modelValue: options.value.show_product_name,
								"onUpdate:modelValue": ($event) => options.value.show_product_name = $event
							}, null, 8, [
								"label",
								"modelValue",
								"onUpdate:modelValue"
							]),
							createVNode(unref(_sfc_main$5), {
								onChange: saveForm,
								id: "show_product_image",
								label: _ctx.$t("Show Product Image"),
								modelValue: options.value.show_product_image,
								"onUpdate:modelValue": ($event) => options.value.show_product_image = $event
							}, null, 8, [
								"label",
								"modelValue",
								"onUpdate:modelValue"
							]),
							createVNode(unref(_sfc_main$5), {
								onChange: saveForm,
								id: "qrcode",
								label: _ctx.$t("Show code as QRCode"),
								modelValue: options.value.qrcode,
								"onUpdate:modelValue": ($event) => options.value.qrcode = $event
							}, null, 8, [
								"label",
								"modelValue",
								"onUpdate:modelValue"
							]),
							createVNode(unref(_sfc_main$5), {
								onChange: saveForm,
								id: "check_promo",
								label: _ctx.$t("Check for Promotions"),
								modelValue: options.value.check_promo,
								"onUpdate:modelValue": ($event) => options.value.check_promo = $event
							}, null, 8, [
								"label",
								"modelValue",
								"onUpdate:modelValue"
							])
						])
					];
				}),
				actions: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) {
						_push(`<div class="flex w-full items-center justify-between"${_scopeId}>`);
						_push(ssrRenderComponent(unref(_sfc_main$1), {
							type: "button",
							onClick: reset
						}, {
							default: withCtx((_, _push, _parent, _scopeId) => {
								if (_push) _push(`${ssrInterpolate(_ctx.$t("Reset"))}`);
								else return [createTextVNode(toDisplayString(_ctx.$t("Reset")), 1)];
							}),
							_: 1
						}, _parent, _scopeId));
						_push(ssrRenderComponent(unref(_sfc_main$6), {
							type: "button",
							onClick: load,
							loading: loaded.value
						}, {
							default: withCtx((_, _push, _parent, _scopeId) => {
								if (_push) _push(`${ssrInterpolate(_ctx.$t("Load"))}`);
								else return [createTextVNode(toDisplayString(_ctx.$t("Load")), 1)];
							}),
							_: 1
						}, _parent, _scopeId));
						_push(`</div>`);
					} else return [createVNode("div", { class: "flex w-full items-center justify-between" }, [createVNode(unref(_sfc_main$1), {
						type: "button",
						onClick: reset
					}, {
						default: withCtx(() => [createTextVNode(toDisplayString(_ctx.$t("Reset")), 1)]),
						_: 1
					}), createVNode(unref(_sfc_main$6), {
						type: "button",
						onClick: load,
						loading: loaded.value
					}, {
						default: withCtx(() => [createTextVNode(toDisplayString(_ctx.$t("Load")), 1)]),
						_: 1
					}, 8, ["loading"])])];
				}),
				_: 1
			}, _parent));
			else _push(`<!---->`);
			if (loaded.value) {
				_push(`<div class="flex flex-col gap-6 text-black"><div class="hidden"><div class="mb-[1px]"></div><div class="mb-[5px]"></div><div class="mb-[10px]"></div><div class="mb-[15px]"></div><div class="mb-[20px]"></div><div class="mb-[25px]"></div><div class="mb-[30px]"></div></div>`);
				if (options.value.template == "1" && options.value.page_break) {
					_push(`<!--[-->`);
					ssrRenderList(labels.value, (label) => {
						_push(`<div style="${ssrRenderStyle({
							width: options.value.label_width * 96 + "px",
							height: options.value.label_height * 96 + "px"
						})}" class="mx-auto flex break-inside-avoid break-after-page flex-col items-center overflow-hidden rounded-xs bg-white p-1 text-sm">`);
						if (options.value.show_site_name) _push(`<div class="font-extrabold">${ssrInterpolate(unref(page).props.settings?.name)}</div>`);
						else _push(`<!---->`);
						if (options.value.show_product_name) _push(`<div>${ssrInterpolate(label.name)}</div>`);
						else _push(`<!---->`);
						_push(`<div class="${ssrRenderClass([options.value.barcode_height ? options.value.barcode_height == 100 ? "h-[100px]" : options.value.barcode_height == 80 ? "h-[80px]" : options.value.barcode_height == 60 ? "h-[60px]" : options.value.barcode_height == 50 ? "h-[50px]" : options.value.barcode_height == 40 ? "h-[40px]" : options.value.barcode_height == 30 ? "h-[30px]" : options.value.barcode_height == 25 ? "h-[25px]" : options.value.barcode_height == 20 ? "h-[20px]" : "h-[55px]" : "h-[55px]", "flex items-center justify-center gap-x-2"])}">`);
						if (label.photo) _push(`<img${ssrRenderAttr("src", label.photo)} class="max-h-full">`);
						else _push(`<!---->`);
						if (options.value.qrcode) _push(`<div class="flex w-full items-center justify-center"><div class="${ssrRenderClass([options.value.barcode_height ? options.value.barcode_height == 100 ? "h-[100px]" : options.value.barcode_height == 80 ? "h-[80px]" : options.value.barcode_height == 60 ? "h-[60px]" : options.value.barcode_height == 50 ? "h-[50px]" : options.value.barcode_height == 40 ? "h-[40px]" : options.value.barcode_height == 30 ? "h-[30px]" : options.value.barcode_height == 25 ? "h-[25px]" : options.value.barcode_height == 20 ? "h-[20px]" : "h-[55px]" : "h-[55px]", "qrcode"])}">${label.qrcode ?? ""}</div></div>`);
						else _push(`<svg class="barcode"${ssrRenderAttr("jsbarcode-width", 1)}${ssrRenderAttr("jsbarcode-margin", 0)}${ssrRenderAttr("jsbarcode-fontsize", 12)}${ssrRenderAttr("jsbarcode-textmargin", 0)} jsbarcode-fontoptions="bold"${ssrRenderAttr("jsbarcode-value", label.code)}${ssrRenderAttr("jsbarcode-format", label.symbology)}${ssrRenderAttr("jsbarcode-height", options.value.barcode_height || 30)}></svg>`);
						_push(`</div>`);
						if (options.value.show_product_price) _push(`<div>${ssrInterpolate(_ctx.$t("Price"))}: ${ssrInterpolate(_ctx.$currency(label.price))}</div>`);
						else _push(`<!---->`);
						_push(`</div>`);
					});
					_push(`<!--]-->`);
				} else if (options.value.template == "1") {
					_push(`<div style="${ssrRenderStyle({ width: "794px" })}" class="col-span-full mx-auto flex w-full break-after-page flex-wrap place-content-start items-start justify-between gap-px overflow-hidden p-px text-black print:h-full print:w-full"><!--[-->`);
					ssrRenderList(labels.value, (label) => {
						_push(`<div style="${ssrRenderStyle({
							width: options.value.label_width * 96 + "px",
							height: options.value.label_height * 96 + "px"
						})}" class="mb-px flex break-inside-avoid flex-col items-center overflow-hidden rounded-xs bg-white p-1 text-sm">`);
						if (options.value.show_site_name) _push(`<div class="font-extrabold">${ssrInterpolate(unref(page).props.settings?.name)}</div>`);
						else _push(`<!---->`);
						if (options.value.show_product_name) _push(`<div>${ssrInterpolate(label.name)}</div>`);
						else _push(`<!---->`);
						_push(`<div class="${ssrRenderClass([options.value.barcode_height ? options.value.barcode_height == 100 ? "h-[100px]" : options.value.barcode_height == 80 ? "h-[80px]" : options.value.barcode_height == 60 ? "h-[60px]" : options.value.barcode_height == 50 ? "h-[50px]" : options.value.barcode_height == 40 ? "h-[40px]" : options.value.barcode_height == 30 ? "h-[30px]" : options.value.barcode_height == 25 ? "h-[25px]" : options.value.barcode_height == 20 ? "h-[20px]" : "h-[55px]" : "h-[55px]", "flex items-center justify-center gap-x-2"])}">`);
						if (label.photo) _push(`<img${ssrRenderAttr("src", label.photo)} class="max-h-full">`);
						else _push(`<!---->`);
						if (options.value.qrcode) _push(`<div class="flex w-full items-center justify-center"><div class="${ssrRenderClass([options.value.barcode_height ? options.value.barcode_height == 100 ? "h-[100px]" : options.value.barcode_height == 80 ? "h-[80px]" : options.value.barcode_height == 60 ? "h-[60px]" : options.value.barcode_height == 50 ? "h-[50px]" : options.value.barcode_height == 40 ? "h-[40px]" : options.value.barcode_height == 30 ? "h-[30px]" : options.value.barcode_height == 25 ? "h-[25px]" : options.value.barcode_height == 20 ? "h-[20px]" : "h-[55px]" : "h-[55px]", "qrcode"])}">${label.qrcode ?? ""}</div></div>`);
						else _push(`<svg class="barcode"${ssrRenderAttr("jsbarcode-width", 1)}${ssrRenderAttr("jsbarcode-margin", 0)}${ssrRenderAttr("jsbarcode-fontsize", 12)}${ssrRenderAttr("jsbarcode-textmargin", 0)} jsbarcode-fontoptions="bold"${ssrRenderAttr("jsbarcode-value", label.code)}${ssrRenderAttr("jsbarcode-format", label.symbology)}${ssrRenderAttr("jsbarcode-height", options.value.barcode_height || 30)}></svg>`);
						_push(`</div>`);
						if (options.value.show_product_price) _push(`<div>${ssrInterpolate(_ctx.$t("Price"))}: ${ssrInterpolate(_ctx.$currency(label.price))}</div>`);
						else _push(`<!---->`);
						_push(`</div>`);
					});
					_push(`<!--]--></div>`);
				} else {
					_push(`<!--[-->`);
					ssrRenderList(labels.value, (group, gi) => {
						_push(`<div style="${ssrRenderStyle({
							width: "826px",
							height: "1159px"
						})}" class="col-span-full mx-auto rounded-md border border-gray-200 p-4 dark:border-gray-700 print:border-0 print:p-0"><div style="${ssrRenderStyle({
							width: "794px",
							height: "1123px"
						})}" class="col-span-full mx-auto flex w-full break-after-page flex-wrap place-content-start items-start justify-between gap-px overflow-hidden p-px text-black print:h-full print:w-full"><!--[-->`);
						ssrRenderList(group, (label) => {
							_push(`<div style="${ssrRenderStyle({
								width: selected_template.value?.width + "px",
								height: selected_template.value.height + "px"
							})}" class="${ssrRenderClass([[`mb-[${selected_template.value?.vertical_gap || 1}px]`, selected_template.value.image == "start" ? "" : "flex-col"], "flex break-inside-avoid items-center overflow-hidden rounded-xs bg-white p-1 text-sm"])}">`);
							if (label.photo && selected_template.value.image == "start") _push(`<img${ssrRenderAttr("src", label.photo)} class="h-full max-h-28">`);
							else _push(`<!---->`);
							_push(`<div class="flex w-full flex-col items-center justify-center">`);
							if (options.value.show_site_name) _push(`<div class="font-extrabold">${ssrInterpolate(unref(page).props.settings?.name)}</div>`);
							else _push(`<!---->`);
							if (options.value.show_product_name) _push(`<div>${ssrInterpolate(label.name)}</div>`);
							else _push(`<!---->`);
							_push(`<div class="${ssrRenderClass([[selected_template.value.image == "start" ? "justify-center" : "justify-between", selected_template.value.barcode_height ? selected_template.value.barcode_height == 60 ? "h-[60px]" : selected_template.value.barcode_height == 50 ? "h-[50px]" : selected_template.value.barcode_height == 40 ? "h-[40px]" : selected_template.value.barcode_height == 30 ? "h-[30px]" : selected_template.value.barcode_height == 25 ? "h-[25px]" : "h-[55px]" : "h-[55px]"], "flex w-full items-center gap-x-2 px-2"])}">`);
							if (label.photo && selected_template.value.image != "start") _push(`<img${ssrRenderAttr("src", label.photo)} class="max-h-full">`);
							else _push(`<!---->`);
							if (options.value.qrcode) _push(`<div class="flex items-center justify-center"><div class="${ssrRenderClass([selected_template.value.barcode_height ? selected_template.value.barcode_height == 60 ? "h-[60px]" : selected_template.value.barcode_height == 50 ? "h-[50px]" : selected_template.value.barcode_height == 40 ? "h-[40px]" : selected_template.value.barcode_height == 30 ? "h-[30px]" : selected_template.value.barcode_height == 25 ? "h-[25px]" : "h-[55px]" : "h-[55px]", "qrcode"])}">${label.qrcode ?? ""}</div></div>`);
							else _push(`<svg class="barcode"${ssrRenderAttr("jsbarcode-width", 1)}${ssrRenderAttr("jsbarcode-margin", 0)}${ssrRenderAttr("jsbarcode-fontsize", 12)}${ssrRenderAttr("jsbarcode-textmargin", 0)} jsbarcode-fontoptions="bold"${ssrRenderAttr("jsbarcode-value", label.code)}${ssrRenderAttr("jsbarcode-format", label.symbology)}${ssrRenderAttr("jsbarcode-height", selected_template.value?.barcode_height ? selected_template.value.barcode_height - 10 : 30)}></svg>`);
							_push(`</div>`);
							if (options.value.show_product_price) _push(`<div>${ssrInterpolate(_ctx.$t("Price"))}: ${ssrInterpolate(_ctx.$currency(label.price))}</div>`);
							else _push(`<!---->`);
							_push(`</div></div>`);
						});
						_push(`<!--]--></div><div class="text-center text-xs text-gray-700 dark:text-gray-300 print:hidden">${ssrInterpolate(_ctx.$t("Page"))} ${ssrInterpolate(gi + 1)}</div></div>`);
					});
					_push(`<!--]-->`);
				}
				_push(`<div class="mt-6 flex w-full items-center justify-center gap-4 print:hidden">`);
				_push(ssrRenderComponent(unref(_sfc_main$1), {
					type: "button",
					onClick: showForm
				}, {
					default: withCtx((_, _push, _parent, _scopeId) => {
						if (_push) _push(`${ssrInterpolate(_ctx.$t("Form"))}`);
						else return [createTextVNode(toDisplayString(_ctx.$t("Form")), 1)];
					}),
					_: 1
				}, _parent));
				_push(ssrRenderComponent(unref(_sfc_main$6), {
					type: "button",
					onClick: print
				}, {
					default: withCtx((_, _push, _parent, _scopeId) => {
						if (_push) _push(`${ssrInterpolate(_ctx.$t("Print"))}`);
						else return [createTextVNode(toDisplayString(_ctx.$t("Print")), 1)];
					}),
					_: 1
				}, _parent));
				_push(`</div></div>`);
			} else _push(`<!---->`);
			_push(`</div><!--]-->`);
		};
	}
});
var _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
	const ssrContext = useSSRContext();
	(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("resources/js/Pages/Sma/Product/Label.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
//#endregion
export { _sfc_main as default };
