@antontranelis/money-printer 1.0.3 → 1.0.4

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 i, Fragment as K } from "react/jsx-runtime";
2
- import { create as fe } from "zustand";
3
- import { persist as be } from "zustand/middleware";
4
- import { useState as C, useCallback as S, useRef as T, useEffect as q } from "react";
5
- import ye from "jspdf";
6
- const V = {
1
+ import { jsxs as g, jsx as i, Fragment as $ } from "react/jsx-runtime";
2
+ import { create as me } from "zustand";
3
+ import { persist as ue } from "zustand/middleware";
4
+ import { useState as N, useCallback as S, useRef as L, useEffect as V } from "react";
5
+ import ge from "jspdf";
6
+ const G = {
7
7
  personalInfo: {
8
8
  name: "",
9
9
  email: "",
@@ -23,10 +23,10 @@ const V = {
23
23
  currentSide: "front",
24
24
  isEnhancing: !1,
25
25
  isExporting: !1
26
- }, f = fe()(
27
- be(
26
+ }, w = me()(
27
+ ue(
28
28
  (e) => ({
29
- ...V,
29
+ ...G,
30
30
  setPersonalInfo: (t) => e((a) => ({
31
31
  personalInfo: { ...a.personalInfo, ...t }
32
32
  })),
@@ -72,7 +72,7 @@ const V = {
72
72
  setHours: (t) => e((a) => ({
73
73
  voucherConfig: { ...a.voucherConfig, hours: t }
74
74
  })),
75
- reset: () => e(V)
75
+ reset: () => e(G)
76
76
  }),
77
77
  {
78
78
  name: "money-generator-storage",
@@ -82,7 +82,7 @@ const V = {
82
82
  })
83
83
  }
84
84
  )
85
- ), we = {
85
+ ), fe = {
86
86
  header: {
87
87
  title: "Money Generator",
88
88
  subtitle: "Erstelle deinen persönlichen Zeitgutschein"
@@ -129,7 +129,7 @@ const V = {
129
129
  bill: {
130
130
  descriptionText: "Für diesen Schein erhältst du {hours} {hourLabel} meiner Zeit oder ein gleichwertiges Dankeschön"
131
131
  }
132
- }, ve = {
132
+ }, be = {
133
133
  header: {
134
134
  title: "Money Generator",
135
135
  subtitle: "Create your personal time voucher"
@@ -176,20 +176,20 @@ const V = {
176
176
  bill: {
177
177
  descriptionText: "This voucher entitles you to {hours} {hourLabel} of my time or an equivalent thank you"
178
178
  }
179
- }, xe = { de: we, en: ve };
179
+ }, we = { de: fe, en: be };
180
180
  function _(e) {
181
- return xe[e];
181
+ return we[e];
182
182
  }
183
- function Q(e, t, a) {
183
+ function ee(e, t, a) {
184
184
  if (a && a.trim())
185
185
  return a;
186
186
  const n = _(e), r = t === 1 ? n.form.voucher.hourLabel : n.form.voucher.hoursLabel;
187
187
  return n.bill.descriptionText.replace("{hours}", t.toString()).replace("{hourLabel}", r);
188
188
  }
189
- function Ze() {
190
- const e = f((r) => r.voucherConfig.language), t = f((r) => r.personalInfo), a = f((r) => r.setPersonalInfo), n = _(e);
191
- return /* @__PURE__ */ m("div", { className: "space-y-4", children: [
192
- /* @__PURE__ */ m("div", { className: "form-control", children: [
189
+ function je() {
190
+ const e = w((r) => r.voucherConfig.language), t = w((r) => r.personalInfo), a = w((r) => r.setPersonalInfo), n = _(e);
191
+ return /* @__PURE__ */ g("div", { className: "space-y-4", children: [
192
+ /* @__PURE__ */ g("div", { className: "form-control", children: [
193
193
  /* @__PURE__ */ i("label", { className: "label", children: /* @__PURE__ */ i("span", { className: "label-text font-medium", children: n.form.personalInfo.name }) }),
194
194
  /* @__PURE__ */ i(
195
195
  "input",
@@ -202,7 +202,7 @@ function Ze() {
202
202
  }
203
203
  )
204
204
  ] }),
205
- /* @__PURE__ */ m("div", { className: "form-control", children: [
205
+ /* @__PURE__ */ g("div", { className: "form-control", children: [
206
206
  /* @__PURE__ */ i("label", { className: "label", children: /* @__PURE__ */ i("span", { className: "label-text font-medium", children: n.form.personalInfo.email }) }),
207
207
  /* @__PURE__ */ i(
208
208
  "input",
@@ -215,7 +215,7 @@ function Ze() {
215
215
  }
216
216
  )
217
217
  ] }),
218
- /* @__PURE__ */ m("div", { className: "form-control", children: [
218
+ /* @__PURE__ */ g("div", { className: "form-control", children: [
219
219
  /* @__PURE__ */ i("label", { className: "label", children: /* @__PURE__ */ i("span", { className: "label-text font-medium", children: n.form.personalInfo.phone }) }),
220
220
  /* @__PURE__ */ i(
221
221
  "input",
@@ -230,11 +230,11 @@ function Ze() {
230
230
  ] })
231
231
  ] });
232
232
  }
233
- const D = {}, ke = "https://api.stability.ai/v1/generation", Ie = "https://clipdrop-api.co/remove-background/v1", ee = "stability_api_key", te = "clipdrop_api_key", Pe = {
233
+ const K = {}, ye = "https://api.stability.ai/v1/generation", ve = "https://api.stability.ai/v2beta/stable-image/edit/remove-background", te = "stability_api_key", xe = {
234
234
  vintage: "portrait in the style of vintage currency engraving, fine line work, crosshatching, sepia tones, detailed stippling, classic bank note portrait style",
235
235
  engraved: "portrait as detailed intaglio engraving, currency bill style, fine parallel lines, high contrast, official government portrait",
236
236
  currency: "portrait rendered as US dollar bill engraving, official currency portrait style, green tint, fine line engraving technique"
237
- }, G = [
237
+ }, Z = [
238
238
  { width: 1024, height: 1024 },
239
239
  { width: 1152, height: 896 },
240
240
  { width: 1216, height: 832 },
@@ -245,20 +245,20 @@ const D = {}, ke = "https://api.stability.ai/v1/generation", Ie = "https://clipd
245
245
  { width: 832, height: 1216 },
246
246
  { width: 896, height: 1152 }
247
247
  ];
248
- function Ee(e, t) {
248
+ function ke(e, t) {
249
249
  const a = e / t;
250
- let n = G[0], r = 1 / 0;
251
- for (const o of G) {
250
+ let n = Z[0], r = 1 / 0;
251
+ for (const o of Z) {
252
252
  const d = o.width / o.height, l = Math.abs(a - d);
253
253
  l < r && (r = l, n = o);
254
254
  }
255
255
  return n;
256
256
  }
257
- function Ne(e) {
257
+ function Ie(e) {
258
258
  return new Promise((t, a) => {
259
259
  const n = new Image();
260
260
  n.onload = () => {
261
- const r = Ee(n.width, n.height), o = document.createElement("canvas");
261
+ const r = ke(n.width, n.height), o = document.createElement("canvas");
262
262
  o.width = r.width, o.height = r.height;
263
263
  const d = o.getContext("2d");
264
264
  if (!d) {
@@ -266,8 +266,8 @@ function Ne(e) {
266
266
  return;
267
267
  }
268
268
  const l = n.width / n.height, s = r.width / r.height;
269
- let c = 0, u = 0, g = n.width, b = n.height;
270
- l > s ? (g = n.height * s, c = (n.width - g) / 2) : (b = n.width / s, u = (n.height - b) / 2), d.drawImage(n, c, u, g, b, 0, 0, r.width, r.height), t(o.toDataURL("image/png"));
269
+ let c = 0, m = 0, f = n.width, b = n.height;
270
+ l > s ? (f = n.height * s, c = (n.width - f) / 2) : (b = n.width / s, m = (n.height - b) / 2), d.drawImage(n, c, m, f, b, 0, 0, r.width, r.height), t(o.toDataURL("image/png"));
271
271
  }, n.onerror = () => a(new Error("Failed to load image")), n.src = e;
272
272
  });
273
273
  }
@@ -278,35 +278,24 @@ function ne(e) {
278
278
  o[l] = n.charCodeAt(l);
279
279
  return new Blob([o], { type: a });
280
280
  }
281
- function ae() {
282
- var t;
283
- const e = typeof import.meta < "u" && (D == null ? void 0 : D.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(ee) : null;
285
- }
286
- function Ce(e) {
287
- localStorage.setItem(ee, e);
288
- }
289
- function Z() {
290
- return ae() !== null;
291
- }
292
- function re() {
281
+ function Y() {
293
282
  var t;
294
- const e = typeof import.meta < "u" && (D == null ? void 0 : D.VITE_CLIPDROP_API_KEY) || typeof process < "u" && ((t = process.env) == null ? void 0 : t.NEXT_PUBLIC_CLIPDROP_API_KEY);
283
+ const e = typeof import.meta < "u" && (K == null ? void 0 : K.VITE_STABILITY_API_KEY) || typeof process < "u" && ((t = process.env) == null ? void 0 : t.NEXT_PUBLIC_STABILITY_API_KEY);
295
284
  return e && e !== "your-api-key-here" ? e : typeof localStorage < "u" ? localStorage.getItem(te) : null;
296
285
  }
297
- function Se(e) {
286
+ function Ee(e) {
298
287
  localStorage.setItem(te, e);
299
288
  }
300
- function Ae() {
301
- return re() !== null;
289
+ function X() {
290
+ return Y() !== null;
302
291
  }
303
- async function Le(e) {
304
- const t = ae();
292
+ async function Pe(e) {
293
+ const t = Y();
305
294
  if (!t)
306
295
  throw new Error("No Stability AI API key configured");
307
- const { imageDataUrl: a, style: n, strength: r = 0.35 } = e, o = await Ne(a), d = ne(o), l = new FormData();
308
- l.append("init_image", d, "portrait.png"), l.append("init_image_mode", "IMAGE_STRENGTH"), l.append("image_strength", String(1 - r)), l.append("text_prompts[0][text]", Pe[n]), l.append("text_prompts[0][weight]", "1"), l.append("cfg_scale", "7"), l.append("samples", "1"), l.append("steps", "30");
309
- const c = await fetch(`${ke}/stable-diffusion-xl-1024-v1-0/image-to-image`, {
296
+ const { imageDataUrl: a, style: n, strength: r = 0.35 } = e, o = await Ie(a), d = ne(o), l = new FormData();
297
+ l.append("init_image", d, "portrait.png"), l.append("init_image_mode", "IMAGE_STRENGTH"), l.append("image_strength", String(1 - r)), l.append("text_prompts[0][text]", xe[n]), l.append("text_prompts[0][weight]", "1"), l.append("cfg_scale", "7"), l.append("samples", "1"), l.append("steps", "30");
298
+ const c = await fetch(`${ye}/stable-diffusion-xl-1024-v1-0/image-to-image`, {
310
299
  method: "POST",
311
300
  headers: {
312
301
  Authorization: `Bearer ${t}`,
@@ -315,30 +304,31 @@ async function Le(e) {
315
304
  body: l
316
305
  });
317
306
  if (!c.ok) {
318
- const g = await c.text();
319
- 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}`);
307
+ const f = await c.text();
308
+ throw console.error("Stability AI error:", f), 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}`);
320
309
  }
321
- const u = await c.json();
322
- if (!u.artifacts || u.artifacts.length === 0)
310
+ const m = await c.json();
311
+ if (!m.artifacts || m.artifacts.length === 0)
323
312
  throw new Error("No image generated");
324
- return `data:image/png;base64,${u.artifacts[0].base64}`;
313
+ return `data:image/png;base64,${m.artifacts[0].base64}`;
325
314
  }
326
- async function Te(e) {
327
- const t = re();
315
+ async function Ne(e) {
316
+ const t = Y();
328
317
  if (!t)
329
- throw new Error("No Clipdrop API key configured");
318
+ throw new Error("No Stability AI API key configured");
330
319
  const a = ne(e), n = new FormData();
331
- n.append("image_file", a, "image.png");
332
- const r = await fetch(Ie, {
320
+ n.append("image", a, "image.png"), n.append("output_format", "png");
321
+ const r = await fetch(ve, {
333
322
  method: "POST",
334
323
  headers: {
335
- "x-api-key": t
324
+ Authorization: `Bearer ${t}`,
325
+ Accept: "image/*"
336
326
  },
337
327
  body: n
338
328
  });
339
329
  if (!r.ok) {
340
330
  const d = await r.text();
341
- throw console.error("Clipdrop 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}`);
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}`);
342
332
  }
343
333
  const o = await r.blob();
344
334
  return new Promise((d, l) => {
@@ -346,7 +336,7 @@ async function Te(e) {
346
336
  s.onload = () => d(s.result), s.onerror = () => l(new Error("Failed to read result")), s.readAsDataURL(o);
347
337
  });
348
338
  }
349
- async function X(e) {
339
+ async function J(e) {
350
340
  return new Promise((t, a) => {
351
341
  const n = new Image();
352
342
  n.onload = () => {
@@ -359,42 +349,40 @@ async function X(e) {
359
349
  }, n.onerror = () => a(new Error("Failed to load image")), n.src = e;
360
350
  });
361
351
  }
362
- function De() {
363
- const [e, t] = C(!1), [a, n] = C(!1), [r, o] = C(null), [d, l] = C(Z()), [s, c] = C(Ae()), u = S(() => o(null), []), g = S((x) => {
364
- Ce(x), l(!0), o(null);
365
- }, []), b = S((x) => {
366
- Se(x), c(!0), o(null);
367
- }, []), w = S(
368
- async (x, k = "vintage") => {
352
+ function Se() {
353
+ const [e, t] = N(!1), [a, n] = N(!1), [r, o] = N(null), [d, l] = N(X()), s = S(() => o(null), []), c = S((b) => {
354
+ Ee(b), l(!0), o(null);
355
+ }, []), m = S(
356
+ async (b, u = "vintage") => {
369
357
  t(!0), o(null);
370
358
  try {
371
- return Z() ? await Le({
372
- imageDataUrl: x,
373
- style: k,
359
+ return X() ? await Pe({
360
+ imageDataUrl: b,
361
+ style: u,
374
362
  strength: 0.35
375
- }) : await X(x);
376
- } catch (v) {
377
- const E = v instanceof Error ? v.message : "Enhancement failed";
378
- if (o(E), E.includes("API") || E.includes("key"))
363
+ }) : await J(b);
364
+ } catch (h) {
365
+ const k = h instanceof Error ? h.message : "Enhancement failed";
366
+ if (o(k), k.includes("API") || k.includes("key"))
379
367
  try {
380
- return await X(x);
368
+ return await J(b);
381
369
  } catch {
382
- throw v;
370
+ throw h;
383
371
  }
384
- throw v;
372
+ throw h;
385
373
  } finally {
386
374
  t(!1);
387
375
  }
388
376
  },
389
377
  []
390
- ), h = S(
391
- async (x) => {
378
+ ), f = S(
379
+ async (b) => {
392
380
  n(!0), o(null);
393
381
  try {
394
- return await Te(x);
395
- } catch (k) {
396
- const v = k instanceof Error ? k.message : "Background removal failed";
397
- throw o(v), k;
382
+ return await Ne(b);
383
+ } catch (u) {
384
+ const h = u instanceof Error ? u.message : "Background removal failed";
385
+ throw o(h), u;
398
386
  } finally {
399
387
  n(!1);
400
388
  }
@@ -402,20 +390,18 @@ function De() {
402
390
  []
403
391
  );
404
392
  return {
405
- enhance: w,
406
- removeBg: h,
393
+ enhance: m,
394
+ removeBg: f,
407
395
  isEnhancing: e,
408
396
  isRemovingBg: a,
409
397
  error: r,
410
398
  hasKey: d,
411
- setApiKey: g,
412
- hasClipdropKey: s,
413
- setClipdropKey: b,
414
- clearError: u
399
+ setApiKey: c,
400
+ clearError: s
415
401
  };
416
402
  }
417
- function _e({ isOpen: e, onClose: t, onSubmit: a }) {
418
- const n = f((c) => c.voucherConfig.language), [r, o] = C("");
403
+ function Ce({ isOpen: e, onClose: t, onSubmit: a }) {
404
+ const n = w((c) => c.voucherConfig.language), [r, o] = N("");
419
405
  if (!e) return null;
420
406
  const d = (c) => {
421
407
  c.preventDefault(), r.trim() && (a(r.trim()), o(""), t());
@@ -437,12 +423,12 @@ function _e({ isOpen: e, onClose: t, onSubmit: a }) {
437
423
  hint: "The key is stored locally in your browser."
438
424
  }
439
425
  }[n];
440
- return /* @__PURE__ */ m("dialog", { className: "modal modal-open", children: [
441
- /* @__PURE__ */ m("div", { className: "modal-box", children: [
426
+ return /* @__PURE__ */ g("dialog", { className: "modal modal-open", children: [
427
+ /* @__PURE__ */ g("div", { className: "modal-box", children: [
442
428
  /* @__PURE__ */ i("h3", { className: "font-bold text-lg", children: s.title }),
443
429
  /* @__PURE__ */ i("p", { className: "py-4 text-sm opacity-80", children: s.description }),
444
- /* @__PURE__ */ m("form", { onSubmit: d, children: [
445
- /* @__PURE__ */ m("div", { className: "form-control", children: [
430
+ /* @__PURE__ */ g("form", { onSubmit: d, children: [
431
+ /* @__PURE__ */ g("div", { className: "form-control", children: [
446
432
  /* @__PURE__ */ i(
447
433
  "input",
448
434
  {
@@ -456,7 +442,7 @@ function _e({ isOpen: e, onClose: t, onSubmit: a }) {
456
442
  ),
457
443
  /* @__PURE__ */ i("label", { className: "label", children: /* @__PURE__ */ i("span", { className: "label-text-alt", children: s.hint }) })
458
444
  ] }),
459
- /* @__PURE__ */ m("div", { className: "modal-action", children: [
445
+ /* @__PURE__ */ g("div", { className: "modal-action", children: [
460
446
  /* @__PURE__ */ i("button", { type: "button", className: "btn btn-ghost", onClick: t, children: s.cancel }),
461
447
  /* @__PURE__ */ i("button", { type: "submit", className: "btn btn-primary", disabled: !r.trim(), children: s.submit })
462
448
  ] })
@@ -465,49 +451,49 @@ function _e({ isOpen: e, onClose: t, onSubmit: a }) {
465
451
  /* @__PURE__ */ i("form", { method: "dialog", className: "modal-backdrop", children: /* @__PURE__ */ i("button", { onClick: t, children: "close" }) })
466
452
  ] });
467
453
  }
468
- function Xe() {
469
- const e = f((p) => p.voucherConfig.language), t = f((p) => p.portrait), a = f((p) => p.setPortrait), n = f((p) => p.setEnhancedPortrait), r = f((p) => p.toggleUseEnhanced), o = f((p) => p.setPortraitZoom), { enhance: d, removeBg: l, isEnhancing: s, isRemovingBg: c, error: u, hasKey: g, setApiKey: b, hasClipdropKey: w } = De(), h = _(e), x = T(null), [k, v] = C(!1), [E, y] = C(!1), N = S(
454
+ function Ye() {
455
+ const e = w((p) => p.voucherConfig.language), t = w((p) => p.portrait), a = w((p) => p.setPortrait), n = w((p) => p.setEnhancedPortrait), r = w((p) => p.toggleUseEnhanced), o = w((p) => p.setPortraitZoom), { enhance: d, removeBg: l, isEnhancing: s, isRemovingBg: c, error: m, hasKey: f, setApiKey: b } = Se(), u = _(e), h = L(null), [k, I] = N(!1), [E, C] = N(!1), y = S(
470
456
  async (p) => {
471
457
  if (!p.type.startsWith("image/"))
472
458
  return;
473
- const I = new FileReader();
474
- I.onload = async ($) => {
475
- var Y;
476
- const F = (Y = $.target) == null ? void 0 : Y.result;
477
- if (w)
459
+ const v = new FileReader();
460
+ v.onload = async (R) => {
461
+ var q;
462
+ const F = (q = R.target) == null ? void 0 : q.result;
463
+ if (f)
478
464
  try {
479
- const O = await l(F);
480
- a(O);
481
- } catch (O) {
482
- console.error("Background removal failed, using original:", O), a(F);
465
+ const W = await l(F);
466
+ a(W);
467
+ } catch (W) {
468
+ console.error("Background removal failed, using original:", W), a(F);
483
469
  }
484
470
  else
485
471
  a(F);
486
- }, I.readAsDataURL(p);
472
+ }, v.readAsDataURL(p);
487
473
  },
488
- [a, w, l]
489
- ), R = S(
474
+ [a, f, l]
475
+ ), P = S(
490
476
  (p) => {
491
- p.preventDefault(), v(!1);
492
- const I = p.dataTransfer.files[0];
493
- I && N(I);
477
+ p.preventDefault(), I(!1);
478
+ const v = p.dataTransfer.files[0];
479
+ v && y(v);
494
480
  },
495
- [N]
496
- ), B = S((p) => {
497
- p.preventDefault(), v(!0);
498
- }, []), U = S((p) => {
499
- p.preventDefault(), v(!1);
481
+ [y]
482
+ ), D = S((p) => {
483
+ p.preventDefault(), I(!0);
484
+ }, []), B = S((p) => {
485
+ p.preventDefault(), I(!1);
500
486
  }, []), M = () => {
501
487
  var p;
502
- (p = x.current) == null || p.click();
503
- }, he = (p) => {
504
- var $;
505
- const I = ($ = p.target.files) == null ? void 0 : $[0];
506
- I && N(I);
507
- }, pe = async () => {
488
+ (p = h.current) == null || p.click();
489
+ }, U = (p) => {
490
+ var R;
491
+ const v = (R = p.target.files) == null ? void 0 : R[0];
492
+ v && y(v);
493
+ }, ce = async () => {
508
494
  if (t.original) {
509
- if (!g) {
510
- y(!0);
495
+ if (!f) {
496
+ C(!0);
511
497
  return;
512
498
  }
513
499
  try {
@@ -517,24 +503,24 @@ function Xe() {
517
503
  console.error("Enhancement failed:", p);
518
504
  }
519
505
  }
520
- }, ue = async (p) => {
506
+ }, de = async (p) => {
521
507
  if (b(p), t.original)
522
508
  try {
523
- const I = await d(t.original, "vintage");
524
- n(I);
525
- } catch (I) {
526
- console.error("Enhancement failed:", I);
509
+ const v = await d(t.original, "vintage");
510
+ n(v);
511
+ } catch (v) {
512
+ console.error("Enhancement failed:", v);
527
513
  }
528
- }, me = () => {
514
+ }, he = () => {
529
515
  a(null);
530
- }, ge = t.useEnhanced && t.enhanced ? t.enhanced : t.original;
531
- return /* @__PURE__ */ m("div", { className: "space-y-4", children: [
532
- t.original ? /* @__PURE__ */ m("div", { className: "space-y-4", children: [
533
- /* @__PURE__ */ i("div", { className: "flex justify-center", children: /* @__PURE__ */ m("div", { className: "relative", children: [
516
+ }, pe = t.useEnhanced && t.enhanced ? t.enhanced : t.original;
517
+ return /* @__PURE__ */ g("div", { className: "space-y-4", children: [
518
+ t.original ? /* @__PURE__ */ g("div", { className: "space-y-4", children: [
519
+ /* @__PURE__ */ i("div", { className: "flex justify-center", children: /* @__PURE__ */ g("div", { className: "relative", children: [
534
520
  /* @__PURE__ */ i("div", { className: "w-32 h-32 rounded-full overflow-hidden border-4 border-currency-gold shadow-lg", children: /* @__PURE__ */ i(
535
521
  "img",
536
522
  {
537
- src: ge || "",
523
+ src: pe || "",
538
524
  alt: "Portrait",
539
525
  className: "w-full h-full object-cover",
540
526
  style: { transform: `scale(${t.zoom})` }
@@ -544,7 +530,7 @@ function Xe() {
544
530
  "button",
545
531
  {
546
532
  className: "btn btn-circle btn-xs btn-error absolute -top-1 -right-1",
547
- onClick: me,
533
+ onClick: he,
548
534
  children: /* @__PURE__ */ i(
549
535
  "svg",
550
536
  {
@@ -567,10 +553,10 @@ function Xe() {
567
553
  }
568
554
  )
569
555
  ] }) }),
570
- /* @__PURE__ */ m("div", { className: "form-control", children: [
571
- /* @__PURE__ */ m("label", { className: "label", children: [
572
- /* @__PURE__ */ i("span", { className: "label-text", children: h.form.portrait.zoom }),
573
- /* @__PURE__ */ m("span", { className: "label-text-alt", children: [
556
+ /* @__PURE__ */ g("div", { className: "form-control", children: [
557
+ /* @__PURE__ */ g("label", { className: "label", children: [
558
+ /* @__PURE__ */ i("span", { className: "label-text", children: u.form.portrait.zoom }),
559
+ /* @__PURE__ */ g("span", { className: "label-text-alt", children: [
574
560
  Math.round(t.zoom * 100),
575
561
  "%"
576
562
  ] })
@@ -588,17 +574,17 @@ function Xe() {
588
574
  }
589
575
  )
590
576
  ] }),
591
- g && /* @__PURE__ */ m("div", { className: "flex flex-col gap-2", children: [
577
+ f && /* @__PURE__ */ g("div", { className: "flex flex-col gap-2", children: [
592
578
  /* @__PURE__ */ i(
593
579
  "button",
594
580
  {
595
581
  className: `btn btn-secondary ${s ? "loading" : ""}`,
596
- onClick: pe,
582
+ onClick: ce,
597
583
  disabled: s,
598
- children: s ? /* @__PURE__ */ m(K, { children: [
584
+ children: s ? /* @__PURE__ */ g($, { children: [
599
585
  /* @__PURE__ */ i("span", { className: "loading loading-spinner loading-sm" }),
600
- h.form.portrait.enhancing
601
- ] }) : /* @__PURE__ */ m(K, { children: [
586
+ u.form.portrait.enhancing
587
+ ] }) : /* @__PURE__ */ g($, { children: [
602
588
  /* @__PURE__ */ i(
603
589
  "svg",
604
590
  {
@@ -618,15 +604,15 @@ function Xe() {
618
604
  )
619
605
  }
620
606
  ),
621
- h.form.portrait.enhance
607
+ u.form.portrait.enhance
622
608
  ] })
623
609
  }
624
610
  ),
625
- u && /* @__PURE__ */ m("div", { className: "alert alert-warning text-sm py-2", children: [
611
+ m && /* @__PURE__ */ g("div", { className: "alert alert-warning text-sm py-2", children: [
626
612
  /* @__PURE__ */ i("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__ */ i("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" }) }),
627
- /* @__PURE__ */ i("span", { children: u })
613
+ /* @__PURE__ */ i("span", { children: m })
628
614
  ] }),
629
- t.enhanced && /* @__PURE__ */ i("div", { className: "form-control", children: /* @__PURE__ */ m("label", { className: "label cursor-pointer justify-start gap-3", children: [
615
+ t.enhanced && /* @__PURE__ */ i("div", { className: "form-control", children: /* @__PURE__ */ g("label", { className: "label cursor-pointer justify-start gap-3", children: [
630
616
  /* @__PURE__ */ i(
631
617
  "input",
632
618
  {
@@ -636,32 +622,32 @@ function Xe() {
636
622
  onChange: r
637
623
  }
638
624
  ),
639
- /* @__PURE__ */ i("span", { className: "label-text", children: t.useEnhanced ? h.form.portrait.useEnhanced : h.form.portrait.useOriginal })
625
+ /* @__PURE__ */ i("span", { className: "label-text", children: t.useEnhanced ? u.form.portrait.useEnhanced : u.form.portrait.useOriginal })
640
626
  ] }) })
641
627
  ] })
642
- ] }) : /* @__PURE__ */ m(
628
+ ] }) : /* @__PURE__ */ g(
643
629
  "div",
644
630
  {
645
631
  className: `border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${c ? "border-primary bg-primary/10 pointer-events-none" : k ? "border-primary bg-primary/10" : "border-base-300 hover:border-primary hover:bg-base-200"}`,
646
- onDrop: R,
647
- onDragOver: B,
648
- onDragLeave: U,
632
+ onDrop: P,
633
+ onDragOver: D,
634
+ onDragLeave: B,
649
635
  onClick: M,
650
636
  children: [
651
637
  /* @__PURE__ */ i(
652
638
  "input",
653
639
  {
654
- ref: x,
640
+ ref: h,
655
641
  type: "file",
656
642
  accept: "image/*",
657
643
  className: "hidden",
658
- onChange: he
644
+ onChange: U
659
645
  }
660
646
  ),
661
- c ? /* @__PURE__ */ m("div", { className: "flex flex-col items-center gap-2", children: [
647
+ c ? /* @__PURE__ */ g("div", { className: "flex flex-col items-center gap-2", children: [
662
648
  /* @__PURE__ */ i("span", { className: "loading loading-spinner loading-lg text-primary" }),
663
649
  /* @__PURE__ */ i("p", { className: "font-medium", children: e === "de" ? "Hintergrund wird entfernt..." : "Removing background..." })
664
- ] }) : /* @__PURE__ */ m("div", { className: "flex flex-col items-center gap-2", children: [
650
+ ] }) : /* @__PURE__ */ g("div", { className: "flex flex-col items-center gap-2", children: [
665
651
  /* @__PURE__ */ i(
666
652
  "svg",
667
653
  {
@@ -681,62 +667,62 @@ function Xe() {
681
667
  )
682
668
  }
683
669
  ),
684
- /* @__PURE__ */ i("p", { className: "font-medium", children: h.form.portrait.upload }),
685
- /* @__PURE__ */ i("p", { className: "text-sm text-base-content/60", children: h.form.portrait.dragDrop })
670
+ /* @__PURE__ */ i("p", { className: "font-medium", children: u.form.portrait.upload }),
671
+ /* @__PURE__ */ i("p", { className: "text-sm text-base-content/60", children: u.form.portrait.dragDrop })
686
672
  ] })
687
673
  ]
688
674
  }
689
675
  ),
690
676
  /* @__PURE__ */ i(
691
- _e,
677
+ Ce,
692
678
  {
693
679
  isOpen: E,
694
- onClose: () => y(!1),
695
- onSubmit: ue
680
+ onClose: () => C(!1),
681
+ onSubmit: de
696
682
  }
697
683
  )
698
684
  ] });
699
685
  }
700
- function Je() {
686
+ function qe() {
701
687
  return null;
702
688
  }
703
- const P = typeof import.meta < "u" && "/" || "/", Re = {
689
+ const x = typeof import.meta < "u" && "/" || "/", Ae = {
704
690
  en: {
705
691
  1: {
706
- front: `${P}templates/front_ldpi_en.png`,
707
- back: `${P}templates/back_ldpi_en.png`,
692
+ front: `${x}templates/front_ldpi_en.png`,
693
+ back: `${x}templates/back_ldpi_en.png`,
708
694
  width: 1536,
709
695
  height: 1024
710
696
  },
711
697
  5: {
712
- front: `${P}templates/front_ldpi_en.png`,
713
- back: `${P}templates/back_ldpi_en.png`,
698
+ front: `${x}templates/front_ldpi_en.png`,
699
+ back: `${x}templates/back_ldpi_en.png`,
714
700
  width: 1536,
715
701
  height: 1024
716
702
  },
717
703
  10: {
718
- front: `${P}templates/front_ldpi_en.png`,
719
- back: `${P}templates/back_ldpi_en.png`,
704
+ front: `${x}templates/front_ldpi_en.png`,
705
+ back: `${x}templates/back_ldpi_en.png`,
720
706
  width: 1536,
721
707
  height: 1024
722
708
  }
723
709
  },
724
710
  de: {
725
711
  1: {
726
- front: `${P}templates/front_hdpi_de.webp`,
727
- back: `${P}templates/back_hdpi_de.webp`,
712
+ front: `${x}templates/front_hdpi_de.webp`,
713
+ back: `${x}templates/back_hdpi_de.webp`,
728
714
  width: 6144,
729
715
  height: 3200
730
716
  },
731
717
  5: {
732
- front: `${P}templates/front_hdpi_de.webp`,
733
- back: `${P}templates/back_hdpi_de.webp`,
718
+ front: `${x}templates/front_hdpi_de.webp`,
719
+ back: `${x}templates/back_hdpi_de.webp`,
734
720
  width: 6144,
735
721
  height: 3200
736
722
  },
737
723
  10: {
738
- front: `${P}templates/front_hdpi_de.webp`,
739
- back: `${P}templates/back_hdpi_de.webp`,
724
+ front: `${x}templates/front_hdpi_de.webp`,
725
+ back: `${x}templates/back_hdpi_de.webp`,
740
726
  width: 6144,
741
727
  height: 3200
742
728
  }
@@ -787,7 +773,7 @@ const P = typeof import.meta < "u" && "/" || "/", Re = {
787
773
  align: "center"
788
774
  }
789
775
  }
790
- }, L = {
776
+ }, T = {
791
777
  front: {
792
778
  portrait: {
793
779
  x: 3074,
@@ -834,126 +820,126 @@ const P = typeof import.meta < "u" && "/" || "/", Re = {
834
820
  }
835
821
  }
836
822
  };
837
- function oe(e) {
838
- return e === "de" ? L : A;
823
+ function ae(e) {
824
+ return e === "de" ? T : A;
839
825
  }
840
- function ie(e, t) {
841
- return Re[e][t];
826
+ function re(e, t) {
827
+ return Ae[e][t];
842
828
  }
843
- const W = /* @__PURE__ */ new Map();
829
+ const O = /* @__PURE__ */ new Map();
844
830
  async function j(e) {
845
- return W.has(e) ? W.get(e) : new Promise((t, a) => {
831
+ return O.has(e) ? O.get(e) : new Promise((t, a) => {
846
832
  const n = new Image();
847
833
  n.crossOrigin = "anonymous", n.onload = () => {
848
- W.set(e, n), t(n);
834
+ O.set(e, n), t(n);
849
835
  }, n.onerror = a, n.src = e;
850
836
  });
851
837
  }
852
- function se(e, t, a, n) {
838
+ function oe(e, t, a, n) {
853
839
  e.drawImage(t, 0, 0, a, n);
854
840
  }
855
- function Be(e, t, a, n, r, o, d = 1) {
841
+ function Te(e, t, a, n, r, o, d = 1) {
856
842
  e.save(), e.beginPath(), e.ellipse(a, n, r, o, 0, 0, Math.PI * 2), e.closePath(), e.clip();
857
- const l = t.width / t.height, s = r / o, c = r * 2, u = o * 2;
858
- let g, b;
859
- l > s ? (b = u, g = u * l) : (g = c, b = c / l), g *= d, b *= d;
860
- const w = a - g / 2, h = n - b / 2;
861
- e.drawImage(t, w, h, g, b), e.restore();
843
+ const l = t.width / t.height, s = r / o, c = r * 2, m = o * 2;
844
+ let f, b;
845
+ l > s ? (b = m, f = m * l) : (f = c, b = c / l), f *= d, b *= d;
846
+ const u = a - f / 2, h = n - b / 2;
847
+ e.drawImage(t, u, h, f, b), e.restore();
862
848
  }
863
- function le(e, t, a, n = "#2a3a2a") {
849
+ function ie(e, t, a, n = "#2a3a2a") {
864
850
  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();
865
851
  }
866
- function $e(e, t, a, n = "#2a3a2a") {
852
+ function Le(e, t, a, n = "#2a3a2a") {
867
853
  e.save(), e.font = `${a.fontSize}px "Times New Roman", serif`, e.textAlign = a.align || "center", e.textBaseline = "top", e.fillStyle = n;
868
854
  const r = a.maxWidth || 400, o = a.lineHeight || a.fontSize * 1.4, d = t.split(" "), l = [];
869
855
  let s = "";
870
- for (const g of d) {
871
- const b = s ? `${s} ${g}` : g;
872
- e.measureText(b).width > r && s ? (l.push(s), s = g) : s = b;
856
+ for (const f of d) {
857
+ const b = s ? `${s} ${f}` : f;
858
+ e.measureText(b).width > r && s ? (l.push(s), s = f) : s = b;
873
859
  }
874
860
  s && l.push(s);
875
861
  const c = l.length * o;
876
- let u = a.y - c / 2;
877
- for (const g of l)
878
- e.fillText(g, a.x, u), u += o;
862
+ let m = a.y - c / 2;
863
+ for (const f of l)
864
+ e.fillText(f, a.x, m), m += o;
879
865
  e.restore();
880
866
  }
881
- function Ke(e, t, a, n, r, o = "#2a3a2a") {
867
+ function _e(e, t, a, n, r, o = "#2a3a2a") {
882
868
  e.save(), e.font = `${r.fontSize}px "Times New Roman", serif`, e.textAlign = r.align || "center", e.textBaseline = "middle", e.fillStyle = o;
883
869
  const d = r.lineHeight || r.fontSize * 1.8, l = [t, a, n].filter(Boolean), s = (l.length - 1) * d;
884
870
  let c = r.y - s / 2;
885
- for (const u of l)
886
- u && (e.fillText(u, r.x, c), c += d);
871
+ for (const m of l)
872
+ m && (e.fillText(m, r.x, c), c += d);
887
873
  e.restore();
888
874
  }
889
- async function ce(e, t, a, n, r, o, d, l = 1) {
875
+ async function se(e, t, a, n, r, o, d, l = 1) {
890
876
  const s = e.getContext("2d");
891
877
  if (!s) return;
892
878
  e.width = o, e.height = d, s.clearRect(0, 0, o, d);
893
879
  const c = await j(t);
894
- if (se(s, c, o, d), a)
880
+ if (oe(s, c, o, d), a)
895
881
  try {
896
- const u = await j(a);
897
- Be(
882
+ const m = await j(a);
883
+ Te(
898
884
  s,
899
- u,
885
+ m,
900
886
  r.portrait.x,
901
887
  r.portrait.y,
902
888
  r.portrait.radiusX,
903
889
  r.portrait.radiusY,
904
890
  l
905
891
  );
906
- } catch (u) {
907
- console.error("Failed to load portrait:", u);
892
+ } catch (m) {
893
+ console.error("Failed to load portrait:", m);
908
894
  }
909
- n && le(s, n, r.namePlate);
895
+ n && ie(s, n, r.namePlate);
910
896
  }
911
- async function de(e, t, a, n, r, o, d, l, s) {
897
+ async function le(e, t, a, n, r, o, d, l, s) {
912
898
  const c = e.getContext("2d");
913
899
  if (!c) return;
914
900
  e.width = l, e.height = s, c.clearRect(0, 0, l, s);
915
- const u = await j(t);
916
- se(c, u, l, s), d.contactInfo && (a || n || r) && Ke(c, a, n, r, d.contactInfo), d.description && o && $e(c, o, d.description), a && le(c, a, d.namePlate);
901
+ const m = await j(t);
902
+ oe(c, m, l, s), d.contactInfo && (a || n || r) && _e(c, a, n, r, d.contactInfo), d.description && o && Le(c, o, d.description), a && ie(c, a, d.namePlate);
917
903
  }
918
- function Qe() {
919
- const e = f((y) => y.voucherConfig.language), t = f((y) => y.voucherConfig.hours), a = f((y) => y.voucherConfig.description), n = f((y) => y.personalInfo), r = f((y) => y.portrait), o = f((y) => y.currentSide), d = f((y) => y.flipSide), l = _(e), s = T(null), c = T(null), u = T(null), [g, b] = C(!1), w = ie(e, t), h = oe(e), x = r.useEnhanced && r.enhanced ? r.enhanced : r.original, k = Q(e, t, a);
920
- q(() => {
921
- s.current && ce(
904
+ function Ve() {
905
+ const e = w((y) => y.voucherConfig.language), t = w((y) => y.voucherConfig.hours), a = w((y) => y.voucherConfig.description), n = w((y) => y.personalInfo), r = w((y) => y.portrait), o = w((y) => y.currentSide), d = w((y) => y.flipSide), l = _(e), s = L(null), c = L(null), m = L(null), [f, b] = N(!1), u = re(e, t), h = ae(e), k = r.useEnhanced && r.enhanced ? r.enhanced : r.original, I = ee(e, t, a);
906
+ V(() => {
907
+ s.current && se(
922
908
  s.current,
923
- w.front,
924
- x,
909
+ u.front,
910
+ k,
925
911
  n.name,
926
912
  h.front,
927
- w.width,
928
- w.height,
913
+ u.width,
914
+ u.height,
929
915
  r.zoom
930
916
  );
931
- }, [w, x, n.name, h, r.zoom]), q(() => {
932
- c.current && de(
917
+ }, [u, k, n.name, h, r.zoom]), V(() => {
918
+ c.current && le(
933
919
  c.current,
934
- w.back,
920
+ u.back,
935
921
  n.name,
936
922
  n.email,
937
923
  n.phone,
938
- k,
924
+ I,
939
925
  h.back,
940
- w.width,
941
- w.height
926
+ u.width,
927
+ u.height
942
928
  );
943
- }, [w, n, k, h]);
944
- const v = () => {
929
+ }, [u, n, I, h]);
930
+ const E = () => {
945
931
  b(!0), setTimeout(() => {
946
932
  d(), b(!1);
947
933
  }, 150);
948
- }, E = w.width / w.height;
949
- return /* @__PURE__ */ m("div", { className: "space-y-4", children: [
950
- /* @__PURE__ */ m("div", { className: "flex justify-between items-center", children: [
951
- /* @__PURE__ */ m("div", { className: "tabs tabs-boxed bg-base-200", children: [
934
+ }, C = u.width / u.height;
935
+ return /* @__PURE__ */ g("div", { className: "space-y-4", children: [
936
+ /* @__PURE__ */ g("div", { className: "flex justify-between items-center", children: [
937
+ /* @__PURE__ */ g("div", { className: "tabs tabs-boxed bg-base-200", children: [
952
938
  /* @__PURE__ */ i(
953
939
  "button",
954
940
  {
955
941
  className: `tab ${o === "front" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
956
- onClick: () => o !== "front" && v(),
942
+ onClick: () => o !== "front" && E(),
957
943
  children: l.preview.front
958
944
  }
959
945
  ),
@@ -961,12 +947,12 @@ function Qe() {
961
947
  "button",
962
948
  {
963
949
  className: `tab ${o === "back" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
964
- onClick: () => o !== "back" && v(),
950
+ onClick: () => o !== "back" && E(),
965
951
  children: l.preview.back
966
952
  }
967
953
  )
968
954
  ] }),
969
- /* @__PURE__ */ m("button", { className: "btn btn-ghost btn-sm", onClick: v, children: [
955
+ /* @__PURE__ */ g("button", { className: "btn btn-ghost btn-sm", onClick: E, children: [
970
956
  /* @__PURE__ */ i(
971
957
  "svg",
972
958
  {
@@ -989,25 +975,25 @@ function Qe() {
989
975
  l.preview.flip
990
976
  ] })
991
977
  ] }),
992
- /* @__PURE__ */ m(
978
+ /* @__PURE__ */ g(
993
979
  "div",
994
980
  {
995
- ref: u,
981
+ ref: m,
996
982
  className: "relative w-full overflow-hidden shadow-lg",
997
- style: { aspectRatio: E },
983
+ style: { aspectRatio: C },
998
984
  children: [
999
985
  /* @__PURE__ */ i(
1000
986
  "canvas",
1001
987
  {
1002
988
  ref: s,
1003
- 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"}`
989
+ className: `absolute inset-0 w-full h-full transition-all duration-300 ${o === "front" ? f ? "opacity-0 scale-95" : "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"}`
1004
990
  }
1005
991
  ),
1006
992
  /* @__PURE__ */ i(
1007
993
  "canvas",
1008
994
  {
1009
995
  ref: c,
1010
- 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"}`
996
+ className: `absolute inset-0 w-full h-full transition-all duration-300 ${o === "back" ? f ? "opacity-0 scale-95" : "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"}`
1011
997
  }
1012
998
  )
1013
999
  ]
@@ -1015,11 +1001,11 @@ function Qe() {
1015
1001
  )
1016
1002
  ] });
1017
1003
  }
1018
- function et() {
1019
- const e = T(null), t = T(null);
1004
+ function Ge() {
1005
+ const e = L(null), t = L(null);
1020
1006
  return { frontCanvasRef: e, backCanvasRef: t };
1021
1007
  }
1022
- async function ze(e) {
1008
+ async function De(e) {
1023
1009
  const {
1024
1010
  frontTemplateSrc: t,
1025
1011
  backTemplateSrc: a,
@@ -1030,35 +1016,35 @@ async function ze(e) {
1030
1016
  portraitZoom: l = 1,
1031
1017
  name: s,
1032
1018
  email: c,
1033
- phone: u,
1034
- description: g
1035
- } = e, b = document.createElement("canvas"), w = document.createElement("canvas");
1019
+ phone: m,
1020
+ description: f
1021
+ } = e, b = document.createElement("canvas"), u = document.createElement("canvas");
1036
1022
  await Promise.all([
1037
- ce(b, t, d, s, o.front, n, r, l),
1038
- de(w, a, s, c, u, g, o.back, n, r)
1023
+ se(b, t, d, s, o.front, n, r, l),
1024
+ le(u, a, s, c, m, f, o.back, n, r)
1039
1025
  ]);
1040
- const h = new ye({
1026
+ const h = new ge({
1041
1027
  orientation: "landscape",
1042
1028
  unit: "mm",
1043
1029
  format: "a4"
1044
- }), x = 297, k = 210, v = 10, E = n / r;
1045
- let y = x - v * 2, N = y / E;
1046
- N > k - v * 2 && (N = k - v * 2, y = N * E);
1047
- const R = (x - y) / 2, B = (k - N) / 2, U = b.toDataURL("image/jpeg", 0.95);
1048
- h.addImage(U, "JPEG", R, B, y, N), h.addPage();
1049
- const M = w.toDataURL("image/jpeg", 0.95);
1050
- return h.addImage(M, "JPEG", R, B, y, N), h.output("blob");
1030
+ }), k = 297, I = 210, E = 10, C = n / r;
1031
+ let y = k - E * 2, P = y / C;
1032
+ P > I - E * 2 && (P = I - E * 2, y = P * C);
1033
+ const D = (k - y) / 2, B = (I - P) / 2, M = b.toDataURL("image/jpeg", 0.95);
1034
+ h.addImage(M, "JPEG", D, B, y, P), h.addPage();
1035
+ const U = u.toDataURL("image/jpeg", 0.95);
1036
+ return h.addImage(U, "JPEG", D, B, y, P), h.output("blob");
1051
1037
  }
1052
- function He(e, t) {
1038
+ function Be(e, t) {
1053
1039
  const a = URL.createObjectURL(e), n = document.createElement("a");
1054
1040
  n.href = a, n.download = t, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(a);
1055
1041
  }
1056
- async function Ue(e) {
1057
- const t = await ze(e);
1058
- He(t, e.filename);
1042
+ async function Re(e) {
1043
+ const t = await De(e);
1044
+ Be(t, e.filename);
1059
1045
  }
1060
- function tt() {
1061
- const e = f((h) => h.voucherConfig.language), t = f((h) => h.voucherConfig.hours), a = f((h) => h.voucherConfig.description), n = f((h) => h.personalInfo), r = f((h) => h.portrait), o = f((h) => h.isExporting), d = f((h) => h.setIsExporting), l = _(e), s = ie(e, t), c = oe(e), u = r.useEnhanced && r.enhanced ? r.enhanced : r.original, g = Q(e, t, a), b = n.name.trim().length > 0 && n.email.trim().length > 0 && n.phone.trim().length > 0 && r.original !== null;
1046
+ function Ze() {
1047
+ const e = w((h) => h.voucherConfig.language), t = w((h) => h.voucherConfig.hours), a = w((h) => h.voucherConfig.description), n = w((h) => h.personalInfo), r = w((h) => h.portrait), o = w((h) => h.isExporting), d = w((h) => h.setIsExporting), l = _(e), s = re(e, t), c = ae(e), m = r.useEnhanced && r.enhanced ? r.enhanced : r.original, f = ee(e, t, a), b = n.name.trim().length > 0 && n.email.trim().length > 0 && n.phone.trim().length > 0 && r.original !== null;
1062
1048
  return /* @__PURE__ */ i(
1063
1049
  "button",
1064
1050
  {
@@ -1068,18 +1054,18 @@ function tt() {
1068
1054
  d(!0);
1069
1055
  try {
1070
1056
  const h = `zeitgutschein-${t}h-${n.name.replace(/\s+/g, "-").toLowerCase()}.pdf`;
1071
- await Ue({
1057
+ await Re({
1072
1058
  frontTemplateSrc: s.front,
1073
1059
  backTemplateSrc: s.back,
1074
1060
  templateWidth: s.width,
1075
1061
  templateHeight: s.height,
1076
1062
  layout: c,
1077
- portrait: u,
1063
+ portrait: m,
1078
1064
  portraitZoom: r.zoom,
1079
1065
  name: n.name,
1080
1066
  email: n.email,
1081
1067
  phone: n.phone,
1082
- description: g,
1068
+ description: f,
1083
1069
  filename: h
1084
1070
  });
1085
1071
  } catch (h) {
@@ -1090,10 +1076,10 @@ function tt() {
1090
1076
  }
1091
1077
  },
1092
1078
  disabled: !b || o,
1093
- children: o ? /* @__PURE__ */ m(K, { children: [
1079
+ children: o ? /* @__PURE__ */ g($, { children: [
1094
1080
  /* @__PURE__ */ i("span", { className: "loading loading-spinner loading-sm" }),
1095
1081
  l.export.exporting
1096
- ] }) : /* @__PURE__ */ m(K, { children: [
1082
+ ] }) : /* @__PURE__ */ g($, { children: [
1097
1083
  /* @__PURE__ */ i(
1098
1084
  "svg",
1099
1085
  {
@@ -1118,11 +1104,11 @@ function tt() {
1118
1104
  }
1119
1105
  );
1120
1106
  }
1121
- function Me() {
1122
- const e = f((n) => n.voucherConfig.language), t = f((n) => n.setLanguage), a = (n) => {
1107
+ function $e() {
1108
+ const e = w((n) => n.voucherConfig.language), t = w((n) => n.setLanguage), a = (n) => {
1123
1109
  t(n);
1124
1110
  };
1125
- return /* @__PURE__ */ m("div", { className: "join", children: [
1111
+ return /* @__PURE__ */ g("div", { className: "join", children: [
1126
1112
  /* @__PURE__ */ i(
1127
1113
  "button",
1128
1114
  {
@@ -1141,15 +1127,15 @@ function Me() {
1141
1127
  )
1142
1128
  ] });
1143
1129
  }
1144
- function nt() {
1145
- const e = f((a) => a.voucherConfig.language), t = _(e);
1146
- return /* @__PURE__ */ m("div", { className: "navbar bg-currency-green text-currency-cream shadow-lg", children: [
1130
+ function Xe() {
1131
+ const e = w((a) => a.voucherConfig.language), t = _(e);
1132
+ return /* @__PURE__ */ g("div", { className: "navbar bg-currency-green text-currency-cream shadow-lg", children: [
1147
1133
  /* @__PURE__ */ i("div", { className: "navbar-start", children: /* @__PURE__ */ i("a", { className: "btn btn-ghost text-xl font-currency font-bold", children: t.header.title }) }),
1148
1134
  /* @__PURE__ */ i("div", { className: "navbar-center hidden sm:flex", children: /* @__PURE__ */ i("span", { className: "text-sm opacity-80", children: t.header.subtitle }) }),
1149
- /* @__PURE__ */ i("div", { className: "navbar-end", children: /* @__PURE__ */ i(Me, {}) })
1135
+ /* @__PURE__ */ i("div", { className: "navbar-end", children: /* @__PURE__ */ i($e, {}) })
1150
1136
  ] });
1151
1137
  }
1152
- const z = "/", Fe = {
1138
+ const z = "/", ze = {
1153
1139
  id: "time-voucher-classic-de",
1154
1140
  name: "Zeitgutschein Classic",
1155
1141
  type: "time-voucher",
@@ -1203,17 +1189,17 @@ const z = "/", Fe = {
1203
1189
  ],
1204
1190
  layout: {
1205
1191
  front: {
1206
- portrait: L.front.portrait,
1207
- name: L.front.namePlate
1192
+ portrait: T.front.portrait,
1193
+ name: T.front.namePlate
1208
1194
  },
1209
1195
  back: {
1210
- name: L.back.namePlate,
1211
- contactInfo: L.back.contactInfo,
1212
- description: L.back.description
1196
+ name: T.back.namePlate,
1197
+ contactInfo: T.back.contactInfo,
1198
+ description: T.back.description
1213
1199
  }
1214
1200
  },
1215
1201
  languages: ["de"]
1216
- }, Oe = {
1202
+ }, He = {
1217
1203
  id: "time-voucher-classic-en",
1218
1204
  name: "Time Voucher Classic",
1219
1205
  type: "time-voucher",
@@ -1277,79 +1263,76 @@ const z = "/", Fe = {
1277
1263
  }
1278
1264
  },
1279
1265
  languages: ["en"]
1280
- }, J = [
1281
- Fe,
1282
- Oe
1283
- ], We = {
1266
+ }, Q = [
1267
+ ze,
1268
+ He
1269
+ ], Me = {
1284
1270
  async listTemplates(e) {
1285
- let t = [...J];
1271
+ let t = [...Q];
1286
1272
  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;
1287
1273
  },
1288
1274
  async getTemplate(e) {
1289
- const t = J.find((a) => a.id === e);
1275
+ const t = Q.find((a) => a.id === e);
1290
1276
  if (!t)
1291
1277
  throw new Error(`Template not found: ${e}`);
1292
1278
  return t;
1293
1279
  }
1294
1280
  };
1295
- function at(e) {
1281
+ function Je(e) {
1296
1282
  return e === "de" ? "time-voucher-classic-de" : "time-voucher-classic-en";
1297
1283
  }
1298
- let H = We;
1299
- function rt(e) {
1284
+ let H = Me;
1285
+ function Qe(e) {
1300
1286
  H = e;
1301
1287
  }
1302
- function ot() {
1288
+ function et() {
1303
1289
  return H;
1304
1290
  }
1305
- async function it(e) {
1291
+ async function tt(e) {
1306
1292
  return H.listTemplates(e);
1307
1293
  }
1308
- async function st(e) {
1294
+ async function nt(e) {
1309
1295
  return H.getTemplate(e);
1310
1296
  }
1311
1297
  export {
1312
- _e as ApiKeyModal,
1313
- Qe as BillPreview,
1314
- tt as ExportButton,
1315
- nt as Header,
1316
- L as LAYOUT_HDPI,
1298
+ Ce as ApiKeyModal,
1299
+ Ve as BillPreview,
1300
+ Ze as ExportButton,
1301
+ Xe as Header,
1302
+ T as LAYOUT_HDPI,
1317
1303
  A as LAYOUT_LDPI,
1318
- Me as LanguageToggle,
1319
- Ze as PersonalInfoForm,
1320
- Xe as PortraitUpload,
1321
- Re as TEMPLATES,
1322
- Je as VoucherConfig,
1323
- He as downloadBlob,
1324
- Ke as drawContactInfo,
1325
- $e as drawMultilineText,
1326
- Be as drawOvalPortrait,
1327
- se as drawTemplate,
1328
- le as drawText,
1329
- Le as enhancePortrait,
1330
- X as enhancePortraitFallback,
1331
- Ue as exportBillAsPDF,
1332
- Q as formatDescription,
1333
- ze as generateBillPDF,
1334
- ae as getApiKey,
1335
- re as getClipdropApiKey,
1336
- at as getDefaultTemplateId,
1337
- oe as getLayout,
1338
- ie as getTemplate,
1339
- st as getTemplateById,
1340
- ot as getTemplateProvider,
1341
- Z as hasApiKey,
1342
- Ae as hasClipdropApiKey,
1343
- it as listTemplates,
1304
+ $e as LanguageToggle,
1305
+ je as PersonalInfoForm,
1306
+ Ye as PortraitUpload,
1307
+ Ae as TEMPLATES,
1308
+ qe as VoucherConfig,
1309
+ Be as downloadBlob,
1310
+ _e as drawContactInfo,
1311
+ Le as drawMultilineText,
1312
+ Te as drawOvalPortrait,
1313
+ oe as drawTemplate,
1314
+ ie as drawText,
1315
+ Pe as enhancePortrait,
1316
+ J as enhancePortraitFallback,
1317
+ Re as exportBillAsPDF,
1318
+ ee as formatDescription,
1319
+ De as generateBillPDF,
1320
+ Y as getApiKey,
1321
+ Je as getDefaultTemplateId,
1322
+ ae as getLayout,
1323
+ re as getTemplate,
1324
+ nt as getTemplateById,
1325
+ et as getTemplateProvider,
1326
+ X as hasApiKey,
1327
+ tt as listTemplates,
1344
1328
  j as loadImage,
1345
- Te as removeBackground,
1346
- de as renderBackSide,
1347
- ce as renderFrontSide,
1348
- Ce as setApiKey,
1349
- Se as setClipdropApiKey,
1350
- rt as setTemplateProvider,
1351
- We as staticTemplateProvider,
1329
+ Ne as removeBackground,
1330
+ le as renderBackSide,
1331
+ se as renderFrontSide,
1332
+ Ee as setApiKey,
1333
+ Qe as setTemplateProvider,
1334
+ Me as staticTemplateProvider,
1352
1335
  _ as t,
1353
- et as useBillCanvasRefs,
1354
- f as useBillStore
1336
+ Ge as useBillCanvasRefs,
1337
+ w as useBillStore
1355
1338
  };