@antontranelis/money-printer 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { jsxs as m, jsx as l, Fragment as M } from "react/jsx-runtime";
2
- import { create as fe } from "zustand";
3
- import { persist as be } from "zustand/middleware";
4
- import { useState as E, useCallback as C, useRef as $, useEffect as G } from "react";
5
- import ye from "jspdf";
6
- const V = {
1
+ import { jsxs as u, jsx as l, Fragment as O } from "react/jsx-runtime";
2
+ import { create as ve } from "zustand";
3
+ import { persist as ye } from "zustand/middleware";
4
+ import { useState as N, useCallback as T, useRef as _, useEffect as Y } from "react";
5
+ import xe from "jspdf";
6
+ const J = {
7
7
  personalInfo: {
8
8
  name: "",
9
9
  email: "",
@@ -23,27 +23,28 @@ const V = {
23
23
  currentSide: "front",
24
24
  isEnhancing: !1,
25
25
  isExporting: !1
26
- }, y = fe()(
27
- be(
26
+ }, v = ve()(
27
+ ye(
28
28
  (e) => ({
29
- ...V,
30
- setPersonalInfo: (t) => e((a) => ({
31
- personalInfo: { ...a.personalInfo, ...t }
29
+ ...J,
30
+ setPersonalInfo: (t) => e((n) => ({
31
+ personalInfo: { ...n.personalInfo, ...t }
32
32
  })),
33
- setVoucherConfig: (t) => e((a) => ({
34
- voucherConfig: { ...a.voucherConfig, ...t }
33
+ setVoucherConfig: (t) => e((n) => ({
34
+ voucherConfig: { ...n.voucherConfig, ...t }
35
35
  })),
36
- setPortrait: (t, a = null) => e({
36
+ setPortrait: (t, n = null) => e((a) => ({
37
37
  portrait: {
38
38
  original: t,
39
- enhanced: a,
39
+ enhanced: n,
40
40
  useEnhanced: !1,
41
- zoom: 1
41
+ // Keep current zoom if updating existing portrait, reset to 1 for new portrait
42
+ zoom: a.portrait.original && t ? a.portrait.zoom : 1
42
43
  }
43
- }),
44
- setEnhancedPortrait: (t) => e((a) => ({
44
+ })),
45
+ setEnhancedPortrait: (t) => e((n) => ({
45
46
  portrait: {
46
- ...a.portrait,
47
+ ...n.portrait,
47
48
  enhanced: t,
48
49
  useEnhanced: t !== null
49
50
  }
@@ -54,9 +55,9 @@ const V = {
54
55
  useEnhanced: t.portrait.enhanced ? !t.portrait.useEnhanced : !1
55
56
  }
56
57
  })),
57
- setPortraitZoom: (t) => e((a) => ({
58
+ setPortraitZoom: (t) => e((n) => ({
58
59
  portrait: {
59
- ...a.portrait,
60
+ ...n.portrait,
60
61
  zoom: t
61
62
  }
62
63
  })),
@@ -66,23 +67,24 @@ const V = {
66
67
  })),
67
68
  setIsEnhancing: (t) => e({ isEnhancing: t }),
68
69
  setIsExporting: (t) => e({ isExporting: t }),
69
- setLanguage: (t) => e((a) => ({
70
- voucherConfig: { ...a.voucherConfig, language: t }
70
+ setLanguage: (t) => e((n) => ({
71
+ voucherConfig: { ...n.voucherConfig, language: t }
71
72
  })),
72
- setHours: (t) => e((a) => ({
73
- voucherConfig: { ...a.voucherConfig, hours: t }
73
+ setHours: (t) => e((n) => ({
74
+ voucherConfig: { ...n.voucherConfig, hours: t }
74
75
  })),
75
- reset: () => e(V)
76
+ reset: () => e(J)
76
77
  }),
77
78
  {
78
79
  name: "money-generator-storage",
79
80
  partialize: (e) => ({
80
81
  personalInfo: e.personalInfo,
81
- voucherConfig: e.voucherConfig
82
+ voucherConfig: e.voucherConfig,
83
+ portrait: e.portrait
82
84
  })
83
85
  }
84
86
  )
85
- ), we = {
87
+ ), ke = {
86
88
  header: {
87
89
  title: "Money Generator",
88
90
  subtitle: "Erstelle deinen persönlichen Zeitgutschein"
@@ -129,7 +131,7 @@ const V = {
129
131
  bill: {
130
132
  descriptionText: "Für diesen Schein erhältst du {hours} {hourLabel} meiner Zeit oder ein gleichwertiges Dankeschön"
131
133
  }
132
- }, ve = {
134
+ }, Ie = {
133
135
  header: {
134
136
  title: "Money Generator",
135
137
  subtitle: "Create your personal time voucher"
@@ -176,65 +178,99 @@ const V = {
176
178
  bill: {
177
179
  descriptionText: "This voucher entitles you to {hours} {hourLabel} of my time or an equivalent thank you"
178
180
  }
179
- }, xe = { de: we, en: ve };
180
- function z(e) {
181
- return xe[e];
181
+ }, Ee = { de: ke, en: Ie };
182
+ function M(e) {
183
+ return Ee[e];
182
184
  }
183
- function J(e, t, a) {
184
- if (a && a.trim())
185
- return a;
186
- const n = z(e), r = t === 1 ? n.form.voucher.hourLabel : n.form.voucher.hoursLabel;
187
- return n.bill.descriptionText.replace("{hours}", t.toString()).replace("{hourLabel}", r);
185
+ function te(e, t, n) {
186
+ if (n && n.trim())
187
+ return n;
188
+ const a = M(e), r = t === 1 ? a.form.voucher.hourLabel : a.form.voucher.hoursLabel;
189
+ return a.bill.descriptionText.replace("{hours}", t.toString()).replace("{hourLabel}", r);
188
190
  }
189
- function Ve() {
190
- const e = y((r) => r.voucherConfig.language), t = y((r) => r.personalInfo), a = y((r) => r.setPersonalInfo), n = z(e);
191
- return /* @__PURE__ */ m("div", { className: "space-y-4", children: [
192
- /* @__PURE__ */ m("div", { className: "form-control", children: [
193
- /* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text font-medium", children: n.form.personalInfo.name }) }),
191
+ function Je() {
192
+ const e = v((r) => r.voucherConfig.language), t = v((r) => r.personalInfo), n = v((r) => r.setPersonalInfo), a = M(e);
193
+ return /* @__PURE__ */ u("div", { className: "space-y-4", children: [
194
+ /* @__PURE__ */ u("div", { className: "form-control", children: [
195
+ /* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text font-medium", children: a.form.personalInfo.name }) }),
194
196
  /* @__PURE__ */ l(
195
197
  "input",
196
198
  {
197
199
  type: "text",
198
- placeholder: n.form.personalInfo.namePlaceholder,
200
+ placeholder: a.form.personalInfo.namePlaceholder,
199
201
  className: "input input-bordered w-full",
200
202
  value: t.name,
201
- onChange: (r) => a({ name: r.target.value })
203
+ onChange: (r) => n({ name: r.target.value })
202
204
  }
203
205
  )
204
206
  ] }),
205
- /* @__PURE__ */ m("div", { className: "form-control", children: [
206
- /* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text font-medium", children: n.form.personalInfo.email }) }),
207
+ /* @__PURE__ */ u("div", { className: "form-control", children: [
208
+ /* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text font-medium", children: a.form.personalInfo.email }) }),
207
209
  /* @__PURE__ */ l(
208
210
  "input",
209
211
  {
210
212
  type: "email",
211
- placeholder: n.form.personalInfo.emailPlaceholder,
213
+ placeholder: a.form.personalInfo.emailPlaceholder,
212
214
  className: "input input-bordered w-full",
213
215
  value: t.email,
214
- onChange: (r) => a({ email: r.target.value })
216
+ onChange: (r) => n({ email: r.target.value })
215
217
  }
216
218
  )
217
219
  ] }),
218
- /* @__PURE__ */ m("div", { className: "form-control", children: [
219
- /* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text font-medium", children: n.form.personalInfo.phone }) }),
220
+ /* @__PURE__ */ u("div", { className: "form-control", children: [
221
+ /* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text font-medium", children: a.form.personalInfo.phone }) }),
220
222
  /* @__PURE__ */ l(
221
223
  "input",
222
224
  {
223
225
  type: "tel",
224
- placeholder: n.form.personalInfo.phonePlaceholder,
226
+ placeholder: a.form.personalInfo.phonePlaceholder,
225
227
  className: "input input-bordered w-full",
226
228
  value: t.phone,
227
- onChange: (r) => a({ phone: r.target.value })
229
+ onChange: (r) => n({ phone: r.target.value })
228
230
  }
229
231
  )
230
232
  ] })
231
233
  ] });
232
234
  }
233
- const j = {}, Ie = "https://api.stability.ai/v1/generation", ke = "https://api.stability.ai/v2beta/stable-image/edit/remove-background", Q = "stability_api_key", Ne = {
235
+ async function Ne(e, t = 0.5) {
236
+ return new Promise((n, a) => {
237
+ const r = new Image();
238
+ r.onload = () => {
239
+ const i = document.createElement("canvas"), c = i.getContext("2d");
240
+ if (!c) {
241
+ a(new Error("Failed to get canvas context"));
242
+ return;
243
+ }
244
+ i.width = r.width, i.height = r.height, c.drawImage(r, 0, 0);
245
+ const s = c.getImageData(0, 0, i.width, i.height), o = s.data, d = 1 + t * 0.8;
246
+ for (let h = 0; h < o.length; h += 4) {
247
+ const g = o[h], f = o[h + 1], b = o[h + 2];
248
+ if (o[h + 3] === 0) continue;
249
+ let k = (((0.299 * g + 0.587 * f + 0.114 * b) / 255 - 0.5) * d + 0.5) * 255;
250
+ k = Math.max(0, Math.min(255, k));
251
+ const x = Math.min(255, k * 0.9 + 25), A = Math.min(255, k * 0.78 + 15), y = Math.min(255, k * 0.55 + 5);
252
+ o[h] = Math.round(g * (1 - t) + x * t), o[h + 1] = Math.round(f * (1 - t) + A * t), o[h + 2] = Math.round(b * (1 - t) + y * t);
253
+ }
254
+ c.putImageData(s, 0, 0), n(i.toDataURL("image/png"));
255
+ }, r.onerror = () => a(new Error("Failed to load image")), r.src = e;
256
+ });
257
+ }
258
+ const Pe = "https://api.stability.ai/v1/generation", Se = "https://api.stability.ai/v2beta/stable-image/edit/remove-background", ne = "stability_api_key";
259
+ let $ = null;
260
+ function Qe(e) {
261
+ $ = e;
262
+ }
263
+ function et() {
264
+ return $;
265
+ }
266
+ function tt() {
267
+ return $ !== null;
268
+ }
269
+ const Ce = {
234
270
  vintage: "portrait in the style of vintage currency engraving, fine line work, crosshatching, sepia tones, detailed stippling, classic bank note portrait style",
235
271
  engraved: "portrait as detailed intaglio engraving, currency bill style, fine parallel lines, high contrast, official government portrait",
236
272
  currency: "portrait rendered as US dollar bill engraving, official currency portrait style, green tint, fine line engraving technique"
237
- }, Z = [
273
+ }, Q = [
238
274
  { width: 1024, height: 1024 },
239
275
  { width: 1152, height: 896 },
240
276
  { width: 1216, height: 832 },
@@ -245,167 +281,158 @@ const j = {}, Ie = "https://api.stability.ai/v1/generation", ke = "https://api.s
245
281
  { width: 832, height: 1216 },
246
282
  { width: 896, height: 1152 }
247
283
  ];
248
- function Ee(e, t) {
249
- const a = e / t;
250
- let n = Z[0], r = 1 / 0;
251
- for (const s of Z) {
252
- const d = s.width / s.height, o = Math.abs(a - d);
253
- o < r && (r = o, n = s);
284
+ function Te(e, t) {
285
+ const n = e / t;
286
+ let a = Q[0], r = 1 / 0;
287
+ for (const i of Q) {
288
+ const c = i.width / i.height, s = Math.abs(n - c);
289
+ s < r && (r = s, a = i);
254
290
  }
255
- return n;
291
+ return a;
256
292
  }
257
- function Pe(e) {
258
- return new Promise((t, a) => {
259
- const n = new Image();
260
- n.onload = () => {
261
- const r = Ee(n.width, n.height), s = document.createElement("canvas");
262
- s.width = r.width, s.height = r.height;
263
- const d = s.getContext("2d");
264
- if (!d) {
265
- a(new Error("Failed to get canvas context"));
293
+ function Ae(e) {
294
+ return new Promise((t, n) => {
295
+ const a = new Image();
296
+ a.onload = () => {
297
+ const r = Te(a.width, a.height), i = document.createElement("canvas");
298
+ i.width = r.width, i.height = r.height;
299
+ const c = i.getContext("2d");
300
+ if (!c) {
301
+ n(new Error("Failed to get canvas context"));
266
302
  return;
267
303
  }
268
- const o = n.width / n.height, i = r.width / r.height;
269
- let c = 0, u = 0, g = n.width, f = n.height;
270
- o > i ? (g = n.height * i, c = (n.width - g) / 2) : (f = n.width / i, u = (n.height - f) / 2), d.drawImage(n, c, u, g, f, 0, 0, r.width, r.height), t(s.toDataURL("image/png"));
271
- }, n.onerror = () => a(new Error("Failed to load image")), n.src = e;
304
+ const s = a.width / a.height, o = r.width / r.height;
305
+ let d = 0, h = 0, g = a.width, f = a.height;
306
+ s > o ? (g = a.height * o, d = (a.width - g) / 2) : (f = a.width / o, h = (a.height - f) / 2), c.drawImage(a, d, h, g, f, 0, 0, r.width, r.height), t(i.toDataURL("image/png"));
307
+ }, a.onerror = () => n(new Error("Failed to load image")), a.src = e;
272
308
  });
273
309
  }
274
- function ee(e) {
275
- var d;
276
- const t = e.split(","), a = ((d = t[0].match(/:(.*?);/)) == null ? void 0 : d[1]) || "image/png", n = atob(t[1]), r = n.length, s = new Uint8Array(r);
277
- for (let o = 0; o < r; o++)
278
- s[o] = n.charCodeAt(o);
279
- return new Blob([s], { type: a });
310
+ function ae(e) {
311
+ var c;
312
+ const t = e.split(","), n = ((c = t[0].match(/:(.*?);/)) == null ? void 0 : c[1]) || "image/png", a = atob(t[1]), r = a.length, i = new Uint8Array(r);
313
+ for (let s = 0; s < r; s++)
314
+ i[s] = a.charCodeAt(s);
315
+ return new Blob([i], { type: n });
280
316
  }
281
- function q() {
317
+ function V() {
282
318
  var t;
283
- const e = typeof import.meta < "u" && (j == null ? void 0 : j.VITE_STABILITY_API_KEY) || typeof process < "u" && ((t = process.env) == null ? void 0 : t.NEXT_PUBLIC_STABILITY_API_KEY);
284
- return e && e !== "your-api-key-here" ? e : typeof localStorage < "u" ? localStorage.getItem(Q) : null;
319
+ const e = typeof import.meta < "u" && "sk-7mEKklrqaltdtgbX0VoZbkA8E1cl939Spn75jSIYRvp1BW0b" || typeof process < "u" && ((t = process.env) == null ? void 0 : t.NEXT_PUBLIC_STABILITY_API_KEY);
320
+ return e && e !== "your-api-key-here" ? e : typeof localStorage < "u" ? localStorage.getItem(ne) : null;
285
321
  }
286
- function Se(e) {
287
- localStorage.setItem(Q, e);
322
+ function Le(e) {
323
+ localStorage.setItem(ne, e);
288
324
  }
289
- function Ce() {
290
- return q() !== null;
325
+ function De() {
326
+ return $ ? !0 : V() !== null;
291
327
  }
292
- async function Ze(e) {
293
- const t = q();
328
+ async function nt(e) {
329
+ const t = V();
294
330
  if (!t)
295
331
  throw new Error("No Stability AI API key configured");
296
- const { imageDataUrl: a, style: n, strength: r = 0.35 } = e, s = await Pe(a), d = ee(s), o = new FormData();
297
- o.append("init_image", d, "portrait.png"), o.append("init_image_mode", "IMAGE_STRENGTH"), o.append("image_strength", String(1 - r)), o.append("text_prompts[0][text]", Ne[n]), o.append("text_prompts[0][weight]", "1"), o.append("cfg_scale", "7"), o.append("samples", "1"), o.append("steps", "30");
298
- const c = await fetch(`${Ie}/stable-diffusion-xl-1024-v1-0/image-to-image`, {
332
+ const { imageDataUrl: n, style: a, strength: r = 0.35 } = e, i = await Ae(n), c = ae(i), s = new FormData();
333
+ s.append("init_image", c, "portrait.png"), s.append("init_image_mode", "IMAGE_STRENGTH"), s.append("image_strength", String(1 - r)), s.append("text_prompts[0][text]", Ce[a]), s.append("text_prompts[0][weight]", "1"), s.append("cfg_scale", "7"), s.append("samples", "1"), s.append("steps", "30");
334
+ const d = await fetch(`${Pe}/stable-diffusion-xl-1024-v1-0/image-to-image`, {
299
335
  method: "POST",
300
336
  headers: {
301
337
  Authorization: `Bearer ${t}`,
302
338
  Accept: "application/json"
303
339
  },
304
- body: o
340
+ body: s
305
341
  });
306
- if (!c.ok) {
307
- const g = await c.text();
308
- throw console.error("Stability AI error:", g), c.status === 401 ? new Error("Invalid API key") : c.status === 402 ? new Error("Insufficient credits") : c.status === 429 ? new Error("Rate limit exceeded. Please try again later.") : new Error(`API error: ${c.status}`);
342
+ if (!d.ok) {
343
+ const g = await d.text();
344
+ throw console.error("Stability AI error:", g), d.status === 401 ? new Error("Invalid API key") : d.status === 402 ? new Error("Insufficient credits") : d.status === 429 ? new Error("Rate limit exceeded. Please try again later.") : new Error(`API error: ${d.status}`);
309
345
  }
310
- const u = await c.json();
311
- if (!u.artifacts || u.artifacts.length === 0)
346
+ const h = await d.json();
347
+ if (!h.artifacts || h.artifacts.length === 0)
312
348
  throw new Error("No image generated");
313
- return `data:image/png;base64,${u.artifacts[0].base64}`;
349
+ return `data:image/png;base64,${h.artifacts[0].base64}`;
314
350
  }
315
- async function Ae(e) {
316
- const t = q();
351
+ async function _e(e) {
352
+ if ($) {
353
+ const c = await fetch($, {
354
+ method: "POST",
355
+ headers: {
356
+ "Content-Type": "application/json"
357
+ },
358
+ body: JSON.stringify({ imageDataUrl: e })
359
+ });
360
+ if (!c.ok) {
361
+ const o = await c.json().catch(() => ({}));
362
+ throw new Error(o.error || `API error: ${c.status}`);
363
+ }
364
+ return (await c.json()).imageDataUrl;
365
+ }
366
+ const t = V();
317
367
  if (!t)
318
368
  throw new Error("No Stability AI API key configured");
319
- const a = ee(e), n = new FormData();
320
- n.append("image", a, "image.png"), n.append("output_format", "png");
321
- const r = await fetch(ke, {
369
+ const n = ae(e), a = new FormData();
370
+ a.append("image", n, "image.png"), a.append("output_format", "png");
371
+ const r = await fetch(Se, {
322
372
  method: "POST",
323
373
  headers: {
324
374
  Authorization: `Bearer ${t}`,
325
375
  Accept: "image/*"
326
376
  },
327
- body: n
377
+ body: a
328
378
  });
329
379
  if (!r.ok) {
330
- const d = await r.text();
331
- throw console.error("Stability AI remove background error:", d), r.status === 401 ? new Error("Invalid API key") : r.status === 402 ? new Error("Insufficient credits") : r.status === 429 ? new Error("Rate limit exceeded. Please try again later.") : new Error(`API error: ${r.status}`);
380
+ const c = await r.text();
381
+ throw console.error("Stability AI remove background error:", c), r.status === 401 ? new Error("Invalid API key") : r.status === 402 ? new Error("Insufficient credits") : r.status === 429 ? new Error("Rate limit exceeded. Please try again later.") : new Error(`API error: ${r.status}`);
332
382
  }
333
- const s = await r.blob();
334
- return new Promise((d, o) => {
335
- const i = new FileReader();
336
- i.onload = () => d(i.result), i.onerror = () => o(new Error("Failed to read result")), i.readAsDataURL(s);
337
- });
338
- }
339
- async function Te(e) {
340
- return new Promise((t, a) => {
341
- const n = new Image();
342
- n.onload = () => {
343
- const r = document.createElement("canvas"), s = r.getContext("2d");
344
- if (!s) {
345
- a(new Error("Failed to get canvas context"));
346
- return;
347
- }
348
- r.width = n.width, r.height = n.height, s.drawImage(n, 0, 0);
349
- const d = s.getImageData(0, 0, r.width, r.height), o = d.data;
350
- for (let i = 0; i < o.length; i += 4) {
351
- const c = o[i], u = o[i + 1], g = o[i + 2];
352
- if (o[i + 3] === 0) continue;
353
- let x = (((0.299 * c + 0.587 * u + 0.114 * g) / 255 - 0.5) * 1.15 + 0.5) * 255;
354
- x = Math.max(0, Math.min(255, x));
355
- const k = Math.min(255, x * 0.95 + 30), v = Math.min(255, x * 0.85 + 20), S = Math.min(255, x * 0.65 + 10);
356
- o[i] = k, o[i + 1] = v, o[i + 2] = S;
357
- }
358
- s.putImageData(d, 0, 0), t(r.toDataURL("image/png"));
359
- }, n.onerror = () => a(new Error("Failed to load image")), n.src = e;
383
+ const i = await r.blob();
384
+ return new Promise((c, s) => {
385
+ const o = new FileReader();
386
+ o.onload = () => c(o.result), o.onerror = () => s(new Error("Failed to read result")), o.readAsDataURL(i);
360
387
  });
361
388
  }
362
- function Le() {
363
- const [e, t] = E(!1), [a, n] = E(!1), [r, s] = E(null), [d, o] = E(Ce()), i = C(() => s(null), []), c = C((f) => {
364
- Se(f), o(!0), s(null);
365
- }, []), u = C(
366
- async (f, b = "vintage") => {
367
- t(!0), s(null);
389
+ function Re() {
390
+ const [e, t] = N(!1), [n, a] = N(!1), [r, i] = N(null), [c, s] = N(De()), o = T(() => i(null), []), d = T((f) => {
391
+ Le(f), s(!0), i(null);
392
+ }, []), h = T(
393
+ async (f, b = 0.5) => {
394
+ t(!0), i(null);
368
395
  try {
369
- return await Te(f);
370
- } catch (h) {
371
- const x = h instanceof Error ? h.message : "Enhancement failed";
372
- throw s(x), h;
396
+ return await Ne(f, b);
397
+ } catch (m) {
398
+ const S = m instanceof Error ? m.message : "Enhancement failed";
399
+ throw i(S), m;
373
400
  } finally {
374
401
  t(!1);
375
402
  }
376
403
  },
377
404
  []
378
- ), g = C(
405
+ ), g = T(
379
406
  async (f) => {
380
- n(!0), s(null);
407
+ a(!0), i(null);
381
408
  try {
382
- return await Ae(f);
409
+ return await _e(f);
383
410
  } catch (b) {
384
- const h = b instanceof Error ? b.message : "Background removal failed";
385
- throw s(h), b;
411
+ const m = b instanceof Error ? b.message : "Background removal failed";
412
+ throw i(m), b;
386
413
  } finally {
387
- n(!1);
414
+ a(!1);
388
415
  }
389
416
  },
390
417
  []
391
418
  );
392
419
  return {
393
- enhance: u,
420
+ enhance: h,
394
421
  removeBg: g,
395
422
  isEnhancing: e,
396
- isRemovingBg: a,
423
+ isRemovingBg: n,
397
424
  error: r,
398
- hasKey: d,
399
- setApiKey: c,
400
- clearError: i
425
+ hasKey: c,
426
+ setApiKey: d,
427
+ clearError: o
401
428
  };
402
429
  }
403
- function De({ isOpen: e, onClose: t, onSubmit: a }) {
404
- const n = y((c) => c.voucherConfig.language), [r, s] = E("");
430
+ function Be({ isOpen: e, onClose: t, onSubmit: n }) {
431
+ const a = v((d) => d.voucherConfig.language), [r, i] = N("");
405
432
  if (!e) return null;
406
- const d = (c) => {
407
- c.preventDefault(), r.trim() && (a(r.trim()), s(""), t());
408
- }, i = {
433
+ const c = (d) => {
434
+ d.preventDefault(), r.trim() && (n(r.trim()), i(""), t());
435
+ }, o = {
409
436
  de: {
410
437
  title: "Stability AI API Key",
411
438
  description: "Um die AI-Bildverbesserung zu nutzen, benötigst du einen Stability AI API Key. Du kannst ihn auf platform.stability.ai erhalten.",
@@ -422,105 +449,131 @@ function De({ isOpen: e, onClose: t, onSubmit: a }) {
422
449
  cancel: "Cancel",
423
450
  hint: "The key is stored locally in your browser."
424
451
  }
425
- }[n];
426
- return /* @__PURE__ */ m("dialog", { className: "modal modal-open", children: [
427
- /* @__PURE__ */ m("div", { className: "modal-box", children: [
428
- /* @__PURE__ */ l("h3", { className: "font-bold text-lg", children: i.title }),
429
- /* @__PURE__ */ l("p", { className: "py-4 text-sm opacity-80", children: i.description }),
430
- /* @__PURE__ */ m("form", { onSubmit: d, children: [
431
- /* @__PURE__ */ m("div", { className: "form-control", children: [
452
+ }[a];
453
+ return /* @__PURE__ */ u("dialog", { className: "modal modal-open", children: [
454
+ /* @__PURE__ */ u("div", { className: "modal-box", children: [
455
+ /* @__PURE__ */ l("h3", { className: "font-bold text-lg", children: o.title }),
456
+ /* @__PURE__ */ l("p", { className: "py-4 text-sm opacity-80", children: o.description }),
457
+ /* @__PURE__ */ u("form", { onSubmit: c, children: [
458
+ /* @__PURE__ */ u("div", { className: "form-control", children: [
432
459
  /* @__PURE__ */ l(
433
460
  "input",
434
461
  {
435
462
  type: "password",
436
- placeholder: i.placeholder,
463
+ placeholder: o.placeholder,
437
464
  className: "input input-bordered w-full",
438
465
  value: r,
439
- onChange: (c) => s(c.target.value),
466
+ onChange: (d) => i(d.target.value),
440
467
  autoFocus: !0
441
468
  }
442
469
  ),
443
- /* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text-alt", children: i.hint }) })
470
+ /* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text-alt", children: o.hint }) })
444
471
  ] }),
445
- /* @__PURE__ */ m("div", { className: "modal-action", children: [
446
- /* @__PURE__ */ l("button", { type: "button", className: "btn btn-ghost", onClick: t, children: i.cancel }),
447
- /* @__PURE__ */ l("button", { type: "submit", className: "btn btn-primary", disabled: !r.trim(), children: i.submit })
472
+ /* @__PURE__ */ u("div", { className: "modal-action", children: [
473
+ /* @__PURE__ */ l("button", { type: "button", className: "btn btn-ghost", onClick: t, children: o.cancel }),
474
+ /* @__PURE__ */ l("button", { type: "submit", className: "btn btn-primary", disabled: !r.trim(), children: o.submit })
448
475
  ] })
449
476
  ] })
450
477
  ] }),
451
478
  /* @__PURE__ */ l("form", { method: "dialog", className: "modal-backdrop", children: /* @__PURE__ */ l("button", { onClick: t, children: "close" }) })
452
479
  ] });
453
480
  }
454
- function Xe() {
455
- const e = y((p) => p.voucherConfig.language), t = y((p) => p.portrait), a = y((p) => p.setPortrait), n = y((p) => p.setPortraitZoom), { enhance: r, removeBg: s, isEnhancing: d, isRemovingBg: o, error: i, hasKey: c, setApiKey: u } = Le(), g = z(e), f = $(null), [b, h] = E(!1), [x, k] = E(!1), [v, S] = E(null), [w, N] = E(!1), [T, L] = E(!1), H = C(
481
+ function at() {
482
+ const e = v((p) => p.voucherConfig.language), t = v((p) => p.portrait), n = v((p) => p.setPortrait), a = v((p) => p.setPortraitZoom), { enhance: r, removeBg: i, isEnhancing: c, isRemovingBg: s, error: o, hasKey: d, setApiKey: h } = Re(), g = M(e), f = _(null), [b, m] = N(!1), [S, k] = N(!1), [x, A] = N(null), [y, P] = N(null), [L, D] = N(!1), [C, z] = N(0), H = _(null);
483
+ Y(() => () => {
484
+ H.current && clearTimeout(H.current);
485
+ }, []);
486
+ const j = T(
456
487
  async (p) => {
457
488
  if (!p.type.startsWith("image/"))
458
489
  return;
459
- const P = new FileReader();
460
- P.onload = async (D) => {
461
- var _;
462
- const A = (_ = D.target) == null ? void 0 : _.result;
463
- S(A), a(A), N(!1), L(!1);
464
- }, P.readAsDataURL(p);
490
+ const w = new FileReader();
491
+ w.onload = async (I) => {
492
+ var X;
493
+ const Z = (X = I.target) == null ? void 0 : X.result;
494
+ A(Z), n(Z), D(!1), P(null), z(0);
495
+ }, w.readAsDataURL(p);
465
496
  },
466
- [a]
467
- ), W = C(
497
+ [n]
498
+ ), de = T(
468
499
  (p) => {
469
- p.preventDefault(), h(!1);
470
- const P = p.dataTransfer.files[0];
471
- P && H(P);
500
+ p.preventDefault(), m(!1);
501
+ const w = p.dataTransfer.files[0];
502
+ w && j(w);
472
503
  },
473
- [H]
474
- ), se = C((p) => {
475
- p.preventDefault(), h(!0);
476
- }, []), le = C((p) => {
477
- p.preventDefault(), h(!1);
478
- }, []), ce = () => {
504
+ [j]
505
+ ), he = T((p) => {
506
+ p.preventDefault(), m(!0);
507
+ }, []), me = T((p) => {
508
+ p.preventDefault(), m(!1);
509
+ }, []), pe = () => {
479
510
  var p;
480
511
  (p = f.current) == null || p.click();
481
- }, de = (p) => {
482
- var D;
483
- const P = (D = p.target.files) == null ? void 0 : D[0];
484
- P && H(P);
485
- }, K = C(async (p, P, D) => {
486
- let A = p;
487
- if (P && c)
488
- try {
489
- A = await s(A);
490
- } catch (_) {
491
- console.error("Background removal failed:", _);
492
- }
493
- if (D)
494
- try {
495
- A = await r(A, "vintage");
496
- } catch (_) {
497
- console.error("Enhancement failed:", _);
498
- }
499
- a(A);
500
- }, [c, s, r, a]), he = async () => {
501
- if (!v) return;
502
- if (!w && !c) {
512
+ }, ue = (p) => {
513
+ var I;
514
+ const w = (I = p.target.files) == null ? void 0 : I[0];
515
+ w && j(w);
516
+ }, U = T(async (p, w) => {
517
+ try {
518
+ return await r(p, w);
519
+ } catch (I) {
520
+ return console.error("Enhancement failed:", I), p;
521
+ }
522
+ }, [r]), G = T(async (p) => {
523
+ try {
524
+ const w = await i(p);
525
+ return P(w), w;
526
+ } catch (w) {
527
+ return console.error("Background removal failed:", w), p;
528
+ }
529
+ }, [i]), ge = async () => {
530
+ if (!x) return;
531
+ if (!L && !d) {
503
532
  k(!0);
504
533
  return;
505
534
  }
506
- const p = !w;
507
- N(p), await K(v, p, T);
508
- }, pe = async () => {
509
- if (!v) return;
510
- const p = !T;
511
- L(p), await K(v, w, p);
512
- }, me = async (p) => {
513
- u(p), v && (N(!0), await K(v, !0, T));
514
- }, ue = () => {
515
- a(null), S(null), N(!1), L(!1);
516
- }, ge = t.original;
517
- return /* @__PURE__ */ m("div", { className: "space-y-4", children: [
518
- t.original ? /* @__PURE__ */ m("div", { className: "space-y-4", children: [
519
- /* @__PURE__ */ l("div", { className: "flex justify-center", children: /* @__PURE__ */ m("div", { className: "relative", children: [
535
+ const p = !L;
536
+ if (D(p), p) {
537
+ const w = await G(x);
538
+ if (C > 0) {
539
+ const I = await U(w, C);
540
+ n(I);
541
+ } else
542
+ n(w);
543
+ } else if (P(null), C > 0) {
544
+ const w = await U(x, C);
545
+ n(w);
546
+ } else
547
+ n(x);
548
+ }, fe = (p) => {
549
+ z(p), H.current && clearTimeout(H.current), x && (H.current = setTimeout(async () => {
550
+ const w = L && y ? y : x;
551
+ if (p === 0)
552
+ n(w);
553
+ else {
554
+ const I = await U(w, p);
555
+ n(I);
556
+ }
557
+ }, 150));
558
+ }, be = async (p) => {
559
+ if (h(p), !x) return;
560
+ D(!0);
561
+ const w = await G(x);
562
+ if (C > 0) {
563
+ const I = await U(w, C);
564
+ n(I);
565
+ } else
566
+ n(w);
567
+ }, we = () => {
568
+ n(null), A(null), P(null), D(!1), z(0);
569
+ };
570
+ return /* @__PURE__ */ u("div", { className: "space-y-4", children: [
571
+ t.original ? /* @__PURE__ */ u("div", { className: "flex flex-col items-center space-y-4", children: [
572
+ /* @__PURE__ */ u("div", { className: "relative", children: [
520
573
  /* @__PURE__ */ l("div", { className: "w-32 h-32 rounded-full overflow-hidden border-4 border-currency-gold shadow-lg", children: /* @__PURE__ */ l(
521
574
  "img",
522
575
  {
523
- src: ge || "",
576
+ src: t.original || "",
524
577
  alt: "Portrait",
525
578
  className: "w-full h-full object-cover",
526
579
  style: { transform: `scale(${t.zoom})` }
@@ -530,7 +583,7 @@ function Xe() {
530
583
  "button",
531
584
  {
532
585
  className: "btn btn-circle btn-xs btn-error absolute -top-1 -right-1",
533
- onClick: ue,
586
+ onClick: we,
534
587
  children: /* @__PURE__ */ l(
535
588
  "svg",
536
589
  {
@@ -552,11 +605,11 @@ function Xe() {
552
605
  )
553
606
  }
554
607
  )
555
- ] }) }),
556
- /* @__PURE__ */ m("div", { className: "form-control", children: [
557
- /* @__PURE__ */ m("label", { className: "label", children: [
608
+ ] }),
609
+ /* @__PURE__ */ u("div", { className: "form-control w-full max-w-xs", children: [
610
+ /* @__PURE__ */ u("label", { className: "label", children: [
558
611
  /* @__PURE__ */ l("span", { className: "label-text", children: g.form.portrait.zoom }),
559
- /* @__PURE__ */ m("span", { className: "label-text-alt", children: [
612
+ /* @__PURE__ */ u("span", { className: "label-text-alt", children: [
560
613
  Math.round(t.zoom * 100),
561
614
  "%"
562
615
  ] })
@@ -569,60 +622,67 @@ function Xe() {
569
622
  max: "2",
570
623
  step: "0.05",
571
624
  value: t.zoom,
572
- onChange: (p) => n(parseFloat(p.target.value)),
625
+ onChange: (p) => a(parseFloat(p.target.value)),
573
626
  className: "range range-primary range-sm"
574
627
  }
575
628
  )
576
629
  ] }),
577
- /* @__PURE__ */ m("div", { className: "flex flex-col gap-3", children: [
578
- /* @__PURE__ */ l("div", { className: "form-control", children: /* @__PURE__ */ m("label", { className: "label cursor-pointer justify-start gap-3", children: [
579
- /* @__PURE__ */ l(
580
- "input",
581
- {
582
- type: "checkbox",
583
- className: `toggle toggle-primary ${o ? "opacity-50" : ""}`,
584
- checked: w,
585
- onChange: he,
586
- disabled: o
587
- }
588
- ),
589
- /* @__PURE__ */ m("span", { className: "label-text flex items-center gap-2", children: [
590
- o ? /* @__PURE__ */ m(M, { children: [
591
- /* @__PURE__ */ l("span", { className: "loading loading-spinner loading-xs" }),
592
- e === "de" ? "Hintergrund wird entfernt..." : "Removing background..."
593
- ] }) : e === "de" ? "Hintergrund entfernen" : "Remove background",
594
- !c && /* @__PURE__ */ l("span", { className: "badge badge-sm badge-outline", children: "API" })
630
+ /* @__PURE__ */ u("div", { className: "form-control w-full max-w-xs", children: [
631
+ /* @__PURE__ */ u("label", { className: "label", children: [
632
+ /* @__PURE__ */ u("span", { className: "label-text flex items-center gap-2", children: [
633
+ e === "de" ? "Gravur-Effekt" : "Engraving effect",
634
+ c && /* @__PURE__ */ l("span", { className: "loading loading-spinner loading-xs" })
635
+ ] }),
636
+ /* @__PURE__ */ u("span", { className: "label-text-alt", children: [
637
+ Math.round(C * 100),
638
+ "%"
595
639
  ] })
596
- ] }) }),
597
- /* @__PURE__ */ l("div", { className: "form-control", children: /* @__PURE__ */ m("label", { className: "label cursor-pointer justify-start gap-3", children: [
598
- /* @__PURE__ */ l(
599
- "input",
600
- {
601
- type: "checkbox",
602
- className: `toggle toggle-secondary ${d ? "opacity-50" : ""}`,
603
- checked: T,
604
- onChange: pe,
605
- disabled: d
606
- }
607
- ),
608
- /* @__PURE__ */ l("span", { className: "label-text flex items-center gap-2", children: d ? /* @__PURE__ */ m(M, { children: [
640
+ ] }),
641
+ /* @__PURE__ */ l(
642
+ "input",
643
+ {
644
+ type: "range",
645
+ min: "0",
646
+ max: "1",
647
+ step: "0.05",
648
+ value: C,
649
+ onChange: (p) => fe(parseFloat(p.target.value)),
650
+ className: "range range-secondary range-sm",
651
+ disabled: c
652
+ }
653
+ )
654
+ ] }),
655
+ /* @__PURE__ */ l("div", { className: "form-control", children: /* @__PURE__ */ u("label", { className: "label cursor-pointer justify-start gap-3", children: [
656
+ /* @__PURE__ */ l(
657
+ "input",
658
+ {
659
+ type: "checkbox",
660
+ className: `toggle toggle-primary ${s ? "opacity-50" : ""}`,
661
+ checked: L,
662
+ onChange: ge,
663
+ disabled: s
664
+ }
665
+ ),
666
+ /* @__PURE__ */ u("span", { className: "label-text flex items-center gap-2", children: [
667
+ s ? /* @__PURE__ */ u(O, { children: [
609
668
  /* @__PURE__ */ l("span", { className: "loading loading-spinner loading-xs" }),
610
- e === "de" ? "Gravur-Effekt wird angewendet..." : "Applying engraving effect..."
611
- ] }) : e === "de" ? "Gravur-Effekt" : "Engraving effect" })
612
- ] }) }),
613
- i && /* @__PURE__ */ m("div", { className: "alert alert-warning text-sm py-2", children: [
614
- /* @__PURE__ */ l("svg", { xmlns: "http://www.w3.org/2000/svg", className: "stroke-current shrink-0 h-5 w-5", fill: "none", viewBox: "0 0 24 24", children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
615
- /* @__PURE__ */ l("span", { children: i })
669
+ e === "de" ? "Hintergrund wird entfernt..." : "Removing background..."
670
+ ] }) : e === "de" ? "Hintergrund entfernen" : "Remove background",
671
+ !d && /* @__PURE__ */ l("span", { className: "badge badge-sm badge-outline", children: "API" })
616
672
  ] })
673
+ ] }) }),
674
+ o && /* @__PURE__ */ u("div", { className: "alert alert-warning text-sm py-2", children: [
675
+ /* @__PURE__ */ l("svg", { xmlns: "http://www.w3.org/2000/svg", className: "stroke-current shrink-0 h-5 w-5", fill: "none", viewBox: "0 0 24 24", children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
676
+ /* @__PURE__ */ l("span", { children: o })
617
677
  ] })
618
- ] }) : /* @__PURE__ */ m(
678
+ ] }) : /* @__PURE__ */ u(
619
679
  "div",
620
680
  {
621
- className: `border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${o ? "border-primary bg-primary/10 pointer-events-none" : b ? "border-primary bg-primary/10" : "border-base-300 hover:border-primary hover:bg-base-200"}`,
622
- onDrop: W,
623
- onDragOver: se,
624
- onDragLeave: le,
625
- onClick: ce,
681
+ className: `border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${s ? "border-primary bg-primary/10 pointer-events-none" : b ? "border-primary bg-primary/10" : "border-base-300 hover:border-primary hover:bg-base-200"}`,
682
+ onDrop: de,
683
+ onDragOver: he,
684
+ onDragLeave: me,
685
+ onClick: pe,
626
686
  children: [
627
687
  /* @__PURE__ */ l(
628
688
  "input",
@@ -631,13 +691,13 @@ function Xe() {
631
691
  type: "file",
632
692
  accept: "image/*",
633
693
  className: "hidden",
634
- onChange: de
694
+ onChange: ue
635
695
  }
636
696
  ),
637
- o ? /* @__PURE__ */ m("div", { className: "flex flex-col items-center gap-2", children: [
697
+ s ? /* @__PURE__ */ u("div", { className: "flex flex-col items-center gap-2", children: [
638
698
  /* @__PURE__ */ l("span", { className: "loading loading-spinner loading-lg text-primary" }),
639
699
  /* @__PURE__ */ l("p", { className: "font-medium", children: e === "de" ? "Hintergrund wird entfernt..." : "Removing background..." })
640
- ] }) : /* @__PURE__ */ m("div", { className: "flex flex-col items-center gap-2", children: [
700
+ ] }) : /* @__PURE__ */ u("div", { className: "flex flex-col items-center gap-2", children: [
641
701
  /* @__PURE__ */ l(
642
702
  "svg",
643
703
  {
@@ -664,60 +724,60 @@ function Xe() {
664
724
  }
665
725
  ),
666
726
  /* @__PURE__ */ l(
667
- De,
727
+ Be,
668
728
  {
669
- isOpen: x,
729
+ isOpen: S,
670
730
  onClose: () => k(!1),
671
- onSubmit: me
731
+ onSubmit: be
672
732
  }
673
733
  )
674
734
  ] });
675
735
  }
676
- function Je() {
736
+ function rt() {
677
737
  return null;
678
738
  }
679
- const I = typeof import.meta < "u" && "/" || "/", _e = {
739
+ const E = typeof import.meta < "u" && "/" || "/", $e = {
680
740
  en: {
681
741
  1: {
682
- front: `${I}templates/front_ldpi_en.png`,
683
- back: `${I}templates/back_ldpi_en.png`,
742
+ front: `${E}templates/front_ldpi_en.png`,
743
+ back: `${E}templates/back_ldpi_en.png`,
684
744
  width: 1536,
685
745
  height: 1024
686
746
  },
687
747
  5: {
688
- front: `${I}templates/front_ldpi_en.png`,
689
- back: `${I}templates/back_ldpi_en.png`,
748
+ front: `${E}templates/front_ldpi_en.png`,
749
+ back: `${E}templates/back_ldpi_en.png`,
690
750
  width: 1536,
691
751
  height: 1024
692
752
  },
693
753
  10: {
694
- front: `${I}templates/front_ldpi_en.png`,
695
- back: `${I}templates/back_ldpi_en.png`,
754
+ front: `${E}templates/front_ldpi_en.png`,
755
+ back: `${E}templates/back_ldpi_en.png`,
696
756
  width: 1536,
697
757
  height: 1024
698
758
  }
699
759
  },
700
760
  de: {
701
761
  1: {
702
- front: `${I}templates/front_hdpi_de.webp`,
703
- back: `${I}templates/back_hdpi_de.webp`,
762
+ front: `${E}templates/front_hdpi_de.webp`,
763
+ back: `${E}templates/back_hdpi_de.webp`,
704
764
  width: 6144,
705
765
  height: 3200
706
766
  },
707
767
  5: {
708
- front: `${I}templates/front_hdpi_de.webp`,
709
- back: `${I}templates/back_hdpi_de.webp`,
768
+ front: `${E}templates/front_hdpi_de.webp`,
769
+ back: `${E}templates/back_hdpi_de.webp`,
710
770
  width: 6144,
711
771
  height: 3200
712
772
  },
713
773
  10: {
714
- front: `${I}templates/front_hdpi_de.webp`,
715
- back: `${I}templates/back_hdpi_de.webp`,
774
+ front: `${E}templates/front_hdpi_de.webp`,
775
+ back: `${E}templates/back_hdpi_de.webp`,
716
776
  width: 6144,
717
777
  height: 3200
718
778
  }
719
779
  }
720
- }, B = {
780
+ }, R = {
721
781
  front: {
722
782
  portrait: {
723
783
  x: 768,
@@ -763,7 +823,7 @@ const I = typeof import.meta < "u" && "/" || "/", _e = {
763
823
  align: "center"
764
824
  }
765
825
  }
766
- }, R = {
826
+ }, B = {
767
827
  front: {
768
828
  portrait: {
769
829
  x: 3074,
@@ -810,139 +870,139 @@ const I = typeof import.meta < "u" && "/" || "/", _e = {
810
870
  }
811
871
  }
812
872
  };
813
- function te(e) {
814
- return e === "de" ? R : B;
873
+ function re(e) {
874
+ return e === "de" ? B : R;
815
875
  }
816
- function ne(e, t) {
817
- return _e[e][t];
876
+ function oe(e, t) {
877
+ return $e[e][t];
818
878
  }
819
- const O = /* @__PURE__ */ new Map();
820
- async function Y(e) {
821
- return O.has(e) ? O.get(e) : new Promise((t, a) => {
822
- const n = new Image();
823
- n.crossOrigin = "anonymous", n.onload = () => {
824
- O.set(e, n), t(n);
825
- }, n.onerror = a, n.src = e;
879
+ const K = /* @__PURE__ */ new Map();
880
+ async function q(e) {
881
+ return K.has(e) ? K.get(e) : new Promise((t, n) => {
882
+ const a = new Image();
883
+ a.crossOrigin = "anonymous", a.onload = () => {
884
+ K.set(e, a), t(a);
885
+ }, a.onerror = n, a.src = e;
826
886
  });
827
887
  }
828
- function ae(e, t, a, n) {
829
- e.drawImage(t, 0, 0, a, n);
888
+ function ie(e, t, n, a) {
889
+ e.drawImage(t, 0, 0, n, a);
830
890
  }
831
- function Be(e, t, a, n, r, s, d = 1) {
832
- e.save(), e.beginPath(), e.ellipse(a, n, r, s, 0, 0, Math.PI * 2), e.closePath(), e.clip();
833
- const o = t.width / t.height, i = r / s, c = r * 2, u = s * 2;
891
+ function Me(e, t, n, a, r, i, c = 1) {
892
+ e.save(), e.beginPath(), e.ellipse(n, a, r, i, 0, 0, Math.PI * 2), e.closePath(), e.clip();
893
+ const s = t.width / t.height, o = r / i, d = r * 2, h = i * 2;
834
894
  let g, f;
835
- o > i ? (f = u, g = u * o) : (g = c, f = c / o), g *= d, f *= d;
836
- const b = a - g / 2, h = n - f / 2;
837
- e.drawImage(t, b, h, g, f), e.restore();
895
+ s > o ? (f = h, g = h * s) : (g = d, f = d / s), g *= c, f *= c;
896
+ const b = n - g / 2, m = a - f / 2;
897
+ e.drawImage(t, b, m, g, f), e.restore();
838
898
  }
839
- function re(e, t, a, n = "#2a3a2a") {
840
- e.save(), e.font = `${a.fontSize}px "Times New Roman", serif`, e.textAlign = a.align || "center", e.textBaseline = "middle", e.fillStyle = n, a.maxWidth ? e.fillText(t, a.x, a.y, a.maxWidth) : e.fillText(t, a.x, a.y), e.restore();
899
+ function se(e, t, n, a = "#2a3a2a") {
900
+ e.save(), e.font = `${n.fontSize}px "Times New Roman", serif`, e.textAlign = n.align || "center", e.textBaseline = "middle", e.fillStyle = a, n.maxWidth ? e.fillText(t, n.x, n.y, n.maxWidth) : e.fillText(t, n.x, n.y), e.restore();
841
901
  }
842
- function Re(e, t, a, n = "#2a3a2a") {
843
- e.save(), e.font = `${a.fontSize}px "Times New Roman", serif`, e.textAlign = a.align || "center", e.textBaseline = "top", e.fillStyle = n;
844
- const r = a.maxWidth || 400, s = a.lineHeight || a.fontSize * 1.4, d = t.split(" "), o = [];
845
- let i = "";
846
- for (const g of d) {
847
- const f = i ? `${i} ${g}` : g;
848
- e.measureText(f).width > r && i ? (o.push(i), i = g) : i = f;
902
+ function ze(e, t, n, a = "#2a3a2a") {
903
+ e.save(), e.font = `${n.fontSize}px "Times New Roman", serif`, e.textAlign = n.align || "center", e.textBaseline = "top", e.fillStyle = a;
904
+ const r = n.maxWidth || 400, i = n.lineHeight || n.fontSize * 1.4, c = t.split(" "), s = [];
905
+ let o = "";
906
+ for (const g of c) {
907
+ const f = o ? `${o} ${g}` : g;
908
+ e.measureText(f).width > r && o ? (s.push(o), o = g) : o = f;
849
909
  }
850
- i && o.push(i);
851
- const c = o.length * s;
852
- let u = a.y - c / 2;
853
- for (const g of o)
854
- e.fillText(g, a.x, u), u += s;
910
+ o && s.push(o);
911
+ const d = s.length * i;
912
+ let h = n.y - d / 2;
913
+ for (const g of s)
914
+ e.fillText(g, n.x, h), h += i;
855
915
  e.restore();
856
916
  }
857
- function $e(e, t, a, n, r, s = "#2a3a2a") {
858
- e.save(), e.font = `${r.fontSize}px "Times New Roman", serif`, e.textAlign = r.align || "center", e.textBaseline = "middle", e.fillStyle = s;
859
- const d = r.lineHeight || r.fontSize * 1.8, o = [t, a, n].filter(Boolean), i = (o.length - 1) * d;
860
- let c = r.y - i / 2;
861
- for (const u of o)
862
- u && (e.fillText(u, r.x, c), c += d);
917
+ function He(e, t, n, a, r, i = "#2a3a2a") {
918
+ e.save(), e.font = `${r.fontSize}px "Times New Roman", serif`, e.textAlign = r.align || "center", e.textBaseline = "middle", e.fillStyle = i;
919
+ const c = r.lineHeight || r.fontSize * 1.8, s = [t, n, a].filter(Boolean), o = (s.length - 1) * c;
920
+ let d = r.y - o / 2;
921
+ for (const h of s)
922
+ h && (e.fillText(h, r.x, d), d += c);
863
923
  e.restore();
864
924
  }
865
- async function oe(e, t, a, n, r, s, d, o = 1) {
866
- const i = e.getContext("2d");
867
- if (!i) return;
868
- e.width = s, e.height = d, i.clearRect(0, 0, s, d);
869
- const c = await Y(t);
870
- if (ae(i, c, s, d), a)
925
+ async function le(e, t, n, a, r, i, c, s = 1) {
926
+ const o = e.getContext("2d");
927
+ if (!o) return;
928
+ e.width = i, e.height = c, o.clearRect(0, 0, i, c);
929
+ const d = await q(t);
930
+ if (ie(o, d, i, c), n)
871
931
  try {
872
- const u = await Y(a);
873
- Be(
874
- i,
875
- u,
932
+ const h = await q(n);
933
+ Me(
934
+ o,
935
+ h,
876
936
  r.portrait.x,
877
937
  r.portrait.y,
878
938
  r.portrait.radiusX,
879
939
  r.portrait.radiusY,
880
- o
940
+ s
881
941
  );
882
- } catch (u) {
883
- console.error("Failed to load portrait:", u);
942
+ } catch (h) {
943
+ console.error("Failed to load portrait:", h);
884
944
  }
885
- n && re(i, n, r.namePlate);
945
+ a && se(o, a, r.namePlate);
886
946
  }
887
- async function ie(e, t, a, n, r, s, d, o, i) {
888
- const c = e.getContext("2d");
889
- if (!c) return;
890
- e.width = o, e.height = i, c.clearRect(0, 0, o, i);
891
- const u = await Y(t);
892
- ae(c, u, o, i), d.contactInfo && (a || n || r) && $e(c, a, n, r, d.contactInfo), d.description && s && Re(c, s, d.description), a && re(c, a, d.namePlate);
947
+ async function ce(e, t, n, a, r, i, c, s, o) {
948
+ const d = e.getContext("2d");
949
+ if (!d) return;
950
+ e.width = s, e.height = o, d.clearRect(0, 0, s, o);
951
+ const h = await q(t);
952
+ ie(d, h, s, o), c.contactInfo && (n || a || r) && He(d, n, a, r, c.contactInfo), c.description && i && ze(d, i, c.description), n && se(d, n, c.namePlate);
893
953
  }
894
- function Qe() {
895
- const e = y((w) => w.voucherConfig.language), t = y((w) => w.voucherConfig.hours), a = y((w) => w.voucherConfig.description), n = y((w) => w.personalInfo), r = y((w) => w.portrait), s = y((w) => w.currentSide), d = y((w) => w.flipSide), o = z(e), i = $(null), c = $(null), u = $(null), [g, f] = E(!1), b = ne(e, t), h = te(e), x = r.useEnhanced && r.enhanced ? r.enhanced : r.original, k = J(e, t, a);
896
- G(() => {
897
- i.current && oe(
898
- i.current,
954
+ function ot() {
955
+ const e = v((y) => y.voucherConfig.language), t = v((y) => y.voucherConfig.hours), n = v((y) => y.voucherConfig.description), a = v((y) => y.personalInfo), r = v((y) => y.portrait), i = v((y) => y.currentSide), c = v((y) => y.flipSide), s = M(e), o = _(null), d = _(null), h = _(null), [g, f] = N(!1), b = oe(e, t), m = re(e), S = r.useEnhanced && r.enhanced ? r.enhanced : r.original, k = te(e, t, n);
956
+ Y(() => {
957
+ o.current && le(
958
+ o.current,
899
959
  b.front,
900
- x,
901
- n.name,
902
- h.front,
960
+ S,
961
+ a.name,
962
+ m.front,
903
963
  b.width,
904
964
  b.height,
905
965
  r.zoom
906
966
  );
907
- }, [b, x, n.name, h, r.zoom]), G(() => {
908
- c.current && ie(
909
- c.current,
967
+ }, [b, S, a.name, m, r.zoom]), Y(() => {
968
+ d.current && ce(
969
+ d.current,
910
970
  b.back,
911
- n.name,
912
- n.email,
913
- n.phone,
971
+ a.name,
972
+ a.email,
973
+ a.phone,
914
974
  k,
915
- h.back,
975
+ m.back,
916
976
  b.width,
917
977
  b.height
918
978
  );
919
- }, [b, n, k, h]);
920
- const v = () => {
979
+ }, [b, a, k, m]);
980
+ const x = () => {
921
981
  f(!0), setTimeout(() => {
922
- d(), f(!1);
982
+ c(), f(!1);
923
983
  }, 150);
924
- }, S = b.width / b.height;
925
- return /* @__PURE__ */ m("div", { className: "space-y-4", children: [
926
- /* @__PURE__ */ m("div", { className: "flex justify-between items-center", children: [
927
- /* @__PURE__ */ m("div", { className: "tabs tabs-boxed bg-base-200", children: [
984
+ }, A = b.width / b.height;
985
+ return /* @__PURE__ */ u("div", { className: "space-y-4", children: [
986
+ /* @__PURE__ */ u("div", { className: "flex justify-between items-center", children: [
987
+ /* @__PURE__ */ u("div", { className: "tabs tabs-boxed bg-base-200", children: [
928
988
  /* @__PURE__ */ l(
929
989
  "button",
930
990
  {
931
- className: `tab ${s === "front" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
932
- onClick: () => s !== "front" && v(),
933
- children: o.preview.front
991
+ className: `tab ${i === "front" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
992
+ onClick: () => i !== "front" && x(),
993
+ children: s.preview.front
934
994
  }
935
995
  ),
936
996
  /* @__PURE__ */ l(
937
997
  "button",
938
998
  {
939
- className: `tab ${s === "back" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
940
- onClick: () => s !== "back" && v(),
941
- children: o.preview.back
999
+ className: `tab ${i === "back" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
1000
+ onClick: () => i !== "back" && x(),
1001
+ children: s.preview.back
942
1002
  }
943
1003
  )
944
1004
  ] }),
945
- /* @__PURE__ */ m("button", { className: "btn btn-ghost btn-sm", onClick: v, children: [
1005
+ /* @__PURE__ */ u("button", { className: "btn btn-ghost btn-sm", onClick: x, children: [
946
1006
  /* @__PURE__ */ l(
947
1007
  "svg",
948
1008
  {
@@ -962,28 +1022,28 @@ function Qe() {
962
1022
  )
963
1023
  }
964
1024
  ),
965
- o.preview.flip
1025
+ s.preview.flip
966
1026
  ] })
967
1027
  ] }),
968
- /* @__PURE__ */ m(
1028
+ /* @__PURE__ */ u(
969
1029
  "div",
970
1030
  {
971
- ref: u,
1031
+ ref: h,
972
1032
  className: "relative w-full overflow-hidden shadow-lg",
973
- style: { aspectRatio: S },
1033
+ style: { aspectRatio: A },
974
1034
  children: [
975
1035
  /* @__PURE__ */ l(
976
1036
  "canvas",
977
1037
  {
978
- ref: i,
979
- className: `absolute inset-0 w-full h-full transition-all duration-300 ${s === "front" ? g ? "opacity-0 scale-95" : "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"}`
1038
+ ref: o,
1039
+ className: `absolute inset-0 w-full h-full transition-all duration-300 ${i === "front" ? g ? "opacity-0 scale-95" : "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"}`
980
1040
  }
981
1041
  ),
982
1042
  /* @__PURE__ */ l(
983
1043
  "canvas",
984
1044
  {
985
- ref: c,
986
- className: `absolute inset-0 w-full h-full transition-all duration-300 ${s === "back" ? g ? "opacity-0 scale-95" : "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"}`
1045
+ ref: d,
1046
+ className: `absolute inset-0 w-full h-full transition-all duration-300 ${i === "back" ? g ? "opacity-0 scale-95" : "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"}`
987
1047
  }
988
1048
  )
989
1049
  ]
@@ -991,85 +1051,85 @@ function Qe() {
991
1051
  )
992
1052
  ] });
993
1053
  }
994
- function et() {
995
- const e = $(null), t = $(null);
1054
+ function it() {
1055
+ const e = _(null), t = _(null);
996
1056
  return { frontCanvasRef: e, backCanvasRef: t };
997
1057
  }
998
- async function ze(e) {
1058
+ async function Ue(e) {
999
1059
  const {
1000
1060
  frontTemplateSrc: t,
1001
- backTemplateSrc: a,
1002
- templateWidth: n,
1061
+ backTemplateSrc: n,
1062
+ templateWidth: a,
1003
1063
  templateHeight: r,
1004
- layout: s,
1005
- portrait: d,
1006
- portraitZoom: o = 1,
1007
- name: i,
1008
- email: c,
1009
- phone: u,
1064
+ layout: i,
1065
+ portrait: c,
1066
+ portraitZoom: s = 1,
1067
+ name: o,
1068
+ email: d,
1069
+ phone: h,
1010
1070
  description: g
1011
1071
  } = e, f = document.createElement("canvas"), b = document.createElement("canvas");
1012
1072
  await Promise.all([
1013
- oe(f, t, d, i, s.front, n, r, o),
1014
- ie(b, a, i, c, u, g, s.back, n, r)
1073
+ le(f, t, c, o, i.front, a, r, s),
1074
+ ce(b, n, o, d, h, g, i.back, a, r)
1015
1075
  ]);
1016
- const h = new ye({
1076
+ const m = new xe({
1017
1077
  orientation: "landscape",
1018
1078
  unit: "mm",
1019
1079
  format: "a4"
1020
- }), x = 297, k = 210, v = 10, S = n / r;
1021
- let w = x - v * 2, N = w / S;
1022
- N > k - v * 2 && (N = k - v * 2, w = N * S);
1023
- const T = (x - w) / 2, L = (k - N) / 2, H = f.toDataURL("image/jpeg", 0.95);
1024
- h.addImage(H, "JPEG", T, L, w, N), h.addPage();
1025
- const W = b.toDataURL("image/jpeg", 0.95);
1026
- return h.addImage(W, "JPEG", T, L, w, N), h.output("blob");
1080
+ }), S = 297, k = 210, x = 10, A = a / r;
1081
+ let y = S - x * 2, P = y / A;
1082
+ P > k - x * 2 && (P = k - x * 2, y = P * A);
1083
+ const L = (S - y) / 2, D = (k - P) / 2, C = f.toDataURL("image/jpeg", 0.95);
1084
+ m.addImage(C, "JPEG", L, D, y, P), m.addPage();
1085
+ const z = b.toDataURL("image/jpeg", 0.95);
1086
+ return m.addImage(z, "JPEG", L, D, y, P), m.output("blob");
1027
1087
  }
1028
- function He(e, t) {
1029
- const a = URL.createObjectURL(e), n = document.createElement("a");
1030
- n.href = a, n.download = t, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(a);
1088
+ function Fe(e, t) {
1089
+ const n = URL.createObjectURL(e), a = document.createElement("a");
1090
+ a.href = n, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(n);
1031
1091
  }
1032
- async function Me(e) {
1033
- const t = await ze(e);
1034
- He(t, e.filename);
1092
+ async function We(e) {
1093
+ const t = await Ue(e);
1094
+ Fe(t, e.filename);
1035
1095
  }
1036
- function tt() {
1037
- const e = y((h) => h.voucherConfig.language), t = y((h) => h.voucherConfig.hours), a = y((h) => h.voucherConfig.description), n = y((h) => h.personalInfo), r = y((h) => h.portrait), s = y((h) => h.isExporting), d = y((h) => h.setIsExporting), o = z(e), i = ne(e, t), c = te(e), u = r.useEnhanced && r.enhanced ? r.enhanced : r.original, g = J(e, t, a), f = n.name.trim().length > 0 && n.email.trim().length > 0 && n.phone.trim().length > 0 && r.original !== null;
1096
+ function st() {
1097
+ const e = v((m) => m.voucherConfig.language), t = v((m) => m.voucherConfig.hours), n = v((m) => m.voucherConfig.description), a = v((m) => m.personalInfo), r = v((m) => m.portrait), i = v((m) => m.isExporting), c = v((m) => m.setIsExporting), s = M(e), o = oe(e, t), d = re(e), h = r.useEnhanced && r.enhanced ? r.enhanced : r.original, g = te(e, t, n), f = a.name.trim().length > 0 && a.email.trim().length > 0 && a.phone.trim().length > 0 && r.original !== null;
1038
1098
  return /* @__PURE__ */ l(
1039
1099
  "button",
1040
1100
  {
1041
- className: `btn btn-primary flex-1 ${s ? "loading" : ""}`,
1101
+ className: `btn btn-primary flex-1 ${i ? "loading" : ""}`,
1042
1102
  onClick: async () => {
1043
- if (!(!f || s)) {
1044
- d(!0);
1103
+ if (!(!f || i)) {
1104
+ c(!0);
1045
1105
  try {
1046
- const h = `zeitgutschein-${t}h-${n.name.replace(/\s+/g, "-").toLowerCase()}.pdf`;
1047
- await Me({
1048
- frontTemplateSrc: i.front,
1049
- backTemplateSrc: i.back,
1050
- templateWidth: i.width,
1051
- templateHeight: i.height,
1052
- layout: c,
1053
- portrait: u,
1106
+ const m = `zeitgutschein-${t}h-${a.name.replace(/\s+/g, "-").toLowerCase()}.pdf`;
1107
+ await We({
1108
+ frontTemplateSrc: o.front,
1109
+ backTemplateSrc: o.back,
1110
+ templateWidth: o.width,
1111
+ templateHeight: o.height,
1112
+ layout: d,
1113
+ portrait: h,
1054
1114
  portraitZoom: r.zoom,
1055
- name: n.name,
1056
- email: n.email,
1057
- phone: n.phone,
1115
+ name: a.name,
1116
+ email: a.email,
1117
+ phone: a.phone,
1058
1118
  description: g,
1059
- filename: h
1119
+ filename: m
1060
1120
  });
1061
- } catch (h) {
1062
- console.error("PDF export failed:", h);
1121
+ } catch (m) {
1122
+ console.error("PDF export failed:", m);
1063
1123
  } finally {
1064
- d(!1);
1124
+ c(!1);
1065
1125
  }
1066
1126
  }
1067
1127
  },
1068
- disabled: !f || s,
1069
- children: s ? /* @__PURE__ */ m(M, { children: [
1128
+ disabled: !f || i,
1129
+ children: i ? /* @__PURE__ */ u(O, { children: [
1070
1130
  /* @__PURE__ */ l("span", { className: "loading loading-spinner loading-sm" }),
1071
- o.export.exporting
1072
- ] }) : /* @__PURE__ */ m(M, { children: [
1131
+ s.export.exporting
1132
+ ] }) : /* @__PURE__ */ u(O, { children: [
1073
1133
  /* @__PURE__ */ l(
1074
1134
  "svg",
1075
1135
  {
@@ -1089,21 +1149,21 @@ function tt() {
1089
1149
  )
1090
1150
  }
1091
1151
  ),
1092
- o.export.button
1152
+ s.export.button
1093
1153
  ] })
1094
1154
  }
1095
1155
  );
1096
1156
  }
1097
- function Ue() {
1098
- const e = y((n) => n.voucherConfig.language), t = y((n) => n.setLanguage), a = (n) => {
1099
- t(n);
1157
+ function je() {
1158
+ const e = v((a) => a.voucherConfig.language), t = v((a) => a.setLanguage), n = (a) => {
1159
+ t(a);
1100
1160
  };
1101
- return /* @__PURE__ */ m("div", { className: "join", children: [
1161
+ return /* @__PURE__ */ u("div", { className: "join", children: [
1102
1162
  /* @__PURE__ */ l(
1103
1163
  "button",
1104
1164
  {
1105
1165
  className: `join-item btn btn-sm ${e === "de" ? "btn-active btn-primary" : "btn-ghost"}`,
1106
- onClick: () => a("de"),
1166
+ onClick: () => n("de"),
1107
1167
  children: "DE"
1108
1168
  }
1109
1169
  ),
@@ -1111,28 +1171,28 @@ function Ue() {
1111
1171
  "button",
1112
1172
  {
1113
1173
  className: `join-item btn btn-sm ${e === "en" ? "btn-active btn-primary" : "btn-ghost"}`,
1114
- onClick: () => a("en"),
1174
+ onClick: () => n("en"),
1115
1175
  children: "EN"
1116
1176
  }
1117
1177
  )
1118
1178
  ] });
1119
1179
  }
1120
- function nt() {
1121
- const e = y((a) => a.voucherConfig.language), t = z(e);
1122
- return /* @__PURE__ */ m("div", { className: "navbar bg-currency-green text-currency-cream shadow-lg", children: [
1180
+ function lt() {
1181
+ const e = v((n) => n.voucherConfig.language), t = M(e);
1182
+ return /* @__PURE__ */ u("div", { className: "navbar bg-currency-green text-currency-cream shadow-lg", children: [
1123
1183
  /* @__PURE__ */ l("div", { className: "navbar-start", children: /* @__PURE__ */ l("a", { className: "btn btn-ghost text-xl font-currency font-bold", children: t.header.title }) }),
1124
1184
  /* @__PURE__ */ l("div", { className: "navbar-center hidden sm:flex", children: /* @__PURE__ */ l("span", { className: "text-sm opacity-80", children: t.header.subtitle }) }),
1125
- /* @__PURE__ */ l("div", { className: "navbar-end", children: /* @__PURE__ */ l(Ue, {}) })
1185
+ /* @__PURE__ */ l("div", { className: "navbar-end", children: /* @__PURE__ */ l(je, {}) })
1126
1186
  ] });
1127
1187
  }
1128
- const U = "/", Fe = {
1188
+ const F = "/", Ke = {
1129
1189
  id: "time-voucher-classic-de",
1130
1190
  name: "Zeitgutschein Classic",
1131
1191
  type: "time-voucher",
1132
1192
  category: "classic",
1133
1193
  images: {
1134
- front: `${U}templates/front_hdpi_de.jpg`,
1135
- back: `${U}templates/back_hdpi_de.jpg`,
1194
+ front: `${F}templates/front_hdpi_de.jpg`,
1195
+ back: `${F}templates/back_hdpi_de.jpg`,
1136
1196
  width: 6144,
1137
1197
  height: 4096
1138
1198
  },
@@ -1179,24 +1239,24 @@ const U = "/", Fe = {
1179
1239
  ],
1180
1240
  layout: {
1181
1241
  front: {
1182
- portrait: R.front.portrait,
1183
- name: R.front.namePlate
1242
+ portrait: B.front.portrait,
1243
+ name: B.front.namePlate
1184
1244
  },
1185
1245
  back: {
1186
- name: R.back.namePlate,
1187
- contactInfo: R.back.contactInfo,
1188
- description: R.back.description
1246
+ name: B.back.namePlate,
1247
+ contactInfo: B.back.contactInfo,
1248
+ description: B.back.description
1189
1249
  }
1190
1250
  },
1191
1251
  languages: ["de"]
1192
- }, We = {
1252
+ }, Oe = {
1193
1253
  id: "time-voucher-classic-en",
1194
1254
  name: "Time Voucher Classic",
1195
1255
  type: "time-voucher",
1196
1256
  category: "classic",
1197
1257
  images: {
1198
- front: `${U}templates/front_ldpi_en.png`,
1199
- back: `${U}templates/back_ldpi_en.png`,
1258
+ front: `${F}templates/front_ldpi_en.png`,
1259
+ back: `${F}templates/back_ldpi_en.png`,
1200
1260
  width: 1536,
1201
1261
  height: 1024
1202
1262
  },
@@ -1243,86 +1303,89 @@ const U = "/", Fe = {
1243
1303
  ],
1244
1304
  layout: {
1245
1305
  front: {
1246
- portrait: B.front.portrait,
1247
- name: B.front.namePlate
1306
+ portrait: R.front.portrait,
1307
+ name: R.front.namePlate
1248
1308
  },
1249
1309
  back: {
1250
- name: B.back.namePlate,
1251
- contactInfo: B.back.contactInfo,
1252
- description: B.back.description
1310
+ name: R.back.namePlate,
1311
+ contactInfo: R.back.contactInfo,
1312
+ description: R.back.description
1253
1313
  }
1254
1314
  },
1255
1315
  languages: ["en"]
1256
- }, X = [
1257
- Fe,
1258
- We
1259
- ], Ke = {
1316
+ }, ee = [
1317
+ Ke,
1318
+ Oe
1319
+ ], Ye = {
1260
1320
  async listTemplates(e) {
1261
- let t = [...X];
1262
- return e != null && e.type && (t = t.filter((a) => a.type === e.type)), e != null && e.category && (t = t.filter((a) => a.category === e.category)), e != null && e.language && (t = t.filter((a) => a.languages.includes(e.language))), t;
1321
+ let t = [...ee];
1322
+ return e != null && e.type && (t = t.filter((n) => n.type === e.type)), e != null && e.category && (t = t.filter((n) => n.category === e.category)), e != null && e.language && (t = t.filter((n) => n.languages.includes(e.language))), t;
1263
1323
  },
1264
1324
  async getTemplate(e) {
1265
- const t = X.find((a) => a.id === e);
1325
+ const t = ee.find((n) => n.id === e);
1266
1326
  if (!t)
1267
1327
  throw new Error(`Template not found: ${e}`);
1268
1328
  return t;
1269
1329
  }
1270
1330
  };
1271
- function at(e) {
1331
+ function ct(e) {
1272
1332
  return e === "de" ? "time-voucher-classic-de" : "time-voucher-classic-en";
1273
1333
  }
1274
- let F = Ke;
1275
- function rt(e) {
1276
- F = e;
1334
+ let W = Ye;
1335
+ function dt(e) {
1336
+ W = e;
1277
1337
  }
1278
- function ot() {
1279
- return F;
1338
+ function ht() {
1339
+ return W;
1280
1340
  }
1281
- async function it(e) {
1282
- return F.listTemplates(e);
1341
+ async function mt(e) {
1342
+ return W.listTemplates(e);
1283
1343
  }
1284
- async function st(e) {
1285
- return F.getTemplate(e);
1344
+ async function pt(e) {
1345
+ return W.getTemplate(e);
1286
1346
  }
1287
1347
  export {
1288
- De as ApiKeyModal,
1289
- Qe as BillPreview,
1290
- tt as ExportButton,
1291
- nt as Header,
1292
- R as LAYOUT_HDPI,
1293
- B as LAYOUT_LDPI,
1294
- Ue as LanguageToggle,
1295
- Ve as PersonalInfoForm,
1296
- Xe as PortraitUpload,
1297
- _e as TEMPLATES,
1298
- Je as VoucherConfig,
1299
- He as downloadBlob,
1300
- $e as drawContactInfo,
1301
- Re as drawMultilineText,
1302
- Be as drawOvalPortrait,
1303
- ae as drawTemplate,
1304
- re as drawText,
1305
- Ze as enhancePortrait,
1306
- Te as enhancePortraitFallback,
1307
- Me as exportBillAsPDF,
1308
- J as formatDescription,
1309
- ze as generateBillPDF,
1310
- q as getApiKey,
1311
- at as getDefaultTemplateId,
1312
- te as getLayout,
1313
- ne as getTemplate,
1314
- st as getTemplateById,
1315
- ot as getTemplateProvider,
1316
- Ce as hasApiKey,
1317
- it as listTemplates,
1318
- Y as loadImage,
1319
- Ae as removeBackground,
1320
- ie as renderBackSide,
1321
- oe as renderFrontSide,
1322
- Se as setApiKey,
1323
- rt as setTemplateProvider,
1324
- Ke as staticTemplateProvider,
1325
- z as t,
1326
- et as useBillCanvasRefs,
1327
- y as useBillStore
1348
+ Be as ApiKeyModal,
1349
+ ot as BillPreview,
1350
+ st as ExportButton,
1351
+ lt as Header,
1352
+ B as LAYOUT_HDPI,
1353
+ R as LAYOUT_LDPI,
1354
+ je as LanguageToggle,
1355
+ Je as PersonalInfoForm,
1356
+ at as PortraitUpload,
1357
+ $e as TEMPLATES,
1358
+ rt as VoucherConfig,
1359
+ Ne as applyEngravingEffect,
1360
+ Fe as downloadBlob,
1361
+ He as drawContactInfo,
1362
+ ze as drawMultilineText,
1363
+ Me as drawOvalPortrait,
1364
+ ie as drawTemplate,
1365
+ se as drawText,
1366
+ nt as enhancePortrait,
1367
+ We as exportBillAsPDF,
1368
+ te as formatDescription,
1369
+ Ue as generateBillPDF,
1370
+ V as getApiKey,
1371
+ ct as getDefaultTemplateId,
1372
+ re as getLayout,
1373
+ et as getRemoveBackgroundEndpoint,
1374
+ oe as getTemplate,
1375
+ pt as getTemplateById,
1376
+ ht as getTemplateProvider,
1377
+ De as hasApiKey,
1378
+ tt as hasCustomEndpoint,
1379
+ mt as listTemplates,
1380
+ q as loadImage,
1381
+ _e as removeBackground,
1382
+ ce as renderBackSide,
1383
+ le as renderFrontSide,
1384
+ Le as setApiKey,
1385
+ Qe as setRemoveBackgroundEndpoint,
1386
+ dt as setTemplateProvider,
1387
+ Ye as staticTemplateProvider,
1388
+ M as t,
1389
+ it as useBillCanvasRefs,
1390
+ v as useBillStore
1328
1391
  };