@hintergrund/ui 0.1.6 → 0.1.8

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.
@@ -0,0 +1,285 @@
1
+ import { i as _, r as x, m as v, G as O, c as w, a as R, b as M, T as h, R as G } from "./google-shared-Vko-wWPR.js";
2
+ import { E as S, z as N, D as A } from "./Builder-CHLO8Qn6.js";
3
+ import { b as P, s as U } from "./transform-messages-CkpQp6fJ.js";
4
+ typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
5
+ return Promise.resolve().then(e);
6
+ } });
7
+ const L = "v1", D = "gcp-vertex-credentials", V = {
8
+ THINKING_LEVEL_UNSPECIFIED: h.THINKING_LEVEL_UNSPECIFIED,
9
+ MINIMAL: h.MINIMAL,
10
+ LOW: h.LOW,
11
+ MEDIUM: h.MEDIUM,
12
+ HIGH: h.HIGH
13
+ };
14
+ let H = 0;
15
+ const k = (e, t, n) => {
16
+ const a = new N();
17
+ return (async () => {
18
+ const i = {
19
+ role: "assistant",
20
+ content: [],
21
+ api: "google-vertex",
22
+ provider: e.provider,
23
+ model: e.id,
24
+ usage: {
25
+ input: 0,
26
+ output: 0,
27
+ cacheRead: 0,
28
+ cacheWrite: 0,
29
+ totalTokens: 0,
30
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
31
+ },
32
+ stopReason: "stop",
33
+ timestamp: Date.now()
34
+ };
35
+ try {
36
+ const s = J(n), c = s ? W(e, s, n?.headers) : K(e, q(n), F(n), n?.headers);
37
+ let d = z(e, t, n);
38
+ const C = await n?.onPayload?.(d, e);
39
+ C !== void 0 && (d = C);
40
+ const E = await c.models.generateContentStream(d);
41
+ a.push({ type: "start", partial: i });
42
+ let o = null;
43
+ const I = i.content, u = () => I.length - 1;
44
+ for await (const l of E) {
45
+ i.responseId ||= l.responseId;
46
+ const p = l.candidates?.[0];
47
+ if (p?.content?.parts)
48
+ for (const r of p.content.parts) {
49
+ if (r.text !== void 0) {
50
+ const g = _(r);
51
+ (!o || g && o.type !== "thinking" || !g && o.type !== "text") && (o && (o.type === "text" ? a.push({
52
+ type: "text_end",
53
+ contentIndex: I.length - 1,
54
+ content: o.text,
55
+ partial: i
56
+ }) : a.push({
57
+ type: "thinking_end",
58
+ contentIndex: u(),
59
+ content: o.thinking,
60
+ partial: i
61
+ })), g ? (o = { type: "thinking", thinking: "", thinkingSignature: void 0 }, i.content.push(o), a.push({ type: "thinking_start", contentIndex: u(), partial: i })) : (o = { type: "text", text: "" }, i.content.push(o), a.push({ type: "text_start", contentIndex: u(), partial: i }))), o.type === "thinking" ? (o.thinking += r.text, o.thinkingSignature = x(o.thinkingSignature, r.thoughtSignature), a.push({
62
+ type: "thinking_delta",
63
+ contentIndex: u(),
64
+ delta: r.text,
65
+ partial: i
66
+ })) : (o.text += r.text, o.textSignature = x(o.textSignature, r.thoughtSignature), a.push({
67
+ type: "text_delta",
68
+ contentIndex: u(),
69
+ delta: r.text,
70
+ partial: i
71
+ }));
72
+ }
73
+ if (r.functionCall) {
74
+ o && (o.type === "text" ? a.push({
75
+ type: "text_end",
76
+ contentIndex: u(),
77
+ content: o.text,
78
+ partial: i
79
+ }) : a.push({
80
+ type: "thinking_end",
81
+ contentIndex: u(),
82
+ content: o.thinking,
83
+ partial: i
84
+ }), o = null);
85
+ const g = r.functionCall.id, f = {
86
+ type: "toolCall",
87
+ id: !g || i.content.some((y) => y.type === "toolCall" && y.id === g) ? `${r.functionCall.name}_${Date.now()}_${++H}` : g,
88
+ name: r.functionCall.name || "",
89
+ arguments: r.functionCall.args ?? {},
90
+ ...r.thoughtSignature && { thoughtSignature: r.thoughtSignature }
91
+ };
92
+ i.content.push(f), a.push({ type: "toolcall_start", contentIndex: u(), partial: i }), a.push({
93
+ type: "toolcall_delta",
94
+ contentIndex: u(),
95
+ delta: JSON.stringify(f.arguments),
96
+ partial: i
97
+ }), a.push({ type: "toolcall_end", contentIndex: u(), toolCall: f, partial: i });
98
+ }
99
+ }
100
+ p?.finishReason && (i.stopReason = v(p.finishReason), i.content.some((r) => r.type === "toolCall") && (i.stopReason = "toolUse")), l.usageMetadata && (i.usage = {
101
+ input: (l.usageMetadata.promptTokenCount || 0) - (l.usageMetadata.cachedContentTokenCount || 0),
102
+ output: (l.usageMetadata.candidatesTokenCount || 0) + (l.usageMetadata.thoughtsTokenCount || 0),
103
+ cacheRead: l.usageMetadata.cachedContentTokenCount || 0,
104
+ cacheWrite: 0,
105
+ totalTokens: l.usageMetadata.totalTokenCount || 0,
106
+ cost: {
107
+ input: 0,
108
+ output: 0,
109
+ cacheRead: 0,
110
+ cacheWrite: 0,
111
+ total: 0
112
+ }
113
+ }, A(e, i.usage));
114
+ }
115
+ if (o && (o.type === "text" ? a.push({
116
+ type: "text_end",
117
+ contentIndex: u(),
118
+ content: o.text,
119
+ partial: i
120
+ }) : a.push({
121
+ type: "thinking_end",
122
+ contentIndex: u(),
123
+ content: o.thinking,
124
+ partial: i
125
+ })), n?.signal?.aborted)
126
+ throw new Error("Request was aborted");
127
+ if (i.stopReason === "aborted" || i.stopReason === "error")
128
+ throw new Error("An unknown error occurred");
129
+ a.push({ type: "done", reason: i.stopReason, message: i }), a.end();
130
+ } catch (s) {
131
+ for (const c of i.content)
132
+ "index" in c && delete c.index;
133
+ i.stopReason = n?.signal?.aborted ? "aborted" : "error", i.errorMessage = s instanceof Error ? s.message : JSON.stringify(s), a.push({ type: "error", reason: i.stopReason, error: i }), a.end();
134
+ }
135
+ })(), a;
136
+ }, ae = (e, t, n) => {
137
+ const a = P(e, n, void 0);
138
+ if (!n?.reasoning)
139
+ return k(e, t, {
140
+ ...a,
141
+ thinking: { enabled: !1 }
142
+ });
143
+ const i = S(e, n.reasoning), s = i === "off" ? "high" : i, c = e;
144
+ return m(c) || T(c) ? k(e, t, {
145
+ ...a,
146
+ thinking: {
147
+ enabled: !0,
148
+ level: Y(s, c)
149
+ }
150
+ }) : k(e, t, {
151
+ ...a,
152
+ thinking: {
153
+ enabled: !0,
154
+ budgetTokens: Q(c, s, n.thinkingBudgets)
155
+ }
156
+ });
157
+ };
158
+ function K(e, t, n, a) {
159
+ return new O({
160
+ vertexai: !0,
161
+ project: t,
162
+ location: n,
163
+ apiVersion: L,
164
+ httpOptions: b(e, a)
165
+ });
166
+ }
167
+ function W(e, t, n) {
168
+ return new O({
169
+ vertexai: !0,
170
+ apiKey: t,
171
+ apiVersion: L,
172
+ httpOptions: b(e, n)
173
+ });
174
+ }
175
+ function b(e, t) {
176
+ const n = {}, a = j(e.baseUrl);
177
+ return a && (n.baseUrl = a, n.baseUrlResourceScope = G.COLLECTION, B(a) && (n.apiVersion = "")), (e.headers || t) && (n.headers = { ...e.headers, ...t }), Object.keys(n).length > 0 ? n : void 0;
178
+ }
179
+ function j(e) {
180
+ const t = e.trim();
181
+ if (!(!t || t.includes("{location}")))
182
+ return t;
183
+ }
184
+ function B(e) {
185
+ try {
186
+ return new URL(e).pathname.split("/").some((n) => /^v\d+(?:beta\d*)?$/.test(n));
187
+ } catch {
188
+ return /(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e);
189
+ }
190
+ }
191
+ function J(e) {
192
+ const t = e?.apiKey?.trim() || process.env.GOOGLE_CLOUD_API_KEY?.trim();
193
+ if (!(!t || t === D || $(t)))
194
+ return t;
195
+ }
196
+ function $(e) {
197
+ return /^<[^>]+>$/.test(e);
198
+ }
199
+ function q(e) {
200
+ const t = e?.project || process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT;
201
+ if (!t)
202
+ throw new Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");
203
+ return t;
204
+ }
205
+ function F(e) {
206
+ const t = e?.location || process.env.GOOGLE_CLOUD_LOCATION;
207
+ if (!t)
208
+ throw new Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");
209
+ return t;
210
+ }
211
+ function z(e, t, n = {}) {
212
+ const a = w(e, t), i = {};
213
+ n.temperature !== void 0 && (i.temperature = n.temperature), n.maxTokens !== void 0 && (i.maxOutputTokens = n.maxTokens);
214
+ const s = {
215
+ ...Object.keys(i).length > 0 && i,
216
+ ...t.systemPrompt && { systemInstruction: U(t.systemPrompt) },
217
+ ...t.tools && t.tools.length > 0 && { tools: R(t.tools) }
218
+ };
219
+ if (t.tools && t.tools.length > 0 && n.toolChoice ? s.toolConfig = {
220
+ functionCallingConfig: {
221
+ mode: M(n.toolChoice)
222
+ }
223
+ } : s.toolConfig = void 0, n.thinking?.enabled && e.reasoning) {
224
+ const d = { includeThoughts: !0 };
225
+ n.thinking.level !== void 0 ? d.thinkingLevel = V[n.thinking.level] : n.thinking.budgetTokens !== void 0 && (d.thinkingBudget = n.thinking.budgetTokens), s.thinkingConfig = d;
226
+ } else e.reasoning && n.thinking && !n.thinking.enabled && (s.thinkingConfig = X(e));
227
+ if (n.signal) {
228
+ if (n.signal.aborted)
229
+ throw new Error("Request aborted");
230
+ s.abortSignal = n.signal;
231
+ }
232
+ return {
233
+ model: e.id,
234
+ contents: a,
235
+ config: s
236
+ };
237
+ }
238
+ function m(e) {
239
+ return /gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase());
240
+ }
241
+ function T(e) {
242
+ return /gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase());
243
+ }
244
+ function X(e) {
245
+ const t = e;
246
+ return m(t) ? { thinkingLevel: h.LOW } : T(t) ? { thinkingLevel: h.MINIMAL } : { thinkingBudget: 0 };
247
+ }
248
+ function Y(e, t) {
249
+ if (m(t))
250
+ switch (e) {
251
+ case "minimal":
252
+ case "low":
253
+ return "LOW";
254
+ case "medium":
255
+ case "high":
256
+ return "HIGH";
257
+ }
258
+ switch (e) {
259
+ case "minimal":
260
+ return "MINIMAL";
261
+ case "low":
262
+ return "LOW";
263
+ case "medium":
264
+ return "MEDIUM";
265
+ case "high":
266
+ return "HIGH";
267
+ }
268
+ }
269
+ function Q(e, t, n) {
270
+ return n?.[t] !== void 0 ? n[t] : e.id.includes("2.5-pro") ? {
271
+ minimal: 128,
272
+ low: 2048,
273
+ medium: 8192,
274
+ high: 32768
275
+ }[t] : e.id.includes("2.5-flash") ? {
276
+ minimal: 128,
277
+ low: 2048,
278
+ medium: 8192,
279
+ high: 24576
280
+ }[t] : -1;
281
+ }
282
+ export {
283
+ k as streamGoogleVertex,
284
+ ae as streamSimpleGoogleVertex
285
+ };
@@ -0,0 +1,14 @@
1
+ typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(o) {
2
+ return Promise.resolve().then(o);
3
+ } });
4
+ function n(o) {
5
+ let e = 3735928559, t = 1103547991;
6
+ for (let r = 0; r < o.length; r++) {
7
+ const i = o.charCodeAt(r);
8
+ e = Math.imul(e ^ i, 2654435761), t = Math.imul(t ^ i, 1597334677);
9
+ }
10
+ return e = Math.imul(e ^ e >>> 16, 2246822507) ^ Math.imul(t ^ t >>> 13, 3266489909), t = Math.imul(t ^ t >>> 16, 2246822507) ^ Math.imul(e ^ e >>> 13, 3266489909), (t >>> 0).toString(36) + (e >>> 0).toString(36);
11
+ }
12
+ export {
13
+ n as s
14
+ };
@@ -0,0 +1,12 @@
1
+ typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
2
+ return Promise.resolve().then(e);
3
+ } });
4
+ function n(e) {
5
+ const r = {};
6
+ for (const [o, s] of e.entries())
7
+ r[o] = s;
8
+ return r;
9
+ }
10
+ export {
11
+ n as h
12
+ };
@@ -0,0 +1,93 @@
1
+ import { G as s } from "./Builder-CHLO8Qn6.js";
2
+ typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
3
+ return Promise.resolve().then(e);
4
+ } });
5
+ const a = /* @__PURE__ */ new Set(['"', "\\", "/", "b", "f", "n", "r", "t", "u"]);
6
+ function f(e) {
7
+ const r = e.codePointAt(0);
8
+ return r !== void 0 && r >= 0 && r <= 31;
9
+ }
10
+ function d(e) {
11
+ switch (e) {
12
+ case "\b":
13
+ return "\\b";
14
+ case "\f":
15
+ return "\\f";
16
+ case `
17
+ `:
18
+ return "\\n";
19
+ case "\r":
20
+ return "\\r";
21
+ case " ":
22
+ return "\\t";
23
+ default:
24
+ return `\\u${e.codePointAt(0)?.toString(16).padStart(4, "0") ?? "0000"}`;
25
+ }
26
+ }
27
+ function u(e) {
28
+ let r = "", i = !1;
29
+ for (let t = 0; t < e.length; t++) {
30
+ const n = e[t];
31
+ if (!i) {
32
+ r += n, n === '"' && (i = !0);
33
+ continue;
34
+ }
35
+ if (n === '"') {
36
+ r += n, i = !1;
37
+ continue;
38
+ }
39
+ if (n === "\\") {
40
+ const o = e[t + 1];
41
+ if (o === void 0) {
42
+ r += "\\\\";
43
+ continue;
44
+ }
45
+ if (o === "u") {
46
+ const c = e.slice(t + 2, t + 6);
47
+ if (/^[0-9a-fA-F]{4}$/.test(c)) {
48
+ r += `\\u${c}`, t += 5;
49
+ continue;
50
+ }
51
+ }
52
+ if (a.has(o)) {
53
+ r += `\\${o}`, t += 1;
54
+ continue;
55
+ }
56
+ r += "\\\\";
57
+ continue;
58
+ }
59
+ r += f(n) ? d(n) : n;
60
+ }
61
+ return r;
62
+ }
63
+ function l(e) {
64
+ try {
65
+ return JSON.parse(e);
66
+ } catch (r) {
67
+ const i = u(e);
68
+ if (i !== e)
69
+ return JSON.parse(i);
70
+ throw r;
71
+ }
72
+ }
73
+ function h(e) {
74
+ if (!e || e.trim() === "")
75
+ return {};
76
+ try {
77
+ return l(e);
78
+ } catch {
79
+ try {
80
+ return s.parse(e) ?? {};
81
+ } catch {
82
+ try {
83
+ return s.parse(u(e)) ?? {};
84
+ } catch {
85
+ return {};
86
+ }
87
+ }
88
+ }
89
+ }
90
+ export {
91
+ l as a,
92
+ h as p
93
+ };
package/dist/login.js CHANGED
@@ -1,135 +1,97 @@
1
- import { a3 as se, aa as le, ah as ie, a4 as ue, u as ne, al as n, ai as m, am as v, ad as l, a7 as w, a8 as u, a9 as de, ak as x, x as ve, a0 as e, ae as i, y as q, an as P, ab as R, aj as ce, ao as be, ap as me, aK as ge, aw as N, av as fe, aD as T, au as W, a5 as he, a6 as pe } from "./global-zkva5W_x.js";
2
- var we = m('<div class="flash flash-error mb-3 svelte-uxwqu2"><svg class="octicon svelte-uxwqu2" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M2.343 13.657A8 8 0 1 1 13.658 2.343 8 8 0 0 1 2.343 13.657ZM6.03 4.97a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042L6.94 8 4.97 9.97a.749.749 0 0 0 .326 1.275.749.749 0 0 0 .734-.215L8 9.06l1.97 1.97a.749.749 0 0 0 1.275-.326.749.749 0 0 0-.215-.734L9.06 8l1.97-1.97a.749.749 0 0 0-.326-1.275.749.749 0 0 0-.734.215L8 6.94Z"></path></svg> </div>'), xe = m('<div class="flash flash-success svelte-uxwqu2"><svg class="octicon svelte-uxwqu2" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16Zm3.78-9.72a.751.751 0 0 0-.018-1.042.751.751 0 0 0-1.042-.018L6.75 9.19 5.28 7.72a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042l2 2a.75.75 0 0 0 1.06 0Z"></path></svg> </div>'), qe = m("<option> </option>"), ye = m('<div class="form-group svelte-uxwqu2"><label for="userGroup" class="svelte-uxwqu2">User Group</label> <select id="userGroup" name="userGroup" class="form-control svelte-uxwqu2" required><option>Select a group...</option><!></select></div>'), _e = m(`<div class="form-group svelte-uxwqu2"><label for="email" class="svelte-uxwqu2">Email</label> <input type="email" id="email" name="email" class="form-control form-control-lg svelte-uxwqu2" required placeholder="you@example.com"/> <p class="form-hint svelte-uxwqu2">We'll send you a magic link to sign in.</p></div>`), ze = m('<div class="form-group svelte-uxwqu2"><label for="password" class="svelte-uxwqu2">Password</label> <input type="password" id="password" name="password" class="form-control form-control-lg svelte-uxwqu2" required placeholder="••••••••"/></div>'), Ce = m('<div class="Box svelte-uxwqu2"><div class="Box-body svelte-uxwqu2"><form autocomplete="off"><!> <!> <button type="submit" class="btn btn-primary btn-block btn-lg svelte-uxwqu2"><!></button></form></div></div>'), ke = m('<main class="auth-wrapper svelte-uxwqu2"><div class="auth-container svelte-uxwqu2"><div class="auth-header svelte-uxwqu2"><svg class="auth-logo svelte-uxwqu2" viewBox="0 0 90 90" width="48" height="48" fill="currentColor"><rect x="12" y="12" width="66" height="66" fill="currentColor"></rect></svg> <h1 class="svelte-uxwqu2">Sign in to Hintergrund</h1></div> <!> <!></div></main>');
3
- const Se = {
1
+ import { Y as F, a7 as G, Z as I, _ as K, Q as X, ae as t, a8 as u, ab as s, a0 as x, a4 as v, a5 as $, a9 as m, a6 as g, ac as ee, V as r, ad as i, a1 as q, ag as Z, ah as j, a3 as re, ak as A, al as W } from "./global-lQxDrO8J.js";
2
+ typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(f) {
3
+ return Promise.resolve().then(f);
4
+ } });
5
+ var ae = g('<div class="flash flash-error mb-3 svelte-uxwqu2"><svg class="octicon svelte-uxwqu2" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M2.343 13.657A8 8 0 1 1 13.658 2.343 8 8 0 0 1 2.343 13.657ZM6.03 4.97a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042L6.94 8 4.97 9.97a.749.749 0 0 0 .326 1.275.749.749 0 0 0 .734-.215L8 9.06l1.97 1.97a.749.749 0 0 0 1.275-.326.749.749 0 0 0-.215-.734L9.06 8l1.97-1.97a.749.749 0 0 0-.326-1.275.749.749 0 0 0-.734.215L8 6.94Z"></path></svg> </div>'), oe = g('<div class="flash flash-success svelte-uxwqu2"><svg class="octicon svelte-uxwqu2" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16Zm3.78-9.72a.751.751 0 0 0-.018-1.042.751.751 0 0 0-1.042-.018L6.75 9.19 5.28 7.72a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042l2 2a.75.75 0 0 0 1.06 0Z"></path></svg> </div>'), te = g('<div class="form-group svelte-uxwqu2"><label for="password" class="svelte-uxwqu2">Password</label> <input type="password" id="password" name="password" class="form-control form-control-lg svelte-uxwqu2" required="" placeholder="••••••••"/></div>'), se = g('<div class="Box svelte-uxwqu2"><div class="Box-body svelte-uxwqu2"><form autocomplete="off"><div class="form-group svelte-uxwqu2"><label for="email" class="svelte-uxwqu2">Email</label> <input type="email" id="email" name="email" class="form-control form-control-lg svelte-uxwqu2" required="" placeholder="you@example.com"/></div> <!> <button type="submit" class="btn btn-primary btn-block btn-lg svelte-uxwqu2"><!></button></form></div></div>'), ie = g('<main class="auth-wrapper svelte-uxwqu2"><div class="auth-container svelte-uxwqu2"><div class="auth-header svelte-uxwqu2"><svg class="auth-logo svelte-uxwqu2" viewBox="0 0 90 90" width="48" height="48" fill="currentColor"><rect x="12" y="12" width="66" height="66" fill="currentColor"></rect></svg> <h1 class="svelte-uxwqu2">Sign in to Hintergrund</h1></div> <!> <!></div></main>');
6
+ const le = {
4
7
  hash: "svelte-uxwqu2",
5
8
  code: `.auth-wrapper.svelte-uxwqu2 {min-height:100vh;display:flex;align-items:center;justify-content:center;background-color:var(--bgColor-muted);padding:var(--base-size-24);}.auth-container.svelte-uxwqu2 {width:100%;max-width:340px;}.auth-header.svelte-uxwqu2 {text-align:center;margin-bottom:var(--base-size-24);}.auth-logo.svelte-uxwqu2 {color:var(--fgColor-default);margin-bottom:var(--base-size-16);}.auth-header.svelte-uxwqu2 h1:where(.svelte-uxwqu2) {font-size:var(--text-title-size-medium);font-weight:var(--base-text-weight-light);color:var(--fgColor-default);margin:0;}.Box.svelte-uxwqu2 {background-color:var(--bgColor-default);border:var(--borderWidth-thin) solid var(--borderColor-default);border-radius:var(--borderRadius-medium);}.Box-body.svelte-uxwqu2 {padding:var(--base-size-16);}.flash.svelte-uxwqu2 {display:flex;align-items:flex-start;gap:var(--base-size-8);padding:var(--base-size-16);margin-bottom:var(--base-size-16);border:var(--borderWidth-thin) solid;border-radius:var(--borderRadius-medium);font-size:var(--text-body-size-medium);line-height:var(--text-body-lineHeight-medium);}.flash-error.svelte-uxwqu2 {color:var(--fgColor-danger);background-color:var(--bgColor-danger-muted);border-color:var(--borderColor-danger-muted);}.flash-success.svelte-uxwqu2 {color:var(--fgColor-success, #1a7f37);background-color:var(--bgColor-success-muted, #dafbe1);border-color:var(--borderColor-success-muted, #aceebb);}.flash.svelte-uxwqu2 .octicon:where(.svelte-uxwqu2) {flex-shrink:0;margin-top:2px;}.form-group.svelte-uxwqu2 {margin-bottom:var(--base-size-16);}.form-group.svelte-uxwqu2 label:where(.svelte-uxwqu2) {display:block;margin-bottom:var(--base-size-8);font-weight:var(--base-text-weight-semibold);font-size:var(--text-body-size-medium);color:var(--fgColor-default);}.form-control.svelte-uxwqu2 {display:block;width:100%;padding:var(--base-size-8) var(--base-size-12);font-size:var(--text-body-size-medium);line-height:1.5;color:var(--fgColor-default);background-color:var(--bgColor-default);border:var(--borderWidth-thin) solid var(--borderColor-default);border-radius:var(--borderRadius-medium);outline:none;box-shadow:var(--shadow-inset);transition:border-color 0.2s ease,
6
- box-shadow 0.2s ease;}.form-control.svelte-uxwqu2:focus {border-color:var(--borderColor-accent-emphasis);outline:2px solid var(--borderColor-accent-emphasis);outline-offset:-1px;box-shadow:none;}.form-control-lg.svelte-uxwqu2 {padding:var(--base-size-12) var(--base-size-12);font-size:var(--text-body-size-large);}.form-hint.svelte-uxwqu2 {font-size:var(--text-body-size-small, 12px);color:var(--fgColor-muted, #656d76);margin-top:var(--base-size-8);}.btn.svelte-uxwqu2 {display:inline-flex;align-items:center;justify-content:center;padding:var(--base-size-8) var(--base-size-16);font-size:var(--text-body-size-medium);font-weight:var(--base-text-weight-medium);line-height:1.5;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;border:var(--borderWidth-thin) solid transparent;border-radius:var(--borderRadius-medium);transition:background-color 0.2s ease,
9
+ box-shadow 0.2s ease;}.form-control.svelte-uxwqu2:focus {border-color:var(--borderColor-accent-emphasis);outline:2px solid var(--borderColor-accent-emphasis);outline-offset:-1px;box-shadow:none;}.form-control-lg.svelte-uxwqu2 {padding:var(--base-size-12) var(--base-size-12);font-size:var(--text-body-size-large);}.btn.svelte-uxwqu2 {display:inline-flex;align-items:center;justify-content:center;padding:var(--base-size-8) var(--base-size-16);font-size:var(--text-body-size-medium);font-weight:var(--base-text-weight-medium);line-height:1.5;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;border:var(--borderWidth-thin) solid transparent;border-radius:var(--borderRadius-medium);transition:background-color 0.2s ease,
7
10
  border-color 0.2s ease;}.btn.svelte-uxwqu2:disabled {cursor:not-allowed;opacity:0.5;}.btn-primary.svelte-uxwqu2 {color:var(--button-primary-fgColor-rest);background-color:var(--button-primary-bgColor-rest);border-color:var(--button-primary-borderColor-rest);}.btn-primary.svelte-uxwqu2:hover:not(:disabled) {background-color:var(--button-primary-bgColor-hover);}.btn-primary.svelte-uxwqu2:active:not(:disabled) {background-color:var(--button-primary-bgColor-active);}.btn-block.svelte-uxwqu2 {display:flex;width:100%;}.btn-lg.svelte-uxwqu2 {padding:var(--base-size-12) var(--base-size-24);}.mb-3.svelte-uxwqu2 {margin-bottom:var(--base-size-16);}`
8
11
  };
9
- function Ge(A, U) {
10
- le(U, !0), ie(A, Se);
11
- let _ = ue(U, "config", 7), Z = R(() => {
12
- if (!_()) return null;
13
- try {
14
- return JSON.parse(_());
15
- } catch {
16
- return null;
17
- }
18
- }), k = R(() => e(Z)?.loginMethod ?? "password"), S = R(() => e(Z)?.userGroups ?? []), G = x(""), L = x(""), z = x(""), h = x(""), C = x(""), p = x(!1);
19
- ne(() => {
20
- const a = new URLSearchParams(window.location.search).get("error");
21
- a && (n(h, a, !0), window.history.replaceState({}, "", window.location.pathname));
12
+ function ue(f, B) {
13
+ G(B, !0), I(f, le);
14
+ let L = K(B, "config", 7), h = m(!1), y = m(""), w = m(""), c = m(""), p = m(""), b = m(!1);
15
+ X(() => {
16
+ const e = new URLSearchParams(window.location.search).get("error");
17
+ e && (t(c, e, !0), window.history.replaceState({}, "", window.location.pathname));
22
18
  });
23
- async function K(t) {
24
- t.preventDefault(), n(h, ""), n(C, ""), n(p, !0);
19
+ async function E(a) {
20
+ a.preventDefault(), t(c, ""), t(p, ""), t(b, !0);
25
21
  try {
26
- const a = {};
27
- e(k) === "magic-link" ? a.email = e(L) : a.password = e(G), e(S).length > 0 && e(z) && (a.userGroup = e(z));
28
- const b = await (await fetch("/api/admin/login", {
22
+ const e = {};
23
+ r(w) && (e.email = r(w)), r(h) && (e.password = r(y));
24
+ const l = await (await fetch("/api/admin/login", {
29
25
  method: "POST",
30
26
  headers: { "Content-Type": "application/json" },
31
- body: JSON.stringify(a)
27
+ body: JSON.stringify(e)
32
28
  })).json();
33
- b.success ? b.emailSent ? n(C, b.message || "Check your email for the login link.", !0) : window.location.href = "/admin" : n(h, b.message ?? "An error occurred. Please try again.", !0);
29
+ l.success ? l.requirePassword ? t(h, !0) : l.emailSent ? t(p, l.message || "Check your email for the login link.", !0) : window.location.href = "/admin" : t(c, l.message ?? "An error occurred. Please try again.", !0);
34
30
  } catch {
35
- n(h, "An error occurred. Please try again.");
31
+ t(c, "An error occurred. Please try again.");
36
32
  } finally {
37
- n(p, !1);
33
+ t(b, !1);
38
34
  }
39
35
  }
40
- var F = {
36
+ var M = {
41
37
  get config() {
42
- return _();
38
+ return L();
43
39
  },
44
- set config(t) {
45
- _(t), ve();
40
+ set config(a) {
41
+ L(a), ee();
46
42
  }
47
- }, B = ke(), E = l(B), J = v(l(E), 2);
43
+ }, z = ie(), S = s(z), R = u(s(S), 2);
48
44
  {
49
- var I = (t) => {
50
- var a = we(), g = v(l(a));
51
- i(a), q(() => P(g, ` ${e(h) ?? ""}`)), u(t, a);
45
+ var H = (a) => {
46
+ var e = ae(), n = u(s(e));
47
+ i(e), q(() => Z(n, ` ${r(c) ?? ""}`)), v(a, e);
52
48
  };
53
- w(J, (t) => {
54
- e(h) && t(I);
49
+ x(R, (a) => {
50
+ r(c) && a(H);
55
51
  });
56
52
  }
57
- var Q = v(J, 2);
53
+ var J = u(R, 2);
58
54
  {
59
- var V = (t) => {
60
- var a = xe(), g = v(l(a));
61
- i(a), q(() => P(g, ` ${e(C) ?? ""}`)), u(t, a);
62
- }, X = (t) => {
63
- var a = Ce(), g = l(a), b = l(g), O = l(b);
64
- {
65
- var Y = (r) => {
66
- var o = ye(), s = v(l(o), 2), c = l(s);
67
- c.value = c.__value = "";
68
- var j = v(c);
69
- be(j, 17, () => e(S), me, (d, f) => {
70
- var y = qe(), te = l(y, !0);
71
- i(y);
72
- var H = {};
73
- q(() => {
74
- P(te, e(f)), H !== (H = e(f)) && (y.value = (y.__value = e(f)) ?? "");
75
- }), u(d, y);
76
- }), i(s), i(o), ge(s, () => e(z), (d) => n(z, d)), u(r, o);
77
- };
78
- w(O, (r) => {
79
- e(S).length > 0 && r(Y);
80
- });
81
- }
82
- var D = v(O, 2);
55
+ var O = (a) => {
56
+ var e = oe(), n = u(s(e));
57
+ i(e), q(() => Z(n, ` ${r(p) ?? ""}`)), v(a, e);
58
+ }, U = (a) => {
59
+ var e = se(), n = s(e), l = s(n), _ = s(l), C = u(s(_), 2);
60
+ j(C), i(_);
61
+ var T = u(_, 2);
83
62
  {
84
- var $ = (r) => {
85
- var o = _e(), s = v(l(o), 2);
86
- N(s), fe(2), i(o), q(() => s.disabled = e(p)), T(s, () => e(L), (c) => n(L, c)), u(r, o);
87
- }, ee = (r) => {
88
- var o = ze(), s = v(l(o), 2);
89
- N(s), i(o), q(() => s.disabled = e(p)), T(s, () => e(G), (c) => n(G, c)), u(r, o);
63
+ var D = (o) => {
64
+ var d = te(), P = u(s(d), 2);
65
+ j(P), i(d), q(() => P.disabled = r(b)), A(P, () => r(y), (Y) => t(y, Y)), v(o, d);
90
66
  };
91
- w(D, (r) => {
92
- e(k) === "magic-link" ? r($) : r(ee, !1);
67
+ x(T, (o) => {
68
+ r(h) && o(D);
93
69
  });
94
70
  }
95
- var M = v(D, 2), ae = l(M);
71
+ var k = u(T, 2), N = s(k);
96
72
  {
97
- var re = (r) => {
98
- var o = W("Signing in...");
99
- u(r, o);
100
- }, oe = (r) => {
101
- var o = he(), s = pe(o);
102
- {
103
- var c = (d) => {
104
- var f = W("Send Magic Link");
105
- u(d, f);
106
- }, j = (d) => {
107
- var f = W("Sign in");
108
- u(d, f);
109
- };
110
- w(
111
- s,
112
- (d) => {
113
- e(k) === "magic-link" ? d(c) : d(j, !1);
114
- },
115
- !0
116
- );
117
- }
118
- u(r, o);
73
+ var Q = (o) => {
74
+ var d = W("Please wait...");
75
+ v(o, d);
76
+ }, V = (o) => {
77
+ var d = W("Continue");
78
+ v(o, d);
119
79
  };
120
- w(ae, (r) => {
121
- e(p) ? r(re) : r(oe, !1);
80
+ x(N, (o) => {
81
+ r(b) ? o(Q) : o(V, -1);
122
82
  });
123
83
  }
124
- i(M), i(b), i(g), i(a), q(() => M.disabled = e(p)), ce("submit", b, K), u(t, a);
84
+ i(k), i(l), i(n), i(e), q(() => {
85
+ C.disabled = r(b) || r(h), k.disabled = r(b);
86
+ }), re("submit", l, E), A(C, () => r(w), (o) => t(w, o)), v(a, e);
125
87
  };
126
- w(Q, (t) => {
127
- e(C) ? t(V) : t(X, !1);
88
+ x(J, (a) => {
89
+ r(p) ? a(O) : a(U, -1);
128
90
  });
129
91
  }
130
- return i(E), i(B), u(A, B), de(F);
92
+ return i(S), i(z), v(f, z), $(M);
131
93
  }
132
- customElements.define("hintergrund-login", se(Ge, { config: {} }, [], [], !1));
94
+ customElements.define("hintergrund-login", F(ue, { config: {} }, [], []));
133
95
  export {
134
- Ge as default
96
+ ue as default
135
97
  };