@antontranelis/money-printer 1.0.8 → 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 u, jsx as l, Fragment as j } from "react/jsx-runtime";
1
+ import { jsxs as u, jsx as l, Fragment as O } from "react/jsx-runtime";
2
2
  import { create as ve } from "zustand";
3
- import { persist as we } from "zustand/middleware";
4
- import { useState as E, useCallback as T, useRef as D, useEffect as O } from "react";
5
- import ye from "jspdf";
6
- const X = {
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,10 +23,10 @@ const X = {
23
23
  currentSide: "front",
24
24
  isEnhancing: !1,
25
25
  isExporting: !1
26
- }, w = ve()(
27
- we(
26
+ }, v = ve()(
27
+ ye(
28
28
  (e) => ({
29
- ...X,
29
+ ...J,
30
30
  setPersonalInfo: (t) => e((n) => ({
31
31
  personalInfo: { ...n.personalInfo, ...t }
32
32
  })),
@@ -73,7 +73,7 @@ const X = {
73
73
  setHours: (t) => e((n) => ({
74
74
  voucherConfig: { ...n.voucherConfig, hours: t }
75
75
  })),
76
- reset: () => e(X)
76
+ reset: () => e(J)
77
77
  }),
78
78
  {
79
79
  name: "money-generator-storage",
@@ -84,7 +84,7 @@ const X = {
84
84
  })
85
85
  }
86
86
  )
87
- ), xe = {
87
+ ), ke = {
88
88
  header: {
89
89
  title: "Money Generator",
90
90
  subtitle: "Erstelle deinen persönlichen Zeitgutschein"
@@ -178,18 +178,18 @@ const X = {
178
178
  bill: {
179
179
  descriptionText: "This voucher entitles you to {hours} {hourLabel} of my time or an equivalent thank you"
180
180
  }
181
- }, ke = { de: xe, en: Ie };
182
- function $(e) {
183
- return ke[e];
181
+ }, Ee = { de: ke, en: Ie };
182
+ function M(e) {
183
+ return Ee[e];
184
184
  }
185
- function ee(e, t, n) {
185
+ function te(e, t, n) {
186
186
  if (n && n.trim())
187
187
  return n;
188
- const a = $(e), r = t === 1 ? a.form.voucher.hourLabel : a.form.voucher.hoursLabel;
188
+ const a = M(e), r = t === 1 ? a.form.voucher.hourLabel : a.form.voucher.hoursLabel;
189
189
  return a.bill.descriptionText.replace("{hours}", t.toString()).replace("{hourLabel}", r);
190
190
  }
191
- function Xe() {
192
- const e = w((r) => r.voucherConfig.language), t = w((r) => r.personalInfo), n = w((r) => r.setPersonalInfo), a = $(e);
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
193
  return /* @__PURE__ */ u("div", { className: "space-y-4", children: [
194
194
  /* @__PURE__ */ u("div", { className: "form-control", children: [
195
195
  /* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text font-medium", children: a.form.personalInfo.name }) }),
@@ -236,30 +236,41 @@ async function Ne(e, t = 0.5) {
236
236
  return new Promise((n, a) => {
237
237
  const r = new Image();
238
238
  r.onload = () => {
239
- const o = document.createElement("canvas"), c = o.getContext("2d");
239
+ const i = document.createElement("canvas"), c = i.getContext("2d");
240
240
  if (!c) {
241
241
  a(new Error("Failed to get canvas context"));
242
242
  return;
243
243
  }
244
- o.width = r.width, o.height = r.height, c.drawImage(r, 0, 0);
245
- const s = c.getImageData(0, 0, o.width, o.height), i = s.data, d = 1 + t * 0.8;
246
- for (let h = 0; h < i.length; h += 4) {
247
- const g = i[h], f = i[h + 1], b = i[h + 2];
248
- if (i[h + 3] === 0) continue;
249
- let I = (((0.299 * g + 0.587 * f + 0.114 * b) / 255 - 0.5) * d + 0.5) * 255;
250
- I = Math.max(0, Math.min(255, I));
251
- const x = Math.min(255, I * 0.9 + 25), A = Math.min(255, I * 0.78 + 15), y = Math.min(255, I * 0.55 + 5);
252
- i[h] = Math.round(g * (1 - t) + x * t), i[h + 1] = Math.round(f * (1 - t) + A * t), i[h + 2] = Math.round(b * (1 - t) + y * t);
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
253
  }
254
- c.putImageData(s, 0, 0), n(o.toDataURL("image/png"));
254
+ c.putImageData(s, 0, 0), n(i.toDataURL("image/png"));
255
255
  }, r.onerror = () => a(new Error("Failed to load image")), r.src = e;
256
256
  });
257
257
  }
258
- const Ee = "https://api.stability.ai/v1/generation", Pe = "https://api.stability.ai/v2beta/stable-image/edit/remove-background", te = "stability_api_key", Se = {
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 = {
259
270
  vintage: "portrait in the style of vintage currency engraving, fine line work, crosshatching, sepia tones, detailed stippling, classic bank note portrait style",
260
271
  engraved: "portrait as detailed intaglio engraving, currency bill style, fine parallel lines, high contrast, official government portrait",
261
272
  currency: "portrait rendered as US dollar bill engraving, official currency portrait style, green tint, fine line engraving technique"
262
- }, J = [
273
+ }, Q = [
263
274
  { width: 1024, height: 1024 },
264
275
  { width: 1152, height: 896 },
265
276
  { width: 1216, height: 832 },
@@ -270,57 +281,57 @@ const Ee = "https://api.stability.ai/v1/generation", Pe = "https://api.stability
270
281
  { width: 832, height: 1216 },
271
282
  { width: 896, height: 1152 }
272
283
  ];
273
- function Ce(e, t) {
284
+ function Te(e, t) {
274
285
  const n = e / t;
275
- let a = J[0], r = 1 / 0;
276
- for (const o of J) {
277
- const c = o.width / o.height, s = Math.abs(n - c);
278
- s < r && (r = s, a = o);
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);
279
290
  }
280
291
  return a;
281
292
  }
282
- function Te(e) {
293
+ function Ae(e) {
283
294
  return new Promise((t, n) => {
284
295
  const a = new Image();
285
296
  a.onload = () => {
286
- const r = Ce(a.width, a.height), o = document.createElement("canvas");
287
- o.width = r.width, o.height = r.height;
288
- const c = o.getContext("2d");
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");
289
300
  if (!c) {
290
301
  n(new Error("Failed to get canvas context"));
291
302
  return;
292
303
  }
293
- const s = a.width / a.height, i = r.width / r.height;
304
+ const s = a.width / a.height, o = r.width / r.height;
294
305
  let d = 0, h = 0, g = a.width, f = a.height;
295
- s > i ? (g = a.height * i, d = (a.width - g) / 2) : (f = a.width / i, h = (a.height - f) / 2), c.drawImage(a, d, h, g, f, 0, 0, r.width, r.height), t(o.toDataURL("image/png"));
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"));
296
307
  }, a.onerror = () => n(new Error("Failed to load image")), a.src = e;
297
308
  });
298
309
  }
299
- function ne(e) {
310
+ function ae(e) {
300
311
  var c;
301
- const t = e.split(","), n = ((c = t[0].match(/:(.*?);/)) == null ? void 0 : c[1]) || "image/png", a = atob(t[1]), r = a.length, o = new Uint8Array(r);
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);
302
313
  for (let s = 0; s < r; s++)
303
- o[s] = a.charCodeAt(s);
304
- return new Blob([o], { type: n });
314
+ i[s] = a.charCodeAt(s);
315
+ return new Blob([i], { type: n });
305
316
  }
306
- function q() {
317
+ function V() {
307
318
  var t;
308
319
  const e = typeof import.meta < "u" && "sk-7mEKklrqaltdtgbX0VoZbkA8E1cl939Spn75jSIYRvp1BW0b" || typeof process < "u" && ((t = process.env) == null ? void 0 : t.NEXT_PUBLIC_STABILITY_API_KEY);
309
- return e && e !== "your-api-key-here" ? e : typeof localStorage < "u" ? localStorage.getItem(te) : null;
320
+ return e && e !== "your-api-key-here" ? e : typeof localStorage < "u" ? localStorage.getItem(ne) : null;
310
321
  }
311
- function Ae(e) {
312
- localStorage.setItem(te, e);
322
+ function Le(e) {
323
+ localStorage.setItem(ne, e);
313
324
  }
314
- function Le() {
315
- return q() !== null;
325
+ function De() {
326
+ return $ ? !0 : V() !== null;
316
327
  }
317
- async function Je(e) {
318
- const t = q();
328
+ async function nt(e) {
329
+ const t = V();
319
330
  if (!t)
320
331
  throw new Error("No Stability AI API key configured");
321
- const { imageDataUrl: n, style: a, strength: r = 0.35 } = e, o = await Te(n), c = ne(o), s = new FormData();
322
- 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]", Se[a]), s.append("text_prompts[0][weight]", "1"), s.append("cfg_scale", "7"), s.append("samples", "1"), s.append("steps", "30");
323
- const d = await fetch(`${Ee}/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`, {
324
335
  method: "POST",
325
336
  headers: {
326
337
  Authorization: `Bearer ${t}`,
@@ -338,12 +349,26 @@ async function Je(e) {
338
349
  return `data:image/png;base64,${h.artifacts[0].base64}`;
339
350
  }
340
351
  async function _e(e) {
341
- const t = q();
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();
342
367
  if (!t)
343
368
  throw new Error("No Stability AI API key configured");
344
- const n = ne(e), a = new FormData();
369
+ const n = ae(e), a = new FormData();
345
370
  a.append("image", n, "image.png"), a.append("output_format", "png");
346
- const r = await fetch(Pe, {
371
+ const r = await fetch(Se, {
347
372
  method: "POST",
348
373
  headers: {
349
374
  Authorization: `Bearer ${t}`,
@@ -355,23 +380,23 @@ async function _e(e) {
355
380
  const c = await r.text();
356
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}`);
357
382
  }
358
- const o = await r.blob();
383
+ const i = await r.blob();
359
384
  return new Promise((c, s) => {
360
- const i = new FileReader();
361
- i.onload = () => c(i.result), i.onerror = () => s(new Error("Failed to read result")), i.readAsDataURL(o);
385
+ const o = new FileReader();
386
+ o.onload = () => c(o.result), o.onerror = () => s(new Error("Failed to read result")), o.readAsDataURL(i);
362
387
  });
363
388
  }
364
- function De() {
365
- const [e, t] = E(!1), [n, a] = E(!1), [r, o] = E(null), [c, s] = E(Le()), i = T(() => o(null), []), d = T((f) => {
366
- Ae(f), s(!0), o(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);
367
392
  }, []), h = T(
368
393
  async (f, b = 0.5) => {
369
- t(!0), o(null);
394
+ t(!0), i(null);
370
395
  try {
371
396
  return await Ne(f, b);
372
397
  } catch (m) {
373
398
  const S = m instanceof Error ? m.message : "Enhancement failed";
374
- throw o(S), m;
399
+ throw i(S), m;
375
400
  } finally {
376
401
  t(!1);
377
402
  }
@@ -379,12 +404,12 @@ function De() {
379
404
  []
380
405
  ), g = T(
381
406
  async (f) => {
382
- a(!0), o(null);
407
+ a(!0), i(null);
383
408
  try {
384
409
  return await _e(f);
385
410
  } catch (b) {
386
411
  const m = b instanceof Error ? b.message : "Background removal failed";
387
- throw o(m), b;
412
+ throw i(m), b;
388
413
  } finally {
389
414
  a(!1);
390
415
  }
@@ -399,15 +424,15 @@ function De() {
399
424
  error: r,
400
425
  hasKey: c,
401
426
  setApiKey: d,
402
- clearError: i
427
+ clearError: o
403
428
  };
404
429
  }
405
- function Re({ isOpen: e, onClose: t, onSubmit: n }) {
406
- const a = w((d) => d.voucherConfig.language), [r, o] = E("");
430
+ function Be({ isOpen: e, onClose: t, onSubmit: n }) {
431
+ const a = v((d) => d.voucherConfig.language), [r, i] = N("");
407
432
  if (!e) return null;
408
433
  const c = (d) => {
409
- d.preventDefault(), r.trim() && (n(r.trim()), o(""), t());
410
- }, i = {
434
+ d.preventDefault(), r.trim() && (n(r.trim()), i(""), t());
435
+ }, o = {
411
436
  de: {
412
437
  title: "Stability AI API Key",
413
438
  description: "Um die AI-Bildverbesserung zu nutzen, benötigst du einen Stability AI API Key. Du kannst ihn auf platform.stability.ai erhalten.",
@@ -427,120 +452,120 @@ function Re({ isOpen: e, onClose: t, onSubmit: n }) {
427
452
  }[a];
428
453
  return /* @__PURE__ */ u("dialog", { className: "modal modal-open", children: [
429
454
  /* @__PURE__ */ u("div", { className: "modal-box", children: [
430
- /* @__PURE__ */ l("h3", { className: "font-bold text-lg", children: i.title }),
431
- /* @__PURE__ */ l("p", { className: "py-4 text-sm opacity-80", children: i.description }),
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 }),
432
457
  /* @__PURE__ */ u("form", { onSubmit: c, children: [
433
458
  /* @__PURE__ */ u("div", { className: "form-control", children: [
434
459
  /* @__PURE__ */ l(
435
460
  "input",
436
461
  {
437
462
  type: "password",
438
- placeholder: i.placeholder,
463
+ placeholder: o.placeholder,
439
464
  className: "input input-bordered w-full",
440
465
  value: r,
441
- onChange: (d) => o(d.target.value),
466
+ onChange: (d) => i(d.target.value),
442
467
  autoFocus: !0
443
468
  }
444
469
  ),
445
- /* @__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 }) })
446
471
  ] }),
447
472
  /* @__PURE__ */ u("div", { className: "modal-action", children: [
448
- /* @__PURE__ */ l("button", { type: "button", className: "btn btn-ghost", onClick: t, children: i.cancel }),
449
- /* @__PURE__ */ l("button", { type: "submit", className: "btn btn-primary", disabled: !r.trim(), children: i.submit })
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 })
450
475
  ] })
451
476
  ] })
452
477
  ] }),
453
478
  /* @__PURE__ */ l("form", { method: "dialog", className: "modal-backdrop", children: /* @__PURE__ */ l("button", { onClick: t, children: "close" }) })
454
479
  ] });
455
480
  }
456
- function Qe() {
457
- const e = w((p) => p.voucherConfig.language), t = w((p) => p.portrait), n = w((p) => p.setPortrait), a = w((p) => p.setPortraitZoom), { enhance: r, removeBg: o, isEnhancing: c, isRemovingBg: s, error: i, hasKey: d, setApiKey: h } = De(), g = $(e), f = D(null), [b, m] = E(!1), [S, I] = E(!1), [x, A] = E(null), [y, P] = E(null), [L, _] = E(!1), [C, M] = E(0), z = D(null);
458
- O(() => () => {
459
- z.current && clearTimeout(z.current);
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);
460
485
  }, []);
461
- const W = T(
486
+ const j = T(
462
487
  async (p) => {
463
488
  if (!p.type.startsWith("image/"))
464
489
  return;
465
- const v = new FileReader();
466
- v.onload = async (k) => {
467
- var Z;
468
- const G = (Z = k.target) == null ? void 0 : Z.result;
469
- A(G), n(G), _(!1), P(null), M(0);
470
- }, v.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);
471
496
  },
472
497
  [n]
473
- ), ce = T(
498
+ ), de = T(
474
499
  (p) => {
475
500
  p.preventDefault(), m(!1);
476
- const v = p.dataTransfer.files[0];
477
- v && W(v);
501
+ const w = p.dataTransfer.files[0];
502
+ w && j(w);
478
503
  },
479
- [W]
480
- ), de = T((p) => {
504
+ [j]
505
+ ), he = T((p) => {
481
506
  p.preventDefault(), m(!0);
482
- }, []), he = T((p) => {
507
+ }, []), me = T((p) => {
483
508
  p.preventDefault(), m(!1);
484
- }, []), me = () => {
509
+ }, []), pe = () => {
485
510
  var p;
486
511
  (p = f.current) == null || p.click();
487
- }, pe = (p) => {
488
- var k;
489
- const v = (k = p.target.files) == null ? void 0 : k[0];
490
- v && W(v);
491
- }, H = T(async (p, v) => {
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) => {
492
517
  try {
493
- return await r(p, v);
494
- } catch (k) {
495
- return console.error("Enhancement failed:", k), p;
518
+ return await r(p, w);
519
+ } catch (I) {
520
+ return console.error("Enhancement failed:", I), p;
496
521
  }
497
- }, [r]), V = T(async (p) => {
522
+ }, [r]), G = T(async (p) => {
498
523
  try {
499
- const v = await o(p);
500
- return P(v), v;
501
- } catch (v) {
502
- return console.error("Background removal failed:", v), p;
524
+ const w = await i(p);
525
+ return P(w), w;
526
+ } catch (w) {
527
+ return console.error("Background removal failed:", w), p;
503
528
  }
504
- }, [o]), ue = async () => {
529
+ }, [i]), ge = async () => {
505
530
  if (!x) return;
506
531
  if (!L && !d) {
507
- I(!0);
532
+ k(!0);
508
533
  return;
509
534
  }
510
535
  const p = !L;
511
- if (_(p), p) {
512
- const v = await V(x);
536
+ if (D(p), p) {
537
+ const w = await G(x);
513
538
  if (C > 0) {
514
- const k = await H(v, C);
515
- n(k);
539
+ const I = await U(w, C);
540
+ n(I);
516
541
  } else
517
- n(v);
542
+ n(w);
518
543
  } else if (P(null), C > 0) {
519
- const v = await H(x, C);
520
- n(v);
544
+ const w = await U(x, C);
545
+ n(w);
521
546
  } else
522
547
  n(x);
523
- }, ge = (p) => {
524
- M(p), z.current && clearTimeout(z.current), x && (z.current = setTimeout(async () => {
525
- const v = L && y ? y : x;
548
+ }, fe = (p) => {
549
+ z(p), H.current && clearTimeout(H.current), x && (H.current = setTimeout(async () => {
550
+ const w = L && y ? y : x;
526
551
  if (p === 0)
527
- n(v);
552
+ n(w);
528
553
  else {
529
- const k = await H(v, p);
530
- n(k);
554
+ const I = await U(w, p);
555
+ n(I);
531
556
  }
532
557
  }, 150));
533
- }, fe = async (p) => {
558
+ }, be = async (p) => {
534
559
  if (h(p), !x) return;
535
- _(!0);
536
- const v = await V(x);
560
+ D(!0);
561
+ const w = await G(x);
537
562
  if (C > 0) {
538
- const k = await H(v, C);
539
- n(k);
563
+ const I = await U(w, C);
564
+ n(I);
540
565
  } else
541
- n(v);
542
- }, be = () => {
543
- n(null), A(null), P(null), _(!1), M(0);
566
+ n(w);
567
+ }, we = () => {
568
+ n(null), A(null), P(null), D(!1), z(0);
544
569
  };
545
570
  return /* @__PURE__ */ u("div", { className: "space-y-4", children: [
546
571
  t.original ? /* @__PURE__ */ u("div", { className: "flex flex-col items-center space-y-4", children: [
@@ -558,7 +583,7 @@ function Qe() {
558
583
  "button",
559
584
  {
560
585
  className: "btn btn-circle btn-xs btn-error absolute -top-1 -right-1",
561
- onClick: be,
586
+ onClick: we,
562
587
  children: /* @__PURE__ */ l(
563
588
  "svg",
564
589
  {
@@ -621,7 +646,7 @@ function Qe() {
621
646
  max: "1",
622
647
  step: "0.05",
623
648
  value: C,
624
- onChange: (p) => ge(parseFloat(p.target.value)),
649
+ onChange: (p) => fe(parseFloat(p.target.value)),
625
650
  className: "range range-secondary range-sm",
626
651
  disabled: c
627
652
  }
@@ -634,30 +659,30 @@ function Qe() {
634
659
  type: "checkbox",
635
660
  className: `toggle toggle-primary ${s ? "opacity-50" : ""}`,
636
661
  checked: L,
637
- onChange: ue,
662
+ onChange: ge,
638
663
  disabled: s
639
664
  }
640
665
  ),
641
666
  /* @__PURE__ */ u("span", { className: "label-text flex items-center gap-2", children: [
642
- s ? /* @__PURE__ */ u(j, { children: [
667
+ s ? /* @__PURE__ */ u(O, { children: [
643
668
  /* @__PURE__ */ l("span", { className: "loading loading-spinner loading-xs" }),
644
669
  e === "de" ? "Hintergrund wird entfernt..." : "Removing background..."
645
670
  ] }) : e === "de" ? "Hintergrund entfernen" : "Remove background",
646
671
  !d && /* @__PURE__ */ l("span", { className: "badge badge-sm badge-outline", children: "API" })
647
672
  ] })
648
673
  ] }) }),
649
- i && /* @__PURE__ */ u("div", { className: "alert alert-warning text-sm py-2", children: [
674
+ o && /* @__PURE__ */ u("div", { className: "alert alert-warning text-sm py-2", children: [
650
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" }) }),
651
- /* @__PURE__ */ l("span", { children: i })
676
+ /* @__PURE__ */ l("span", { children: o })
652
677
  ] })
653
678
  ] }) : /* @__PURE__ */ u(
654
679
  "div",
655
680
  {
656
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"}`,
657
- onDrop: ce,
658
- onDragOver: de,
659
- onDragLeave: he,
660
- onClick: me,
682
+ onDrop: de,
683
+ onDragOver: he,
684
+ onDragLeave: me,
685
+ onClick: pe,
661
686
  children: [
662
687
  /* @__PURE__ */ l(
663
688
  "input",
@@ -666,7 +691,7 @@ function Qe() {
666
691
  type: "file",
667
692
  accept: "image/*",
668
693
  className: "hidden",
669
- onChange: pe
694
+ onChange: ue
670
695
  }
671
696
  ),
672
697
  s ? /* @__PURE__ */ u("div", { className: "flex flex-col items-center gap-2", children: [
@@ -699,55 +724,55 @@ function Qe() {
699
724
  }
700
725
  ),
701
726
  /* @__PURE__ */ l(
702
- Re,
727
+ Be,
703
728
  {
704
729
  isOpen: S,
705
- onClose: () => I(!1),
706
- onSubmit: fe
730
+ onClose: () => k(!1),
731
+ onSubmit: be
707
732
  }
708
733
  )
709
734
  ] });
710
735
  }
711
- function et() {
736
+ function rt() {
712
737
  return null;
713
738
  }
714
- const N = typeof import.meta < "u" && "/" || "/", Be = {
739
+ const E = typeof import.meta < "u" && "/" || "/", $e = {
715
740
  en: {
716
741
  1: {
717
- front: `${N}templates/front_ldpi_en.png`,
718
- back: `${N}templates/back_ldpi_en.png`,
742
+ front: `${E}templates/front_ldpi_en.png`,
743
+ back: `${E}templates/back_ldpi_en.png`,
719
744
  width: 1536,
720
745
  height: 1024
721
746
  },
722
747
  5: {
723
- front: `${N}templates/front_ldpi_en.png`,
724
- back: `${N}templates/back_ldpi_en.png`,
748
+ front: `${E}templates/front_ldpi_en.png`,
749
+ back: `${E}templates/back_ldpi_en.png`,
725
750
  width: 1536,
726
751
  height: 1024
727
752
  },
728
753
  10: {
729
- front: `${N}templates/front_ldpi_en.png`,
730
- back: `${N}templates/back_ldpi_en.png`,
754
+ front: `${E}templates/front_ldpi_en.png`,
755
+ back: `${E}templates/back_ldpi_en.png`,
731
756
  width: 1536,
732
757
  height: 1024
733
758
  }
734
759
  },
735
760
  de: {
736
761
  1: {
737
- front: `${N}templates/front_hdpi_de.webp`,
738
- back: `${N}templates/back_hdpi_de.webp`,
762
+ front: `${E}templates/front_hdpi_de.webp`,
763
+ back: `${E}templates/back_hdpi_de.webp`,
739
764
  width: 6144,
740
765
  height: 3200
741
766
  },
742
767
  5: {
743
- front: `${N}templates/front_hdpi_de.webp`,
744
- back: `${N}templates/back_hdpi_de.webp`,
768
+ front: `${E}templates/front_hdpi_de.webp`,
769
+ back: `${E}templates/back_hdpi_de.webp`,
745
770
  width: 6144,
746
771
  height: 3200
747
772
  },
748
773
  10: {
749
- front: `${N}templates/front_hdpi_de.webp`,
750
- back: `${N}templates/back_hdpi_de.webp`,
774
+ front: `${E}templates/front_hdpi_de.webp`,
775
+ back: `${E}templates/back_hdpi_de.webp`,
751
776
  width: 6144,
752
777
  height: 3200
753
778
  }
@@ -845,14 +870,14 @@ const N = typeof import.meta < "u" && "/" || "/", Be = {
845
870
  }
846
871
  }
847
872
  };
848
- function ae(e) {
873
+ function re(e) {
849
874
  return e === "de" ? B : R;
850
875
  }
851
- function re(e, t) {
852
- return Be[e][t];
876
+ function oe(e, t) {
877
+ return $e[e][t];
853
878
  }
854
879
  const K = /* @__PURE__ */ new Map();
855
- async function Y(e) {
880
+ async function q(e) {
856
881
  return K.has(e) ? K.get(e) : new Promise((t, n) => {
857
882
  const a = new Image();
858
883
  a.crossOrigin = "anonymous", a.onload = () => {
@@ -860,53 +885,53 @@ async function Y(e) {
860
885
  }, a.onerror = n, a.src = e;
861
886
  });
862
887
  }
863
- function oe(e, t, n, a) {
888
+ function ie(e, t, n, a) {
864
889
  e.drawImage(t, 0, 0, n, a);
865
890
  }
866
- function $e(e, t, n, a, r, o, c = 1) {
867
- e.save(), e.beginPath(), e.ellipse(n, a, r, o, 0, 0, Math.PI * 2), e.closePath(), e.clip();
868
- const s = t.width / t.height, i = r / o, d = r * 2, h = o * 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;
869
894
  let g, f;
870
- s > i ? (f = h, g = h * s) : (g = d, f = d / s), g *= c, f *= c;
895
+ s > o ? (f = h, g = h * s) : (g = d, f = d / s), g *= c, f *= c;
871
896
  const b = n - g / 2, m = a - f / 2;
872
897
  e.drawImage(t, b, m, g, f), e.restore();
873
898
  }
874
- function ie(e, t, n, a = "#2a3a2a") {
899
+ function se(e, t, n, a = "#2a3a2a") {
875
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();
876
901
  }
877
- function Me(e, t, n, a = "#2a3a2a") {
902
+ function ze(e, t, n, a = "#2a3a2a") {
878
903
  e.save(), e.font = `${n.fontSize}px "Times New Roman", serif`, e.textAlign = n.align || "center", e.textBaseline = "top", e.fillStyle = a;
879
- const r = n.maxWidth || 400, o = n.lineHeight || n.fontSize * 1.4, c = t.split(" "), s = [];
880
- let i = "";
904
+ const r = n.maxWidth || 400, i = n.lineHeight || n.fontSize * 1.4, c = t.split(" "), s = [];
905
+ let o = "";
881
906
  for (const g of c) {
882
- const f = i ? `${i} ${g}` : g;
883
- e.measureText(f).width > r && i ? (s.push(i), i = g) : i = f;
907
+ const f = o ? `${o} ${g}` : g;
908
+ e.measureText(f).width > r && o ? (s.push(o), o = g) : o = f;
884
909
  }
885
- i && s.push(i);
886
- const d = s.length * o;
910
+ o && s.push(o);
911
+ const d = s.length * i;
887
912
  let h = n.y - d / 2;
888
913
  for (const g of s)
889
- e.fillText(g, n.x, h), h += o;
914
+ e.fillText(g, n.x, h), h += i;
890
915
  e.restore();
891
916
  }
892
- function ze(e, t, n, a, r, o = "#2a3a2a") {
893
- e.save(), e.font = `${r.fontSize}px "Times New Roman", serif`, e.textAlign = r.align || "center", e.textBaseline = "middle", e.fillStyle = o;
894
- const c = r.lineHeight || r.fontSize * 1.8, s = [t, n, a].filter(Boolean), i = (s.length - 1) * c;
895
- let d = r.y - i / 2;
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;
896
921
  for (const h of s)
897
922
  h && (e.fillText(h, r.x, d), d += c);
898
923
  e.restore();
899
924
  }
900
- async function se(e, t, n, a, r, o, c, s = 1) {
901
- const i = e.getContext("2d");
902
- if (!i) return;
903
- e.width = o, e.height = c, i.clearRect(0, 0, o, c);
904
- const d = await Y(t);
905
- if (oe(i, d, o, c), n)
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)
906
931
  try {
907
- const h = await Y(n);
908
- $e(
909
- i,
932
+ const h = await q(n);
933
+ Me(
934
+ o,
910
935
  h,
911
936
  r.portrait.x,
912
937
  r.portrait.y,
@@ -917,20 +942,20 @@ async function se(e, t, n, a, r, o, c, s = 1) {
917
942
  } catch (h) {
918
943
  console.error("Failed to load portrait:", h);
919
944
  }
920
- a && ie(i, a, r.namePlate);
945
+ a && se(o, a, r.namePlate);
921
946
  }
922
- async function le(e, t, n, a, r, o, c, s, i) {
947
+ async function ce(e, t, n, a, r, i, c, s, o) {
923
948
  const d = e.getContext("2d");
924
949
  if (!d) return;
925
- e.width = s, e.height = i, d.clearRect(0, 0, s, i);
926
- const h = await Y(t);
927
- oe(d, h, s, i), c.contactInfo && (n || a || r) && ze(d, n, a, r, c.contactInfo), c.description && o && Me(d, o, c.description), n && ie(d, n, c.namePlate);
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);
928
953
  }
929
- function tt() {
930
- const e = w((y) => y.voucherConfig.language), t = w((y) => y.voucherConfig.hours), n = w((y) => y.voucherConfig.description), a = w((y) => y.personalInfo), r = w((y) => y.portrait), o = w((y) => y.currentSide), c = w((y) => y.flipSide), s = $(e), i = D(null), d = D(null), h = D(null), [g, f] = E(!1), b = re(e, t), m = ae(e), S = r.useEnhanced && r.enhanced ? r.enhanced : r.original, I = ee(e, t, n);
931
- O(() => {
932
- i.current && se(
933
- 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,
934
959
  b.front,
935
960
  S,
936
961
  a.name,
@@ -939,19 +964,19 @@ function tt() {
939
964
  b.height,
940
965
  r.zoom
941
966
  );
942
- }, [b, S, a.name, m, r.zoom]), O(() => {
943
- d.current && le(
967
+ }, [b, S, a.name, m, r.zoom]), Y(() => {
968
+ d.current && ce(
944
969
  d.current,
945
970
  b.back,
946
971
  a.name,
947
972
  a.email,
948
973
  a.phone,
949
- I,
974
+ k,
950
975
  m.back,
951
976
  b.width,
952
977
  b.height
953
978
  );
954
- }, [b, a, I, m]);
979
+ }, [b, a, k, m]);
955
980
  const x = () => {
956
981
  f(!0), setTimeout(() => {
957
982
  c(), f(!1);
@@ -963,16 +988,16 @@ function tt() {
963
988
  /* @__PURE__ */ l(
964
989
  "button",
965
990
  {
966
- className: `tab ${o === "front" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
967
- onClick: () => o !== "front" && x(),
991
+ className: `tab ${i === "front" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
992
+ onClick: () => i !== "front" && x(),
968
993
  children: s.preview.front
969
994
  }
970
995
  ),
971
996
  /* @__PURE__ */ l(
972
997
  "button",
973
998
  {
974
- className: `tab ${o === "back" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
975
- onClick: () => o !== "back" && x(),
999
+ className: `tab ${i === "back" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
1000
+ onClick: () => i !== "back" && x(),
976
1001
  children: s.preview.back
977
1002
  }
978
1003
  )
@@ -1010,15 +1035,15 @@ function tt() {
1010
1035
  /* @__PURE__ */ l(
1011
1036
  "canvas",
1012
1037
  {
1013
- ref: i,
1014
- className: `absolute inset-0 w-full h-full transition-all duration-300 ${o === "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"}`
1015
1040
  }
1016
1041
  ),
1017
1042
  /* @__PURE__ */ l(
1018
1043
  "canvas",
1019
1044
  {
1020
1045
  ref: d,
1021
- className: `absolute inset-0 w-full h-full transition-all duration-300 ${o === "back" ? g ? "opacity-0 scale-95" : "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"}`
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"}`
1022
1047
  }
1023
1048
  )
1024
1049
  ]
@@ -1026,64 +1051,64 @@ function tt() {
1026
1051
  )
1027
1052
  ] });
1028
1053
  }
1029
- function nt() {
1030
- const e = D(null), t = D(null);
1054
+ function it() {
1055
+ const e = _(null), t = _(null);
1031
1056
  return { frontCanvasRef: e, backCanvasRef: t };
1032
1057
  }
1033
- async function He(e) {
1058
+ async function Ue(e) {
1034
1059
  const {
1035
1060
  frontTemplateSrc: t,
1036
1061
  backTemplateSrc: n,
1037
1062
  templateWidth: a,
1038
1063
  templateHeight: r,
1039
- layout: o,
1064
+ layout: i,
1040
1065
  portrait: c,
1041
1066
  portraitZoom: s = 1,
1042
- name: i,
1067
+ name: o,
1043
1068
  email: d,
1044
1069
  phone: h,
1045
1070
  description: g
1046
1071
  } = e, f = document.createElement("canvas"), b = document.createElement("canvas");
1047
1072
  await Promise.all([
1048
- se(f, t, c, i, o.front, a, r, s),
1049
- le(b, n, i, d, h, g, o.back, a, r)
1073
+ le(f, t, c, o, i.front, a, r, s),
1074
+ ce(b, n, o, d, h, g, i.back, a, r)
1050
1075
  ]);
1051
- const m = new ye({
1076
+ const m = new xe({
1052
1077
  orientation: "landscape",
1053
1078
  unit: "mm",
1054
1079
  format: "a4"
1055
- }), S = 297, I = 210, x = 10, A = a / r;
1080
+ }), S = 297, k = 210, x = 10, A = a / r;
1056
1081
  let y = S - x * 2, P = y / A;
1057
- P > I - x * 2 && (P = I - x * 2, y = P * A);
1058
- const L = (S - y) / 2, _ = (I - P) / 2, C = f.toDataURL("image/jpeg", 0.95);
1059
- m.addImage(C, "JPEG", L, _, y, P), m.addPage();
1060
- const M = b.toDataURL("image/jpeg", 0.95);
1061
- return m.addImage(M, "JPEG", L, _, y, P), m.output("blob");
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");
1062
1087
  }
1063
- function Ue(e, t) {
1088
+ function Fe(e, t) {
1064
1089
  const n = URL.createObjectURL(e), a = document.createElement("a");
1065
1090
  a.href = n, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(n);
1066
1091
  }
1067
- async function Fe(e) {
1068
- const t = await He(e);
1069
- Ue(t, e.filename);
1092
+ async function We(e) {
1093
+ const t = await Ue(e);
1094
+ Fe(t, e.filename);
1070
1095
  }
1071
- function at() {
1072
- const e = w((m) => m.voucherConfig.language), t = w((m) => m.voucherConfig.hours), n = w((m) => m.voucherConfig.description), a = w((m) => m.personalInfo), r = w((m) => m.portrait), o = w((m) => m.isExporting), c = w((m) => m.setIsExporting), s = $(e), i = re(e, t), d = ae(e), h = r.useEnhanced && r.enhanced ? r.enhanced : r.original, g = ee(e, t, n), f = a.name.trim().length > 0 && a.email.trim().length > 0 && a.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;
1073
1098
  return /* @__PURE__ */ l(
1074
1099
  "button",
1075
1100
  {
1076
- className: `btn btn-primary flex-1 ${o ? "loading" : ""}`,
1101
+ className: `btn btn-primary flex-1 ${i ? "loading" : ""}`,
1077
1102
  onClick: async () => {
1078
- if (!(!f || o)) {
1103
+ if (!(!f || i)) {
1079
1104
  c(!0);
1080
1105
  try {
1081
1106
  const m = `zeitgutschein-${t}h-${a.name.replace(/\s+/g, "-").toLowerCase()}.pdf`;
1082
- await Fe({
1083
- frontTemplateSrc: i.front,
1084
- backTemplateSrc: i.back,
1085
- templateWidth: i.width,
1086
- templateHeight: i.height,
1107
+ await We({
1108
+ frontTemplateSrc: o.front,
1109
+ backTemplateSrc: o.back,
1110
+ templateWidth: o.width,
1111
+ templateHeight: o.height,
1087
1112
  layout: d,
1088
1113
  portrait: h,
1089
1114
  portraitZoom: r.zoom,
@@ -1100,11 +1125,11 @@ function at() {
1100
1125
  }
1101
1126
  }
1102
1127
  },
1103
- disabled: !f || o,
1104
- children: o ? /* @__PURE__ */ u(j, { children: [
1128
+ disabled: !f || i,
1129
+ children: i ? /* @__PURE__ */ u(O, { children: [
1105
1130
  /* @__PURE__ */ l("span", { className: "loading loading-spinner loading-sm" }),
1106
1131
  s.export.exporting
1107
- ] }) : /* @__PURE__ */ u(j, { children: [
1132
+ ] }) : /* @__PURE__ */ u(O, { children: [
1108
1133
  /* @__PURE__ */ l(
1109
1134
  "svg",
1110
1135
  {
@@ -1129,8 +1154,8 @@ function at() {
1129
1154
  }
1130
1155
  );
1131
1156
  }
1132
- function We() {
1133
- const e = w((a) => a.voucherConfig.language), t = w((a) => a.setLanguage), n = (a) => {
1157
+ function je() {
1158
+ const e = v((a) => a.voucherConfig.language), t = v((a) => a.setLanguage), n = (a) => {
1134
1159
  t(a);
1135
1160
  };
1136
1161
  return /* @__PURE__ */ u("div", { className: "join", children: [
@@ -1152,22 +1177,22 @@ function We() {
1152
1177
  )
1153
1178
  ] });
1154
1179
  }
1155
- function rt() {
1156
- const e = w((n) => n.voucherConfig.language), t = $(e);
1180
+ function lt() {
1181
+ const e = v((n) => n.voucherConfig.language), t = M(e);
1157
1182
  return /* @__PURE__ */ u("div", { className: "navbar bg-currency-green text-currency-cream shadow-lg", children: [
1158
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 }) }),
1159
1184
  /* @__PURE__ */ l("div", { className: "navbar-center hidden sm:flex", children: /* @__PURE__ */ l("span", { className: "text-sm opacity-80", children: t.header.subtitle }) }),
1160
- /* @__PURE__ */ l("div", { className: "navbar-end", children: /* @__PURE__ */ l(We, {}) })
1185
+ /* @__PURE__ */ l("div", { className: "navbar-end", children: /* @__PURE__ */ l(je, {}) })
1161
1186
  ] });
1162
1187
  }
1163
- const U = "/", Ke = {
1188
+ const F = "/", Ke = {
1164
1189
  id: "time-voucher-classic-de",
1165
1190
  name: "Zeitgutschein Classic",
1166
1191
  type: "time-voucher",
1167
1192
  category: "classic",
1168
1193
  images: {
1169
- front: `${U}templates/front_hdpi_de.jpg`,
1170
- back: `${U}templates/back_hdpi_de.jpg`,
1194
+ front: `${F}templates/front_hdpi_de.jpg`,
1195
+ back: `${F}templates/back_hdpi_de.jpg`,
1171
1196
  width: 6144,
1172
1197
  height: 4096
1173
1198
  },
@@ -1224,14 +1249,14 @@ const U = "/", Ke = {
1224
1249
  }
1225
1250
  },
1226
1251
  languages: ["de"]
1227
- }, je = {
1252
+ }, Oe = {
1228
1253
  id: "time-voucher-classic-en",
1229
1254
  name: "Time Voucher Classic",
1230
1255
  type: "time-voucher",
1231
1256
  category: "classic",
1232
1257
  images: {
1233
- front: `${U}templates/front_ldpi_en.png`,
1234
- back: `${U}templates/back_ldpi_en.png`,
1258
+ front: `${F}templates/front_ldpi_en.png`,
1259
+ back: `${F}templates/back_ldpi_en.png`,
1235
1260
  width: 1536,
1236
1261
  height: 1024
1237
1262
  },
@@ -1288,76 +1313,79 @@ const U = "/", Ke = {
1288
1313
  }
1289
1314
  },
1290
1315
  languages: ["en"]
1291
- }, Q = [
1316
+ }, ee = [
1292
1317
  Ke,
1293
- je
1294
- ], Oe = {
1318
+ Oe
1319
+ ], Ye = {
1295
1320
  async listTemplates(e) {
1296
- let t = [...Q];
1321
+ let t = [...ee];
1297
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;
1298
1323
  },
1299
1324
  async getTemplate(e) {
1300
- const t = Q.find((n) => n.id === e);
1325
+ const t = ee.find((n) => n.id === e);
1301
1326
  if (!t)
1302
1327
  throw new Error(`Template not found: ${e}`);
1303
1328
  return t;
1304
1329
  }
1305
1330
  };
1306
- function ot(e) {
1331
+ function ct(e) {
1307
1332
  return e === "de" ? "time-voucher-classic-de" : "time-voucher-classic-en";
1308
1333
  }
1309
- let F = Oe;
1310
- function it(e) {
1311
- F = e;
1334
+ let W = Ye;
1335
+ function dt(e) {
1336
+ W = e;
1312
1337
  }
1313
- function st() {
1314
- return F;
1338
+ function ht() {
1339
+ return W;
1315
1340
  }
1316
- async function lt(e) {
1317
- return F.listTemplates(e);
1341
+ async function mt(e) {
1342
+ return W.listTemplates(e);
1318
1343
  }
1319
- async function ct(e) {
1320
- return F.getTemplate(e);
1344
+ async function pt(e) {
1345
+ return W.getTemplate(e);
1321
1346
  }
1322
1347
  export {
1323
- Re as ApiKeyModal,
1324
- tt as BillPreview,
1325
- at as ExportButton,
1326
- rt as Header,
1348
+ Be as ApiKeyModal,
1349
+ ot as BillPreview,
1350
+ st as ExportButton,
1351
+ lt as Header,
1327
1352
  B as LAYOUT_HDPI,
1328
1353
  R as LAYOUT_LDPI,
1329
- We as LanguageToggle,
1330
- Xe as PersonalInfoForm,
1331
- Qe as PortraitUpload,
1332
- Be as TEMPLATES,
1333
- et as VoucherConfig,
1354
+ je as LanguageToggle,
1355
+ Je as PersonalInfoForm,
1356
+ at as PortraitUpload,
1357
+ $e as TEMPLATES,
1358
+ rt as VoucherConfig,
1334
1359
  Ne as applyEngravingEffect,
1335
- Ue as downloadBlob,
1336
- ze as drawContactInfo,
1337
- Me as drawMultilineText,
1338
- $e as drawOvalPortrait,
1339
- oe as drawTemplate,
1340
- ie as drawText,
1341
- Je as enhancePortrait,
1342
- Fe as exportBillAsPDF,
1343
- ee as formatDescription,
1344
- He as generateBillPDF,
1345
- q as getApiKey,
1346
- ot as getDefaultTemplateId,
1347
- ae as getLayout,
1348
- re as getTemplate,
1349
- ct as getTemplateById,
1350
- st as getTemplateProvider,
1351
- Le as hasApiKey,
1352
- lt as listTemplates,
1353
- Y as loadImage,
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,
1354
1381
  _e as removeBackground,
1355
- le as renderBackSide,
1356
- se as renderFrontSide,
1357
- Ae as setApiKey,
1358
- it as setTemplateProvider,
1359
- Oe as staticTemplateProvider,
1360
- $ as t,
1361
- nt as useBillCanvasRefs,
1362
- w as useBillStore
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
1363
1391
  };