treege 3.0.0-beta.31 → 3.0.0-beta.33

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,1199 @@
1
+ import { t as e } from "./ThemeContext-DBFles56.js";
2
+ import { A as t, C as n, D as r, E as i, F as a, M as o, N as s, O as c, P as l, S as u, T as d, _ as f, a as p, b as m, c as h, i as g, j as _, k as v, l as y, n as b, o as ee, r as te, s as x, t as S, v as C, w, y as T } from "./separator-Cdfv5nIR.js";
3
+ import { S as E, a as D, b as ne, c as O, d as k, g as re, n as A, o as j, r as M, s as N, t as P, w as F } from "./useRenderNode-BTzgPipn.js";
4
+ import { Fragment as ie, jsx as I, jsxs as L } from "react/jsx-runtime";
5
+ import { Check as ae, ChevronDownIcon as R, ChevronLeftIcon as oe, ChevronRightIcon as z, ChevronsUpDown as se, CircleIcon as ce, Loader2 as le, MapPin as ue } from "lucide-react";
6
+ import * as de from "react";
7
+ import { forwardRef as B, useCallback as fe, useEffect as V, useMemo as pe, useRef as H, useState as U } from "react";
8
+ import { DayPicker as W, getDefaultClassNames as G } from "react-day-picker";
9
+ import * as K from "@radix-ui/react-tooltip";
10
+ import * as q from "@radix-ui/react-radio-group";
11
+ //#region src/renderer/features/TreegeRenderer/web/components/DefaultFormWrapper.tsx
12
+ var me = ({ children: e, onSubmit: t }) => /* @__PURE__ */ I("form", {
13
+ onSubmit: t,
14
+ className: "mx-auto max-w-2xl gap-y-3",
15
+ children: e
16
+ }), J = ({ node: e, children: t }) => {
17
+ let n = j()(e.data.label);
18
+ return /* @__PURE__ */ L("section", {
19
+ className: "mb-6 rounded-lg border p-4",
20
+ children: [n && /* @__PURE__ */ I("h3", {
21
+ className: "mb-4 font-semibold text-lg",
22
+ children: n
23
+ }), t]
24
+ });
25
+ }, he = async (e, t) => {
26
+ if (!e || e.trim().length < 3) return [];
27
+ try {
28
+ let n = await fetch(`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(e)}&format=jsonv2&addressdetails=1&limit=5`, { headers: {
29
+ Accept: "application/json",
30
+ "User-Agent": "Treege Renderer",
31
+ ...t && { "Accept-Language": t }
32
+ } });
33
+ return n.ok ? (await n.json()).map((e) => ({
34
+ label: e.display_name,
35
+ value: e.display_name
36
+ })) : [];
37
+ } catch (e) {
38
+ return console.error("Nominatim fetch error:", e), [];
39
+ }
40
+ }, ge = (e) => !e || e.trim().length < 3 ? Promise.resolve([]) : new Promise((t) => {
41
+ if (!window.google?.maps?.places) {
42
+ console.warn("Google Places SDK not loaded yet"), t([]);
43
+ return;
44
+ }
45
+ new window.google.maps.places.AutocompleteService().getPlacePredictions({ input: e }, (e, n) => {
46
+ if (n !== google.maps.places.PlacesServiceStatus.OK || !e) {
47
+ console.warn("Google Places API status:", n), t([]);
48
+ return;
49
+ }
50
+ t(e.map((e) => ({
51
+ label: e.description,
52
+ value: e.description
53
+ })));
54
+ });
55
+ }), _e = ({ node: e, value: n, setValue: i, error: a, label: o, placeholder: s, helperText: l, id: u, name: d }) => {
56
+ let [f, p] = U(""), [m, h] = U([]), [y, S] = U(!1), { googleApiKey: C, language: w } = O(), T = j(), E = fe((e) => {
57
+ i(e.value), p(e.value), S(!1);
58
+ }, [i]);
59
+ V(() => {
60
+ if (!f || f.trim().length < 3) {
61
+ h([]);
62
+ return;
63
+ }
64
+ let e = setTimeout(async () => {
65
+ h(C ? await ge(f) : await he(f, w));
66
+ }, 300);
67
+ return () => clearTimeout(e);
68
+ }, [
69
+ f,
70
+ C,
71
+ w
72
+ ]);
73
+ let D = fe((e) => {
74
+ i(e), p(e), e.length >= 3 && S(!0);
75
+ }, [i]);
76
+ return /* @__PURE__ */ L(ie, { children: [C && /* @__PURE__ */ I("script", {
77
+ async: !0,
78
+ src: `https://maps.googleapis.com/maps/api/js?key=${C}&libraries=places`
79
+ }), /* @__PURE__ */ L(_, {
80
+ className: "mb-4",
81
+ children: [
82
+ /* @__PURE__ */ L(r, {
83
+ htmlFor: u,
84
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
85
+ className: "text-red-500",
86
+ children: "*"
87
+ })]
88
+ }),
89
+ /* @__PURE__ */ L("div", {
90
+ className: "relative",
91
+ children: [
92
+ /* @__PURE__ */ I(c, {
93
+ type: "text",
94
+ id: u,
95
+ name: d,
96
+ value: n || "",
97
+ onChange: (e) => D(e.target.value),
98
+ onFocus: () => {
99
+ m.length > 0 && S(!0);
100
+ },
101
+ placeholder: s || T("renderer.defaultAddressInput.enterAddress"),
102
+ className: "pr-10",
103
+ autoComplete: "off"
104
+ }),
105
+ /* @__PURE__ */ I(ue, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 right-3 h-4 w-4 text-muted-foreground" }),
106
+ y && /* @__PURE__ */ I("div", {
107
+ className: "absolute z-50 mt-1 w-full rounded-md border bg-popover shadow-md",
108
+ children: /* @__PURE__ */ I(b, { children: /* @__PURE__ */ L(x, { children: [/* @__PURE__ */ I(te, { children: T("renderer.defaultAddressInput.noAddressesFound") }), /* @__PURE__ */ I(g, { children: m.map((e, t) => /* @__PURE__ */ L(ee, {
109
+ value: e.value,
110
+ onSelect: () => E(e),
111
+ onMouseDown: (e) => e.preventDefault(),
112
+ children: [/* @__PURE__ */ I(ue, { className: "mr-2 h-4 w-4" }), e.label]
113
+ }, t)) })] }) })
114
+ })
115
+ ]
116
+ }),
117
+ a && /* @__PURE__ */ I(t, { children: a }),
118
+ l && !a && /* @__PURE__ */ I(v, { children: l })
119
+ ]
120
+ })] });
121
+ }, ve = ({ node: e, value: n, setValue: o, error: c, label: l, placeholder: u, helperText: f, id: m }) => {
122
+ let h = j(), [y, S] = U(!1), C = `${m}-trigger`, T = `${m}-error`, E = e.data.options || [], D = E.find((e) => e.value === n);
123
+ return /* @__PURE__ */ L(_, {
124
+ className: "mb-4",
125
+ children: [
126
+ /* @__PURE__ */ L(r, {
127
+ htmlFor: C,
128
+ children: [l || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
129
+ className: "text-red-500",
130
+ children: "*"
131
+ })]
132
+ }),
133
+ /* @__PURE__ */ L(w, {
134
+ open: y,
135
+ onOpenChange: S,
136
+ children: [/* @__PURE__ */ I(i, {
137
+ asChild: !0,
138
+ children: /* @__PURE__ */ L(s, {
139
+ id: C,
140
+ variant: "outline",
141
+ role: "combobox",
142
+ "aria-expanded": y,
143
+ "aria-invalid": !!c || void 0,
144
+ "aria-describedby": c ? T : void 0,
145
+ className: "w-full justify-between font-normal",
146
+ children: [n ? D?.label ? h(D.label) : n : u || h("renderer.defaultAutocompleteInput.selectOption"), /* @__PURE__ */ I(se, { className: "ml-2 size-4 shrink-0 opacity-50" })]
147
+ })
148
+ }), /* @__PURE__ */ I(d, {
149
+ className: "w-full p-0",
150
+ align: "start",
151
+ children: /* @__PURE__ */ L(b, { children: [/* @__PURE__ */ I(p, { placeholder: u || h("renderer.defaultAutocompleteInput.search") }), /* @__PURE__ */ L(x, { children: [/* @__PURE__ */ I(te, { children: h("renderer.defaultAutocompleteInput.noResults") }), /* @__PURE__ */ I(g, { children: E.map((e) => /* @__PURE__ */ L(ee, {
152
+ value: e.value,
153
+ disabled: e.disabled,
154
+ onSelect: (e) => {
155
+ o(e === n ? "" : e), S(!1);
156
+ },
157
+ children: [/* @__PURE__ */ I(ae, { className: a("mr-2 size-4", n === e.value ? "opacity-100" : "opacity-0") }), h(e.label)]
158
+ }, e.value)) })] })] })
159
+ })]
160
+ }),
161
+ c && /* @__PURE__ */ I(t, {
162
+ id: T,
163
+ children: c
164
+ }),
165
+ f && !c && /* @__PURE__ */ I(v, { children: f })
166
+ ]
167
+ });
168
+ }, Y = ({ node: e, value: n, setValue: i, error: a, label: s, helperText: c, id: l, name: u }) => {
169
+ let d = j();
170
+ if (e.data.options && e.data.options.length > 0) {
171
+ let f = Array.isArray(n) ? n.map(String) : [], p = (e, t) => {
172
+ i(t ? [...f, e] : f.filter((t) => t !== e));
173
+ };
174
+ return /* @__PURE__ */ L(_, {
175
+ className: "mb-4",
176
+ children: [
177
+ /* @__PURE__ */ L(r, {
178
+ className: "mb-1",
179
+ children: [s || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
180
+ className: "text-red-500",
181
+ children: "*"
182
+ })]
183
+ }),
184
+ /* @__PURE__ */ I("div", {
185
+ className: "space-y-2",
186
+ children: e.data.options.map((e, t) => {
187
+ let n = d(e.description);
188
+ return /* @__PURE__ */ L("div", {
189
+ className: "flex items-start gap-3",
190
+ children: [/* @__PURE__ */ I(o, {
191
+ id: `${l}-${e.value}`,
192
+ name: u,
193
+ checked: f.includes(String(e.value)),
194
+ onCheckedChange: (t) => p(String(e.value), !!t),
195
+ disabled: e.disabled,
196
+ className: "mt-0.5"
197
+ }), /* @__PURE__ */ L("div", {
198
+ className: "flex flex-col",
199
+ children: [/* @__PURE__ */ I(r, {
200
+ htmlFor: `${l}-${e.value}`,
201
+ className: "cursor-pointer font-normal text-sm",
202
+ children: d(e.label) ? d(e.label) : e.value
203
+ }), n && /* @__PURE__ */ I("span", {
204
+ className: "text-muted-foreground text-xs",
205
+ children: n
206
+ })]
207
+ })]
208
+ }, e.value + t);
209
+ })
210
+ }),
211
+ a && /* @__PURE__ */ I(t, { children: a }),
212
+ c && !a && /* @__PURE__ */ I(v, { children: c })
213
+ ]
214
+ });
215
+ }
216
+ return /* @__PURE__ */ L(_, {
217
+ className: "mb-4",
218
+ children: [/* @__PURE__ */ L("div", {
219
+ className: "flex items-center gap-3",
220
+ children: [/* @__PURE__ */ I(o, {
221
+ id: l,
222
+ name: u,
223
+ checked: typeof n == "boolean" ? n : !1,
224
+ onCheckedChange: (e) => i(!!e)
225
+ }), /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ L(r, {
226
+ htmlFor: l,
227
+ className: "cursor-pointer font-medium text-sm",
228
+ children: [s || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
229
+ className: "text-red-500",
230
+ children: "*"
231
+ })]
232
+ }), c && !a && /* @__PURE__ */ I(v, { children: c })] })]
233
+ }), a && /* @__PURE__ */ I(t, { children: a })]
234
+ });
235
+ };
236
+ //#endregion
237
+ //#region src/shared/components/ui/calendar.tsx
238
+ function X({ className: e, classNames: t, showOutsideDays: n = !0, captionLayout: r = "label", buttonVariant: i = "ghost", formatters: o, components: s, ...c }) {
239
+ let u = G();
240
+ return /* @__PURE__ */ I(W, {
241
+ showOutsideDays: n,
242
+ className: a("group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, e),
243
+ captionLayout: r,
244
+ formatters: {
245
+ formatMonthDropdown: (e) => e.toLocaleString("default", { month: "short" }),
246
+ ...o
247
+ },
248
+ classNames: {
249
+ button_next: a(l({ variant: i }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", u.button_next),
250
+ button_previous: a(l({ variant: i }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", u.button_previous),
251
+ caption_label: a("select-none font-medium", r === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5", u.caption_label),
252
+ day: a("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none", u.day),
253
+ disabled: a("text-muted-foreground opacity-50", u.disabled),
254
+ dropdown: a("absolute bg-popover inset-0 opacity-0", u.dropdown),
255
+ dropdown_root: a("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md", u.dropdown_root),
256
+ dropdowns: a("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5", u.dropdowns),
257
+ hidden: a("invisible", u.hidden),
258
+ month: a("flex flex-col w-full gap-4", u.month),
259
+ month_caption: a("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)", u.month_caption),
260
+ months: a("flex gap-4 flex-col md:flex-row relative", u.months),
261
+ nav: a("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between", u.nav),
262
+ outside: a("text-muted-foreground aria-selected:text-muted-foreground", u.outside),
263
+ range_end: a("rounded-r-md bg-accent", u.range_end),
264
+ range_middle: a("rounded-none", u.range_middle),
265
+ range_start: a("rounded-l-md bg-accent", u.range_start),
266
+ root: a("w-fit", u.root),
267
+ table: "w-full border-collapse",
268
+ today: a("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none", u.today),
269
+ week: a("flex w-full mt-2", u.week),
270
+ week_number: a("text-[0.8rem] select-none text-muted-foreground", u.week_number),
271
+ week_number_header: a("select-none w-(--cell-size)", u.week_number_header),
272
+ weekday: a("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none", u.weekday),
273
+ weekdays: a("flex", u.weekdays),
274
+ ...t
275
+ },
276
+ components: {
277
+ Chevron: ({ className: e, orientation: t, ...n }) => I(t === "left" ? oe : t === "right" ? z : R, {
278
+ className: a("size-4", e),
279
+ ...n
280
+ }),
281
+ DayButton: Z,
282
+ Root: ({ className: e, rootRef: t, ...n }) => /* @__PURE__ */ I("div", {
283
+ "data-slot": "calendar",
284
+ ref: t,
285
+ className: a(e),
286
+ ...n
287
+ }),
288
+ WeekNumber: ({ children: e, ...t }) => /* @__PURE__ */ I("td", {
289
+ ...t,
290
+ children: /* @__PURE__ */ I("div", {
291
+ className: "flex size-(--cell-size) items-center justify-center text-center",
292
+ children: e
293
+ })
294
+ }),
295
+ ...s
296
+ },
297
+ ...c
298
+ });
299
+ }
300
+ function Z({ className: e, day: t, modifiers: n, ...r }) {
301
+ let i = G(), o = de.useRef(null);
302
+ return de.useEffect(() => {
303
+ n.focused && o.current?.focus();
304
+ }, [n.focused]), /* @__PURE__ */ I(s, {
305
+ ref: o,
306
+ variant: "ghost",
307
+ size: "icon",
308
+ "data-day": t.date.toLocaleDateString(),
309
+ "data-selected-single": n.selected && !n.range_start && !n.range_end && !n.range_middle,
310
+ "data-range-start": n.range_start,
311
+ "data-range-end": n.range_end,
312
+ "data-range-middle": n.range_middle,
313
+ className: a("flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-start=true]:rounded-l-md data-[range-end=true]:bg-primary data-[range-middle=true]:bg-accent data-[range-start=true]:bg-primary data-[selected-single=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:text-accent-foreground data-[range-start=true]:text-primary-foreground data-[selected-single=true]:text-primary-foreground group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70", i.day, e),
314
+ ...r
315
+ });
316
+ }
317
+ //#endregion
318
+ //#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.tsx
319
+ var Q = ({ node: e, value: n, setValue: a, error: o, label: c, placeholder: l, helperText: u, id: f, name: p }) => {
320
+ let [m, h] = U(!1), g = j(), y = n ? new Date(n) : void 0;
321
+ return /* @__PURE__ */ L(_, {
322
+ className: "mb-4",
323
+ children: [
324
+ /* @__PURE__ */ L(r, {
325
+ htmlFor: f,
326
+ children: [c || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
327
+ className: "text-red-500",
328
+ children: "*"
329
+ })]
330
+ }),
331
+ /* @__PURE__ */ L(w, {
332
+ open: m,
333
+ onOpenChange: h,
334
+ children: [/* @__PURE__ */ I(i, {
335
+ asChild: !0,
336
+ children: /* @__PURE__ */ L(s, {
337
+ variant: "outline",
338
+ id: f,
339
+ name: p,
340
+ className: "w-full justify-between font-normal",
341
+ children: [y ? y.toLocaleDateString() : l || g("renderer.defaultInputs.selectDate"), /* @__PURE__ */ I(R, { className: "size-4" })]
342
+ })
343
+ }), /* @__PURE__ */ I(d, {
344
+ className: "w-auto overflow-hidden p-0",
345
+ align: "start",
346
+ children: /* @__PURE__ */ I(X, {
347
+ mode: "single",
348
+ selected: y,
349
+ captionLayout: "dropdown",
350
+ disabled: (t) => {
351
+ if (e.data.disablePast) {
352
+ let e = /* @__PURE__ */ new Date();
353
+ return e.setHours(0, 0, 0, 0), t < e;
354
+ }
355
+ return !1;
356
+ },
357
+ onSelect: (e) => {
358
+ a(e ? e.toISOString() : ""), h(!1);
359
+ }
360
+ })
361
+ })]
362
+ }),
363
+ o && /* @__PURE__ */ I(t, { children: o }),
364
+ u && !o && /* @__PURE__ */ I(v, { children: u })
365
+ ]
366
+ });
367
+ }, ye = ({ node: e, value: n, setValue: a, error: o, label: c, helperText: l, id: u }) => {
368
+ let [f, p] = U(!1), m = j(), h = Array.isArray(n) ? n : [], g = h[0] ? new Date(h[0]) : void 0, y = h[1] ? new Date(h[1]) : void 0;
369
+ return /* @__PURE__ */ L(_, {
370
+ className: "mb-4",
371
+ children: [
372
+ /* @__PURE__ */ L(r, {
373
+ htmlFor: u,
374
+ children: [c || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
375
+ className: "text-red-500",
376
+ children: "*"
377
+ })]
378
+ }),
379
+ /* @__PURE__ */ L(w, {
380
+ open: f,
381
+ onOpenChange: p,
382
+ children: [/* @__PURE__ */ I(i, {
383
+ asChild: !0,
384
+ children: /* @__PURE__ */ L(s, {
385
+ id: u,
386
+ variant: "outline",
387
+ className: "w-full justify-between font-normal",
388
+ children: [g && y ? `${g.toLocaleDateString()} - ${y.toLocaleDateString()}` : g ? g.toLocaleDateString() : m("renderer.defaultInputs.selectDateRange"), /* @__PURE__ */ I(R, { className: "size-4" })]
389
+ })
390
+ }), /* @__PURE__ */ I(d, {
391
+ className: "w-auto overflow-hidden p-0",
392
+ align: "start",
393
+ children: /* @__PURE__ */ I(X, {
394
+ mode: "range",
395
+ selected: {
396
+ from: g,
397
+ to: y
398
+ },
399
+ captionLayout: "dropdown",
400
+ disabled: (t) => {
401
+ if (e.data.disablePast) {
402
+ let e = /* @__PURE__ */ new Date();
403
+ return e.setHours(0, 0, 0, 0), t < e;
404
+ }
405
+ return !1;
406
+ },
407
+ onSelect: (e) => {
408
+ a([e?.from ? e.from.toISOString() : void 0, e?.to ? e.to.toISOString() : void 0]);
409
+ },
410
+ numberOfMonths: 2
411
+ })
412
+ })]
413
+ }),
414
+ o && /* @__PURE__ */ I(t, { children: o }),
415
+ l && !o && /* @__PURE__ */ I(v, { children: l })
416
+ ]
417
+ });
418
+ }, $ = ({ node: e, setValue: n, error: i, label: a, placeholder: o, helperText: s, name: l, id: u }) => /* @__PURE__ */ L(_, {
419
+ className: "mb-4",
420
+ children: [
421
+ /* @__PURE__ */ L(r, {
422
+ htmlFor: u,
423
+ children: [a || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
424
+ className: "text-red-500",
425
+ children: "*"
426
+ })]
427
+ }),
428
+ /* @__PURE__ */ I(c, {
429
+ type: "file",
430
+ name: l,
431
+ id: u,
432
+ onChange: async (t) => {
433
+ let { files: r } = t.target;
434
+ if (!r || r.length === 0) {
435
+ n(null);
436
+ return;
437
+ }
438
+ if (e.data.multiple) {
439
+ n(await M(Array.from(r)));
440
+ return;
441
+ }
442
+ n(await A(r[0]));
443
+ },
444
+ multiple: e.data.multiple,
445
+ placeholder: o
446
+ }),
447
+ i && /* @__PURE__ */ I(t, { children: i }),
448
+ s && !i && /* @__PURE__ */ I(v, { children: s })
449
+ ]
450
+ }), be = ({ value: e, name: t, id: n }) => /* @__PURE__ */ I(c, {
451
+ type: "hidden",
452
+ id: n,
453
+ name: t,
454
+ value: e ?? ""
455
+ });
456
+ //#endregion
457
+ //#region src/shared/components/ui/tooltip.tsx
458
+ function xe({ delayDuration: e = 0, ...t }) {
459
+ return /* @__PURE__ */ I(K.Provider, {
460
+ "data-slot": "tooltip-provider",
461
+ delayDuration: e,
462
+ ...t
463
+ });
464
+ }
465
+ function Se({ ...e }) {
466
+ return /* @__PURE__ */ I(xe, { children: /* @__PURE__ */ I(K.Root, {
467
+ "data-slot": "tooltip",
468
+ ...e
469
+ }) });
470
+ }
471
+ function Ce({ ...e }) {
472
+ return /* @__PURE__ */ I(K.Trigger, {
473
+ "data-slot": "tooltip-trigger",
474
+ ...e
475
+ });
476
+ }
477
+ function we({ className: e, sideOffset: t = 0, children: n, ...r }) {
478
+ return /* @__PURE__ */ I(K.Portal, { children: /* @__PURE__ */ L(K.Content, {
479
+ "data-slot": "tooltip-content",
480
+ sideOffset: t,
481
+ className: a("fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in text-balance rounded-md bg-foreground px-3 py-1.5 text-background text-xs data-[state=closed]:animate-out", e),
482
+ ...r,
483
+ children: [n, /* @__PURE__ */ I(K.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })]
484
+ }) });
485
+ }
486
+ //#endregion
487
+ //#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.tsx
488
+ var Te = (e, t) => t ? t.split(".").reduce((e, t) => {
489
+ if (e == null) return;
490
+ let n = t.match(/^(\w+)\[(\d+)]$/);
491
+ if (n) {
492
+ let [, t, r] = n, i = e[t];
493
+ return Array.isArray(i) ? i[Number.parseInt(r, 10)] : i;
494
+ }
495
+ return e[t];
496
+ }, e) : e, Ee = (e) => {
497
+ let t = e.matchAll(/{{([\w-]+)}}/g);
498
+ return Array.from(t, (e) => e[1]);
499
+ }, De = (e, t) => Ee(e).every((e) => {
500
+ let n = t[e];
501
+ return n != null && n !== "";
502
+ }), Oe = (e, t, n = !1) => e.replace(/{{([\w-]+)}}/g, (e, r) => {
503
+ let i = t[r], a = i == null ? "" : String(i);
504
+ return n ? encodeURIComponent(a) : a;
505
+ }), ke = ({ node: e, value: o, setValue: l, error: h, label: y, placeholder: S, helperText: D, id: k, name: A }) => {
506
+ let [M, N] = U(!1), [P, F] = U(null), [R, oe] = U([]), [z, ce] = U(""), [ue, de] = U(!1), { formValues: B, inputNodes: W } = O(), G = j(), { httpConfig: K } = e.data, q = H(!1), me = H(""), J = H(K), he = H(B), ge = H(W), _e = H(l), ve = H(null), Y = H(null), X = pe(() => K?.url ? Ee(K.url) : [], [K?.url]), Z = X.length > 0, Q = pe(() => X.map((e) => `${e}:${String(B[e] ?? "")}`).join("|"), [X, B]), ye = pe(() => K?.url ? Z ? De(K.url, B) : !0 : !1, [
507
+ K?.url,
508
+ Z,
509
+ B
510
+ ]), $ = fe(async (e) => {
511
+ Y.current && Y.current.abort();
512
+ let t = new AbortController();
513
+ Y.current = t;
514
+ let n = J.current, r = he.current, i = _e.current;
515
+ if (!n?.url) {
516
+ F(G("renderer.defaultHttpInput.noUrlConfigured")), Y.current = null;
517
+ return;
518
+ }
519
+ if (n.url && !De(n.url, r)) {
520
+ Y.current = null;
521
+ return;
522
+ }
523
+ N(!0), F(null);
524
+ try {
525
+ let a = Oe(n.url, r, !0), o = n.searchParam && e ? `${a}${a.includes("?") ? "&" : "?"}${n.searchParam}=${encodeURIComponent(e)}` : a, s = {};
526
+ n.headers?.forEach((e) => {
527
+ s[e.key] = Oe(e.value, r);
528
+ });
529
+ let c = [
530
+ "POST",
531
+ "PUT",
532
+ "PATCH"
533
+ ].includes(n.method || "") ? n.sendAllFormValues ? JSON.stringify(ne(r, ge.current)) : n.body ? Oe(n.body, r) : void 0 : void 0, l = setTimeout(() => t.abort(), 3e4), u = await fetch(o, {
534
+ body: c || void 0,
535
+ headers: {
536
+ "Content-Type": "application/json",
537
+ ...s
538
+ },
539
+ method: n.method || "GET",
540
+ signal: t.signal
541
+ });
542
+ if (clearTimeout(l), !u.ok) {
543
+ F(`HTTP Error ${u.status}: ${u.statusText}`), N(!1);
544
+ return;
545
+ }
546
+ let d = re(await u.json()), f = n.responsePath ? Te(d, n.responsePath) : d;
547
+ if (n.responseMapping && Array.isArray(f)) {
548
+ let { valueField: e = "value", labelField: t = "label" } = n.responseMapping;
549
+ oe(f.map((n) => ({
550
+ label: String(Te(n, t) || ""),
551
+ value: String(Te(n, e) || "")
552
+ })));
553
+ } else i(typeof f == "string" ? f : JSON.stringify(f));
554
+ } catch (e) {
555
+ if (e instanceof Error && e.name === "AbortError") return;
556
+ F(e instanceof Error ? e.message : G("renderer.defaultHttpInput.fetchFailed")), console.error("HTTP Input fetch error:", e);
557
+ } finally {
558
+ N(!1), Y.current = null;
559
+ }
560
+ }, [G]);
561
+ if (V(() => {
562
+ J.current = K, he.current = B, ge.current = W, _e.current = l, ve.current = $;
563
+ }, [
564
+ K,
565
+ B,
566
+ W,
567
+ l,
568
+ $
569
+ ]), V(() => () => {
570
+ Y.current && Y.current.abort();
571
+ }, []), V(() => {
572
+ if (q.current) return;
573
+ q.current = !0;
574
+ let e = J.current, t = he.current, n = ve.current, r = e?.url && De(e.url, t);
575
+ e?.fetchOnMount && r && n && (n(), e.url && (me.current = Ee(e.url).map((e) => `${e}:${String(t[e] ?? "")}`).join("|")));
576
+ }, []), V(() => {
577
+ if (!q.current || !Z || me.current === Q || !ye) return;
578
+ let e = setTimeout(() => {
579
+ $(), me.current = Q;
580
+ }, 500);
581
+ return () => clearTimeout(e);
582
+ }, [
583
+ Q,
584
+ Z,
585
+ ye,
586
+ $
587
+ ]), V(() => {
588
+ if (!(K?.searchParam && z)) return;
589
+ let e = setTimeout(() => {
590
+ $(z);
591
+ }, 300);
592
+ return () => clearTimeout(e);
593
+ }, [
594
+ z,
595
+ K?.searchParam,
596
+ $
597
+ ]), K?.responseMapping) {
598
+ let c = Array.isArray(o) ? o[0] : o, ne = R.find((e) => e.value === c);
599
+ if (K.searchParam) {
600
+ let n = M && K?.showLoading ? /* @__PURE__ */ L("div", {
601
+ className: "flex items-center gap-2",
602
+ children: [/* @__PURE__ */ I(le, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ I("span", {
603
+ className: "text-muted-foreground",
604
+ children: ne?.label || S || G("renderer.defaultHttpInput.search")
605
+ })]
606
+ }) : ne?.label || S || G("renderer.defaultHttpInput.search");
607
+ return /* @__PURE__ */ L(_, {
608
+ className: "mb-4",
609
+ children: [
610
+ /* @__PURE__ */ L(r, { children: [y || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
611
+ className: "text-red-500",
612
+ children: "*"
613
+ })] }),
614
+ /* @__PURE__ */ L(w, {
615
+ open: ue,
616
+ onOpenChange: de,
617
+ children: [/* @__PURE__ */ I(i, {
618
+ asChild: !0,
619
+ children: /* @__PURE__ */ L(s, {
620
+ variant: "outline",
621
+ role: "combobox",
622
+ "aria-expanded": ue,
623
+ className: "w-full justify-between",
624
+ children: [n, /* @__PURE__ */ I(se, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })]
625
+ })
626
+ }), /* @__PURE__ */ I(d, {
627
+ className: "w-[300px] p-0",
628
+ align: "start",
629
+ children: /* @__PURE__ */ L(b, {
630
+ shouldFilter: !1,
631
+ children: [/* @__PURE__ */ I(p, {
632
+ placeholder: G("renderer.defaultHttpInput.search"),
633
+ value: z,
634
+ onValueChange: (e) => {
635
+ ce(e), F(null);
636
+ }
637
+ }), /* @__PURE__ */ L(x, { children: [
638
+ M && /* @__PURE__ */ I("div", {
639
+ className: "flex items-center justify-center p-4",
640
+ children: /* @__PURE__ */ I(le, { className: "h-4 w-4 animate-spin" })
641
+ }),
642
+ !M && P && /* @__PURE__ */ L("div", {
643
+ className: "p-4 text-destructive text-sm",
644
+ children: [/* @__PURE__ */ I("div", { children: P }), /* @__PURE__ */ I("button", {
645
+ type: "button",
646
+ onClick: () => $(z),
647
+ className: "mt-2 block text-primary hover:underline",
648
+ children: G("renderer.defaultHttpInput.retry")
649
+ })]
650
+ }),
651
+ !(M || P) && /* @__PURE__ */ L(ie, { children: [/* @__PURE__ */ I(te, { children: G("renderer.defaultHttpInput.noResults") }), /* @__PURE__ */ I(g, { children: R.map((e) => /* @__PURE__ */ L(ee, {
652
+ value: e.value,
653
+ onSelect: () => {
654
+ l(e.value), de(!1);
655
+ },
656
+ children: [/* @__PURE__ */ I(ae, { className: a("mr-2 h-4 w-4", o === e.value ? "opacity-100" : "opacity-0") }), e.label]
657
+ }, e.value)) })] })
658
+ ] })]
659
+ })
660
+ })]
661
+ }),
662
+ h && /* @__PURE__ */ I(t, { children: h }),
663
+ D && !h && /* @__PURE__ */ I(v, { children: D })
664
+ ]
665
+ });
666
+ }
667
+ let O = M && K?.showLoading, re = X.filter((e) => {
668
+ let t = B[e];
669
+ return t == null || t === "";
670
+ }), j = re.map((e) => E(e, W) || e), N = R.length === 0 && !O ? P || (re.length > 0 ? `${G("renderer.defaultHttpInput.waitingForRequiredFields")}: ${j.join(", ")}` : G("renderer.defaultHttpInput.noDataAvailable")) : void 0, oe = /* @__PURE__ */ L(f, {
671
+ value: Array.isArray(o) ? o[0] ?? "" : o ?? "",
672
+ onValueChange: (e) => l(e),
673
+ disabled: O || R.length === 0,
674
+ name: A,
675
+ children: [/* @__PURE__ */ L(u, {
676
+ id: k,
677
+ name: A,
678
+ className: "w-full",
679
+ children: [O && /* @__PURE__ */ I(le, { className: "mr-2 h-4 w-4 animate-spin" }), /* @__PURE__ */ I(n, { placeholder: S || G("renderer.defaultHttpInput.selectOption") })]
680
+ }), /* @__PURE__ */ I(C, { children: /* @__PURE__ */ I(T, { children: R.map((e, t) => /* @__PURE__ */ I(m, {
681
+ value: e.value,
682
+ children: e.label
683
+ }, e.value + t)) }) })]
684
+ });
685
+ return /* @__PURE__ */ L(_, {
686
+ className: "mb-4",
687
+ children: [
688
+ /* @__PURE__ */ L(r, {
689
+ htmlFor: k,
690
+ children: [y || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
691
+ className: "text-red-500",
692
+ children: "*"
693
+ })]
694
+ }),
695
+ N ? /* @__PURE__ */ I(xe, { children: /* @__PURE__ */ L(Se, { children: [/* @__PURE__ */ I(Ce, {
696
+ asChild: !0,
697
+ children: /* @__PURE__ */ I("div", {
698
+ className: "w-full",
699
+ children: oe
700
+ })
701
+ }), /* @__PURE__ */ I(we, { children: /* @__PURE__ */ I("p", { children: N }) })] }) }) : oe,
702
+ h && /* @__PURE__ */ I(t, { children: h }),
703
+ D && !h && /* @__PURE__ */ I(v, { children: D })
704
+ ]
705
+ });
706
+ }
707
+ return /* @__PURE__ */ L(_, {
708
+ className: "mb-4",
709
+ children: [
710
+ /* @__PURE__ */ L(r, {
711
+ htmlFor: k,
712
+ children: [y || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
713
+ className: "text-red-500",
714
+ children: "*"
715
+ })]
716
+ }),
717
+ /* @__PURE__ */ I(c, {
718
+ type: "text",
719
+ name: A,
720
+ id: k,
721
+ value: typeof o == "string" ? o : JSON.stringify(o),
722
+ readOnly: !0,
723
+ disabled: !0
724
+ }),
725
+ h && /* @__PURE__ */ I(t, { children: h }),
726
+ D && !h && /* @__PURE__ */ I(v, { children: D })
727
+ ]
728
+ });
729
+ }, Ae = ({ node: e, value: n, setValue: i, error: a, label: o, placeholder: s, helperText: l, name: u, id: d }) => /* @__PURE__ */ L(_, {
730
+ className: "mb-4",
731
+ children: [
732
+ /* @__PURE__ */ L(r, {
733
+ htmlFor: d,
734
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
735
+ className: "text-red-500",
736
+ children: "*"
737
+ })]
738
+ }),
739
+ /* @__PURE__ */ I(c, {
740
+ id: d,
741
+ type: "number",
742
+ name: u,
743
+ value: n ?? "",
744
+ onChange: (e) => i(e.target.value === "" ? null : Number(e.target.value)),
745
+ placeholder: s
746
+ }),
747
+ a && /* @__PURE__ */ I(t, { children: a }),
748
+ l && !a && /* @__PURE__ */ I(v, { children: l })
749
+ ]
750
+ }), je = ({ node: e, value: n, setValue: i, error: a, label: o, placeholder: s, helperText: l, name: u, id: d }) => /* @__PURE__ */ L(_, {
751
+ className: "mb-4",
752
+ children: [
753
+ /* @__PURE__ */ L(r, {
754
+ htmlFor: d,
755
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
756
+ className: "text-red-500",
757
+ children: "*"
758
+ })]
759
+ }),
760
+ /* @__PURE__ */ I(c, {
761
+ id: d,
762
+ name: u,
763
+ type: "password",
764
+ value: n ?? "",
765
+ onChange: (e) => i(e.target.value),
766
+ placeholder: s,
767
+ autoComplete: "new-password"
768
+ }),
769
+ a && /* @__PURE__ */ I(t, { children: a }),
770
+ l && !a && /* @__PURE__ */ I(v, { children: l })
771
+ ]
772
+ });
773
+ //#endregion
774
+ //#region src/shared/components/ui/radio-group.tsx
775
+ function Me({ className: e, ...t }) {
776
+ return /* @__PURE__ */ I(q.Root, {
777
+ "data-slot": "radio-group",
778
+ className: a("grid gap-3", e),
779
+ ...t
780
+ });
781
+ }
782
+ function Ne({ className: e, ...t }) {
783
+ return /* @__PURE__ */ I(q.Item, {
784
+ "data-slot": "radio-group-item",
785
+ className: a("aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40", e),
786
+ ...t,
787
+ children: /* @__PURE__ */ I(q.Indicator, {
788
+ "data-slot": "radio-group-indicator",
789
+ className: "relative flex items-center justify-center",
790
+ children: /* @__PURE__ */ I(ce, { className: "-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 size-2 fill-primary" })
791
+ })
792
+ });
793
+ }
794
+ //#endregion
795
+ //#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.tsx
796
+ var Pe = ({ node: e, value: n, setValue: i, error: o, label: s, helperText: c, id: l, name: u }) => {
797
+ let d = j(), f = n ? String(n) : "", p = e.data.variant === "card";
798
+ return /* @__PURE__ */ L(_, {
799
+ className: "mb-4",
800
+ children: [
801
+ /* @__PURE__ */ L(r, {
802
+ className: "mb-1",
803
+ htmlFor: l,
804
+ children: [s || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
805
+ className: "text-red-500",
806
+ children: "*"
807
+ })]
808
+ }),
809
+ /* @__PURE__ */ I(Me, {
810
+ value: f,
811
+ onValueChange: (e) => i(e),
812
+ id: l,
813
+ name: u,
814
+ className: p ? "flex flex-col gap-2" : void 0,
815
+ children: e.data.options?.map((e, t) => {
816
+ let n = `${l}-${e.value}`, i = d(e.label) || e.value, o = d(e.description), s = f === String(e.value);
817
+ return p ? /* @__PURE__ */ L(r, {
818
+ htmlFor: n,
819
+ className: a("flex cursor-pointer items-start gap-3 rounded-md border p-3 transition-colors", "hover:border-primary/50", s && "border-primary bg-primary/5", e.disabled && "pointer-events-none opacity-50"),
820
+ children: [
821
+ /* @__PURE__ */ I(Ne, {
822
+ value: String(e.value),
823
+ id: n,
824
+ disabled: e.disabled,
825
+ className: "mt-1"
826
+ }),
827
+ e.image && /* @__PURE__ */ I("img", {
828
+ src: e.image,
829
+ alt: "",
830
+ className: "h-10 w-10 shrink-0 rounded object-cover"
831
+ }),
832
+ /* @__PURE__ */ L("div", {
833
+ className: "flex min-w-0 flex-col",
834
+ children: [/* @__PURE__ */ I("span", {
835
+ className: "font-medium text-sm",
836
+ children: i
837
+ }), o && /* @__PURE__ */ I("span", {
838
+ className: "text-muted-foreground text-xs",
839
+ children: o
840
+ })]
841
+ })
842
+ ]
843
+ }, e.value + t) : /* @__PURE__ */ L("div", {
844
+ className: "flex items-start space-x-2",
845
+ children: [
846
+ /* @__PURE__ */ I(Ne, {
847
+ value: String(e.value),
848
+ id: n,
849
+ disabled: e.disabled,
850
+ className: "mt-0.5"
851
+ }),
852
+ e.image && /* @__PURE__ */ I("img", {
853
+ src: e.image,
854
+ alt: "",
855
+ className: "h-8 w-8 rounded object-cover"
856
+ }),
857
+ /* @__PURE__ */ L("div", {
858
+ className: "flex flex-col",
859
+ children: [/* @__PURE__ */ I(r, {
860
+ htmlFor: n,
861
+ className: "cursor-pointer font-normal text-sm",
862
+ children: i
863
+ }), o && /* @__PURE__ */ I("span", {
864
+ className: "text-muted-foreground text-xs",
865
+ children: o
866
+ })]
867
+ })
868
+ ]
869
+ }, e.value + t);
870
+ })
871
+ }),
872
+ o && /* @__PURE__ */ I(t, { children: o }),
873
+ c && !o && /* @__PURE__ */ I(v, { children: c })
874
+ ]
875
+ });
876
+ }, Fe = ({ node: e, value: i, setValue: a, error: o, label: s, placeholder: c, helperText: l, name: d, id: p }) => {
877
+ let h = j(), g = i ? String(i) : "";
878
+ return /* @__PURE__ */ L(_, {
879
+ className: "mb-4",
880
+ children: [
881
+ /* @__PURE__ */ L(r, {
882
+ htmlFor: p,
883
+ children: [s || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
884
+ className: "text-red-500",
885
+ children: "*"
886
+ })]
887
+ }),
888
+ /* @__PURE__ */ L(f, {
889
+ name: d,
890
+ value: g,
891
+ onValueChange: (e) => a(e),
892
+ children: [/* @__PURE__ */ I(u, {
893
+ id: p,
894
+ name: d,
895
+ className: "w-full",
896
+ children: /* @__PURE__ */ I(n, { placeholder: c || h("renderer.defaultSelectInput.selectOption") })
897
+ }), /* @__PURE__ */ I(C, { children: /* @__PURE__ */ I(T, { children: e.data.options?.map((e, t) => /* @__PURE__ */ I(m, {
898
+ value: String(e.value),
899
+ disabled: e.disabled,
900
+ children: h(e.label) ? h(e.label) : e.value
901
+ }, `${e.value}-${t}`)) }) })]
902
+ }),
903
+ o && /* @__PURE__ */ I(t, { children: o }),
904
+ l && !o && /* @__PURE__ */ I(v, { children: l })
905
+ ]
906
+ });
907
+ }, Ie = B(({ label: e, id: t, disabled: n, onBlur: r, onClick: i, onFocus: a, onPointerDown: o, onPointerLeave: s, onPointerMove: c, ...l }, u) => {
908
+ let d = j();
909
+ return /* @__PURE__ */ I("button", {
910
+ ref: u,
911
+ id: t,
912
+ onBlur: r,
913
+ onClick: i,
914
+ onFocus: a,
915
+ onPointerDown: o,
916
+ disabled: n,
917
+ onPointerLeave: s,
918
+ onPointerMove: c,
919
+ type: "submit",
920
+ className: "mt-4 rounded-md bg-blue-500 px-4 py-2 font-medium text-white transition-colors hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
921
+ ...l,
922
+ children: e || d("renderer.defaultSubmitButton.submit")
923
+ });
924
+ }), Le = ({ children: e, missingFields: t = [] }) => {
925
+ let n = t.length > 0, r = j();
926
+ return n ? /* @__PURE__ */ I(xe, { children: /* @__PURE__ */ L(Se, { children: [/* @__PURE__ */ I(Ce, {
927
+ asChild: !0,
928
+ children: e
929
+ }), /* @__PURE__ */ I(we, { children: /* @__PURE__ */ L("div", {
930
+ className: "space-y-1",
931
+ children: [/* @__PURE__ */ L("p", {
932
+ className: "font-semibold",
933
+ children: [r("renderer.defaultSubmitButton.requiredFieldsMissing"), ":"]
934
+ }), /* @__PURE__ */ I("ul", {
935
+ className: "list-inside list-disc",
936
+ children: t.map((e, t) => /* @__PURE__ */ I("li", { children: e }, t))
937
+ })]
938
+ }) })] }) }) : e;
939
+ }, Re = ({ missingRequiredFields: e, isSubmitting: t, label: n }) => {
940
+ let r = F(), i = r?.components?.submitButton, a = r?.components?.submitButtonWrapper;
941
+ return /* @__PURE__ */ I(a || Le, {
942
+ missingFields: e,
943
+ children: /* @__PURE__ */ I(i || Ie, {
944
+ label: n,
945
+ disabled: t
946
+ })
947
+ });
948
+ }, ze = ({ node: e, value: n, setValue: i, error: a, label: o, helperText: s, name: c, id: l }) => /* @__PURE__ */ L(_, {
949
+ className: "mb-4",
950
+ children: [
951
+ /* @__PURE__ */ L(r, {
952
+ htmlFor: l,
953
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
954
+ className: "text-red-500",
955
+ children: "*"
956
+ })]
957
+ }),
958
+ /* @__PURE__ */ I(h, {
959
+ id: l,
960
+ name: c,
961
+ checked: n,
962
+ onCheckedChange: i
963
+ }),
964
+ s && !a && /* @__PURE__ */ I(v, { children: s }),
965
+ a && /* @__PURE__ */ I(t, { children: a })
966
+ ]
967
+ }), Be = ({ node: e, value: n, setValue: i, error: a, label: o, placeholder: s, helperText: c, name: l, id: u }) => /* @__PURE__ */ L(_, {
968
+ className: "mb-4",
969
+ children: [
970
+ /* @__PURE__ */ L(r, {
971
+ htmlFor: u,
972
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
973
+ className: "text-red-500",
974
+ children: "*"
975
+ })]
976
+ }),
977
+ /* @__PURE__ */ I(y, {
978
+ id: u,
979
+ name: l,
980
+ value: n ?? "",
981
+ onChange: (e) => i(e.target.value),
982
+ placeholder: s,
983
+ className: "w-full rounded-md border px-3 py-2",
984
+ rows: 4
985
+ }),
986
+ a && /* @__PURE__ */ I(t, { children: a }),
987
+ c && !a && /* @__PURE__ */ I(v, { children: c })
988
+ ]
989
+ }), Ve = ({ node: e, value: n, setValue: i, error: a, label: o, placeholder: s, helperText: l, name: u, id: d }) => /* @__PURE__ */ L(_, {
990
+ className: "mb-4",
991
+ children: [
992
+ /* @__PURE__ */ L(r, {
993
+ htmlFor: d,
994
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
995
+ className: "text-red-500",
996
+ children: "*"
997
+ })]
998
+ }),
999
+ /* @__PURE__ */ I(c, {
1000
+ type: "text",
1001
+ id: d,
1002
+ name: u,
1003
+ value: n ?? "",
1004
+ onChange: (e) => i(e.target.value),
1005
+ placeholder: s
1006
+ }),
1007
+ a && /* @__PURE__ */ I(t, { children: a }),
1008
+ l && !a && /* @__PURE__ */ I(v, { children: l })
1009
+ ]
1010
+ }), He = ({ node: e, value: n, setValue: i, error: a, label: o, placeholder: s, helperText: l, name: u, id: d }) => /* @__PURE__ */ L(_, {
1011
+ className: "mb-4",
1012
+ children: [
1013
+ /* @__PURE__ */ L(r, {
1014
+ htmlFor: d,
1015
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
1016
+ className: "text-red-500",
1017
+ children: "*"
1018
+ })]
1019
+ }),
1020
+ /* @__PURE__ */ I(c, {
1021
+ type: "time",
1022
+ id: d,
1023
+ name: u,
1024
+ value: n ?? "",
1025
+ onChange: (e) => i(e.target.value),
1026
+ placeholder: s,
1027
+ className: "bg-background [color-scheme:light] dark:[color-scheme:dark]"
1028
+ }),
1029
+ a && /* @__PURE__ */ I(t, { children: a }),
1030
+ l && !a && /* @__PURE__ */ I(v, { children: l })
1031
+ ]
1032
+ }), Ue = ({ node: e, value: n, setValue: i, error: a, label: o, helperText: s, id: l, name: u }) => {
1033
+ let d = j(), f = Array.isArray(n) ? n : [], p = f[0] || "", m = f[1] || "", h = (e) => {
1034
+ i([e, m]);
1035
+ }, g = (e) => {
1036
+ i([p, e]);
1037
+ };
1038
+ return /* @__PURE__ */ L(_, {
1039
+ className: "mb-4",
1040
+ children: [
1041
+ /* @__PURE__ */ L(r, {
1042
+ htmlFor: `${l}-start`,
1043
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ I("span", {
1044
+ className: "text-red-500",
1045
+ children: "*"
1046
+ })]
1047
+ }),
1048
+ /* @__PURE__ */ L("div", {
1049
+ className: "flex gap-2",
1050
+ children: [/* @__PURE__ */ I(c, {
1051
+ id: `${l}-start`,
1052
+ name: `${u}-start`,
1053
+ "aria-label": `${o || e.data.name} - ${d("renderer.defaultInputs.startTime")}`,
1054
+ "aria-invalid": !!a,
1055
+ "aria-describedby": a ? `${e.id}-error` : void 0,
1056
+ type: "time",
1057
+ value: p,
1058
+ onChange: (e) => h(e.target.value),
1059
+ placeholder: d("renderer.defaultInputs.startTime"),
1060
+ className: "flex-1 bg-background [color-scheme:light] dark:[color-scheme:dark]"
1061
+ }), /* @__PURE__ */ I(c, {
1062
+ id: `${l}-end`,
1063
+ name: `${u}-end`,
1064
+ "aria-label": `${o || e.data.name} - ${d("renderer.defaultInputs.endTime")}`,
1065
+ "aria-invalid": !!a,
1066
+ "aria-describedby": a ? `${e.id}-error` : void 0,
1067
+ type: "time",
1068
+ value: m,
1069
+ onChange: (e) => g(e.target.value),
1070
+ placeholder: d("renderer.defaultInputs.endTime"),
1071
+ className: "flex-1 bg-background [color-scheme:light] dark:[color-scheme:dark]"
1072
+ })]
1073
+ }),
1074
+ a && /* @__PURE__ */ I(t, { children: a }),
1075
+ s && !a && /* @__PURE__ */ I(v, { children: s })
1076
+ ]
1077
+ });
1078
+ }, We = {
1079
+ address: _e,
1080
+ autocomplete: ve,
1081
+ checkbox: Y,
1082
+ date: Q,
1083
+ daterange: ye,
1084
+ file: $,
1085
+ hidden: be,
1086
+ http: ke,
1087
+ number: Ae,
1088
+ password: je,
1089
+ radio: Pe,
1090
+ select: Fe,
1091
+ submit: Re,
1092
+ switch: ze,
1093
+ text: Ve,
1094
+ textarea: Be,
1095
+ time: He,
1096
+ timerange: Ue
1097
+ }, Ge = ({ node: e }) => {
1098
+ let t = j()(e.data?.label);
1099
+ return t ? /* @__PURE__ */ L("div", {
1100
+ className: "flex items-center gap-x-3",
1101
+ children: [
1102
+ /* @__PURE__ */ I(S, { className: "my-8 flex-1" }),
1103
+ /* @__PURE__ */ I("h4", {
1104
+ className: "font-semibold text-sm",
1105
+ children: t
1106
+ }),
1107
+ /* @__PURE__ */ I(S, { className: "my-8 flex-1" })
1108
+ ]
1109
+ }) : /* @__PURE__ */ I(S, { className: "my-8" });
1110
+ }, Ke = ({ node: e }) => {
1111
+ let { edges: t } = O(), n = j();
1112
+ return /* @__PURE__ */ I("h2", {
1113
+ className: a("mb-5 font-bold text-2xl", !k(e.id, t) && "mt-10"),
1114
+ children: n(e.data?.label)
1115
+ });
1116
+ }, qe = {
1117
+ divider: Ge,
1118
+ title: Ke
1119
+ }, Je = ({ components: t, className: n, flows: r, googleApiKey: i, language: o, onChange: s, onSubmit: c, theme: l, validate: u, validationMode: d, initialValues: f = {} }) => {
1120
+ let { canSubmit: p, clearSubmitMessage: m, config: h, firstErrorFieldId: g, formErrors: _, formValues: v, handleSubmit: y, inputNodes: b, isSubmitting: ee, mergedFlow: te, missingRequiredFields: x, setFieldValue: S, submitMessage: C, t: w, visibleNodes: T, visibleRootNodes: E } = D({
1121
+ components: t,
1122
+ flows: r,
1123
+ googleApiKey: i,
1124
+ initialValues: f,
1125
+ language: o,
1126
+ onChange: s,
1127
+ onSubmit: c,
1128
+ theme: l,
1129
+ validate: u,
1130
+ validationMode: d
1131
+ }), { FormWrapper: ne, SubmitButton: O, SubmitButtonWrapper: k, renderNode: re } = P({
1132
+ config: h,
1133
+ DefaultFormWrapper: me,
1134
+ DefaultGroup: J,
1135
+ DefaultSubmitButton: Ie,
1136
+ DefaultSubmitButtonWrapper: Le,
1137
+ defaultInputRenderers: We,
1138
+ defaultUI: qe,
1139
+ formErrors: _,
1140
+ formValues: v,
1141
+ missingRequiredFields: x,
1142
+ setFieldValue: S,
1143
+ visibleNodes: T
1144
+ }), A = fe(async (e) => {
1145
+ e.preventDefault(), !await y() && g && document.getElementById(g)?.focus();
1146
+ }, [y, g]);
1147
+ return /* @__PURE__ */ I("div", {
1148
+ className: a("treege", n),
1149
+ children: /* @__PURE__ */ I(e, {
1150
+ theme: h.theme,
1151
+ storageKey: "treege-renderer-theme",
1152
+ children: /* @__PURE__ */ L(N, {
1153
+ value: {
1154
+ flows: te,
1155
+ formErrors: _,
1156
+ formValues: v,
1157
+ googleApiKey: h.googleApiKey,
1158
+ inputNodes: b,
1159
+ language: h.language,
1160
+ setFieldValue: S
1161
+ },
1162
+ children: [/* @__PURE__ */ L(ne, {
1163
+ onSubmit: A,
1164
+ children: [
1165
+ E.map((e) => re(e)),
1166
+ p && /* @__PURE__ */ I(k, {
1167
+ missingFields: x,
1168
+ children: /* @__PURE__ */ I(O, {
1169
+ label: w("renderer.defaultSubmitButton.submit"),
1170
+ disabled: ee
1171
+ })
1172
+ }),
1173
+ /* @__PURE__ */ I("p", {
1174
+ className: "py-2 text-muted-foreground text-xs",
1175
+ children: "Powered by Treege"
1176
+ })
1177
+ ]
1178
+ }), C && /* @__PURE__ */ I("div", {
1179
+ className: `my-4 rounded-md p-4 ${C.type === "success" ? "bg-green-50 text-green-800 dark:bg-green-900/20 dark:text-green-300" : "bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,
1180
+ role: "alert",
1181
+ children: /* @__PURE__ */ L("div", {
1182
+ className: "flex items-center justify-between",
1183
+ children: [/* @__PURE__ */ I("p", {
1184
+ className: "font-medium text-sm",
1185
+ children: C.message
1186
+ }), /* @__PURE__ */ I("button", {
1187
+ type: "button",
1188
+ onClick: m,
1189
+ className: "ml-4 font-medium text-sm underline hover:no-underline focus:outline-none",
1190
+ children: w("common.close")
1191
+ })]
1192
+ })
1193
+ })]
1194
+ })
1195
+ })
1196
+ });
1197
+ };
1198
+ //#endregion
1199
+ export { J as C, _e as S, $ as _, We as a, Y as b, Ve as c, Fe as d, Pe as f, be as g, ke as h, qe as i, Be as l, Ae as m, Ge as n, Ue as o, je as p, Ke as r, He as s, Je as t, ze as u, ye as v, ve as x, Q as y };