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