@nice2dev/ui-3d 1.0.5 → 1.0.6

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.
Files changed (95) hide show
  1. package/dist/cjs/core/i18n.js +3 -3
  2. package/dist/cjs/dance/DanceBridge.js +13 -13
  3. package/dist/cjs/dance/DanceScoreEngine.js +8 -8
  4. package/dist/cjs/dance/PoseDetector.js +20 -20
  5. package/dist/cjs/material/NiceMaterialEditor.js +19 -19
  6. package/dist/cjs/model/ModelEditorLeftPanel.js +5 -5
  7. package/dist/cjs/model/ModelEditorLeftPanel.js.map +1 -1
  8. package/dist/cjs/model/ModelEditorMenuBar.js +6 -5
  9. package/dist/cjs/model/ModelEditorMenuBar.js.map +1 -1
  10. package/dist/cjs/model/ModelEditorRightPanel.js +19 -17
  11. package/dist/cjs/model/ModelEditorRightPanel.js.map +1 -1
  12. package/dist/cjs/model/ModelEditorSubComponents.js +10 -9
  13. package/dist/cjs/model/ModelEditorSubComponents.js.map +1 -1
  14. package/dist/cjs/model/ModelEditorTimeline.js +6 -5
  15. package/dist/cjs/model/ModelEditorTimeline.js.map +1 -1
  16. package/dist/cjs/model/ModelEditorToolbar.js +4 -4
  17. package/dist/cjs/model/ModelEditorToolbar.js.map +1 -1
  18. package/dist/cjs/model/ModelEditorViewport.js +2 -2
  19. package/dist/cjs/model/ModelViewer.js +14 -13
  20. package/dist/cjs/model/ModelViewer.js.map +1 -1
  21. package/dist/cjs/model/NiceArmatureEditor.js +18 -18
  22. package/dist/cjs/model/NiceMorphTargetEditor.js +18 -18
  23. package/dist/cjs/model/NiceOctree.js +16 -16
  24. package/dist/cjs/model/NicePhysicsSimulation.js +24 -24
  25. package/dist/cjs/model/NiceProceduralGeometry.js +8 -8
  26. package/dist/cjs/model/NiceTerrainEditor.js +19 -19
  27. package/dist/cjs/model/NiceWeightPainter.js +14 -14
  28. package/dist/cjs/model/NiceXRPreview.js +18 -18
  29. package/dist/cjs/model/useModelEditor.js +127 -127
  30. package/dist/cjs/model/useModelViewer.js +61 -61
  31. package/dist/cjs/particle/NiceParticleEditor.js +11 -11
  32. package/dist/cjs/rendering/NiceCascadedShadows.js +12 -12
  33. package/dist/cjs/rendering/NiceRenderExport.js +5 -5
  34. package/dist/cjs/rendering/NiceSSAO.js +18 -18
  35. package/dist/cjs/rendering/NiceSSR.js +14 -14
  36. package/dist/cjs/rendering/NiceWebGPURenderer.js +21 -21
  37. package/dist/cjs/ui/dist/NiceButton-DmTHNHet.js +453 -0
  38. package/dist/cjs/ui/dist/NiceButton-DmTHNHet.js.map +1 -0
  39. package/dist/cjs/ui/dist/NiceErrorBoundary-D1hh5GGe.js +543 -0
  40. package/dist/cjs/ui/dist/NiceErrorBoundary-D1hh5GGe.js.map +1 -0
  41. package/dist/cjs/ui/dist/NiceModuleLifecyclePanel-BapdidD6.js +4772 -0
  42. package/dist/cjs/ui/dist/NiceModuleLifecyclePanel-BapdidD6.js.map +1 -0
  43. package/dist/cjs/ui/dist/NicePinCodeInput-4q8yULuo.js +11329 -0
  44. package/dist/cjs/ui/dist/NicePinCodeInput-4q8yULuo.js.map +1 -0
  45. package/dist/cjs/ui/dist/NiceSavedQueryPanel-DUw8plYP.js +5544 -0
  46. package/dist/cjs/ui/dist/NiceSavedQueryPanel-DUw8plYP.js.map +1 -0
  47. package/dist/cjs/ui/dist/NiceStockChart-Cpmv9_Cc.js +2244 -0
  48. package/dist/cjs/ui/dist/NiceStockChart-Cpmv9_Cc.js.map +1 -0
  49. package/dist/cjs/ui/dist/NiceToggle-C1UKGXmJ.js +212 -0
  50. package/dist/cjs/ui/dist/NiceToggle-C1UKGXmJ.js.map +1 -0
  51. package/dist/cjs/ui/dist/NiceWindow-D1awkyFl.js +697 -0
  52. package/dist/cjs/ui/dist/NiceWindow-D1awkyFl.js.map +1 -0
  53. package/dist/cjs/ui/dist/core-CfXsl755.js +9597 -0
  54. package/dist/cjs/ui/dist/core-CfXsl755.js.map +1 -0
  55. package/dist/cjs/ui/dist/index-CNwVELPJ.js +31214 -0
  56. package/dist/cjs/ui/dist/index-CNwVELPJ.js.map +1 -0
  57. package/dist/cjs/ui/dist/index-x8mRM4Jc.js +20 -0
  58. package/dist/cjs/ui/dist/index-x8mRM4Jc.js.map +1 -0
  59. package/dist/cjs/uv/NiceUVEditor.js +24 -24
  60. package/dist/esm/model/ModelEditorLeftPanel.js +5 -5
  61. package/dist/esm/model/ModelEditorMenuBar.js +6 -5
  62. package/dist/esm/model/ModelEditorMenuBar.js.map +1 -1
  63. package/dist/esm/model/ModelEditorRightPanel.js +19 -17
  64. package/dist/esm/model/ModelEditorRightPanel.js.map +1 -1
  65. package/dist/esm/model/ModelEditorSubComponents.js +7 -6
  66. package/dist/esm/model/ModelEditorSubComponents.js.map +1 -1
  67. package/dist/esm/model/ModelEditorTimeline.js +6 -5
  68. package/dist/esm/model/ModelEditorTimeline.js.map +1 -1
  69. package/dist/esm/model/ModelEditorToolbar.js +4 -4
  70. package/dist/esm/model/ModelEditorViewport.js +2 -2
  71. package/dist/esm/model/ModelViewer.js +6 -5
  72. package/dist/esm/model/ModelViewer.js.map +1 -1
  73. package/dist/esm/ui/dist/NiceButton-DmTHNHet.js +448 -0
  74. package/dist/esm/ui/dist/NiceButton-DmTHNHet.js.map +1 -0
  75. package/dist/esm/ui/dist/NiceErrorBoundary-D1hh5GGe.js +533 -0
  76. package/dist/esm/ui/dist/NiceErrorBoundary-D1hh5GGe.js.map +1 -0
  77. package/dist/esm/ui/dist/NiceModuleLifecyclePanel-BapdidD6.js +4731 -0
  78. package/dist/esm/ui/dist/NiceModuleLifecyclePanel-BapdidD6.js.map +1 -0
  79. package/dist/esm/ui/dist/NicePinCodeInput-4q8yULuo.js +11259 -0
  80. package/dist/esm/ui/dist/NicePinCodeInput-4q8yULuo.js.map +1 -0
  81. package/dist/esm/ui/dist/NiceSavedQueryPanel-DUw8plYP.js +5527 -0
  82. package/dist/esm/ui/dist/NiceSavedQueryPanel-DUw8plYP.js.map +1 -0
  83. package/dist/esm/ui/dist/NiceStockChart-Cpmv9_Cc.js +2222 -0
  84. package/dist/esm/ui/dist/NiceStockChart-Cpmv9_Cc.js.map +1 -0
  85. package/dist/esm/ui/dist/NiceToggle-C1UKGXmJ.js +208 -0
  86. package/dist/esm/ui/dist/NiceToggle-C1UKGXmJ.js.map +1 -0
  87. package/dist/esm/ui/dist/NiceWindow-D1awkyFl.js +686 -0
  88. package/dist/esm/ui/dist/NiceWindow-D1awkyFl.js.map +1 -0
  89. package/dist/esm/ui/dist/core-CfXsl755.js +9419 -0
  90. package/dist/esm/ui/dist/core-CfXsl755.js.map +1 -0
  91. package/dist/esm/ui/dist/index-CNwVELPJ.js +31110 -0
  92. package/dist/esm/ui/dist/index-CNwVELPJ.js.map +1 -0
  93. package/dist/esm/ui/dist/index-x8mRM4Jc.js +18 -0
  94. package/dist/esm/ui/dist/index-x8mRM4Jc.js.map +1 -0
  95. package/package.json +1 -1
@@ -0,0 +1,4731 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import we, { useState, useCallback, useId, useRef, forwardRef, useEffect, useMemo, createContext } from 'react';
3
+ import { c as ll, d as cl, a as ei, u as ys, b as de, g as vs } from './core-CfXsl755.js';
4
+ import { b as Re, a as De, N as Ae, c as Fe$1 } from './NiceButton-DmTHNHet.js';
5
+ import { a as ie, b as le, N as se } from './NiceToggle-C1UKGXmJ.js';
6
+
7
+ const ia = ({
8
+ tabs: n,
9
+ activeTab: a,
10
+ onChange: i,
11
+ variant: l = "default",
12
+ vertical: s,
13
+ size: h = "md",
14
+ className: o,
15
+ style: b,
16
+ displayStyle: r
17
+ }) => {
18
+ const t = ll("tab", r), u = cl("tab", r), [m, w] = useState(a || n[0]?.id), d = a ?? m, g = useCallback(
19
+ (M) => {
20
+ w(M), i?.(M);
21
+ },
22
+ [i]
23
+ ), z = n.find((M) => M.id === d)?.content;
24
+ return /* @__PURE__ */ jsxs(
25
+ "div",
26
+ {
27
+ className: `nice-tabs nice-tabs--${h} nice-tabs--ds-${u} ${o || ""}`,
28
+ style: { ...t, ...b, ...s ? { display: "flex", gap: 16 } : {} },
29
+ children: [
30
+ /* @__PURE__ */ jsx(
31
+ "div",
32
+ {
33
+ className: `nice-tabs__list ${l !== "default" ? `nice-tabs__list--${l}` : ""} ${s ? "nice-tabs__list--vertical" : ""}`,
34
+ role: "tablist",
35
+ children: n.map((M) => /* @__PURE__ */ jsxs(
36
+ "button",
37
+ {
38
+ role: "tab",
39
+ "aria-selected": d === M.id,
40
+ className: `nice-tabs__tab ${d === M.id ? "nice-tabs__tab--active" : ""} ${M.disabled ? "nice-tabs__tab--disabled" : ""}`,
41
+ disabled: M.disabled,
42
+ onClick: () => g(M.id),
43
+ children: [
44
+ M.icon,
45
+ /* @__PURE__ */ jsx("span", { children: M.label }),
46
+ M.badge !== void 0 && /* @__PURE__ */ jsx("span", { className: "nice-tabs__badge", children: M.badge })
47
+ ]
48
+ },
49
+ M.id
50
+ ))
51
+ }
52
+ ),
53
+ z && /* @__PURE__ */ jsx("div", { className: "nice-tabs__panel", role: "tabpanel", children: z })
54
+ ]
55
+ }
56
+ );
57
+ }, ca = ({
58
+ items: n,
59
+ multiple: a = false,
60
+ defaultOpen: i = [],
61
+ size: l = "md",
62
+ className: s,
63
+ style: h,
64
+ displayStyle: o
65
+ }) => {
66
+ cl("card", o);
67
+ const [b, r] = useState(new Set(i)), t = useId(), u = useCallback(
68
+ (m) => {
69
+ r((w) => {
70
+ const d = new Set(w);
71
+ return d.has(m) ? d.delete(m) : (a || d.clear(), d.add(m)), d;
72
+ });
73
+ },
74
+ [a]
75
+ );
76
+ return /* @__PURE__ */ jsx("div", { className: `nice-accordion nice-accordion--${l} ${s || ""}`, style: h, children: n.map((m, w) => {
77
+ const d = b.has(m.id), g = `${t}-trigger-${w}`, z = `${t}-panel-${w}`;
78
+ return /* @__PURE__ */ jsxs("div", { className: "nice-accordion__item", children: [
79
+ /* @__PURE__ */ jsxs(
80
+ "button",
81
+ {
82
+ id: g,
83
+ className: "nice-accordion__trigger",
84
+ onClick: () => !m.disabled && u(m.id),
85
+ "aria-expanded": d,
86
+ "aria-controls": z,
87
+ "aria-disabled": m.disabled,
88
+ disabled: m.disabled,
89
+ children: [
90
+ /* @__PURE__ */ jsx("span", { children: m.title }),
91
+ /* @__PURE__ */ jsx(
92
+ "svg",
93
+ {
94
+ className: `nice-accordion__chevron ${d ? "nice-accordion__chevron--open" : ""}`,
95
+ viewBox: "0 0 20 20",
96
+ fill: "currentColor",
97
+ "aria-hidden": "true",
98
+ children: /* @__PURE__ */ jsx(
99
+ "path",
100
+ {
101
+ fillRule: "evenodd",
102
+ d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",
103
+ clipRule: "evenodd"
104
+ }
105
+ )
106
+ }
107
+ )
108
+ ]
109
+ }
110
+ ),
111
+ d && /* @__PURE__ */ jsx(
112
+ "div",
113
+ {
114
+ id: z,
115
+ className: "nice-accordion__content",
116
+ role: "region",
117
+ "aria-labelledby": g,
118
+ children: m.content
119
+ }
120
+ )
121
+ ] }, m.id);
122
+ }) });
123
+ }, la = ({
124
+ items: n,
125
+ separator: a = "/",
126
+ size: i = "md",
127
+ className: l,
128
+ style: s
129
+ }) => /* @__PURE__ */ jsx(
130
+ "nav",
131
+ {
132
+ className: `nice-breadcrumb nice-breadcrumb--${i} ${l || ""}`,
133
+ style: s,
134
+ "aria-label": "Breadcrumb",
135
+ children: n.map((h, o) => /* @__PURE__ */ jsxs(we.Fragment, { children: [
136
+ o > 0 && /* @__PURE__ */ jsx("span", { className: "nice-breadcrumb__separator", children: a }),
137
+ o === n.length - 1 ? /* @__PURE__ */ jsx("span", { className: "nice-breadcrumb__current", "aria-current": "page", children: h.label }) : /* @__PURE__ */ jsx("span", { className: "nice-breadcrumb__item", children: /* @__PURE__ */ jsx(
138
+ "a",
139
+ {
140
+ className: "nice-breadcrumb__link",
141
+ href: h.href,
142
+ onClick: (b) => {
143
+ h.onClick && (b.preventDefault(), h.onClick());
144
+ },
145
+ children: h.label
146
+ }
147
+ ) })
148
+ ] }, o))
149
+ }
150
+ );
151
+ function nn(n, a, i) {
152
+ const l = [], s = Math.max(2, n - i), h = Math.min(a - 1, n + i);
153
+ l.push(1), s > 2 && l.push("dots");
154
+ for (let o = s; o <= h; o++) l.push(o);
155
+ return h < a - 1 && l.push("dots"), a > 1 && l.push(a), l;
156
+ }
157
+ const ta = ({
158
+ page: n,
159
+ totalPages: a,
160
+ onChange: i,
161
+ showInfo: l,
162
+ siblingCount: s = 1,
163
+ size: h = "md",
164
+ className: o,
165
+ style: b
166
+ }) => {
167
+ const r = nn(n, a, s);
168
+ return /* @__PURE__ */ jsxs(
169
+ "nav",
170
+ {
171
+ className: `nice-pagination nice-pagination--${h} ${o || ""}`,
172
+ style: b,
173
+ "aria-label": "Pagination",
174
+ children: [
175
+ /* @__PURE__ */ jsx(
176
+ "button",
177
+ {
178
+ className: "nice-pagination__btn",
179
+ disabled: n <= 1,
180
+ onClick: () => i(n - 1),
181
+ "aria-label": "Previous",
182
+ children: /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx(
183
+ "path",
184
+ {
185
+ fillRule: "evenodd",
186
+ d: "M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",
187
+ clipRule: "evenodd"
188
+ }
189
+ ) })
190
+ }
191
+ ),
192
+ r.map(
193
+ (t, u) => t === "dots" ? /* @__PURE__ */ jsx("span", { className: "nice-pagination__ellipsis", children: "…" }, `dots-${u}`) : /* @__PURE__ */ jsx(
194
+ "button",
195
+ {
196
+ className: `nice-pagination__btn ${t === n ? "nice-pagination__btn--active" : ""}`,
197
+ onClick: () => i(t),
198
+ "aria-current": t === n ? "page" : void 0,
199
+ children: t
200
+ },
201
+ t
202
+ )
203
+ ),
204
+ /* @__PURE__ */ jsx(
205
+ "button",
206
+ {
207
+ className: "nice-pagination__btn",
208
+ disabled: n >= a,
209
+ onClick: () => i(n + 1),
210
+ "aria-label": "Next",
211
+ children: /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx(
212
+ "path",
213
+ {
214
+ fillRule: "evenodd",
215
+ d: "M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",
216
+ clipRule: "evenodd"
217
+ }
218
+ ) })
219
+ }
220
+ ),
221
+ l && /* @__PURE__ */ jsxs("span", { className: "nice-pagination__info", children: [
222
+ n,
223
+ " / ",
224
+ a
225
+ ] })
226
+ ]
227
+ }
228
+ );
229
+ }, sa = ({
230
+ children: n,
231
+ title: a,
232
+ headerExtra: i,
233
+ footer: l,
234
+ hoverable: s,
235
+ onClick: h,
236
+ size: o = "md",
237
+ className: b,
238
+ style: r,
239
+ displayStyle: t
240
+ }) => {
241
+ const u = ll("card", t), m = cl("card", t);
242
+ return /* @__PURE__ */ jsxs(
243
+ "div",
244
+ {
245
+ className: `nice-card nice-card--${o} nice-card--ds-${m} ${s ? "nice-card--hoverable" : ""} ${h ? "nice-card--clickable" : ""} ${b || ""}`,
246
+ style: { ...u, ...r },
247
+ onClick: h,
248
+ role: h ? "button" : void 0,
249
+ tabIndex: h ? 0 : void 0,
250
+ children: [
251
+ (a || i) && /* @__PURE__ */ jsxs("div", { className: "nice-card__header", children: [
252
+ a && /* @__PURE__ */ jsx("h3", { className: "nice-card__title", children: a }),
253
+ i
254
+ ] }),
255
+ /* @__PURE__ */ jsx("div", { className: "nice-card__body", children: n }),
256
+ l && /* @__PURE__ */ jsx("div", { className: "nice-card__footer", children: l })
257
+ ]
258
+ }
259
+ );
260
+ }, an = ({
261
+ items: n,
262
+ orientation: a = "horizontal",
263
+ onItemClick: i,
264
+ size: l = "md",
265
+ className: s,
266
+ style: h,
267
+ accessMode: o,
268
+ id: b,
269
+ displayStyle: r
270
+ }) => {
271
+ if (ll("menu", r), cl("menu", r), ei(o, b) === "hidden") return null;
272
+ const [u, m] = useState(null), [w, d] = useState(-1), g = useRef(null), z = n.filter((f) => !f.disabled), M = useCallback(
273
+ (f) => {
274
+ const $ = a === "horizontal", p = $ ? "ArrowLeft" : "ArrowUp", y = $ ? "ArrowRight" : "ArrowDown";
275
+ if (f.key === p)
276
+ f.preventDefault(), d((x) => x <= 0 ? z.length - 1 : x - 1);
277
+ else if (f.key === y)
278
+ f.preventDefault(), d((x) => x >= z.length - 1 ? 0 : x + 1);
279
+ else if (f.key === "Enter" || f.key === " ") {
280
+ f.preventDefault();
281
+ const x = z[w];
282
+ x && (x.items?.length ? m(u === x.key ? null : x.key) : (x.onClick?.(), i?.(x)));
283
+ } else f.key === "Escape" && m(null);
284
+ },
285
+ [a, z, w, u, i]
286
+ ), T = (f, $) => {
287
+ const p = f.items && f.items.length > 0, y = u === f.key, x = z[w]?.key === f.key;
288
+ return /* @__PURE__ */ jsxs(
289
+ "li",
290
+ {
291
+ className: `nice-menu__item ${f.disabled ? "nice-menu__item--disabled" : ""} ${p ? "nice-menu__item--has-children" : ""} ${x ? "nice-menu__item--focused" : ""}`,
292
+ onMouseEnter: () => p && m(f.key),
293
+ onMouseLeave: () => p && m(null),
294
+ role: "none",
295
+ children: [
296
+ /* @__PURE__ */ jsxs(
297
+ "button",
298
+ {
299
+ type: "button",
300
+ className: "nice-menu__link",
301
+ disabled: f.disabled,
302
+ tabIndex: x ? 0 : -1,
303
+ role: "menuitem",
304
+ "aria-haspopup": p || void 0,
305
+ "aria-expanded": p ? y : void 0,
306
+ onClick: () => {
307
+ f.disabled || (f.onClick?.(), i?.(f));
308
+ },
309
+ children: [
310
+ f.icon && /* @__PURE__ */ jsx("span", { className: "nice-menu__icon", children: f.icon }),
311
+ /* @__PURE__ */ jsx("span", { children: f.text }),
312
+ p && /* @__PURE__ */ jsx("span", { className: "nice-menu__arrow", children: "▸" })
313
+ ]
314
+ }
315
+ ),
316
+ p && y && /* @__PURE__ */ jsx("ul", { className: "nice-menu__submenu", role: "menu", children: f.items.map((C, A) => T(C)) })
317
+ ]
318
+ },
319
+ f.key
320
+ );
321
+ };
322
+ return /* @__PURE__ */ jsx(
323
+ "nav",
324
+ {
325
+ className: `nice-menu nice-menu--${a} nice-menu--${l} ${s || ""}`,
326
+ style: h,
327
+ children: /* @__PURE__ */ jsx(
328
+ "ul",
329
+ {
330
+ ref: g,
331
+ className: "nice-menu__list",
332
+ role: "menubar",
333
+ tabIndex: 0,
334
+ onKeyDown: M,
335
+ onFocus: () => w < 0 && d(0),
336
+ children: n.map((f, $) => T(f))
337
+ }
338
+ )
339
+ }
340
+ );
341
+ };
342
+ an.displayName = "NiceMenu";
343
+ const ra = ({
344
+ items: n,
345
+ target: a,
346
+ onItemClick: i,
347
+ size: l = "md",
348
+ className: s,
349
+ style: h
350
+ }) => {
351
+ const [o, b] = useState(null), r = useRef(null);
352
+ return vs(r, () => b(null)), useEffect(() => {
353
+ const t = a.current;
354
+ if (!t) return;
355
+ const u = (m) => {
356
+ m.preventDefault(), b({ x: m.clientX, y: m.clientY });
357
+ };
358
+ return t.addEventListener("contextmenu", u), () => t.removeEventListener("contextmenu", u);
359
+ }, [a]), o ? /* @__PURE__ */ jsx(
360
+ "div",
361
+ {
362
+ ref: r,
363
+ className: `nice-contextmenu nice-contextmenu--${l} ${s || ""}`,
364
+ style: { position: "fixed", left: o.x, top: o.y, zIndex: 1e4, ...h },
365
+ children: /* @__PURE__ */ jsx("ul", { className: "nice-contextmenu__list", role: "menu", children: n.map((t) => /* @__PURE__ */ jsx(
366
+ "li",
367
+ {
368
+ className: `nice-contextmenu__item ${t.disabled ? "nice-contextmenu__item--disabled" : ""}`,
369
+ role: "none",
370
+ children: /* @__PURE__ */ jsxs(
371
+ "button",
372
+ {
373
+ type: "button",
374
+ className: "nice-contextmenu__btn",
375
+ disabled: t.disabled,
376
+ "aria-disabled": t.disabled,
377
+ role: "menuitem",
378
+ onClick: () => {
379
+ t.onClick?.(), i?.(t), b(null);
380
+ },
381
+ children: [
382
+ t.icon && /* @__PURE__ */ jsx("span", { className: "nice-contextmenu__icon", "aria-hidden": "true", children: t.icon }),
383
+ /* @__PURE__ */ jsx("span", { children: t.text })
384
+ ]
385
+ }
386
+ )
387
+ },
388
+ t.key
389
+ )) })
390
+ }
391
+ ) : null;
392
+ }, oa = ({
393
+ items: n,
394
+ selectedIndex: a,
395
+ onSelectedIndexChange: i,
396
+ animationEnabled: l = true,
397
+ size: s = "md",
398
+ className: h,
399
+ style: o,
400
+ accessMode: b,
401
+ id: r
402
+ }) => {
403
+ if (ei(b, r) === "hidden") return null;
404
+ const [u, m] = useState(0), d = n[a ?? u];
405
+ return d ? /* @__PURE__ */ jsx(
406
+ "div",
407
+ {
408
+ className: `nice-multiview nice-multiview--${s} ${l ? "nice-multiview--animated" : ""} ${h || ""}`,
409
+ style: o,
410
+ children: /* @__PURE__ */ jsx("div", { className: "nice-multiview__content", children: d.render() }, d.key)
411
+ }
412
+ ) : null;
413
+ }, da = ({
414
+ items: n,
415
+ selectedKey: a,
416
+ onSelectedKeyChange: i,
417
+ tabPosition: l = "top",
418
+ size: s = "md",
419
+ className: h,
420
+ style: o,
421
+ displayStyle: b
422
+ }) => {
423
+ cl("tab", b);
424
+ const [r, t] = useState(n[0]?.key ?? ""), u = a ?? r, m = (z) => {
425
+ i ? i(z) : t(z);
426
+ }, w = n.find((z) => z.key === u), d = l === "left" || l === "right", g = /* @__PURE__ */ jsx(
427
+ "div",
428
+ {
429
+ className: "nice-tabpanel__tabs",
430
+ role: "tablist",
431
+ style: { display: "flex", flexDirection: d ? "column" : "row" },
432
+ children: n.map((z) => /* @__PURE__ */ jsxs(
433
+ "button",
434
+ {
435
+ type: "button",
436
+ role: "tab",
437
+ className: `nice-tabpanel__tab ${z.key === u ? "nice-tabpanel__tab--active" : ""}`,
438
+ disabled: z.disabled,
439
+ onClick: () => !z.disabled && m(z.key),
440
+ "aria-selected": z.key === u,
441
+ children: [
442
+ z.icon && /* @__PURE__ */ jsx("span", { className: "nice-tabpanel__tab-icon", children: z.icon }),
443
+ /* @__PURE__ */ jsx("span", { children: z.title }),
444
+ z.badge && /* @__PURE__ */ jsx("span", { className: "nice-tabpanel__tab-badge", children: z.badge })
445
+ ]
446
+ },
447
+ z.key
448
+ ))
449
+ }
450
+ );
451
+ return /* @__PURE__ */ jsxs(
452
+ "div",
453
+ {
454
+ className: `nice-tabpanel nice-tabpanel--${l} ${h || ""}`,
455
+ style: { display: "flex", flexDirection: d ? "row" : "column", ...o },
456
+ children: [
457
+ (l === "top" || l === "left") && g,
458
+ /* @__PURE__ */ jsx("div", { className: "nice-tabpanel__content", role: "tabpanel", children: w?.render() }),
459
+ (l === "bottom" || l === "right") && g
460
+ ]
461
+ }
462
+ );
463
+ }, ua = ({
464
+ panes: n,
465
+ orientation: a = "horizontal",
466
+ gutterSize: i = 6,
467
+ onResize: l,
468
+ className: s,
469
+ style: h,
470
+ accessMode: o,
471
+ id: b
472
+ }) => {
473
+ if (ei(o, b) === "hidden") return null;
474
+ const t = useRef(null), [u, m] = useState(
475
+ () => n.map(() => 100 / n.length)
476
+ ), w = useCallback((g, z) => {
477
+ z.preventDefault();
478
+ const M = t.current;
479
+ if (!M) return;
480
+ const T = a === "horizontal", f = T ? M.offsetWidth : M.offsetHeight, $ = T ? z.clientX : z.clientY, p = [...u], y = (C) => {
481
+ const A = ((T ? C.clientX : C.clientY) - $) / f * 100, S = [...p], k = n[g].minSize ? n[g].minSize / f * 100 : 5, N = n[g + 1].minSize ? n[g + 1].minSize / f * 100 : 5;
482
+ let D = p[g] + A, _ = p[g + 1] - A;
483
+ D < k && (D = k, _ = p[g] + p[g + 1] - k), _ < N && (_ = N, D = p[g] + p[g + 1] - N), S[g] = D, S[g + 1] = _, m(S), l?.(S);
484
+ }, x = () => {
485
+ document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", x);
486
+ };
487
+ document.addEventListener("pointermove", y), document.addEventListener("pointerup", x);
488
+ }, [u, a, n, l]), d = a === "horizontal";
489
+ return /* @__PURE__ */ jsx(
490
+ "div",
491
+ {
492
+ ref: t,
493
+ className: `nice-splitter nice-splitter--${a} ${s || ""}`,
494
+ style: { display: "flex", flexDirection: d ? "row" : "column", height: "100%", ...h },
495
+ children: n.map((g, z) => /* @__PURE__ */ jsxs(we.Fragment, { children: [
496
+ /* @__PURE__ */ jsx(
497
+ "div",
498
+ {
499
+ className: "nice-splitter__pane",
500
+ style: { [d ? "width" : "height"]: `calc(${u[z]}% - ${i * (n.length - 1) / n.length}px)`, overflow: "auto" },
501
+ children: g.render()
502
+ }
503
+ ),
504
+ z < n.length - 1 && /* @__PURE__ */ jsx(
505
+ "div",
506
+ {
507
+ className: `nice-splitter__gutter nice-splitter__gutter--${a}`,
508
+ style: { [d ? "width" : "height"]: i, cursor: d ? "col-resize" : "row-resize", flexShrink: 0 },
509
+ onPointerDown: (M) => w(z, M)
510
+ }
511
+ )
512
+ ] }, g.key))
513
+ }
514
+ );
515
+ }, _a = ({
516
+ items: n,
517
+ size: a = "md",
518
+ className: i,
519
+ style: l,
520
+ accessMode: s,
521
+ id: h
522
+ }) => {
523
+ if (ei(s, h) === "hidden") return null;
524
+ const b = n.filter((m) => !m.location || m.location === "before"), r = n.filter((m) => m.location === "center"), t = n.filter((m) => m.location === "after"), u = (m) => m.widget === "separator" ? /* @__PURE__ */ jsx("div", { className: "nice-toolbar__separator" }, m.key) : m.widget === "spacer" ? /* @__PURE__ */ jsx("div", { className: "nice-toolbar__spacer", style: { flex: 1 } }, m.key) : m.render ? /* @__PURE__ */ jsx("div", { className: "nice-toolbar__custom", children: m.render() }, m.key) : /* @__PURE__ */ jsxs(
525
+ "button",
526
+ {
527
+ type: "button",
528
+ className: `nice-toolbar__btn nice-btn nice-btn--ghost nice-btn--${a}`,
529
+ disabled: m.disabled,
530
+ onClick: m.onClick,
531
+ children: [
532
+ m.icon && /* @__PURE__ */ jsx("span", { className: "nice-toolbar__icon", children: m.icon }),
533
+ m.text && /* @__PURE__ */ jsx("span", { children: m.text })
534
+ ]
535
+ },
536
+ m.key
537
+ );
538
+ return /* @__PURE__ */ jsxs("div", { className: `nice-toolbar ${i || ""}`, style: { display: "flex", alignItems: "center", gap: 4, ...l }, children: [
539
+ /* @__PURE__ */ jsx("div", { className: "nice-toolbar__section nice-toolbar__section--before", style: { display: "flex", alignItems: "center", gap: 4 }, children: b.map(u) }),
540
+ r.length > 0 && /* @__PURE__ */ jsx("div", { className: "nice-toolbar__section nice-toolbar__section--center", style: { display: "flex", alignItems: "center", gap: 4, flex: 1, justifyContent: "center" }, children: r.map(u) }),
541
+ /* @__PURE__ */ jsx("div", { className: "nice-toolbar__section nice-toolbar__section--after", style: { display: "flex", alignItems: "center", gap: 4, marginLeft: r.length === 0 ? "auto" : void 0 }, children: t.map(u) })
542
+ ] });
543
+ }, cn = forwardRef(({
544
+ panels: n,
545
+ columns: a = 12,
546
+ rowHeight: i = 80,
547
+ gap: l = 8,
548
+ draggable: s = true,
549
+ resizable: h = true,
550
+ onLayoutChange: o,
551
+ className: b,
552
+ style: r,
553
+ id: t
554
+ }, u) => {
555
+ const m = ys(t), [w, d] = useState(null), g = useRef(null), z = useCallback((y, x) => {
556
+ s && (d(x), y.dataTransfer.effectAllowed = "move");
557
+ }, [s]), M = useCallback((y, x) => {
558
+ if (y.preventDefault(), !w || w === x) return;
559
+ const C = n.find((k) => k.key === w), A = n.find((k) => k.key === x);
560
+ if (!C || !A) return;
561
+ const S = n.map((k) => k.key === w ? { ...k, col: A.col, row: A.row } : k.key === x ? { ...k, col: C.col, row: C.row } : k);
562
+ o?.(S), d(null);
563
+ }, [w, n, o]), T = useCallback((y) => {
564
+ y.preventDefault();
565
+ }, []), f = useRef(null);
566
+ useEffect(() => {
567
+ if (!h) return;
568
+ const y = (C) => {
569
+ if (!f.current || !g.current) return;
570
+ const { key: A, startX: S, startY: k, cs: N, rs: D } = f.current, _ = C.clientX - S, Y = C.clientY - k, K = g.current.clientWidth / a, Q = Math.max(1, N + Math.round(_ / K)), W = Math.max(1, D + Math.round(Y / i)), V = n.map((j) => j.key === A ? { ...j, colSpan: Q, rowSpan: W } : j);
571
+ o?.(V);
572
+ }, x = () => {
573
+ f.current = null;
574
+ };
575
+ return document.addEventListener("mousemove", y), document.addEventListener("mouseup", x), () => {
576
+ document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", x);
577
+ };
578
+ }, [h, n, a, i, o]);
579
+ const $ = useCallback((y, x, C, A) => {
580
+ y.stopPropagation(), f.current = { key: x, startX: y.clientX, startY: y.clientY, cs: C, rs: A };
581
+ }, []), p = Math.max(...n.map((y) => y.row + (y.rowSpan ?? 1)), 1);
582
+ return /* @__PURE__ */ jsx(
583
+ "div",
584
+ {
585
+ ref: u,
586
+ id: m,
587
+ className: `nice-dashboard ${b || ""}`,
588
+ style: r,
589
+ children: /* @__PURE__ */ jsx(
590
+ "div",
591
+ {
592
+ ref: g,
593
+ className: "nice-dashboard__grid",
594
+ style: {
595
+ display: "grid",
596
+ gridTemplateColumns: `repeat(${a}, 1fr)`,
597
+ gridTemplateRows: `repeat(${p}, ${i}px)`,
598
+ gap: l
599
+ },
600
+ children: n.map((y) => /* @__PURE__ */ jsxs(
601
+ "div",
602
+ {
603
+ className: `nice-dashboard__panel${w === y.key ? " nice-dashboard__panel--dragging" : ""}`,
604
+ style: {
605
+ gridColumn: `${y.col + 1} / span ${y.colSpan ?? 1}`,
606
+ gridRow: `${y.row + 1} / span ${y.rowSpan ?? 1}`
607
+ },
608
+ draggable: s,
609
+ onDragStart: (x) => z(x, y.key),
610
+ onDragOver: T,
611
+ onDrop: (x) => M(x, y.key),
612
+ children: [
613
+ /* @__PURE__ */ jsx("div", { className: "nice-dashboard__panel-content", children: y.render() }),
614
+ h && /* @__PURE__ */ jsx(
615
+ "div",
616
+ {
617
+ className: "nice-dashboard__resize-handle",
618
+ onMouseDown: (x) => $(x, y.key, y.colSpan ?? 1, y.rowSpan ?? 1)
619
+ }
620
+ )
621
+ ]
622
+ },
623
+ y.key
624
+ ))
625
+ }
626
+ )
627
+ }
628
+ );
629
+ });
630
+ cn.displayName = "NiceDashboardLayout";
631
+ const ln = forwardRef(({
632
+ header: n,
633
+ sidebar: a,
634
+ sidebarWidth: i = 260,
635
+ sidebarCollapsed: l,
636
+ onToggleSidebar: s,
637
+ children: h,
638
+ footer: o,
639
+ className: b,
640
+ style: r,
641
+ id: t
642
+ }, u) => {
643
+ const m = ys(t), [w, d] = useState(false), g = l ?? w, z = useCallback(() => {
644
+ const M = !g;
645
+ d(M), s?.(M);
646
+ }, [g, s]);
647
+ return /* @__PURE__ */ jsxs(
648
+ "div",
649
+ {
650
+ ref: u,
651
+ id: m,
652
+ className: `nice-app-layout${g ? " nice-app-layout--collapsed" : ""} ${b || ""}`,
653
+ style: r,
654
+ children: [
655
+ n && /* @__PURE__ */ jsx("header", { className: "nice-app-layout__header", children: n }),
656
+ /* @__PURE__ */ jsxs("div", { className: "nice-app-layout__body", children: [
657
+ a && /* @__PURE__ */ jsx(
658
+ "aside",
659
+ {
660
+ className: "nice-app-layout__sidebar",
661
+ style: { width: g ? 0 : i, overflow: "hidden", transition: "width 0.2s" },
662
+ children: !g && a
663
+ }
664
+ ),
665
+ a && /* @__PURE__ */ jsx(
666
+ "button",
667
+ {
668
+ type: "button",
669
+ className: "nice-app-layout__sidebar-toggle",
670
+ onClick: z,
671
+ "aria-label": g ? "Open sidebar" : "Close sidebar",
672
+ children: g ? "☰" : "✕"
673
+ }
674
+ ),
675
+ /* @__PURE__ */ jsx("main", { className: "nice-app-layout__content", children: h })
676
+ ] }),
677
+ o && /* @__PURE__ */ jsx("footer", { className: "nice-app-layout__footer", children: o })
678
+ ]
679
+ }
680
+ );
681
+ });
682
+ ln.displayName = "NiceAppLayout";
683
+ const tn = forwardRef(({
684
+ items: n,
685
+ activeKey: a,
686
+ onChange: i,
687
+ size: l = "md",
688
+ showLabels: s = true,
689
+ className: h,
690
+ style: o,
691
+ id: b
692
+ }, r) => {
693
+ const t = ys(b);
694
+ return /* @__PURE__ */ jsx(
695
+ "nav",
696
+ {
697
+ ref: r,
698
+ id: t,
699
+ className: `nice-bottom-nav nice-bottom-nav--${l} ${h || ""}`,
700
+ style: o,
701
+ role: "navigation",
702
+ children: n.map((u) => /* @__PURE__ */ jsxs(
703
+ "button",
704
+ {
705
+ type: "button",
706
+ className: `nice-bottom-nav__item${a === u.key ? " nice-bottom-nav__item--active" : ""}${u.disabled ? " nice-bottom-nav__item--disabled" : ""}`,
707
+ onClick: () => !u.disabled && i?.(u.key),
708
+ disabled: u.disabled,
709
+ "aria-current": a === u.key ? "page" : void 0,
710
+ children: [
711
+ u.icon && /* @__PURE__ */ jsx("span", { className: "nice-bottom-nav__icon", children: u.icon }),
712
+ s && /* @__PURE__ */ jsx("span", { className: "nice-bottom-nav__label", children: u.label })
713
+ ]
714
+ },
715
+ u.key
716
+ ))
717
+ }
718
+ );
719
+ });
720
+ tn.displayName = "NiceBottomNavigation";
721
+ const sn = forwardRef(({
722
+ items: n,
723
+ size: a = "md",
724
+ className: i,
725
+ style: l,
726
+ id: s
727
+ }, h) => {
728
+ const o = ys(s), [b, r] = useState(null), t = useRef(null);
729
+ useEffect(() => {
730
+ if (!b) return;
731
+ const m = (w) => {
732
+ t.current && !t.current.contains(w.target) && r(null);
733
+ };
734
+ return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
735
+ }, [b]);
736
+ const u = n.find((m) => m.key === b);
737
+ return /* @__PURE__ */ jsxs(
738
+ "div",
739
+ {
740
+ ref: h,
741
+ id: o,
742
+ className: `nice-mega-menu nice-mega-menu--${a} ${i || ""}`,
743
+ style: l,
744
+ children: [
745
+ /* @__PURE__ */ jsx("div", { ref: t, className: "nice-mega-menu__bar", role: "menubar", children: n.map((m) => /* @__PURE__ */ jsx(
746
+ "button",
747
+ {
748
+ type: "button",
749
+ className: `nice-mega-menu__trigger${b === m.key ? " nice-mega-menu__trigger--active" : ""}`,
750
+ onMouseEnter: () => r(m.key),
751
+ onClick: () => r(b === m.key ? null : m.key),
752
+ "aria-haspopup": "true",
753
+ "aria-expanded": b === m.key,
754
+ children: m.label
755
+ },
756
+ m.key
757
+ )) }),
758
+ u && /* @__PURE__ */ jsx(
759
+ "div",
760
+ {
761
+ className: "nice-mega-menu__dropdown",
762
+ onMouseLeave: () => r(null),
763
+ children: u.renderPanel ? u.renderPanel() : /* @__PURE__ */ jsx("div", { className: "nice-mega-menu__columns", children: u.columns.map((m, w) => /* @__PURE__ */ jsxs("div", { className: "nice-mega-menu__column", children: [
764
+ m.header && /* @__PURE__ */ jsx("div", { className: "nice-mega-menu__column-header", children: m.header }),
765
+ /* @__PURE__ */ jsx("ul", { className: "nice-mega-menu__list", role: "menu", children: m.items.map((d) => /* @__PURE__ */ jsx(
766
+ "li",
767
+ {
768
+ className: `nice-mega-menu__item${d.disabled ? " nice-mega-menu__item--disabled" : ""}`,
769
+ role: "menuitem",
770
+ children: d.href ? /* @__PURE__ */ jsxs("a", { href: d.href, className: "nice-mega-menu__link", children: [
771
+ d.icon && /* @__PURE__ */ jsx("span", { className: "nice-mega-menu__icon", children: d.icon }),
772
+ d.label
773
+ ] }) : /* @__PURE__ */ jsxs(
774
+ "button",
775
+ {
776
+ type: "button",
777
+ className: "nice-mega-menu__link",
778
+ disabled: d.disabled,
779
+ onClick: () => {
780
+ d.onClick?.(), r(null);
781
+ },
782
+ children: [
783
+ d.icon && /* @__PURE__ */ jsx("span", { className: "nice-mega-menu__icon", children: d.icon }),
784
+ d.label
785
+ ]
786
+ }
787
+ )
788
+ },
789
+ d.key
790
+ )) })
791
+ ] }, w)) })
792
+ }
793
+ )
794
+ ]
795
+ }
796
+ );
797
+ });
798
+ sn.displayName = "NiceMegaMenu";
799
+ const rn = forwardRef(
800
+ ({
801
+ items: n,
802
+ position: a = "bottom",
803
+ size: i = "md",
804
+ magnify: l = true,
805
+ magnifyScale: s = 1.5,
806
+ activeKey: h,
807
+ onItemClick: o,
808
+ className: b,
809
+ style: r,
810
+ id: t,
811
+ ...u
812
+ }, m) => {
813
+ const w = ys(t), { t: d } = de(), [g, z] = useState(null), M = useCallback(
814
+ (f) => {
815
+ if (!l || g === null) return 1;
816
+ const $ = Math.abs(f - g);
817
+ return $ === 0 ? s : $ === 1 ? 1 + (s - 1) * 0.5 : $ === 2 ? 1 + (s - 1) * 0.2 : 1;
818
+ },
819
+ [l, g, s]
820
+ ), T = a === "left" || a === "right";
821
+ return /* @__PURE__ */ jsx(
822
+ "div",
823
+ {
824
+ ref: m,
825
+ id: w,
826
+ className: `nice-dock nice-dock--${a} nice-dock--${i} ${b ?? ""}`,
827
+ style: r,
828
+ role: "toolbar",
829
+ "aria-label": d("dock.label", "Dock"),
830
+ ...u,
831
+ children: /* @__PURE__ */ jsx("div", { className: "nice-dock__bar", style: { flexDirection: T ? "column" : "row" }, children: n.map((f, $) => {
832
+ const p = M($);
833
+ return /* @__PURE__ */ jsxs(
834
+ "button",
835
+ {
836
+ type: "button",
837
+ className: `nice-dock__item ${h === f.key ? "nice-dock__item--active" : ""} ${f.disabled ? "nice-dock__item--disabled" : ""}`,
838
+ style: { transform: `scale(${p})`, transition: "transform 0.15s ease-out" },
839
+ disabled: f.disabled,
840
+ onClick: () => o?.(f.key),
841
+ onMouseEnter: () => z($),
842
+ onMouseLeave: () => z(null),
843
+ "aria-label": f.label,
844
+ title: f.label,
845
+ children: [
846
+ /* @__PURE__ */ jsx("span", { className: "nice-dock__icon", children: f.icon }),
847
+ f.badge !== void 0 && /* @__PURE__ */ jsx("span", { className: "nice-dock__badge", children: f.badge })
848
+ ]
849
+ },
850
+ f.key
851
+ );
852
+ }) })
853
+ }
854
+ );
855
+ }
856
+ );
857
+ rn.displayName = "NiceDock";
858
+ const on = ({
859
+ items: n,
860
+ label: a,
861
+ icon: i,
862
+ position: l,
863
+ onItemClick: s
864
+ }) => {
865
+ const { t: h } = de(), [o, b] = useState(false), [r, t] = useState(null), u = useRef(null);
866
+ useEffect(() => {
867
+ if (!o) return;
868
+ const d = (g) => {
869
+ u.current && !u.current.contains(g.target) && (b(false), t(null));
870
+ };
871
+ return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
872
+ }, [o]), useEffect(() => {
873
+ if (!o) return;
874
+ const d = (g) => {
875
+ g.key === "Escape" && (b(false), t(null));
876
+ };
877
+ return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
878
+ }, [o]);
879
+ const m = l === "bottom" ? "bottom-start" : l === "top" ? "top-start" : l === "left" ? "left-start" : "right-start", w = useCallback((d) => {
880
+ if (d.children && d.children.length > 0) {
881
+ t(r === d.key ? null : d.key);
882
+ return;
883
+ }
884
+ d.onClick?.(), s?.(d.key), b(false), t(null);
885
+ }, [s, r]);
886
+ return /* @__PURE__ */ jsxs("div", { className: "nice-desktop__start", ref: u, children: [
887
+ /* @__PURE__ */ jsxs(
888
+ "button",
889
+ {
890
+ type: "button",
891
+ className: `nice-desktop__start-btn ${o ? "nice-desktop__start-btn--active" : ""}`,
892
+ onClick: () => b(!o),
893
+ "aria-expanded": o,
894
+ "aria-haspopup": "menu",
895
+ "aria-label": h("desktop.start", "Start"),
896
+ children: [
897
+ i && /* @__PURE__ */ jsx("span", { className: "nice-desktop__start-icon", children: i }),
898
+ a && /* @__PURE__ */ jsx("span", { className: "nice-desktop__start-label", children: a }),
899
+ !i && !a && /* @__PURE__ */ jsx("span", { className: "nice-desktop__start-label", children: h("desktop.start", "Start") })
900
+ ]
901
+ }
902
+ ),
903
+ o && /* @__PURE__ */ jsx(
904
+ "div",
905
+ {
906
+ className: `nice-desktop__start-menu nice-desktop__start-menu--${m}`,
907
+ role: "menu",
908
+ children: n.map((d) => /* @__PURE__ */ jsxs(we.Fragment, { children: [
909
+ d.divider && /* @__PURE__ */ jsx("div", { className: "nice-desktop__start-divider" }),
910
+ /* @__PURE__ */ jsxs("div", { className: "nice-desktop__start-item-wrap", children: [
911
+ /* @__PURE__ */ jsxs(
912
+ "button",
913
+ {
914
+ type: "button",
915
+ className: `nice-desktop__start-item ${r === d.key ? "nice-desktop__start-item--open" : ""}`,
916
+ disabled: d.disabled,
917
+ onClick: () => w(d),
918
+ role: "menuitem",
919
+ children: [
920
+ d.icon && /* @__PURE__ */ jsx("span", { className: "nice-desktop__start-item-icon", children: d.icon }),
921
+ /* @__PURE__ */ jsx("span", { className: "nice-desktop__start-item-label", children: d.label }),
922
+ d.children && d.children.length > 0 && /* @__PURE__ */ jsx("span", { className: "nice-desktop__start-item-arrow", children: "▸" })
923
+ ]
924
+ }
925
+ ),
926
+ d.children && r === d.key && /* @__PURE__ */ jsx("div", { className: "nice-desktop__start-submenu", role: "menu", children: d.children.map((g) => /* @__PURE__ */ jsxs(
927
+ "button",
928
+ {
929
+ type: "button",
930
+ className: "nice-desktop__start-item",
931
+ disabled: g.disabled,
932
+ onClick: () => w(g),
933
+ role: "menuitem",
934
+ children: [
935
+ g.icon && /* @__PURE__ */ jsx("span", { className: "nice-desktop__start-item-icon", children: g.icon }),
936
+ /* @__PURE__ */ jsx("span", { className: "nice-desktop__start-item-label", children: g.label })
937
+ ]
938
+ },
939
+ g.key
940
+ )) })
941
+ ] })
942
+ ] }, d.key))
943
+ }
944
+ )
945
+ ] });
946
+ }, Fe = ({
947
+ items: n,
948
+ position: a,
949
+ size: i,
950
+ startMenu: l,
951
+ systemTray: s,
952
+ onItemClick: h
953
+ }) => {
954
+ const b = a === "left" || a === "right" ? { width: i, height: "100%" } : { height: i, width: "100%" };
955
+ return /* @__PURE__ */ jsxs(
956
+ "div",
957
+ {
958
+ className: `nice-desktop__taskbar nice-desktop__taskbar--${a}`,
959
+ style: b,
960
+ role: "toolbar",
961
+ "aria-label": "Taskbar",
962
+ children: [
963
+ l,
964
+ /* @__PURE__ */ jsx("div", { className: "nice-desktop__taskbar-items", children: n.map((r) => /* @__PURE__ */ jsxs(
965
+ "button",
966
+ {
967
+ type: "button",
968
+ className: `nice-desktop__taskbar-btn ${r.active ? "nice-desktop__taskbar-btn--active" : ""} ${r.minimized ? "nice-desktop__taskbar-btn--minimized" : ""}`,
969
+ onClick: () => h?.(r.key),
970
+ title: r.label,
971
+ children: [
972
+ r.icon && /* @__PURE__ */ jsx("span", { className: "nice-desktop__taskbar-btn-icon", children: r.icon }),
973
+ /* @__PURE__ */ jsx("span", { className: "nice-desktop__taskbar-btn-label", children: r.label }),
974
+ r.badge !== void 0 && /* @__PURE__ */ jsx("span", { className: "nice-desktop__taskbar-btn-badge", children: r.badge })
975
+ ]
976
+ },
977
+ r.key
978
+ )) }),
979
+ s
980
+ ]
981
+ }
982
+ );
983
+ }, dn = ({
984
+ items: n,
985
+ showClock: a = true,
986
+ onItemClick: i
987
+ }) => {
988
+ const [l, s] = useState(() => /* @__PURE__ */ new Date());
989
+ return useEffect(() => {
990
+ if (!a) return;
991
+ const h = setInterval(() => s(/* @__PURE__ */ new Date()), 3e4);
992
+ return () => clearInterval(h);
993
+ }, [a]), /* @__PURE__ */ jsxs("div", { className: "nice-desktop__tray", children: [
994
+ n.map((h) => /* @__PURE__ */ jsx(
995
+ "button",
996
+ {
997
+ type: "button",
998
+ className: "nice-desktop__tray-item",
999
+ title: h.tooltip,
1000
+ onClick: () => {
1001
+ h.onClick?.(), i?.(h.key);
1002
+ },
1003
+ children: h.icon
1004
+ },
1005
+ h.key
1006
+ )),
1007
+ a && /* @__PURE__ */ jsx("span", { className: "nice-desktop__tray-clock", children: l.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
1008
+ ] });
1009
+ }, un = ({
1010
+ icons: n,
1011
+ gridColumns: a,
1012
+ iconSize: i,
1013
+ onIconClick: l,
1014
+ onIconDoubleClick: s
1015
+ }) => {
1016
+ const [h, o] = useState(null), b = useCallback((t) => {
1017
+ o(t), l?.(t);
1018
+ }, [l]), r = useCallback((t) => {
1019
+ s?.(t);
1020
+ }, [s]);
1021
+ return /* @__PURE__ */ jsx(
1022
+ "div",
1023
+ {
1024
+ className: `nice-desktop__grid nice-desktop__grid--${i}`,
1025
+ style: { gridTemplateColumns: `repeat(${a}, 1fr)` },
1026
+ children: n.map((t) => /* @__PURE__ */ jsxs(
1027
+ "div",
1028
+ {
1029
+ className: `nice-desktop__icon ${h === t.key ? "nice-desktop__icon--selected" : ""} ${t.disabled ? "nice-desktop__icon--disabled" : ""}`,
1030
+ style: t.gridCol != null || t.gridRow != null ? { gridColumn: t.gridCol, gridRow: t.gridRow } : void 0,
1031
+ onClick: () => !t.disabled && b(t.key),
1032
+ onDoubleClick: () => !t.disabled && r(t.key),
1033
+ role: "button",
1034
+ tabIndex: t.disabled ? -1 : 0,
1035
+ "aria-label": t.label,
1036
+ onKeyDown: (u) => {
1037
+ t.disabled || (u.key === "Enter" && r(t.key), u.key === " " && (u.preventDefault(), b(t.key)));
1038
+ },
1039
+ children: [
1040
+ /* @__PURE__ */ jsx("div", { className: "nice-desktop__icon-img", children: t.icon }),
1041
+ /* @__PURE__ */ jsx("span", { className: "nice-desktop__icon-label", children: t.label })
1042
+ ]
1043
+ },
1044
+ t.key
1045
+ ))
1046
+ }
1047
+ );
1048
+ }, _n = ({
1049
+ items: n,
1050
+ x: a,
1051
+ y: i,
1052
+ onItemClick: l,
1053
+ onClose: s
1054
+ }) => {
1055
+ const h = useRef(null);
1056
+ return useEffect(() => {
1057
+ const o = (b) => {
1058
+ h.current && !h.current.contains(b.target) && s();
1059
+ };
1060
+ return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
1061
+ }, [s]), useEffect(() => {
1062
+ const o = (b) => {
1063
+ b.key === "Escape" && s();
1064
+ };
1065
+ return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
1066
+ }, [s]), /* @__PURE__ */ jsx(
1067
+ "div",
1068
+ {
1069
+ ref: h,
1070
+ className: "nice-desktop__context-menu",
1071
+ style: { position: "fixed", left: a, top: i },
1072
+ role: "menu",
1073
+ children: n.map((o) => /* @__PURE__ */ jsxs(we.Fragment, { children: [
1074
+ o.divider && /* @__PURE__ */ jsx("div", { className: "nice-desktop__context-divider" }),
1075
+ /* @__PURE__ */ jsxs(
1076
+ "button",
1077
+ {
1078
+ type: "button",
1079
+ className: "nice-desktop__context-item",
1080
+ disabled: o.disabled,
1081
+ onClick: () => {
1082
+ o.onClick?.(), l?.(o.key), s();
1083
+ },
1084
+ role: "menuitem",
1085
+ children: [
1086
+ o.icon && /* @__PURE__ */ jsx("span", { className: "nice-desktop__context-icon", children: o.icon }),
1087
+ /* @__PURE__ */ jsx("span", { children: o.label })
1088
+ ]
1089
+ }
1090
+ )
1091
+ ] }, o.key))
1092
+ }
1093
+ );
1094
+ }, hn = forwardRef(
1095
+ ({
1096
+ icons: n = [],
1097
+ taskbarPosition: a = "bottom",
1098
+ taskbarSize: i = 40,
1099
+ startMenuItems: l = [],
1100
+ startMenuLabel: s,
1101
+ startMenuIcon: h,
1102
+ taskbarItems: o = [],
1103
+ systemTrayItems: b = [],
1104
+ showClock: r = true,
1105
+ wallpaper: t,
1106
+ gridColumns: u = 8,
1107
+ iconSize: m = "md",
1108
+ onIconClick: w,
1109
+ onIconDoubleClick: d,
1110
+ onTaskbarItemClick: g,
1111
+ onStartMenuItemClick: z,
1112
+ onSystemTrayItemClick: M,
1113
+ contextMenuItems: T,
1114
+ onContextMenuItemClick: f,
1115
+ children: $,
1116
+ className: p,
1117
+ style: y,
1118
+ id: x,
1119
+ accessMode: C,
1120
+ ...A
1121
+ }, S) => {
1122
+ const k = ys(x);
1123
+ if (ei(C, x) === "hidden") return null;
1124
+ const [D, _] = useState(null), Y = useCallback(
1125
+ (V) => {
1126
+ !T || T.length === 0 || (V.preventDefault(), _({ x: V.clientX, y: V.clientY }));
1127
+ },
1128
+ [T]
1129
+ ), K = l.length > 0 ? /* @__PURE__ */ jsx(
1130
+ on,
1131
+ {
1132
+ items: l,
1133
+ label: s,
1134
+ icon: h,
1135
+ position: a,
1136
+ onItemClick: z
1137
+ }
1138
+ ) : null, Q = /* @__PURE__ */ jsx(
1139
+ dn,
1140
+ {
1141
+ items: b,
1142
+ showClock: r,
1143
+ onItemClick: M
1144
+ }
1145
+ ), W = {
1146
+ ...y,
1147
+ ...t ? { background: t } : {}
1148
+ };
1149
+ return /* @__PURE__ */ jsxs(
1150
+ "div",
1151
+ {
1152
+ ref: S,
1153
+ id: k,
1154
+ className: `nice-desktop nice-desktop--taskbar-${a} ${p ?? ""}`,
1155
+ style: W,
1156
+ ...A,
1157
+ children: [
1158
+ (a === "top" || a === "left") && /* @__PURE__ */ jsx(
1159
+ Fe,
1160
+ {
1161
+ items: o,
1162
+ position: a,
1163
+ size: i,
1164
+ startMenu: K,
1165
+ systemTray: Q,
1166
+ onItemClick: g
1167
+ }
1168
+ ),
1169
+ /* @__PURE__ */ jsxs(
1170
+ "div",
1171
+ {
1172
+ className: "nice-desktop__area",
1173
+ onContextMenu: Y,
1174
+ children: [
1175
+ n.length > 0 && /* @__PURE__ */ jsx(
1176
+ un,
1177
+ {
1178
+ icons: n,
1179
+ gridColumns: u,
1180
+ iconSize: m,
1181
+ onIconClick: w,
1182
+ onIconDoubleClick: d
1183
+ }
1184
+ ),
1185
+ $,
1186
+ D && T && /* @__PURE__ */ jsx(
1187
+ _n,
1188
+ {
1189
+ items: T,
1190
+ x: D.x,
1191
+ y: D.y,
1192
+ onItemClick: f,
1193
+ onClose: () => _(null)
1194
+ }
1195
+ )
1196
+ ]
1197
+ }
1198
+ ),
1199
+ (a === "bottom" || a === "right") && /* @__PURE__ */ jsx(
1200
+ Fe,
1201
+ {
1202
+ items: o,
1203
+ position: a,
1204
+ size: i,
1205
+ startMenu: K,
1206
+ systemTray: Q,
1207
+ onItemClick: g
1208
+ }
1209
+ )
1210
+ ]
1211
+ }
1212
+ );
1213
+ }
1214
+ );
1215
+ hn.displayName = "NiceDesktop";
1216
+ const mn = ({ commands: n, onSelect: a, onClose: i }) => {
1217
+ const [l, s] = useState(""), h = useRef(null), { t: o } = de();
1218
+ useEffect(() => {
1219
+ h.current?.focus();
1220
+ }, []), useEffect(() => {
1221
+ const r = (t) => {
1222
+ t.key === "Escape" && i();
1223
+ };
1224
+ return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
1225
+ }, [i]);
1226
+ const b = l ? n.filter((r) => r.label.toLowerCase().includes(l.toLowerCase())) : n;
1227
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1228
+ /* @__PURE__ */ jsx("div", { className: "nice-console__palette-overlay", onClick: i }),
1229
+ /* @__PURE__ */ jsxs("div", { className: "nice-console__palette", role: "dialog", "aria-label": o("console.commandPalette", "Command Palette"), children: [
1230
+ /* @__PURE__ */ jsx(
1231
+ "input",
1232
+ {
1233
+ ref: h,
1234
+ className: "nice-console__palette-input",
1235
+ placeholder: o("console.searchCommands", "Search commands..."),
1236
+ value: l,
1237
+ onChange: (r) => s(r.target.value),
1238
+ onKeyDown: (r) => {
1239
+ r.key === "Enter" && b.length > 0 && (a(b[0].key), i());
1240
+ }
1241
+ }
1242
+ ),
1243
+ /* @__PURE__ */ jsxs("div", { className: "nice-console__palette-list", children: [
1244
+ b.map((r) => /* @__PURE__ */ jsxs(
1245
+ "button",
1246
+ {
1247
+ type: "button",
1248
+ className: "nice-console__palette-item",
1249
+ disabled: r.disabled,
1250
+ onClick: () => {
1251
+ a(r.key), i();
1252
+ },
1253
+ children: [
1254
+ r.icon && /* @__PURE__ */ jsx("span", { className: "nice-console__palette-icon", children: r.icon }),
1255
+ /* @__PURE__ */ jsx("span", { className: "nice-console__palette-label", children: r.label }),
1256
+ r.description && /* @__PURE__ */ jsx("span", { className: "nice-console__palette-desc", children: r.description }),
1257
+ r.shortcut && /* @__PURE__ */ jsx("span", { className: "nice-console__palette-shortcut", children: r.shortcut })
1258
+ ]
1259
+ },
1260
+ r.key
1261
+ )),
1262
+ b.length === 0 && /* @__PURE__ */ jsx("div", { className: "nice-console__palette-empty", children: o("console.noCommands", "No matching commands") })
1263
+ ] })
1264
+ ] })
1265
+ ] });
1266
+ }, bn = forwardRef(
1267
+ ({
1268
+ tabs: n = [],
1269
+ activeTabKey: a,
1270
+ onTabChange: i,
1271
+ onTabClose: l,
1272
+ commandPalette: s = [],
1273
+ onCommand: h,
1274
+ statusItems: o = [],
1275
+ toolbar: b,
1276
+ sidePanel: r,
1277
+ sidePanelWidth: t = 220,
1278
+ sidePanelCollapsed: u,
1279
+ onToggleSidePanel: m,
1280
+ bottomPanel: w,
1281
+ bottomPanelHeight: d = 200,
1282
+ bottomPanelCollapsed: g,
1283
+ onToggleBottomPanel: z,
1284
+ children: M,
1285
+ size: T = "md",
1286
+ theme: f = "dark",
1287
+ className: $,
1288
+ style: p,
1289
+ id: y,
1290
+ accessMode: x,
1291
+ ...C
1292
+ }, A) => {
1293
+ const S = ys(y), k = ei(x, y), { t: N } = de();
1294
+ if (k === "hidden") return null;
1295
+ const [D, _] = useState(n[0]?.key ?? ""), [Y, K] = useState(false), [Q, W] = useState(false), [V, j] = useState(false), J = a ?? D, B = u ?? Y, O = g ?? Q, X = useCallback((F) => {
1296
+ i ? i(F) : _(F);
1297
+ }, [i]), q = useCallback(() => {
1298
+ const F = !B;
1299
+ m ? m(F) : K(F);
1300
+ }, [B, m]), me = useCallback(() => {
1301
+ const F = !O;
1302
+ z ? z(F) : W(F);
1303
+ }, [O, z]);
1304
+ useEffect(() => {
1305
+ if (s.length === 0) return;
1306
+ const F = (Z) => {
1307
+ Z.ctrlKey && Z.shiftKey && Z.key === "P" && (Z.preventDefault(), j((U) => !U));
1308
+ };
1309
+ return document.addEventListener("keydown", F), () => document.removeEventListener("keydown", F);
1310
+ }, [s.length]);
1311
+ const ve = n.find((F) => F.key === J), pe = o.filter((F) => !F.position || F.position === "left"), de$1 = o.filter((F) => F.position === "right");
1312
+ return /* @__PURE__ */ jsxs(
1313
+ "div",
1314
+ {
1315
+ ref: A,
1316
+ id: S,
1317
+ className: `nice-console nice-console--${T} nice-console--${f} ${$ ?? ""}`,
1318
+ style: p,
1319
+ ...C,
1320
+ children: [
1321
+ b && /* @__PURE__ */ jsx("div", { className: "nice-console__toolbar", children: b }),
1322
+ n.length > 0 && /* @__PURE__ */ jsx("div", { className: "nice-console__tabs", role: "tablist", children: n.map((F) => /* @__PURE__ */ jsxs(
1323
+ "div",
1324
+ {
1325
+ className: `nice-console__tab ${F.key === J ? "nice-console__tab--active" : ""}`,
1326
+ role: "tab",
1327
+ "aria-selected": F.key === J,
1328
+ children: [
1329
+ /* @__PURE__ */ jsxs(
1330
+ "button",
1331
+ {
1332
+ type: "button",
1333
+ className: "nice-console__tab-btn",
1334
+ onClick: () => X(F.key),
1335
+ children: [
1336
+ F.icon && /* @__PURE__ */ jsx("span", { className: "nice-console__tab-icon", children: F.icon }),
1337
+ /* @__PURE__ */ jsx("span", { children: F.label })
1338
+ ]
1339
+ }
1340
+ ),
1341
+ (F.closable ?? true) && l && /* @__PURE__ */ jsx(
1342
+ "button",
1343
+ {
1344
+ type: "button",
1345
+ className: "nice-console__tab-close",
1346
+ onClick: () => l(F.key),
1347
+ "aria-label": N("console.closeTab", "Close tab"),
1348
+ children: "✕"
1349
+ }
1350
+ )
1351
+ ]
1352
+ },
1353
+ F.key
1354
+ )) }),
1355
+ /* @__PURE__ */ jsxs("div", { className: "nice-console__main", children: [
1356
+ r && !B && /* @__PURE__ */ jsxs(
1357
+ "aside",
1358
+ {
1359
+ className: "nice-console__side",
1360
+ style: { width: t, flexShrink: 0 },
1361
+ children: [
1362
+ /* @__PURE__ */ jsx("div", { className: "nice-console__side-header", children: /* @__PURE__ */ jsx(
1363
+ "button",
1364
+ {
1365
+ type: "button",
1366
+ className: "nice-console__side-toggle",
1367
+ onClick: q,
1368
+ "aria-label": N("console.closeSidePanel", "Close side panel"),
1369
+ children: "✕"
1370
+ }
1371
+ ) }),
1372
+ /* @__PURE__ */ jsx("div", { className: "nice-console__side-content", children: r })
1373
+ ]
1374
+ }
1375
+ ),
1376
+ /* @__PURE__ */ jsxs("div", { className: "nice-console__center", children: [
1377
+ /* @__PURE__ */ jsx("div", { className: "nice-console__content", role: "tabpanel", children: ve ? ve.render() : M }),
1378
+ w && !O && /* @__PURE__ */ jsxs(
1379
+ "div",
1380
+ {
1381
+ className: "nice-console__bottom",
1382
+ style: { height: d, flexShrink: 0 },
1383
+ children: [
1384
+ /* @__PURE__ */ jsx("div", { className: "nice-console__bottom-header", children: /* @__PURE__ */ jsx(
1385
+ "button",
1386
+ {
1387
+ type: "button",
1388
+ className: "nice-console__bottom-toggle",
1389
+ onClick: me,
1390
+ "aria-label": N("console.closeBottomPanel", "Close bottom panel"),
1391
+ children: "✕"
1392
+ }
1393
+ ) }),
1394
+ /* @__PURE__ */ jsx("div", { className: "nice-console__bottom-content", children: w })
1395
+ ]
1396
+ }
1397
+ )
1398
+ ] })
1399
+ ] }),
1400
+ o.length > 0 && /* @__PURE__ */ jsxs("div", { className: "nice-console__statusbar", children: [
1401
+ /* @__PURE__ */ jsxs("div", { className: "nice-console__statusbar-left", children: [
1402
+ r && B && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-console__statusbar-btn", onClick: q, title: N("console.openSidePanel", "Open side panel"), children: "☰" }),
1403
+ w && O && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-console__statusbar-btn", onClick: me, title: N("console.openBottomPanel", "Open bottom panel"), children: "▁" }),
1404
+ pe.map((F) => /* @__PURE__ */ jsx("span", { className: "nice-console__status-item", onClick: F.onClick, role: F.onClick ? "button" : void 0, tabIndex: F.onClick ? 0 : void 0, children: F.content }, F.key))
1405
+ ] }),
1406
+ /* @__PURE__ */ jsx("div", { className: "nice-console__statusbar-right", children: de$1.map((F) => /* @__PURE__ */ jsx("span", { className: "nice-console__status-item", onClick: F.onClick, role: F.onClick ? "button" : void 0, tabIndex: F.onClick ? 0 : void 0, children: F.content }, F.key)) })
1407
+ ] }),
1408
+ V && s.length > 0 && /* @__PURE__ */ jsx(
1409
+ mn,
1410
+ {
1411
+ commands: s,
1412
+ onSelect: (F) => h?.(F),
1413
+ onClose: () => j(false)
1414
+ }
1415
+ )
1416
+ ]
1417
+ }
1418
+ );
1419
+ }
1420
+ );
1421
+ bn.displayName = "NiceConsole";
1422
+ const pn = forwardRef(
1423
+ ({
1424
+ steps: n,
1425
+ activeStep: a,
1426
+ onStepChange: i,
1427
+ onComplete: l,
1428
+ onCancel: s,
1429
+ allowStepClick: h = false,
1430
+ variant: o = "horizontal",
1431
+ nextLabel: b,
1432
+ prevLabel: r,
1433
+ finishLabel: t,
1434
+ cancelLabel: u,
1435
+ showProgress: m = true,
1436
+ className: w,
1437
+ style: d,
1438
+ size: g = "md",
1439
+ accessMode: z,
1440
+ id: M
1441
+ }, T) => {
1442
+ if (ei(z, M) === "hidden") return null;
1443
+ const { t: $ } = de(), p = ys(M), [y, x] = useState(0), [C, A] = useState({}), [S, k] = useState(/* @__PURE__ */ new Set([0])), N = a ?? y, D = n[N], _ = N === 0, Y = N === n.length - 1, K = useCallback(
1444
+ (O) => {
1445
+ const X = Math.max(0, Math.min(n.length - 1, O));
1446
+ x(X), k((q) => new Set(q).add(X)), i?.(X);
1447
+ },
1448
+ [n.length, i]
1449
+ ), Q = useCallback(() => {
1450
+ if (!D?.validate) return true;
1451
+ const O = D.validate();
1452
+ return O === true || O === void 0 ? (A((X) => {
1453
+ const q = { ...X };
1454
+ return delete q[D.id], q;
1455
+ }), true) : (A((X) => ({ ...X, [D.id]: O })), false);
1456
+ }, [D]), W = useCallback(() => {
1457
+ Q() && (Y ? l?.() : K(N + 1));
1458
+ }, [N, Y, Q, K, l]), V = useCallback(() => {
1459
+ _ || K(N - 1);
1460
+ }, [N, _, K]), j = useCallback(
1461
+ (O) => {
1462
+ const X = n.findIndex((q) => q.id === O);
1463
+ X >= 0 && K(X);
1464
+ },
1465
+ [n, K]
1466
+ ), J = useMemo(
1467
+ () => ({
1468
+ stepIndex: N,
1469
+ totalSteps: n.length,
1470
+ goNext: W,
1471
+ goPrev: V,
1472
+ goTo: j,
1473
+ isFirst: _,
1474
+ isLast: Y
1475
+ }),
1476
+ [N, n.length, W, V, j, _, Y]
1477
+ ), B = (N + 1) / n.length * 100;
1478
+ return /* @__PURE__ */ jsxs(
1479
+ "div",
1480
+ {
1481
+ ref: T,
1482
+ id: p,
1483
+ className: `nice-wizard nice-wizard--${o} nice-size-${g}${w ? ` ${w}` : ""}`,
1484
+ style: d,
1485
+ children: [
1486
+ /* @__PURE__ */ jsx("div", { className: "nice-wizard__steps", role: "tablist", children: n.map((O, X) => {
1487
+ const q = X < N ? "completed" : X === N ? "active" : "pending", me = !!C[O.id];
1488
+ return /* @__PURE__ */ jsxs(
1489
+ "button",
1490
+ {
1491
+ role: "tab",
1492
+ "aria-selected": X === N,
1493
+ className: `nice-wizard__step nice-wizard__step--${q}${me ? " nice-wizard__step--error" : ""}`,
1494
+ onClick: () => h && X <= N && K(X),
1495
+ disabled: !h || X > N,
1496
+ type: "button",
1497
+ children: [
1498
+ /* @__PURE__ */ jsx("span", { className: "nice-wizard__step-number", children: q === "completed" ? "✓" : X + 1 }),
1499
+ /* @__PURE__ */ jsx("span", { className: "nice-wizard__step-title", children: O.title }),
1500
+ O.optional && /* @__PURE__ */ jsxs("span", { className: "nice-wizard__step-optional", children: [
1501
+ "(",
1502
+ $("optional", "optional"),
1503
+ ")"
1504
+ ] })
1505
+ ]
1506
+ },
1507
+ O.id
1508
+ );
1509
+ }) }),
1510
+ m && /* @__PURE__ */ jsx("div", { className: "nice-wizard__progress", children: /* @__PURE__ */ jsx("div", { className: "nice-wizard__progress-bar", style: { width: `${B}%` } }) }),
1511
+ /* @__PURE__ */ jsx("div", { className: "nice-wizard__content", role: "tabpanel", children: D && /* @__PURE__ */ jsxs(Fragment, { children: [
1512
+ typeof D.content == "function" ? D.content(J) : D.content,
1513
+ C[D.id] && /* @__PURE__ */ jsx("div", { className: "nice-wizard__error nice-error-text", children: C[D.id] })
1514
+ ] }) }),
1515
+ /* @__PURE__ */ jsxs("div", { className: "nice-wizard__actions", children: [
1516
+ s && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-btn nice-btn--text", onClick: s, children: u ?? $("cancel", "Cancel") }),
1517
+ /* @__PURE__ */ jsxs("div", { className: "nice-wizard__actions-right", children: [
1518
+ !_ && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-btn nice-btn--outlined", onClick: V, children: r ?? $("previous", "← Previous") }),
1519
+ /* @__PURE__ */ jsx("button", { type: "button", className: "nice-btn nice-btn--primary", onClick: W, children: Y ? t ?? $("finish", "Finish ✓") : b ?? $("next", "Next →") })
1520
+ ] })
1521
+ ] })
1522
+ ]
1523
+ }
1524
+ );
1525
+ }
1526
+ );
1527
+ pn.displayName = "NiceWizard";
1528
+ const Be = createContext(null);
1529
+ const vn = forwardRef(
1530
+ ({
1531
+ steps: n,
1532
+ initialValues: a = {},
1533
+ activeStep: i,
1534
+ layout: l = "horizontal",
1535
+ size: s = "md",
1536
+ defaultQuickMode: h = false,
1537
+ allowQuickModeToggle: o = true,
1538
+ showStepNumbers: b = true,
1539
+ showProgress: r = true,
1540
+ showEstimatedTime: t = false,
1541
+ allowStepClick: u = true,
1542
+ showReviewStep: m = false,
1543
+ persistKey: w,
1544
+ animation: d = "slide",
1545
+ branding: g,
1546
+ header: z,
1547
+ footer: M,
1548
+ onStepChange: T,
1549
+ onValuesChange: f,
1550
+ onComplete: $,
1551
+ onCancel: p,
1552
+ labels: y = {},
1553
+ accessMode: x,
1554
+ id: C,
1555
+ className: A,
1556
+ style: S
1557
+ }, k) => {
1558
+ const N = ei(x, C);
1559
+ if (N === "hidden") return null;
1560
+ const { t: D } = de(), _ = ys(C), [Y, K] = useState(h), Q = useMemo(() => Y ? n.filter((v) => !v.quickModeSkip) : n, [n, Y]), W = useMemo(() => {
1561
+ if (!m) return Q;
1562
+ const v = {
1563
+ id: "__review__",
1564
+ title: y.review ?? D("wizard.review", "Review"),
1565
+ icon: "📋",
1566
+ content: (H) => /* @__PURE__ */ jsxs("div", { className: "nice-setup-wizard__review", children: [
1567
+ /* @__PURE__ */ jsx("h3", { children: D("wizard.reviewTitle", "Review Your Setup") }),
1568
+ Q.filter((P) => P.summary).map((P) => /* @__PURE__ */ jsxs("div", { className: "nice-setup-wizard__review-section", children: [
1569
+ /* @__PURE__ */ jsx("h4", { children: P.title }),
1570
+ P.summary?.(H.values)
1571
+ ] }, P.id))
1572
+ ] })
1573
+ };
1574
+ return [...Q, v];
1575
+ }, [Q, m, y.review, D]), [V, j] = useState(() => {
1576
+ if (w)
1577
+ try {
1578
+ const v = localStorage.getItem(w);
1579
+ if (v) return { ...a, ...JSON.parse(v) };
1580
+ } catch {
1581
+ }
1582
+ return a;
1583
+ }), [J, B] = useState(() => {
1584
+ if (i) return i;
1585
+ if (w)
1586
+ try {
1587
+ const v = localStorage.getItem(`${w}_step`);
1588
+ if (v && W.some((H) => H.id === v)) return v;
1589
+ } catch {
1590
+ }
1591
+ return W[0]?.id ?? "";
1592
+ }), [O, X] = useState(() => /* @__PURE__ */ new Set([J])), [q, me] = useState({}), [ve, pe] = useState(false), [de$1, F] = useState("next"), Z = W.findIndex((v) => v.id === J), U = W[Z], E = Z === 0, I = Z === W.length - 1, ee = (Z + 1) / W.length * 100;
1593
+ useEffect(() => {
1594
+ w && (localStorage.setItem(w, JSON.stringify(V)), localStorage.setItem(`${w}_step`, J));
1595
+ }, [V, J, w]);
1596
+ const te = useCallback(
1597
+ (v, H) => {
1598
+ j((P) => {
1599
+ const se = { ...P, [v]: H };
1600
+ return f?.(se), se;
1601
+ });
1602
+ },
1603
+ [f]
1604
+ ), fe = useCallback(
1605
+ (v) => {
1606
+ j((H) => {
1607
+ const P = { ...H, ...v };
1608
+ return f?.(P), P;
1609
+ });
1610
+ },
1611
+ [f]
1612
+ ), Ne = useCallback((v, H) => {
1613
+ me((P) => ({ ...P, [v]: H }));
1614
+ }, []), we = useCallback((v) => {
1615
+ me((H) => {
1616
+ const P = { ...H };
1617
+ return delete P[v], P;
1618
+ });
1619
+ }, []), be = useCallback(
1620
+ (v) => {
1621
+ const H = W.findIndex((P) => P.id === v);
1622
+ H >= 0 && (F(H > Z ? "next" : "prev"), B(v), X((P) => new Set(P).add(v)), T?.(v, H));
1623
+ },
1624
+ [W, Z, T]
1625
+ ), ze = useCallback(async () => {
1626
+ if (U) {
1627
+ if (U.validate) {
1628
+ pe(true);
1629
+ try {
1630
+ const v = await U.validate(V);
1631
+ if (v) {
1632
+ Ne(U.id, v), pe(!1);
1633
+ return;
1634
+ }
1635
+ we(U.id);
1636
+ } catch (v) {
1637
+ Ne(U.id, String(v)), pe(false);
1638
+ return;
1639
+ }
1640
+ pe(false);
1641
+ }
1642
+ if (U.fields) {
1643
+ for (const v of U.fields) {
1644
+ if (v.required && !V[v.id]) {
1645
+ Ne(U.id, `${v.label} ${D("wizard.isRequired", "is required")}`);
1646
+ return;
1647
+ }
1648
+ if (v.validation?.custom) {
1649
+ const H = v.validation.custom(V[v.id]);
1650
+ if (H) {
1651
+ Ne(U.id, H);
1652
+ return;
1653
+ }
1654
+ }
1655
+ }
1656
+ we(U.id);
1657
+ }
1658
+ if (I)
1659
+ await $?.(V), w && (localStorage.removeItem(w), localStorage.removeItem(`${w}_step`));
1660
+ else {
1661
+ let v;
1662
+ U.nextStep ? v = typeof U.nextStep == "function" ? U.nextStep(V) : U.nextStep : v = W[Z + 1]?.id ?? "", v && be(v);
1663
+ }
1664
+ }
1665
+ }, [
1666
+ U,
1667
+ V,
1668
+ I,
1669
+ Z,
1670
+ W,
1671
+ $,
1672
+ w,
1673
+ D,
1674
+ Ne,
1675
+ we,
1676
+ be
1677
+ ]), Me = useCallback(() => {
1678
+ if (E) return;
1679
+ const v = U?.prevStep ?? W[Z - 1]?.id;
1680
+ v && (F("prev"), be(v));
1681
+ }, [E, U, Z, W, be]), De = useCallback(() => {
1682
+ if (U?.optional && !I) {
1683
+ const v = W[Z + 1]?.id;
1684
+ v && be(v);
1685
+ }
1686
+ }, [U, I, Z, W, be]), Oe = useCallback(() => {
1687
+ $?.(V);
1688
+ }, [$, V]), Ee = useCallback(() => {
1689
+ p?.();
1690
+ }, [p]), Te = useCallback(() => {
1691
+ K((v) => !v);
1692
+ }, []), ye = useMemo(
1693
+ () => ({
1694
+ values: V,
1695
+ setValue: te,
1696
+ setValues: fe,
1697
+ currentStep: U,
1698
+ currentIndex: Z,
1699
+ totalSteps: W.length,
1700
+ visitedSteps: O,
1701
+ errors: q,
1702
+ setError: Ne,
1703
+ clearError: we,
1704
+ goNext: ze,
1705
+ goPrev: Me,
1706
+ goTo: be,
1707
+ skip: De,
1708
+ complete: Oe,
1709
+ cancel: Ee,
1710
+ isFirst: E,
1711
+ isLast: I,
1712
+ isQuickMode: Y,
1713
+ toggleQuickMode: Te,
1714
+ progress: ee,
1715
+ t: D
1716
+ }),
1717
+ [
1718
+ V,
1719
+ te,
1720
+ fe,
1721
+ U,
1722
+ Z,
1723
+ W.length,
1724
+ O,
1725
+ q,
1726
+ Ne,
1727
+ we,
1728
+ ze,
1729
+ Me,
1730
+ be,
1731
+ De,
1732
+ Oe,
1733
+ Ee,
1734
+ E,
1735
+ I,
1736
+ Y,
1737
+ Te,
1738
+ ee,
1739
+ D
1740
+ ]
1741
+ ), Ae = useMemo(() => {
1742
+ if (!t) return null;
1743
+ const H = W.map((P) => P.estimatedTime).filter(Boolean).map((P) => {
1744
+ const se = P.match(/(\d+)\s*(min|sec|s|m)/i);
1745
+ if (!se) return 0;
1746
+ const ue = parseInt(se[1], 10);
1747
+ return se[2].toLowerCase().startsWith("m") ? ue : ue / 60;
1748
+ }).reduce((P, se) => P + se, 0);
1749
+ return H > 0 ? `~${Math.ceil(H)} min` : null;
1750
+ }, [W, t]);
1751
+ if (!U) return null;
1752
+ const He = (v, H) => {
1753
+ const P = v.id === J, se = O.has(v.id) && !P && H < Z, ue = !P && !se, _e = !!q[v.id], G = u && (se || H <= Z);
1754
+ return /* @__PURE__ */ jsxs(
1755
+ "button",
1756
+ {
1757
+ type: "button",
1758
+ role: "tab",
1759
+ "aria-selected": P,
1760
+ "aria-current": P ? "step" : void 0,
1761
+ className: [
1762
+ "nice-setup-wizard__step-indicator",
1763
+ P && "nice-setup-wizard__step-indicator--active",
1764
+ se && "nice-setup-wizard__step-indicator--completed",
1765
+ ue && "nice-setup-wizard__step-indicator--pending",
1766
+ _e && "nice-setup-wizard__step-indicator--error"
1767
+ ].filter(Boolean).join(" "),
1768
+ onClick: () => G && be(v.id),
1769
+ disabled: !G,
1770
+ children: [
1771
+ /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__step-marker", children: se ? "✓" : _e ? "!" : b ? H + 1 : v.icon || "○" }),
1772
+ /* @__PURE__ */ jsxs("span", { className: "nice-setup-wizard__step-info", children: [
1773
+ /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__step-title", children: v.title }),
1774
+ v.subtitle && /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__step-subtitle", children: v.subtitle }),
1775
+ v.optional && /* @__PURE__ */ jsxs("span", { className: "nice-setup-wizard__step-optional", children: [
1776
+ "(",
1777
+ y.optional ?? D("wizard.optional", "optional"),
1778
+ ")"
1779
+ ] })
1780
+ ] }),
1781
+ v.badge && /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__step-badge", children: v.badge })
1782
+ ]
1783
+ },
1784
+ v.id
1785
+ );
1786
+ }, Ke = (v) => {
1787
+ if (v.showWhen && !v.showWhen(V)) return null;
1788
+ const H = V[v.id] ?? v.defaultValue ?? "", P = (G) => te(v.id, G);
1789
+ if (v.render)
1790
+ return /* @__PURE__ */ jsx(
1791
+ "div",
1792
+ {
1793
+ className: `nice-setup-wizard__field${v.fullWidth ? " nice-setup-wizard__field--full" : ""}`,
1794
+ children: v.render({ value: H, onChange: P, field: v })
1795
+ },
1796
+ v.id
1797
+ );
1798
+ const se = `${_}-${v.id}`, ue = {
1799
+ id: se,
1800
+ disabled: v.disabled || N === "disabled" || N === "readOnly",
1801
+ placeholder: v.placeholder,
1802
+ required: v.required
1803
+ };
1804
+ let _e;
1805
+ switch (v.type) {
1806
+ case "textarea":
1807
+ _e = /* @__PURE__ */ jsx(
1808
+ "textarea",
1809
+ {
1810
+ ...ue,
1811
+ className: "nice-setup-wizard__input nice-setup-wizard__textarea",
1812
+ value: String(H),
1813
+ onChange: (G) => P(G.target.value),
1814
+ rows: 4
1815
+ }
1816
+ );
1817
+ break;
1818
+ case "select":
1819
+ _e = /* @__PURE__ */ jsxs(
1820
+ "select",
1821
+ {
1822
+ ...ue,
1823
+ className: "nice-setup-wizard__input nice-setup-wizard__select",
1824
+ value: String(H),
1825
+ onChange: (G) => P(G.target.value),
1826
+ children: [
1827
+ /* @__PURE__ */ jsx("option", { value: "", children: v.placeholder || D("wizard.select", "Select...") }),
1828
+ v.options?.map((G) => /* @__PURE__ */ jsx("option", { value: G.value, children: G.label }, G.value))
1829
+ ]
1830
+ }
1831
+ );
1832
+ break;
1833
+ case "radio":
1834
+ _e = /* @__PURE__ */ jsx("div", { className: "nice-setup-wizard__radio-group", children: v.options?.map((G) => /* @__PURE__ */ jsxs("label", { className: "nice-setup-wizard__radio-label", children: [
1835
+ /* @__PURE__ */ jsx(
1836
+ "input",
1837
+ {
1838
+ type: "radio",
1839
+ name: se,
1840
+ value: G.value,
1841
+ checked: H === G.value,
1842
+ onChange: () => P(G.value),
1843
+ disabled: ue.disabled
1844
+ }
1845
+ ),
1846
+ G.icon && /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__radio-icon", children: G.icon }),
1847
+ /* @__PURE__ */ jsx("span", { children: G.label })
1848
+ ] }, G.value)) });
1849
+ break;
1850
+ case "checkbox":
1851
+ _e = /* @__PURE__ */ jsxs("label", { className: "nice-setup-wizard__checkbox-label", children: [
1852
+ /* @__PURE__ */ jsx(
1853
+ "input",
1854
+ {
1855
+ type: "checkbox",
1856
+ checked: !!H,
1857
+ onChange: (G) => P(G.target.checked),
1858
+ disabled: ue.disabled
1859
+ }
1860
+ ),
1861
+ /* @__PURE__ */ jsx("span", { children: v.label })
1862
+ ] });
1863
+ break;
1864
+ case "switch":
1865
+ _e = /* @__PURE__ */ jsxs("label", { className: "nice-setup-wizard__switch-label", children: [
1866
+ /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__switch-text", children: v.label }),
1867
+ /* @__PURE__ */ jsxs(
1868
+ "span",
1869
+ {
1870
+ className: `nice-setup-wizard__switch${H ? " nice-setup-wizard__switch--on" : ""}`,
1871
+ children: [
1872
+ /* @__PURE__ */ jsx(
1873
+ "input",
1874
+ {
1875
+ type: "checkbox",
1876
+ checked: !!H,
1877
+ onChange: (G) => P(G.target.checked),
1878
+ disabled: ue.disabled
1879
+ }
1880
+ ),
1881
+ /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__switch-track" }),
1882
+ /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__switch-thumb" })
1883
+ ]
1884
+ }
1885
+ )
1886
+ ] });
1887
+ break;
1888
+ case "slider":
1889
+ _e = /* @__PURE__ */ jsxs("div", { className: "nice-setup-wizard__slider-wrapper", children: [
1890
+ /* @__PURE__ */ jsx(
1891
+ "input",
1892
+ {
1893
+ type: "range",
1894
+ ...ue,
1895
+ className: "nice-setup-wizard__slider",
1896
+ value: Number(H) || v.validation?.min || 0,
1897
+ min: v.validation?.min,
1898
+ max: v.validation?.max,
1899
+ onChange: (G) => P(Number(G.target.value))
1900
+ }
1901
+ ),
1902
+ /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__slider-value", children: String(H ?? "") })
1903
+ ] });
1904
+ break;
1905
+ default:
1906
+ _e = /* @__PURE__ */ jsx(
1907
+ "input",
1908
+ {
1909
+ type: v.type === "custom" ? "text" : v.type,
1910
+ ...ue,
1911
+ className: "nice-setup-wizard__input",
1912
+ value: String(H),
1913
+ onChange: (G) => P(G.target.value),
1914
+ minLength: v.validation?.minLength,
1915
+ maxLength: v.validation?.maxLength,
1916
+ min: v.validation?.min,
1917
+ max: v.validation?.max,
1918
+ pattern: v.validation?.pattern?.source
1919
+ }
1920
+ );
1921
+ }
1922
+ return /* @__PURE__ */ jsxs(
1923
+ "div",
1924
+ {
1925
+ className: `nice-setup-wizard__field${v.fullWidth ? " nice-setup-wizard__field--full" : ""}`,
1926
+ children: [
1927
+ v.type !== "checkbox" && v.type !== "switch" && /* @__PURE__ */ jsxs("label", { htmlFor: se, className: "nice-setup-wizard__label", children: [
1928
+ v.label,
1929
+ v.required && /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__required", children: "*" })
1930
+ ] }),
1931
+ _e,
1932
+ v.description && /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__field-desc", children: v.description })
1933
+ ]
1934
+ },
1935
+ v.id
1936
+ );
1937
+ }, Qe = () => U.fields ? /* @__PURE__ */ jsx("div", { className: "nice-setup-wizard__fields", children: U.fields.map(Ke) }) : U.content ? typeof U.content == "function" ? U.content(ye) : U.content : null;
1938
+ return /* @__PURE__ */ jsx(Be.Provider, { value: ye, children: /* @__PURE__ */ jsxs(
1939
+ "div",
1940
+ {
1941
+ ref: k,
1942
+ id: _,
1943
+ className: [
1944
+ "nice-setup-wizard",
1945
+ `nice-setup-wizard--${l}`,
1946
+ `nice-size-${s}`,
1947
+ d !== "none" && `nice-setup-wizard--anim-${d}`,
1948
+ A
1949
+ ].filter(Boolean).join(" "),
1950
+ style: S,
1951
+ children: [
1952
+ (g || z || o) && /* @__PURE__ */ jsxs("header", { className: "nice-setup-wizard__header", children: [
1953
+ g && /* @__PURE__ */ jsx("div", { className: "nice-setup-wizard__branding", children: g }),
1954
+ z,
1955
+ o && /* @__PURE__ */ jsxs("label", { className: "nice-setup-wizard__quick-toggle", children: [
1956
+ /* @__PURE__ */ jsx("input", { type: "checkbox", checked: Y, onChange: Te }),
1957
+ /* @__PURE__ */ jsx("span", { children: y.quickMode ?? D("wizard.quickMode", "Quick Setup") })
1958
+ ] }),
1959
+ Ae && /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__time", children: Ae })
1960
+ ] }),
1961
+ l !== "minimal" && /* @__PURE__ */ jsx("nav", { className: "nice-setup-wizard__nav", role: "tablist", children: W.map(He) }),
1962
+ r && /* @__PURE__ */ jsx("div", { className: "nice-setup-wizard__progress", children: /* @__PURE__ */ jsx(
1963
+ "div",
1964
+ {
1965
+ className: "nice-setup-wizard__progress-bar",
1966
+ style: { width: `${ee}%` },
1967
+ role: "progressbar",
1968
+ "aria-valuenow": ee,
1969
+ "aria-valuemin": 0,
1970
+ "aria-valuemax": 100
1971
+ }
1972
+ ) }),
1973
+ /* @__PURE__ */ jsxs(
1974
+ "div",
1975
+ {
1976
+ className: [
1977
+ "nice-setup-wizard__content",
1978
+ de$1 === "next" && "nice-setup-wizard__content--slide-next",
1979
+ de$1 === "prev" && "nice-setup-wizard__content--slide-prev"
1980
+ ].filter(Boolean).join(" "),
1981
+ role: "tabpanel",
1982
+ children: [
1983
+ U.description && /* @__PURE__ */ jsx("p", { className: "nice-setup-wizard__step-description", children: U.description }),
1984
+ Qe(),
1985
+ q[U.id] && /* @__PURE__ */ jsx("div", { className: "nice-setup-wizard__error", role: "alert", children: q[U.id] })
1986
+ ]
1987
+ },
1988
+ J
1989
+ ),
1990
+ /* @__PURE__ */ jsxs("footer", { className: "nice-setup-wizard__footer", children: [
1991
+ /* @__PURE__ */ jsxs("div", { className: "nice-setup-wizard__actions-left", children: [
1992
+ p && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-btn nice-btn--text", onClick: Ee, children: y.cancel ?? D("wizard.cancel", "Cancel") }),
1993
+ U.optional && !I && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-btn nice-btn--text", onClick: De, children: y.skip ?? D("wizard.skip", "Skip") }),
1994
+ U.actions?.filter((v) => v.position === "left").map((v) => /* @__PURE__ */ jsxs(
1995
+ "button",
1996
+ {
1997
+ type: "button",
1998
+ className: `nice-btn nice-btn--${v.variant || "outlined"}`,
1999
+ onClick: () => v.onClick(ye),
2000
+ disabled: v.disabled?.(ye),
2001
+ children: [
2002
+ v.icon,
2003
+ " ",
2004
+ v.label
2005
+ ]
2006
+ },
2007
+ v.id
2008
+ ))
2009
+ ] }),
2010
+ /* @__PURE__ */ jsxs("div", { className: "nice-setup-wizard__actions-right", children: [
2011
+ U.actions?.filter((v) => v.position !== "left").map((v) => /* @__PURE__ */ jsxs(
2012
+ "button",
2013
+ {
2014
+ type: "button",
2015
+ className: `nice-btn nice-btn--${v.variant || "outlined"}`,
2016
+ onClick: () => v.onClick(ye),
2017
+ disabled: v.disabled?.(ye),
2018
+ children: [
2019
+ v.icon,
2020
+ " ",
2021
+ v.label
2022
+ ]
2023
+ },
2024
+ v.id
2025
+ )),
2026
+ !E && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-btn nice-btn--outlined", onClick: Me, children: y.prev ?? D("wizard.prev", "← Back") }),
2027
+ /* @__PURE__ */ jsx(
2028
+ "button",
2029
+ {
2030
+ type: "button",
2031
+ className: "nice-btn nice-btn--primary",
2032
+ onClick: ze,
2033
+ disabled: ve,
2034
+ children: ve ? /* @__PURE__ */ jsx("span", { className: "nice-setup-wizard__spinner" }) : I ? y.finish ?? D("wizard.finish", "Finish ✓") : y.next ?? D("wizard.next", "Continue →")
2035
+ }
2036
+ )
2037
+ ] })
2038
+ ] }),
2039
+ M && /* @__PURE__ */ jsx("div", { className: "nice-setup-wizard__custom-footer", children: M }),
2040
+ l === "minimal" && /* @__PURE__ */ jsx("div", { className: "nice-setup-wizard__minimal-indicator", children: y.stepOf ? y.stepOf.replace("{current}", String(Z + 1)).replace("{total}", String(W.length)) : `${Z + 1} / ${W.length}` })
2041
+ ]
2042
+ }
2043
+ ) });
2044
+ }
2045
+ );
2046
+ vn.displayName = "NiceSetupWizard";
2047
+ const Nn = forwardRef(({
2048
+ label: n,
2049
+ helperText: a,
2050
+ disabled: i,
2051
+ size: l = "md",
2052
+ id: s,
2053
+ className: h,
2054
+ style: o,
2055
+ accessMode: b,
2056
+ logo: r,
2057
+ brandName: t,
2058
+ breadcrumbs: u,
2059
+ centerContent: m,
2060
+ rightContent: w,
2061
+ leftContent: d,
2062
+ sticky: g = true,
2063
+ variant: z = "light",
2064
+ height: M = "md",
2065
+ onBrandClick: T,
2066
+ displayStyle: f
2067
+ }, $) => {
2068
+ const p = ei(b, s);
2069
+ if (p === "hidden") return null;
2070
+ p === "disabled" && (i = true);
2071
+ const { t: y } = de(), x = ys(s), C = ll("menu", f), A = cl("menu", f);
2072
+ return /* @__PURE__ */ jsxs(
2073
+ "nav",
2074
+ {
2075
+ ref: $,
2076
+ id: x,
2077
+ className: `nice-navbar nice-navbar--${z} nice-navbar--h-${M}${g ? " nice-navbar--sticky" : ""} nice-navbar--ds-${A}${h ? ` ${h}` : ""}${i ? " nice-disabled" : ""}`,
2078
+ style: { ...C, ...o },
2079
+ role: "navigation",
2080
+ "aria-label": n ?? y("mainNavigation", "Main navigation"),
2081
+ children: [
2082
+ /* @__PURE__ */ jsxs("div", { className: "nice-navbar__left", children: [
2083
+ d,
2084
+ (r || t) && /* @__PURE__ */ jsxs("div", { className: "nice-navbar__brand", onClick: T, role: T ? "button" : void 0, tabIndex: T ? 0 : void 0, children: [
2085
+ r && /* @__PURE__ */ jsx("span", { className: "nice-navbar__logo", children: r }),
2086
+ t && /* @__PURE__ */ jsx("span", { className: "nice-navbar__brand-name", children: t })
2087
+ ] }),
2088
+ u && u.length > 0 && /* @__PURE__ */ jsx("ol", { className: "nice-navbar__breadcrumbs", "aria-label": y("breadcrumbs", "Breadcrumbs"), children: u.map((S, k) => /* @__PURE__ */ jsxs("li", { className: "nice-navbar__breadcrumb", children: [
2089
+ k > 0 && /* @__PURE__ */ jsx("span", { className: "nice-navbar__breadcrumb-sep", children: "/" }),
2090
+ S.href || S.onClick ? /* @__PURE__ */ jsx("a", { href: S.href ?? "#", onClick: (N) => {
2091
+ S.onClick && (N.preventDefault(), S.onClick());
2092
+ }, children: S.label }) : /* @__PURE__ */ jsx("span", { "aria-current": k === u.length - 1 ? "page" : void 0, children: S.label })
2093
+ ] }, k)) })
2094
+ ] }),
2095
+ m && /* @__PURE__ */ jsx("div", { className: "nice-navbar__center", children: m }),
2096
+ w && /* @__PURE__ */ jsx("div", { className: "nice-navbar__right", children: w })
2097
+ ]
2098
+ }
2099
+ );
2100
+ });
2101
+ Nn.displayName = "NiceNavbar";
2102
+ const gn = forwardRef(({
2103
+ label: n,
2104
+ helperText: a,
2105
+ disabled: i,
2106
+ readOnly: l,
2107
+ size: s = "md",
2108
+ id: h,
2109
+ className: o,
2110
+ style: b,
2111
+ accessMode: r,
2112
+ tenants: t,
2113
+ currentTenantId: u,
2114
+ onSwitch: m,
2115
+ onManage: w,
2116
+ onCreate: d,
2117
+ variant: g = "dropdown",
2118
+ searchable: z = false
2119
+ }, M) => {
2120
+ const T = ei(r, h);
2121
+ if (T === "hidden") return null;
2122
+ T === "disabled" && (i = true), T === "readOnly" && (l = true);
2123
+ const { t: f } = de(), $ = ys(h), [p, y] = useState(false), [x, C] = useState(""), A = useMemo(() => t.find((N) => N.id === u), [t, u]), S = useMemo(() => {
2124
+ if (!x) return t;
2125
+ const N = x.toLowerCase();
2126
+ return t.filter((D) => D.name.toLowerCase().includes(N));
2127
+ }, [t, x]), k = useCallback((N) => {
2128
+ m?.(N), y(false), C("");
2129
+ }, [m]);
2130
+ return g === "inline" ? /* @__PURE__ */ jsxs("div", { ref: M, id: $, className: `nice-tenant-switcher nice-tenant-switcher--inline nice-size-${s}${o ? ` ${o}` : ""}${i ? " nice-disabled" : ""}`, style: b, children: [
2131
+ n && /* @__PURE__ */ jsx("span", { className: "nice-tenant-switcher__label", children: n }),
2132
+ /* @__PURE__ */ jsx("div", { className: "nice-tenant-switcher__list", children: t.map((N) => /* @__PURE__ */ jsxs(
2133
+ "button",
2134
+ {
2135
+ type: "button",
2136
+ className: `nice-tenant-switcher__option${N.id === u ? " nice-tenant-switcher__option--active" : ""}`,
2137
+ onClick: () => k(N.id),
2138
+ disabled: i || l,
2139
+ children: [
2140
+ N.logoUrl && /* @__PURE__ */ jsx("img", { src: N.logoUrl, alt: "", className: "nice-tenant-switcher__option-logo" }),
2141
+ /* @__PURE__ */ jsx("span", { children: N.name })
2142
+ ]
2143
+ },
2144
+ N.id
2145
+ )) })
2146
+ ] }) : /* @__PURE__ */ jsxs(
2147
+ "div",
2148
+ {
2149
+ ref: M,
2150
+ id: $,
2151
+ className: `nice-tenant-switcher nice-size-${s}${o ? ` ${o}` : ""}${i ? " nice-disabled" : ""}`,
2152
+ style: b,
2153
+ children: [
2154
+ /* @__PURE__ */ jsxs(
2155
+ "button",
2156
+ {
2157
+ type: "button",
2158
+ className: "nice-tenant-switcher__trigger",
2159
+ onClick: () => !i && !l && y(!p),
2160
+ onBlur: () => setTimeout(() => y(false), 200),
2161
+ disabled: i,
2162
+ "aria-haspopup": "listbox",
2163
+ "aria-expanded": p,
2164
+ children: [
2165
+ A?.logoUrl && /* @__PURE__ */ jsx("img", { src: A.logoUrl, alt: "", className: "nice-tenant-switcher__trigger-logo" }),
2166
+ /* @__PURE__ */ jsx("span", { className: "nice-tenant-switcher__trigger-name", children: A?.name ?? f("selectTenant", "Select organization") }),
2167
+ /* @__PURE__ */ jsx("span", { className: "nice-tenant-switcher__trigger-arrow", children: p ? "▲" : "▼" })
2168
+ ]
2169
+ }
2170
+ ),
2171
+ p && /* @__PURE__ */ jsxs("div", { className: "nice-tenant-switcher__dropdown", role: "listbox", children: [
2172
+ z && /* @__PURE__ */ jsx(
2173
+ "input",
2174
+ {
2175
+ type: "text",
2176
+ className: "nice-input nice-tenant-switcher__search",
2177
+ value: x,
2178
+ onChange: (N) => C(N.target.value),
2179
+ placeholder: f("searchOrganizations", "Search…"),
2180
+ autoFocus: true
2181
+ }
2182
+ ),
2183
+ /* @__PURE__ */ jsxs("div", { className: "nice-tenant-switcher__options", children: [
2184
+ S.map((N) => /* @__PURE__ */ jsxs(
2185
+ "div",
2186
+ {
2187
+ className: `nice-tenant-switcher__option${N.id === u ? " nice-tenant-switcher__option--active" : ""}`,
2188
+ role: "option",
2189
+ "aria-selected": N.id === u,
2190
+ onClick: () => k(N.id),
2191
+ children: [
2192
+ N.logoUrl && /* @__PURE__ */ jsx("img", { src: N.logoUrl, alt: "", className: "nice-tenant-switcher__option-logo" }),
2193
+ /* @__PURE__ */ jsxs("div", { className: "nice-tenant-switcher__option-info", children: [
2194
+ /* @__PURE__ */ jsx("span", { className: "nice-tenant-switcher__option-name", children: N.name }),
2195
+ N.subtitle && /* @__PURE__ */ jsx("span", { className: "nice-tenant-switcher__option-subtitle", children: N.subtitle })
2196
+ ] }),
2197
+ N.id === u && /* @__PURE__ */ jsx("span", { className: "nice-tenant-switcher__check", children: "✓" })
2198
+ ]
2199
+ },
2200
+ N.id
2201
+ )),
2202
+ S.length === 0 && /* @__PURE__ */ jsx("div", { className: "nice-tenant-switcher__empty", children: f("noResults", "No results") })
2203
+ ] }),
2204
+ (w || d) && /* @__PURE__ */ jsxs("div", { className: "nice-tenant-switcher__footer", children: [
2205
+ w && /* @__PURE__ */ jsx("button", { type: "button", onClick: w, children: f("manageTenants", "Manage organizations") }),
2206
+ d && /* @__PURE__ */ jsx("button", { type: "button", onClick: d, children: f("createTenant", "Create organization") })
2207
+ ] })
2208
+ ] })
2209
+ ]
2210
+ }
2211
+ );
2212
+ });
2213
+ gn.displayName = "NiceTenantSwitcher";
2214
+ const fn = {
2215
+ online: "var(--nice-color-success, #5cb85c)",
2216
+ away: "var(--nice-color-warning, #f0ad4e)",
2217
+ busy: "var(--nice-color-error, #d9534f)",
2218
+ offline: "var(--nice-color-muted, #999)"
2219
+ }, yn = forwardRef(({
2220
+ label: n,
2221
+ disabled: a,
2222
+ size: i = "md",
2223
+ id: l,
2224
+ className: s,
2225
+ style: h,
2226
+ accessMode: o,
2227
+ userName: b,
2228
+ userEmail: r,
2229
+ userRole: t,
2230
+ avatarUrl: u,
2231
+ items: m = [],
2232
+ open: w,
2233
+ onOpenChange: d,
2234
+ onProfile: g,
2235
+ onLogout: z,
2236
+ avatarSize: M = 36,
2237
+ status: T
2238
+ }, f) => {
2239
+ const $ = ei(o, l);
2240
+ if ($ === "hidden") return null;
2241
+ $ === "disabled" && (a = true);
2242
+ const { t: p } = de(), y = ys(l), [x, C] = useState(false), A = w ?? x, S = useCallback(() => {
2243
+ const _ = !A;
2244
+ C(_), d?.(_);
2245
+ }, [A, d]), k = b.split(" ").map((_) => _.charAt(0)).join("").toUpperCase().slice(0, 2), N = [];
2246
+ g && N.push({ id: "__profile", label: p("profile", "Profile"), onClick: g }), z && N.push({ id: "__divider", label: "", isDivider: true }, { id: "__logout", label: p("logout", "Logout"), onClick: z, danger: true });
2247
+ const D = m.length > 0 ? m : N;
2248
+ return /* @__PURE__ */ jsxs(
2249
+ "div",
2250
+ {
2251
+ ref: f,
2252
+ id: y,
2253
+ className: `nice-user-menu nice-size-${i}${s ? ` ${s}` : ""}${a ? " nice-disabled" : ""}`,
2254
+ style: h,
2255
+ children: [
2256
+ /* @__PURE__ */ jsx(
2257
+ "button",
2258
+ {
2259
+ type: "button",
2260
+ className: "nice-user-menu__trigger",
2261
+ onClick: S,
2262
+ onBlur: () => setTimeout(() => {
2263
+ C(false), d?.(false);
2264
+ }, 200),
2265
+ disabled: a,
2266
+ "aria-haspopup": "menu",
2267
+ "aria-expanded": A,
2268
+ "aria-label": n ?? b,
2269
+ children: /* @__PURE__ */ jsxs("span", { className: "nice-user-menu__avatar", style: { width: M, height: M }, children: [
2270
+ u ? /* @__PURE__ */ jsx("img", { src: u, alt: b }) : /* @__PURE__ */ jsx("span", { className: "nice-user-menu__initials", children: k }),
2271
+ T && /* @__PURE__ */ jsx("span", { className: "nice-user-menu__status", style: { backgroundColor: fn[T] }, title: T })
2272
+ ] })
2273
+ }
2274
+ ),
2275
+ A && /* @__PURE__ */ jsxs("div", { className: "nice-user-menu__dropdown", role: "menu", children: [
2276
+ /* @__PURE__ */ jsxs("div", { className: "nice-user-menu__info", children: [
2277
+ /* @__PURE__ */ jsx("span", { className: "nice-user-menu__name", children: b }),
2278
+ r && /* @__PURE__ */ jsx("span", { className: "nice-user-menu__email", children: r }),
2279
+ t && /* @__PURE__ */ jsx("span", { className: "nice-user-menu__role", children: t })
2280
+ ] }),
2281
+ D.length > 0 && /* @__PURE__ */ jsx("div", { className: "nice-user-menu__items", children: D.map(
2282
+ (_) => _.isDivider ? /* @__PURE__ */ jsx("hr", { className: "nice-user-menu__divider" }, _.id) : /* @__PURE__ */ jsxs(
2283
+ "button",
2284
+ {
2285
+ type: "button",
2286
+ role: "menuitem",
2287
+ className: `nice-user-menu__item${_.danger ? " nice-user-menu__item--danger" : ""}`,
2288
+ onClick: () => {
2289
+ _.onClick?.(), C(false), d?.(false);
2290
+ },
2291
+ disabled: _.disabled || a,
2292
+ children: [
2293
+ _.icon && /* @__PURE__ */ jsx("span", { className: "nice-user-menu__item-icon", children: _.icon }),
2294
+ /* @__PURE__ */ jsx("span", { children: _.label })
2295
+ ]
2296
+ },
2297
+ _.id
2298
+ )
2299
+ ) })
2300
+ ] })
2301
+ ]
2302
+ }
2303
+ );
2304
+ });
2305
+ yn.displayName = "NiceUserMenu";
2306
+ function kn(n, a) {
2307
+ if (!a) return n;
2308
+ const i = a.toLowerCase();
2309
+ return n.map((l) => {
2310
+ const s = l.entities.filter(
2311
+ (o) => o.label.toLowerCase().includes(i) || o.name.toLowerCase().includes(i)
2312
+ );
2313
+ return l.label.toLowerCase().includes(i) || l.name.toLowerCase().includes(i) ? l : s.length > 0 ? { ...l, entities: s } : null;
2314
+ }).filter(Boolean);
2315
+ }
2316
+ const wn = ({ value: n, onChange: a, placeholder: i }) => /* @__PURE__ */ jsxs("div", { className: "nice-dynamic-sidebar__search", children: [
2317
+ /* @__PURE__ */ jsx("span", { className: "nice-dynamic-sidebar__search-icon", "aria-hidden": true, children: "🔍" }),
2318
+ /* @__PURE__ */ jsx(
2319
+ "input",
2320
+ {
2321
+ type: "text",
2322
+ className: "nice-dynamic-sidebar__search-input",
2323
+ value: n,
2324
+ onChange: (l) => a(l.target.value),
2325
+ placeholder: i,
2326
+ "aria-label": i
2327
+ }
2328
+ ),
2329
+ n && /* @__PURE__ */ jsx(
2330
+ "button",
2331
+ {
2332
+ className: "nice-dynamic-sidebar__search-clear",
2333
+ onClick: () => a(""),
2334
+ "aria-label": "Clear",
2335
+ type: "button",
2336
+ children: "×"
2337
+ }
2338
+ )
2339
+ ] }), Cn = ({ module: n, activeRoute: a, collapsed: i, expandedModules: l, onToggleModule: s, onNavigate: h }) => {
2340
+ const o = l.has(n.id);
2341
+ return i ? /* @__PURE__ */ jsx("div", { className: "nice-dynamic-sidebar__module nice-dynamic-sidebar__module--collapsed", title: n.label, children: /* @__PURE__ */ jsx(
2342
+ "button",
2343
+ {
2344
+ className: `nice-dynamic-sidebar__module-icon ${n.isAvailable ? "" : "nice-dynamic-sidebar__module-icon--disabled"}`,
2345
+ onClick: () => n.isAvailable && n.entities.length > 0 && h(n.entities[0].route, n.entities[0]),
2346
+ disabled: !n.isAvailable,
2347
+ type: "button",
2348
+ children: /* @__PURE__ */ jsx("span", { children: n.icon || n.label[0] })
2349
+ }
2350
+ ) }) : /* @__PURE__ */ jsxs("div", { className: `nice-dynamic-sidebar__module ${n.isAvailable ? "" : "nice-dynamic-sidebar__module--disabled"}`, children: [
2351
+ /* @__PURE__ */ jsxs(
2352
+ "button",
2353
+ {
2354
+ className: `nice-dynamic-sidebar__module-header ${o ? "nice-dynamic-sidebar__module-header--expanded" : ""}`,
2355
+ onClick: () => n.isAvailable && s(n.id),
2356
+ disabled: !n.isAvailable,
2357
+ type: "button",
2358
+ "aria-expanded": o,
2359
+ children: [
2360
+ n.icon && /* @__PURE__ */ jsx("span", { className: "nice-dynamic-sidebar__module-icon", children: n.icon }),
2361
+ /* @__PURE__ */ jsx("span", { className: "nice-dynamic-sidebar__module-label", children: n.label }),
2362
+ /* @__PURE__ */ jsx("span", { className: `nice-dynamic-sidebar__module-chevron ${o ? "nice-dynamic-sidebar__module-chevron--open" : ""}`, children: "▸" })
2363
+ ]
2364
+ }
2365
+ ),
2366
+ o && /* @__PURE__ */ jsx("ul", { className: "nice-dynamic-sidebar__entities", role: "list", children: n.entities.map((b) => /* @__PURE__ */ jsx(
2367
+ "li",
2368
+ {
2369
+ className: `nice-dynamic-sidebar__entity ${a === b.route ? "nice-dynamic-sidebar__entity--active" : ""}`,
2370
+ children: /* @__PURE__ */ jsxs(
2371
+ "button",
2372
+ {
2373
+ className: "nice-dynamic-sidebar__entity-btn",
2374
+ onClick: () => h(b.route, b),
2375
+ type: "button",
2376
+ children: [
2377
+ b.icon && /* @__PURE__ */ jsx("span", { className: "nice-dynamic-sidebar__entity-icon", children: b.icon }),
2378
+ /* @__PURE__ */ jsx("span", { children: b.label })
2379
+ ]
2380
+ }
2381
+ )
2382
+ },
2383
+ b.id
2384
+ )) })
2385
+ ] });
2386
+ }, xn = ({ favorites: n, activeRoute: a, onNavigate: i, label: l }) => n.length === 0 ? null : /* @__PURE__ */ jsxs("div", { className: "nice-dynamic-sidebar__favorites", children: [
2387
+ /* @__PURE__ */ jsx("div", { className: "nice-dynamic-sidebar__section-title", children: l }),
2388
+ /* @__PURE__ */ jsx("ul", { role: "list", children: n.map((s) => /* @__PURE__ */ jsx(
2389
+ "li",
2390
+ {
2391
+ className: `nice-dynamic-sidebar__favorite ${a === s.route ? "nice-dynamic-sidebar__favorite--active" : ""}`,
2392
+ children: /* @__PURE__ */ jsxs(
2393
+ "button",
2394
+ {
2395
+ className: "nice-dynamic-sidebar__favorite-btn",
2396
+ onClick: () => i(s.route),
2397
+ type: "button",
2398
+ children: [
2399
+ s.icon && /* @__PURE__ */ jsx("span", { children: s.icon }),
2400
+ /* @__PURE__ */ jsx("span", { children: s.label })
2401
+ ]
2402
+ }
2403
+ )
2404
+ },
2405
+ s.id
2406
+ )) })
2407
+ ] }), $n = forwardRef(
2408
+ ({
2409
+ menu: n,
2410
+ activeRoute: a,
2411
+ collapsed: i,
2412
+ width: l = 260,
2413
+ collapsedWidth: s = 56,
2414
+ searchable: h = true,
2415
+ showFavorites: o = true,
2416
+ showQuickActions: b = true,
2417
+ collapsible: r = true,
2418
+ onNavigate: t,
2419
+ onCollapseChange: u,
2420
+ onToggleFavorite: m,
2421
+ header: w,
2422
+ footer: d,
2423
+ className: g,
2424
+ style: z,
2425
+ id: M,
2426
+ accessMode: T,
2427
+ ...f
2428
+ }, $) => {
2429
+ const p = ys(M), y = ei(T, M), { t: x } = de(), [C, A] = useState(i ?? false), S = i ?? C, [k, N] = useState(""), [D, _] = useState(() => {
2430
+ if (a) {
2431
+ const j = n.modules.find((J) => J.entities.some((B) => B.route === a));
2432
+ return j ? /* @__PURE__ */ new Set([j.id]) : /* @__PURE__ */ new Set();
2433
+ }
2434
+ return /* @__PURE__ */ new Set();
2435
+ }), Y = useCallback(() => {
2436
+ const j = !S;
2437
+ A(j), u?.(j);
2438
+ }, [S, u]), K = useCallback((j) => {
2439
+ _((J) => {
2440
+ const B = new Set(J);
2441
+ return B.has(j) ? B.delete(j) : B.add(j), B;
2442
+ });
2443
+ }, []), Q = useCallback(
2444
+ (j, J) => {
2445
+ t?.(j, J);
2446
+ },
2447
+ [t]
2448
+ ), W = useMemo(
2449
+ () => kn(n.modules.filter((j) => j.isAvailable).sort((j, J) => j.order - J.order), k),
2450
+ [n.modules, k]
2451
+ ), V = S ? s : l;
2452
+ return y === "hidden" ? null : /* @__PURE__ */ jsxs(
2453
+ "nav",
2454
+ {
2455
+ ref: $,
2456
+ id: p,
2457
+ className: `nice-dynamic-sidebar ${S ? "nice-dynamic-sidebar--collapsed" : ""} ${g ?? ""}`,
2458
+ style: { ...z, width: V, minWidth: V },
2459
+ "aria-label": x("nav.sidebar", "Sidebar"),
2460
+ ...f,
2461
+ children: [
2462
+ w && /* @__PURE__ */ jsx("div", { className: "nice-dynamic-sidebar__header", children: w }),
2463
+ r && /* @__PURE__ */ jsx(
2464
+ "button",
2465
+ {
2466
+ className: "nice-dynamic-sidebar__toggle",
2467
+ onClick: Y,
2468
+ "aria-label": S ? x("expand", "Expand") : x("collapse", "Collapse"),
2469
+ type: "button",
2470
+ children: S ? "▸" : "◂"
2471
+ }
2472
+ ),
2473
+ h && !S && /* @__PURE__ */ jsx(
2474
+ wn,
2475
+ {
2476
+ value: k,
2477
+ onChange: N,
2478
+ placeholder: x("nav.search", "Search")
2479
+ }
2480
+ ),
2481
+ o && !S && /* @__PURE__ */ jsx(
2482
+ xn,
2483
+ {
2484
+ favorites: n.favorites,
2485
+ activeRoute: a,
2486
+ onNavigate: Q,
2487
+ label: x("nav.favorites", "Favorites")
2488
+ }
2489
+ ),
2490
+ b && !S && n.quickActions.length > 0 && /* @__PURE__ */ jsx("div", { className: "nice-dynamic-sidebar__quick-actions", children: n.quickActions.map((j) => /* @__PURE__ */ jsxs(
2491
+ "button",
2492
+ {
2493
+ className: "nice-dynamic-sidebar__quick-action",
2494
+ onClick: () => Q(j.route),
2495
+ title: j.shortcut ? `${j.label} (${j.shortcut})` : j.label,
2496
+ type: "button",
2497
+ children: [
2498
+ j.icon && /* @__PURE__ */ jsx("span", { children: j.icon }),
2499
+ /* @__PURE__ */ jsx("span", { children: j.label })
2500
+ ]
2501
+ },
2502
+ j.id
2503
+ )) }),
2504
+ /* @__PURE__ */ jsxs("div", { className: "nice-dynamic-sidebar__modules", role: "navigation", children: [
2505
+ W.map((j) => /* @__PURE__ */ jsx(
2506
+ Cn,
2507
+ {
2508
+ module: j,
2509
+ activeRoute: a,
2510
+ collapsed: S,
2511
+ expandedModules: D,
2512
+ onToggleModule: K,
2513
+ onNavigate: Q
2514
+ },
2515
+ j.id
2516
+ )),
2517
+ W.length === 0 && !S && /* @__PURE__ */ jsx("div", { className: "nice-dynamic-sidebar__empty", children: x("noData", "No data") })
2518
+ ] }),
2519
+ d && /* @__PURE__ */ jsx("div", { className: "nice-dynamic-sidebar__footer", children: d })
2520
+ ]
2521
+ }
2522
+ );
2523
+ }
2524
+ );
2525
+ $n.displayName = "NiceDynamicSidebar";
2526
+ const xe = {
2527
+ all: { icon: "☰", label: "Wszystko" },
2528
+ "by-role": { icon: "👤", label: "Według roli" },
2529
+ "by-unit": { icon: "🏢", label: "Według jednostki" },
2530
+ favorites: { icon: "⭐", label: "Ulubione" },
2531
+ preferences: { icon: "⚙️", label: "Preferencje" }
2532
+ }, Ue = {
2533
+ enableModeIcons: false,
2534
+ enabledModes: ["all", "by-role", "by-unit", "favorites", "preferences"],
2535
+ activeMode: "all",
2536
+ pinnedSources: {},
2537
+ hiddenItems: [],
2538
+ favorites: [],
2539
+ maxDepth: {},
2540
+ collapsedIds: [],
2541
+ autoExpand: true
2542
+ };
2543
+ function Pe(n) {
2544
+ return `nice_sidebar_nav_${n ?? "_default"}`;
2545
+ }
2546
+ function Sn(n, a) {
2547
+ const i = {
2548
+ ...Ue,
2549
+ userId: n ?? "_default"
2550
+ };
2551
+ if (a && Object.assign(i, a), a && typeof a.activeMode < "u") return i;
2552
+ try {
2553
+ const l = localStorage.getItem(Pe(n));
2554
+ if (l) {
2555
+ const s = JSON.parse(l);
2556
+ return { ...i, ...s, userId: n ?? "_default" };
2557
+ }
2558
+ } catch {
2559
+ }
2560
+ return i;
2561
+ }
2562
+ function zn(n, a, i, l) {
2563
+ const [s, h] = useState(() => {
2564
+ const r = Sn(n, i);
2565
+ return a !== void 0 && (r.enableModeIcons = a), r;
2566
+ });
2567
+ useEffect(() => {
2568
+ i && h((r) => ({ ...r, ...i }));
2569
+ }, [i]);
2570
+ const o = useCallback(
2571
+ (r) => {
2572
+ h((t) => {
2573
+ const u = r(t);
2574
+ if (!i?.activeMode)
2575
+ try {
2576
+ localStorage.setItem(Pe(n), JSON.stringify(u));
2577
+ } catch {
2578
+ }
2579
+ return l?.(u), u;
2580
+ });
2581
+ },
2582
+ [n, i, l]
2583
+ ), b = useMemo(
2584
+ () => ({
2585
+ setMode: (r) => o((t) => ({ ...t, activeMode: r })),
2586
+ setEnableModeIcons: (r) => o((t) => ({ ...t, enableModeIcons: r })),
2587
+ toggleMode: (r) => o((t) => {
2588
+ if (r === "preferences") return t;
2589
+ const u = t.enabledModes.includes(r);
2590
+ return {
2591
+ ...t,
2592
+ enabledModes: u ? t.enabledModes.filter((m) => m !== r) : [...t.enabledModes, r],
2593
+ // If we're hiding the active mode, fall back to 'all'
2594
+ activeMode: !u || t.activeMode !== r ? t.activeMode : "all"
2595
+ };
2596
+ }),
2597
+ pinSource: (r, t) => o((u) => ({
2598
+ ...u,
2599
+ pinnedSources: {
2600
+ ...u.pinnedSources,
2601
+ [r]: [...u.pinnedSources[r] ?? [], t]
2602
+ }
2603
+ })),
2604
+ unpinSource: (r, t) => o((u) => ({
2605
+ ...u,
2606
+ pinnedSources: {
2607
+ ...u.pinnedSources,
2608
+ [r]: (u.pinnedSources[r] ?? []).filter((m) => m !== t)
2609
+ }
2610
+ })),
2611
+ hideItem: (r) => o((t) => ({
2612
+ ...t,
2613
+ hiddenItems: t.hiddenItems.some((u) => u.id === r.id) ? t.hiddenItems : [...t.hiddenItems, r]
2614
+ })),
2615
+ restoreItem: (r) => o((t) => ({
2616
+ ...t,
2617
+ hiddenItems: t.hiddenItems.filter((u) => u.id !== r)
2618
+ })),
2619
+ addFavorite: (r) => o((t) => ({
2620
+ ...t,
2621
+ favorites: t.favorites.some((u) => u.id === r.id) ? t.favorites : [...t.favorites, { ...r, addedAt: Date.now() }]
2622
+ })),
2623
+ removeFavorite: (r) => o((t) => ({ ...t, favorites: t.favorites.filter((u) => u.id !== r) })),
2624
+ setMaxDepth: (r, t) => o((u) => ({
2625
+ ...u,
2626
+ maxDepth: { ...u.maxDepth, [r]: Math.min(4, Math.max(1, t)) }
2627
+ })),
2628
+ toggleCollapse: (r) => o((t) => ({
2629
+ ...t,
2630
+ collapsedIds: t.collapsedIds.includes(r) ? t.collapsedIds.filter((u) => u !== r) : [...t.collapsedIds, r]
2631
+ })),
2632
+ setAutoExpand: (r) => o((t) => ({ ...t, autoExpand: r })),
2633
+ resetAll: () => o(() => ({
2634
+ ...Ue,
2635
+ userId: n ?? "_default"
2636
+ }))
2637
+ }),
2638
+ [o, n]
2639
+ );
2640
+ return [s, b];
2641
+ }
2642
+ function Mn({ enabledModes: n, activeMode: a, onSelect: i }) {
2643
+ const l = [
2644
+ ...n.filter((s) => s !== "preferences"),
2645
+ "preferences"
2646
+ ];
2647
+ return /* @__PURE__ */ jsx("div", { className: "nice-sidebar-nav__mode-strip", role: "tablist", "aria-label": "Tryb nawigacji", children: l.map((s) => {
2648
+ const h = xe[s], o = a === s;
2649
+ return /* @__PURE__ */ jsx(
2650
+ "button",
2651
+ {
2652
+ role: "tab",
2653
+ "aria-selected": o,
2654
+ "aria-label": h.label,
2655
+ title: h.label,
2656
+ className: [
2657
+ "nice-sidebar-nav__mode-btn",
2658
+ o ? "nice-sidebar-nav__mode-btn--active" : ""
2659
+ ].filter(Boolean).join(" "),
2660
+ onClick: () => i(s),
2661
+ children: /* @__PURE__ */ jsx("span", { className: "nice-sidebar-nav__mode-icon", "aria-hidden": "true", children: h.icon })
2662
+ },
2663
+ s
2664
+ );
2665
+ }) });
2666
+ }
2667
+ function Ve({
2668
+ item: n,
2669
+ depth: a,
2670
+ maxDepth: i,
2671
+ activeRoute: l,
2672
+ collapsedIds: s,
2673
+ hiddenIds: h,
2674
+ autoExpand: o,
2675
+ onNavigate: b,
2676
+ onHide: r,
2677
+ onToggleCollapse: t,
2678
+ onAddFavorite: u,
2679
+ isFavorite: m
2680
+ }) {
2681
+ if (h.has(n.id)) return null;
2682
+ const w = (n.children?.length ?? 0) > 0 && a < i, d = s.includes(n.id), g = o ? !d : d, z = !!(n.route && l && n.route === l), M = !!n.route;
2683
+ function T() {
2684
+ M && n.route ? b?.(n.route, n) : w && t(n.id);
2685
+ }
2686
+ return /* @__PURE__ */ jsxs(
2687
+ "li",
2688
+ {
2689
+ className: [
2690
+ "nice-sidebar-nav__node",
2691
+ `nice-sidebar-nav__node--depth-${a}`,
2692
+ z ? "nice-sidebar-nav__node--active" : "",
2693
+ w ? "nice-sidebar-nav__node--branch" : "nice-sidebar-nav__node--leaf"
2694
+ ].filter(Boolean).join(" "),
2695
+ children: [
2696
+ /* @__PURE__ */ jsxs("div", { className: "nice-sidebar-nav__node-row", children: [
2697
+ w && /* @__PURE__ */ jsx(
2698
+ "button",
2699
+ {
2700
+ className: "nice-sidebar-nav__collapse-btn",
2701
+ "aria-label": g ? "Zwiń" : "Rozwiń",
2702
+ "aria-expanded": g,
2703
+ onClick: () => t(n.id),
2704
+ children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: g ? "▾" : "▸" })
2705
+ }
2706
+ ),
2707
+ !w && /* @__PURE__ */ jsx("span", { className: "nice-sidebar-nav__collapse-spacer" }),
2708
+ /* @__PURE__ */ jsxs(
2709
+ "span",
2710
+ {
2711
+ role: M ? "link" : void 0,
2712
+ tabIndex: M ? 0 : void 0,
2713
+ className: [
2714
+ "nice-sidebar-nav__node-content",
2715
+ M ? "nice-sidebar-nav__node-content--link" : ""
2716
+ ].filter(Boolean).join(" "),
2717
+ onClick: T,
2718
+ onKeyDown: (f) => (f.key === "Enter" || f.key === " ") && T(),
2719
+ children: [
2720
+ n.icon && /* @__PURE__ */ jsx("span", { className: "nice-sidebar-nav__node-icon", "aria-hidden": "true", children: n.icon }),
2721
+ /* @__PURE__ */ jsx("span", { className: "nice-sidebar-nav__node-label", children: n.label }),
2722
+ n.badge !== void 0 && /* @__PURE__ */ jsx("span", { className: "nice-sidebar-nav__node-badge", "aria-label": `${n.badge} powiadomień`, children: n.badge })
2723
+ ]
2724
+ }
2725
+ ),
2726
+ /* @__PURE__ */ jsxs("div", { className: "nice-sidebar-nav__node-actions", children: [
2727
+ M && !m(n.id) && /* @__PURE__ */ jsx(
2728
+ "button",
2729
+ {
2730
+ className: "nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--fav",
2731
+ "aria-label": "Dodaj do ulubionych",
2732
+ title: "Dodaj do ulubionych",
2733
+ onClick: (f) => {
2734
+ f.stopPropagation(), u({
2735
+ id: n.id,
2736
+ label: n.label,
2737
+ icon: n.icon,
2738
+ route: n.route,
2739
+ sourceId: n.sourceId,
2740
+ moduleId: n.moduleId,
2741
+ addedAt: Date.now()
2742
+ });
2743
+ },
2744
+ children: "☆"
2745
+ }
2746
+ ),
2747
+ m(n.id) && /* @__PURE__ */ jsx(
2748
+ "span",
2749
+ {
2750
+ className: "nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--fav-active",
2751
+ "aria-label": "W ulubionych",
2752
+ title: "W ulubionych",
2753
+ children: "⭐"
2754
+ }
2755
+ ),
2756
+ /* @__PURE__ */ jsx(
2757
+ "button",
2758
+ {
2759
+ className: "nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--hide",
2760
+ "aria-label": "Ukryj element",
2761
+ title: "Ukryj",
2762
+ onClick: (f) => {
2763
+ f.stopPropagation(), r({ id: n.id, kind: n.kind, label: n.label });
2764
+ },
2765
+ children: "👁"
2766
+ }
2767
+ )
2768
+ ] })
2769
+ ] }),
2770
+ w && g && /* @__PURE__ */ jsx("ul", { className: "nice-sidebar-nav__children", children: n.children.map((f) => /* @__PURE__ */ jsx(
2771
+ Ve,
2772
+ {
2773
+ item: f,
2774
+ depth: a + 1,
2775
+ maxDepth: i,
2776
+ activeRoute: l,
2777
+ collapsedIds: s,
2778
+ hiddenIds: h,
2779
+ autoExpand: o,
2780
+ onNavigate: b,
2781
+ onHide: r,
2782
+ onToggleCollapse: t,
2783
+ onAddFavorite: u,
2784
+ isFavorite: m
2785
+ },
2786
+ f.id
2787
+ )) })
2788
+ ]
2789
+ }
2790
+ );
2791
+ }
2792
+ function Dn(n, a) {
2793
+ return n.map((i) => ({
2794
+ id: i.id,
2795
+ label: i.label,
2796
+ icon: i.icon,
2797
+ kind: "module",
2798
+ sourceId: a,
2799
+ children: i.views.map((l) => ({
2800
+ id: l.id,
2801
+ label: l.label,
2802
+ icon: l.icon,
2803
+ route: l.route,
2804
+ badge: l.badge,
2805
+ kind: "view",
2806
+ sourceId: a,
2807
+ moduleId: i.id,
2808
+ children: []
2809
+ }))
2810
+ }));
2811
+ }
2812
+ function En(n, a) {
2813
+ return n.map((i) => ({
2814
+ id: i.id,
2815
+ label: i.label,
2816
+ icon: i.icon,
2817
+ kind: "role",
2818
+ sourceId: a,
2819
+ children: i.modules.map((l) => ({
2820
+ id: `${i.id}:${l.id}`,
2821
+ label: l.label,
2822
+ icon: l.icon,
2823
+ kind: "module",
2824
+ sourceId: a,
2825
+ children: l.views.map((s) => ({
2826
+ id: s.id,
2827
+ label: s.label,
2828
+ icon: s.icon,
2829
+ route: s.route,
2830
+ badge: s.badge,
2831
+ kind: "view",
2832
+ sourceId: a,
2833
+ moduleId: l.id,
2834
+ children: []
2835
+ }))
2836
+ }))
2837
+ }));
2838
+ }
2839
+ function Tn(n, a) {
2840
+ return n.map((i) => ({
2841
+ id: i.id,
2842
+ label: i.label,
2843
+ icon: i.icon,
2844
+ kind: "unit",
2845
+ sourceId: a,
2846
+ children: i.modules.map((l) => ({
2847
+ id: `${i.id}:${l.id}`,
2848
+ label: l.label,
2849
+ icon: l.icon,
2850
+ kind: "module",
2851
+ sourceId: a,
2852
+ children: l.views.map((s) => ({
2853
+ id: s.id,
2854
+ label: s.label,
2855
+ icon: s.icon,
2856
+ route: s.route,
2857
+ badge: s.badge,
2858
+ kind: "view",
2859
+ sourceId: a,
2860
+ moduleId: l.id,
2861
+ children: []
2862
+ }))
2863
+ }))
2864
+ }));
2865
+ }
2866
+ function In({
2867
+ node: n,
2868
+ mode: a,
2869
+ maxDepth: i,
2870
+ isPinned: l,
2871
+ prefs: s,
2872
+ helpers: h,
2873
+ activeRoute: o,
2874
+ onNavigate: b
2875
+ }) {
2876
+ const r = useMemo(() => new Set(s.hiddenItems.map((m) => m.id)), [s.hiddenItems]), t = useMemo(() => a === "all" ? Dn(n.modules, n.source.id) : a === "by-role" ? En(n.roles, n.source.id) : Tn(n.units, n.source.id), [a, n]), u = useCallback(
2877
+ (m) => s.favorites.some((w) => w.id === m),
2878
+ [s.favorites]
2879
+ );
2880
+ return r.has(n.source.id) ? null : /* @__PURE__ */ jsxs("section", { className: "nice-sidebar-nav__source-section", children: [
2881
+ /* @__PURE__ */ jsxs("div", { className: "nice-sidebar-nav__source-header", children: [
2882
+ n.source.icon && /* @__PURE__ */ jsx("span", { className: "nice-sidebar-nav__source-icon", "aria-hidden": "true", children: n.source.icon }),
2883
+ /* @__PURE__ */ jsx("span", { className: "nice-sidebar-nav__source-label", children: n.source.label }),
2884
+ /* @__PURE__ */ jsxs("div", { className: "nice-sidebar-nav__source-actions", children: [
2885
+ /* @__PURE__ */ jsx(
2886
+ "button",
2887
+ {
2888
+ className: [
2889
+ "nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--pin",
2890
+ l ? "nice-sidebar-nav__action-btn--pin-active" : ""
2891
+ ].filter(Boolean).join(" "),
2892
+ "aria-label": l ? "Odepnij źródło" : "Przypnij źródło",
2893
+ title: l ? "Odepnij" : "Przypnij",
2894
+ onClick: () => l ? h.unpinSource(a, n.source.id) : h.pinSource(a, n.source.id),
2895
+ children: l ? "📌" : "📍"
2896
+ }
2897
+ ),
2898
+ /* @__PURE__ */ jsx(
2899
+ "button",
2900
+ {
2901
+ className: "nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--hide",
2902
+ "aria-label": "Ukryj źródło",
2903
+ title: "Ukryj",
2904
+ onClick: () => h.hideItem({
2905
+ id: n.source.id,
2906
+ kind: "source",
2907
+ label: n.source.label
2908
+ }),
2909
+ children: "👁"
2910
+ }
2911
+ )
2912
+ ] })
2913
+ ] }),
2914
+ i > 1 && /* @__PURE__ */ jsx("ul", { className: "nice-sidebar-nav__tree", children: t.map((m) => /* @__PURE__ */ jsx(
2915
+ Ve,
2916
+ {
2917
+ item: m,
2918
+ depth: 2,
2919
+ maxDepth: i,
2920
+ activeRoute: o,
2921
+ collapsedIds: s.collapsedIds,
2922
+ hiddenIds: r,
2923
+ autoExpand: s.autoExpand,
2924
+ onNavigate: b,
2925
+ onHide: h.hideItem,
2926
+ onToggleCollapse: h.toggleCollapse,
2927
+ onAddFavorite: h.addFavorite,
2928
+ isFavorite: u
2929
+ },
2930
+ m.id
2931
+ )) })
2932
+ ] });
2933
+ }
2934
+ function Ln({ favorites: n, activeRoute: a, onNavigate: i, onRemove: l }) {
2935
+ return n.length === 0 ? /* @__PURE__ */ jsx("p", { className: "nice-sidebar-nav__empty", children: "Brak ulubionych. Najedź na element i kliknij ☆, aby dodać." }) : /* @__PURE__ */ jsx("ul", { className: "nice-sidebar-nav__favorites-list", children: n.map((s) => {
2936
+ const h = !!(s.route && s.route === a);
2937
+ return /* @__PURE__ */ jsxs(
2938
+ "li",
2939
+ {
2940
+ className: [
2941
+ "nice-sidebar-nav__fav-item",
2942
+ h ? "nice-sidebar-nav__fav-item--active" : ""
2943
+ ].filter(Boolean).join(" "),
2944
+ children: [
2945
+ /* @__PURE__ */ jsxs(
2946
+ "span",
2947
+ {
2948
+ role: "link",
2949
+ tabIndex: 0,
2950
+ className: "nice-sidebar-nav__fav-content",
2951
+ onClick: () => {
2952
+ s.route && i?.(s.route, s);
2953
+ },
2954
+ onKeyDown: (o) => {
2955
+ (o.key === "Enter" || o.key === " ") && s.route && i?.(s.route, s);
2956
+ },
2957
+ children: [
2958
+ s.icon && /* @__PURE__ */ jsx("span", { className: "nice-sidebar-nav__fav-icon", "aria-hidden": "true", children: s.icon }),
2959
+ /* @__PURE__ */ jsx("span", { className: "nice-sidebar-nav__fav-label", children: s.label })
2960
+ ]
2961
+ }
2962
+ ),
2963
+ /* @__PURE__ */ jsx(
2964
+ "button",
2965
+ {
2966
+ className: "nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--remove",
2967
+ "aria-label": "Usuń z ulubionych",
2968
+ title: "Usuń z ulubionych",
2969
+ onClick: () => l(s.id),
2970
+ children: "✕"
2971
+ }
2972
+ )
2973
+ ]
2974
+ },
2975
+ s.id
2976
+ );
2977
+ }) });
2978
+ }
2979
+ const je = ["all", "by-role", "by-unit", "favorites"];
2980
+ function On({ prefs: n, helpers: a }) {
2981
+ return /* @__PURE__ */ jsxs("div", { className: "nice-sidebar-nav__prefs", children: [
2982
+ /* @__PURE__ */ jsx("h3", { className: "nice-sidebar-nav__prefs-title", children: "Preferencje" }),
2983
+ /* @__PURE__ */ jsxs("section", { className: "nice-sidebar-nav__prefs-section", children: [
2984
+ /* @__PURE__ */ jsx("h4", { className: "nice-sidebar-nav__prefs-section-title", children: "Tryb wyświetlania" }),
2985
+ /* @__PURE__ */ jsxs("label", { className: "nice-sidebar-nav__prefs-row", children: [
2986
+ /* @__PURE__ */ jsx("span", { children: "Pokaż ikony trybów" }),
2987
+ /* @__PURE__ */ jsx(
2988
+ "input",
2989
+ {
2990
+ type: "checkbox",
2991
+ checked: n.enableModeIcons,
2992
+ onChange: (i) => a.setEnableModeIcons(i.target.checked)
2993
+ }
2994
+ )
2995
+ ] }),
2996
+ je.map((i) => {
2997
+ const l = xe[i], s = n.enabledModes.includes(i);
2998
+ return /* @__PURE__ */ jsxs("label", { className: "nice-sidebar-nav__prefs-row", children: [
2999
+ /* @__PURE__ */ jsxs("span", { children: [
3000
+ l.icon,
3001
+ " ",
3002
+ l.label
3003
+ ] }),
3004
+ /* @__PURE__ */ jsx("input", { type: "checkbox", checked: s, onChange: () => a.toggleMode(i) })
3005
+ ] }, i);
3006
+ })
3007
+ ] }),
3008
+ /* @__PURE__ */ jsxs("section", { className: "nice-sidebar-nav__prefs-section", children: [
3009
+ /* @__PURE__ */ jsx("h4", { className: "nice-sidebar-nav__prefs-section-title", children: "Głębokość drzewa" }),
3010
+ je.map((i) => {
3011
+ const l = xe[i], s = n.maxDepth[i] ?? 4;
3012
+ return /* @__PURE__ */ jsxs("div", { className: "nice-sidebar-nav__prefs-row", children: [
3013
+ /* @__PURE__ */ jsxs("span", { children: [
3014
+ l.icon,
3015
+ " ",
3016
+ l.label
3017
+ ] }),
3018
+ /* @__PURE__ */ jsxs("div", { className: "nice-sidebar-nav__depth-control", children: [
3019
+ /* @__PURE__ */ jsx(
3020
+ "input",
3021
+ {
3022
+ type: "range",
3023
+ min: 1,
3024
+ max: 4,
3025
+ value: s,
3026
+ onChange: (h) => a.setMaxDepth(i, Number(h.target.value)),
3027
+ "aria-label": `Głębokość dla trybu ${l.label}`
3028
+ }
3029
+ ),
3030
+ /* @__PURE__ */ jsx("span", { className: "nice-sidebar-nav__depth-value", children: s })
3031
+ ] })
3032
+ ] }, i);
3033
+ })
3034
+ ] }),
3035
+ /* @__PURE__ */ jsxs("section", { className: "nice-sidebar-nav__prefs-section", children: [
3036
+ /* @__PURE__ */ jsx("h4", { className: "nice-sidebar-nav__prefs-section-title", children: "Zachowanie drzewa" }),
3037
+ /* @__PURE__ */ jsxs("label", { className: "nice-sidebar-nav__prefs-row", children: [
3038
+ /* @__PURE__ */ jsx("span", { children: "Domyślnie rozwiń wszystko" }),
3039
+ /* @__PURE__ */ jsx(
3040
+ "input",
3041
+ {
3042
+ type: "checkbox",
3043
+ checked: n.autoExpand,
3044
+ onChange: (i) => a.setAutoExpand(i.target.checked)
3045
+ }
3046
+ )
3047
+ ] })
3048
+ ] }),
3049
+ n.hiddenItems.length > 0 && /* @__PURE__ */ jsxs("section", { className: "nice-sidebar-nav__prefs-section", children: [
3050
+ /* @__PURE__ */ jsx("h4", { className: "nice-sidebar-nav__prefs-section-title", children: "Ukryte elementy" }),
3051
+ /* @__PURE__ */ jsx("ul", { className: "nice-sidebar-nav__hidden-list", children: n.hiddenItems.map((i) => /* @__PURE__ */ jsxs("li", { className: "nice-sidebar-nav__hidden-item", children: [
3052
+ /* @__PURE__ */ jsxs("span", { className: "nice-sidebar-nav__hidden-label", children: [
3053
+ /* @__PURE__ */ jsxs("span", { className: "nice-sidebar-nav__hidden-kind", children: [
3054
+ "[",
3055
+ i.kind,
3056
+ "]"
3057
+ ] }),
3058
+ " ",
3059
+ i.label
3060
+ ] }),
3061
+ /* @__PURE__ */ jsx(
3062
+ "button",
3063
+ {
3064
+ className: "nice-sidebar-nav__action-btn",
3065
+ onClick: () => a.restoreItem(i.id),
3066
+ "aria-label": `Przywróć ${i.label}`,
3067
+ title: "Przywróć",
3068
+ children: "↩"
3069
+ }
3070
+ )
3071
+ ] }, i.id)) })
3072
+ ] }),
3073
+ /* @__PURE__ */ jsx("section", { className: "nice-sidebar-nav__prefs-section", children: /* @__PURE__ */ jsx(
3074
+ "button",
3075
+ {
3076
+ className: "nice-sidebar-nav__btn-reset",
3077
+ onClick: a.resetAll,
3078
+ "aria-label": "Zresetuj wszystkie preferencje",
3079
+ children: "Resetuj wszystkie preferencje"
3080
+ }
3081
+ ) })
3082
+ ] });
3083
+ }
3084
+ forwardRef(
3085
+ function({
3086
+ data: a,
3087
+ userId: i,
3088
+ activeRoute: l,
3089
+ onNavigate: s,
3090
+ enableModeIcons: h,
3091
+ preferences: o,
3092
+ onPreferencesChange: b,
3093
+ width: r = 264,
3094
+ size: t = "md",
3095
+ className: u,
3096
+ "data-testid": m
3097
+ }, w) {
3098
+ const [d, g] = zn(
3099
+ i,
3100
+ h,
3101
+ o,
3102
+ b
3103
+ ), z = useMemo(() => {
3104
+ const $ = d.activeMode;
3105
+ if ($ === "favorites" || $ === "preferences") return a;
3106
+ const p = d.pinnedSources[$];
3107
+ return !p || p.length === 0 ? a : a.filter((y) => p.includes(y.source.id));
3108
+ }, [a, d.activeMode, d.pinnedSources]), M = d.maxDepth[d.activeMode] ?? 4;
3109
+ function T() {
3110
+ const $ = d.activeMode;
3111
+ return $ === "favorites" ? /* @__PURE__ */ jsx(
3112
+ Ln,
3113
+ {
3114
+ favorites: d.favorites,
3115
+ activeRoute: l,
3116
+ onNavigate: s,
3117
+ onRemove: g.removeFavorite
3118
+ }
3119
+ ) : $ === "preferences" ? /* @__PURE__ */ jsx(On, { prefs: d, helpers: g }) : z.length === 0 ? /* @__PURE__ */ jsx("p", { className: "nice-sidebar-nav__empty", children: "Brak widocznych źródeł danych dla tego trybu." }) : z.map((p) => {
3120
+ const y = (d.pinnedSources[$] ?? []).includes(p.source.id);
3121
+ return /* @__PURE__ */ jsx(
3122
+ In,
3123
+ {
3124
+ node: p,
3125
+ mode: $,
3126
+ maxDepth: M,
3127
+ isPinned: y,
3128
+ prefs: d,
3129
+ helpers: g,
3130
+ activeRoute: l,
3131
+ onNavigate: s
3132
+ },
3133
+ p.source.id
3134
+ );
3135
+ });
3136
+ }
3137
+ const f = [
3138
+ "nice-sidebar-nav",
3139
+ `nice-sidebar-nav--${t}`,
3140
+ d.enableModeIcons ? "nice-sidebar-nav--with-strip" : "",
3141
+ u
3142
+ ].filter(Boolean).join(" ");
3143
+ return /* @__PURE__ */ jsxs(
3144
+ "div",
3145
+ {
3146
+ ref: w,
3147
+ className: f,
3148
+ style: { width: r },
3149
+ "data-testid": m,
3150
+ "data-mode": d.activeMode,
3151
+ children: [
3152
+ d.enableModeIcons && /* @__PURE__ */ jsx(
3153
+ Mn,
3154
+ {
3155
+ enabledModes: d.enabledModes,
3156
+ activeMode: d.activeMode,
3157
+ onSelect: g.setMode
3158
+ }
3159
+ ),
3160
+ /* @__PURE__ */ jsxs("div", { className: "nice-sidebar-nav__content", children: [
3161
+ !d.enableModeIcons && d.activeMode !== "favorites" && d.activeMode !== "preferences" && /* @__PURE__ */ jsxs("div", { className: "nice-sidebar-nav__mode-inline-actions", children: [
3162
+ ["all", "by-role", "by-unit", "favorites"].map(($) => {
3163
+ const p = xe[$], y = d.activeMode === $;
3164
+ return !d.enabledModes.includes($) && $ !== "all" ? null : /* @__PURE__ */ jsxs(
3165
+ "button",
3166
+ {
3167
+ className: [
3168
+ "nice-sidebar-nav__mode-pill",
3169
+ y ? "nice-sidebar-nav__mode-pill--active" : ""
3170
+ ].filter(Boolean).join(" "),
3171
+ onClick: () => g.setMode($),
3172
+ "aria-label": p.label,
3173
+ title: p.label,
3174
+ children: [
3175
+ p.icon,
3176
+ " ",
3177
+ /* @__PURE__ */ jsx("span", { className: "nice-sidebar-nav__mode-pill-label", children: p.label })
3178
+ ]
3179
+ },
3180
+ $
3181
+ );
3182
+ }),
3183
+ /* @__PURE__ */ jsx(
3184
+ "button",
3185
+ {
3186
+ className: [
3187
+ "nice-sidebar-nav__mode-pill",
3188
+ d.activeMode === "preferences" ? "nice-sidebar-nav__mode-pill--active" : ""
3189
+ ].filter(Boolean).join(" "),
3190
+ onClick: () => g.setMode("preferences"),
3191
+ "aria-label": "Preferencje",
3192
+ title: "Preferencje",
3193
+ children: xe.preferences.icon
3194
+ }
3195
+ )
3196
+ ] }),
3197
+ /* @__PURE__ */ jsx("div", { className: "nice-sidebar-nav__body", children: T() })
3198
+ ] })
3199
+ ]
3200
+ }
3201
+ );
3202
+ }
3203
+ ); const An = forwardRef(
3204
+ ({
3205
+ tabs: n,
3206
+ activeIndex: a,
3207
+ renderTab: i,
3208
+ onActiveChange: l,
3209
+ onCloseTab: s,
3210
+ onReorderTabs: h,
3211
+ onSaveState: o,
3212
+ enableShortcuts: b = true,
3213
+ maxTabs: r = 0,
3214
+ showDirtyIndicator: t = true,
3215
+ tabBarPosition: u = "top",
3216
+ draggable: m = true,
3217
+ showAddButton: w = false,
3218
+ onAddTab: d,
3219
+ keepAlive: g = true,
3220
+ // OmniVerk 10.2
3221
+ warnOnUnsavedClose: z = true,
3222
+ maxClosedTabs: M = 10,
3223
+ onUndoCloseTab: T,
3224
+ getTabState: f,
3225
+ unsavedWarningMessage: $,
3226
+ className: p,
3227
+ style: y,
3228
+ id: x,
3229
+ accessMode: C,
3230
+ ...A
3231
+ }, S) => {
3232
+ const k = ys(x), N = ei(C, x), { t: D } = de(), _ = useRef(null), [Y, K] = useState(null), [Q, W] = useState(null), [V, j] = useState([]), [J, B] = useState(null), O = useCallback((E, I, ee = false) => {
3233
+ if (!ee && z && E.isDirty) {
3234
+ B({ tab: E, index: I });
3235
+ return;
3236
+ }
3237
+ const te = {
3238
+ tab: { ...E },
3239
+ originalIndex: I,
3240
+ closedAt: Date.now(),
3241
+ state: f?.(E)
3242
+ };
3243
+ j((fe) => [te, ...fe].slice(0, M)), s?.(E, I);
3244
+ }, [z, M, f, s]), X = useCallback(() => {
3245
+ if (V.length === 0) return;
3246
+ const [E, ...I] = V;
3247
+ j(I), T?.(E);
3248
+ }, [V, T]);
3249
+ useEffect(() => {
3250
+ if (!b) return;
3251
+ const E = (I) => {
3252
+ const ee = I.ctrlKey || I.metaKey;
3253
+ if (ee && I.key === "w") {
3254
+ I.preventDefault();
3255
+ const te = n[a];
3256
+ te && te.closable !== false && O(te, a);
3257
+ } else if (ee && I.key === "Tab") {
3258
+ I.preventDefault();
3259
+ const te = I.shiftKey ? -1 : 1, fe = (a + te + n.length) % n.length;
3260
+ l?.(fe);
3261
+ } else ee && I.shiftKey && (I.key === "t" || I.key === "T") && (I.preventDefault(), X());
3262
+ };
3263
+ return window.addEventListener("keydown", E), () => window.removeEventListener("keydown", E);
3264
+ }, [b, n, a, O, X, l]), useEffect(() => {
3265
+ if (!o) return;
3266
+ const E = setTimeout(() => {
3267
+ o({ tabs: n, activeTabIndex: a });
3268
+ }, 500);
3269
+ return () => clearTimeout(E);
3270
+ }, [n, a, o]);
3271
+ const q = useCallback((E) => {
3272
+ m && W(E);
3273
+ }, [m]), me = useCallback((E, I) => {
3274
+ E.preventDefault();
3275
+ }, [Q]), ve = useCallback((E) => {
3276
+ if (Q === null || Q === E) return;
3277
+ const I = [...n], [ee] = I.splice(Q, 1);
3278
+ I.splice(E, 0, ee), h?.(I), W(null);
3279
+ let te = a;
3280
+ a === Q ? te = E : Q < a && E >= a ? te-- : Q > a && E <= a && te++, te !== a && l?.(te);
3281
+ }, [Q, n, a, h, l]), pe = useCallback((E, I) => {
3282
+ E.preventDefault(), K({ tabIndex: I, x: E.clientX, y: E.clientY });
3283
+ }, []), de$1 = useCallback(() => K(null), []), F = useMemo(() => {
3284
+ if (!Y) return [];
3285
+ const E = n[Y.tabIndex];
3286
+ return [
3287
+ { label: D("wm.close", "Close"), action: () => {
3288
+ O(E, Y.tabIndex), de$1();
3289
+ }, disabled: E.closable === false },
3290
+ { label: D("wm.closeAll", "Close all"), action: () => {
3291
+ n.forEach((I, ee) => I.closable !== false && O(I, ee)), de$1();
3292
+ } },
3293
+ { label: D("wm.closeOthers", "Close others"), action: () => {
3294
+ n.forEach((I, ee) => ee !== Y.tabIndex && I.closable !== false && O(I, ee)), de$1();
3295
+ } },
3296
+ { label: D("controls.pin", "Pin"), action: () => de$1() },
3297
+ { type: "divider" },
3298
+ { label: D("wm.reopenClosed", "Reopen closed tab"), action: () => {
3299
+ X(), de$1();
3300
+ }, disabled: V.length === 0, shortcut: "Ctrl+Shift+T" }
3301
+ ];
3302
+ }, [Y, n, D, O, X, V.length, de$1]);
3303
+ if (useEffect(() => {
3304
+ if (!Y) return;
3305
+ const E = () => de$1();
3306
+ return window.addEventListener("click", E), () => window.removeEventListener("click", E);
3307
+ }, [Y, de$1]), N === "hidden") return null;
3308
+ const Z = /* @__PURE__ */ jsxs("div", { className: `nice-mdi__tab-bar nice-mdi__tab-bar--${u}`, role: "tablist", children: [
3309
+ n.map((E, I) => /* @__PURE__ */ jsxs(
3310
+ "div",
3311
+ {
3312
+ className: `nice-mdi__tab ${I === a ? "nice-mdi__tab--active" : ""} ${E.isPinned ? "nice-mdi__tab--pinned" : ""}`,
3313
+ role: "tab",
3314
+ "aria-selected": I === a,
3315
+ onClick: () => l?.(I),
3316
+ onContextMenu: (ee) => pe(ee, I),
3317
+ draggable: m,
3318
+ onDragStart: () => q(I),
3319
+ onDragOver: (ee) => me(ee, I),
3320
+ onDrop: () => ve(I),
3321
+ children: [
3322
+ E.icon && /* @__PURE__ */ jsx("span", { className: "nice-mdi__tab-icon", children: E.icon }),
3323
+ /* @__PURE__ */ jsx("span", { className: "nice-mdi__tab-title", children: E.title }),
3324
+ t && E.isDirty && /* @__PURE__ */ jsx("span", { className: "nice-mdi__tab-dirty", title: "Unsaved changes", children: "●" }),
3325
+ E.closable !== false && !E.isPinned && /* @__PURE__ */ jsx(
3326
+ "button",
3327
+ {
3328
+ className: "nice-mdi__tab-close",
3329
+ onClick: (ee) => {
3330
+ ee.stopPropagation(), O(E, I);
3331
+ },
3332
+ "aria-label": D("wm.close", "Close"),
3333
+ type: "button",
3334
+ children: "×"
3335
+ }
3336
+ )
3337
+ ]
3338
+ },
3339
+ E.id
3340
+ )),
3341
+ w && /* @__PURE__ */ jsx(
3342
+ "button",
3343
+ {
3344
+ className: "nice-mdi__tab-add",
3345
+ onClick: d,
3346
+ "aria-label": D("controls.new", "New"),
3347
+ type: "button",
3348
+ children: "+"
3349
+ }
3350
+ )
3351
+ ] }), U = g ? /* @__PURE__ */ jsx("div", { className: "nice-mdi__content", children: n.map((E, I) => /* @__PURE__ */ jsx(
3352
+ "div",
3353
+ {
3354
+ className: "nice-mdi__panel",
3355
+ role: "tabpanel",
3356
+ style: { display: I === a ? "block" : "none" },
3357
+ children: i(E, I)
3358
+ },
3359
+ E.id
3360
+ )) }) : /* @__PURE__ */ jsx("div", { className: "nice-mdi__content", children: n[a] && /* @__PURE__ */ jsx("div", { className: "nice-mdi__panel", role: "tabpanel", children: i(n[a], a) }) });
3361
+ return /* @__PURE__ */ jsxs(
3362
+ "div",
3363
+ {
3364
+ ref: (E) => {
3365
+ _.current = E, typeof S == "function" ? S(E) : S && (S.current = E);
3366
+ },
3367
+ id: k,
3368
+ className: `nice-mdi ${p ?? ""}`,
3369
+ style: y,
3370
+ ...A,
3371
+ children: [
3372
+ u === "top" && Z,
3373
+ U,
3374
+ u === "bottom" && Z,
3375
+ Y && /* @__PURE__ */ jsx(
3376
+ "div",
3377
+ {
3378
+ className: "nice-mdi__ctx-menu",
3379
+ style: { position: "fixed", left: Y.x, top: Y.y, zIndex: 9999 },
3380
+ children: F.map((E, I) => "type" in E && E.type === "divider" ? /* @__PURE__ */ jsx("div", { className: "nice-mdi__ctx-divider" }, I) : /* @__PURE__ */ jsxs(
3381
+ "button",
3382
+ {
3383
+ className: "nice-mdi__ctx-item",
3384
+ onClick: E.action,
3385
+ disabled: E.disabled,
3386
+ type: "button",
3387
+ children: [
3388
+ /* @__PURE__ */ jsx("span", { className: "nice-mdi__ctx-label", children: E.label }),
3389
+ "shortcut" in E && E.shortcut && /* @__PURE__ */ jsx("span", { className: "nice-mdi__ctx-shortcut", children: E.shortcut })
3390
+ ]
3391
+ },
3392
+ I
3393
+ ))
3394
+ }
3395
+ ),
3396
+ J && /* @__PURE__ */ jsx("div", { className: "nice-mdi__modal-backdrop", onClick: () => B(null), children: /* @__PURE__ */ jsxs("div", { className: "nice-mdi__modal", onClick: (E) => E.stopPropagation(), children: [
3397
+ /* @__PURE__ */ jsx("div", { className: "nice-mdi__modal-icon", children: "⚠️" }),
3398
+ /* @__PURE__ */ jsx("h3", { className: "nice-mdi__modal-title", children: D("wm.unsavedTitle", "Unsaved Changes") }),
3399
+ /* @__PURE__ */ jsx("p", { className: "nice-mdi__modal-message", children: $ ?? D("wm.unsavedMessage", `"${J.tab.title}" has unsaved changes. Do you want to close it anyway?`) }),
3400
+ /* @__PURE__ */ jsxs("div", { className: "nice-mdi__modal-actions", children: [
3401
+ /* @__PURE__ */ jsx(
3402
+ "button",
3403
+ {
3404
+ type: "button",
3405
+ className: "nice-mdi__modal-btn nice-mdi__modal-btn--secondary",
3406
+ onClick: () => B(null),
3407
+ children: D("controls.cancel", "Cancel")
3408
+ }
3409
+ ),
3410
+ /* @__PURE__ */ jsx(
3411
+ "button",
3412
+ {
3413
+ type: "button",
3414
+ className: "nice-mdi__modal-btn nice-mdi__modal-btn--danger",
3415
+ onClick: () => {
3416
+ O(J.tab, J.index, true), B(null);
3417
+ },
3418
+ children: D("wm.closeAnyway", "Close Anyway")
3419
+ }
3420
+ )
3421
+ ] })
3422
+ ] }) })
3423
+ ]
3424
+ }
3425
+ );
3426
+ }
3427
+ );
3428
+ An.displayName = "NiceMdiWorkspace";
3429
+ const Yn = forwardRef(
3430
+ ({
3431
+ menu: n,
3432
+ activeRoute: a,
3433
+ toolbar: i,
3434
+ statusBar: l,
3435
+ sidebarHeader: s,
3436
+ sidebarFooter: h,
3437
+ onNavigate: o,
3438
+ children: b,
3439
+ className: r,
3440
+ style: t,
3441
+ id: u,
3442
+ accessMode: m,
3443
+ ...w
3444
+ }, d) => {
3445
+ const g = ys(u), z = ei(m, u), { t: M } = de(), [T, f] = useState(false);
3446
+ return z === "hidden" ? null : /* @__PURE__ */ jsxs(
3447
+ "div",
3448
+ {
3449
+ ref: d,
3450
+ id: g,
3451
+ className: `nice-shell nice-shell--classic ${T ? "nice-shell--sidebar-collapsed" : ""} ${r ?? ""}`,
3452
+ style: t,
3453
+ ...w,
3454
+ children: [
3455
+ /* @__PURE__ */ jsxs("aside", { className: "nice-shell__sidebar", children: [
3456
+ s && /* @__PURE__ */ jsx("div", { className: "nice-shell__sidebar-header", children: s }),
3457
+ /* @__PURE__ */ jsx(
3458
+ "button",
3459
+ {
3460
+ className: "nice-shell__sidebar-toggle",
3461
+ onClick: () => f(($) => !$),
3462
+ type: "button",
3463
+ "aria-label": T ? M("expand", "Expand") : M("collapse", "Collapse"),
3464
+ children: T ? "▸" : "◂"
3465
+ }
3466
+ ),
3467
+ n && !T && /* @__PURE__ */ jsx("nav", { className: "nice-shell__nav", role: "navigation", children: n.modules.filter(($) => $.isAvailable).sort(($, p) => $.order - p.order).map(($) => /* @__PURE__ */ jsxs("div", { className: "nice-shell__nav-group", children: [
3468
+ /* @__PURE__ */ jsxs("div", { className: "nice-shell__nav-group-label", children: [
3469
+ $.icon && /* @__PURE__ */ jsx("span", { children: $.icon }),
3470
+ /* @__PURE__ */ jsx("span", { children: $.label })
3471
+ ] }),
3472
+ /* @__PURE__ */ jsx("ul", { children: $.entities.map((p) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
3473
+ "button",
3474
+ {
3475
+ className: `nice-shell__nav-item ${a === p.route ? "nice-shell__nav-item--active" : ""}`,
3476
+ onClick: () => o?.(p.route),
3477
+ type: "button",
3478
+ children: p.label
3479
+ }
3480
+ ) }, p.id)) })
3481
+ ] }, $.id)) }),
3482
+ h && /* @__PURE__ */ jsx("div", { className: "nice-shell__sidebar-footer", children: h })
3483
+ ] }),
3484
+ /* @__PURE__ */ jsxs("div", { className: "nice-shell__main", children: [
3485
+ i && /* @__PURE__ */ jsx("header", { className: "nice-shell__toolbar", children: i }),
3486
+ /* @__PURE__ */ jsx("main", { className: "nice-shell__content", children: b }),
3487
+ l && /* @__PURE__ */ jsx("footer", { className: "nice-shell__status-bar", children: l })
3488
+ ] })
3489
+ ]
3490
+ }
3491
+ );
3492
+ }
3493
+ );
3494
+ Yn.displayName = "NiceClassicShell";
3495
+ const Rn = forwardRef(
3496
+ ({
3497
+ topBar: n,
3498
+ sidePanel: a,
3499
+ sidePanelPosition: i = "left",
3500
+ sidePanelWidth: l = 280,
3501
+ children: s,
3502
+ className: h,
3503
+ style: o,
3504
+ id: b,
3505
+ accessMode: r,
3506
+ ...t
3507
+ }, u) => {
3508
+ const m = ys(b);
3509
+ return ei(r, b) === "hidden" ? null : /* @__PURE__ */ jsxs(
3510
+ "div",
3511
+ {
3512
+ ref: u,
3513
+ id: m,
3514
+ className: `nice-shell nice-shell--dashboard ${h ?? ""}`,
3515
+ style: o,
3516
+ ...t,
3517
+ children: [
3518
+ n && /* @__PURE__ */ jsx("header", { className: "nice-shell__top-bar", children: n }),
3519
+ /* @__PURE__ */ jsxs("div", { className: `nice-shell__dashboard-body nice-shell__dashboard-body--panel-${i}`, children: [
3520
+ a && /* @__PURE__ */ jsx("aside", { className: "nice-shell__side-panel", style: { width: l }, children: a }),
3521
+ /* @__PURE__ */ jsx("main", { className: "nice-shell__dashboard-content", children: s })
3522
+ ] })
3523
+ ]
3524
+ }
3525
+ );
3526
+ }
3527
+ );
3528
+ Rn.displayName = "NiceDashboardShell";
3529
+ const Fn = forwardRef(
3530
+ ({
3531
+ topBar: n,
3532
+ bottomNav: a,
3533
+ children: i,
3534
+ className: l,
3535
+ style: s,
3536
+ id: h,
3537
+ accessMode: o,
3538
+ ...b
3539
+ }, r) => {
3540
+ const t = ys(h);
3541
+ return ei(o, h) === "hidden" ? null : /* @__PURE__ */ jsxs(
3542
+ "div",
3543
+ {
3544
+ ref: r,
3545
+ id: t,
3546
+ className: `nice-shell nice-shell--compact ${l ?? ""}`,
3547
+ style: s,
3548
+ ...b,
3549
+ children: [
3550
+ n && /* @__PURE__ */ jsx("header", { className: "nice-shell__compact-top", children: n }),
3551
+ /* @__PURE__ */ jsx("main", { className: "nice-shell__compact-content", children: i }),
3552
+ a && /* @__PURE__ */ jsx("footer", { className: "nice-shell__compact-bottom", children: a })
3553
+ ]
3554
+ }
3555
+ );
3556
+ }
3557
+ );
3558
+ Fn.displayName = "NiceCompactShell";
3559
+ const jn = forwardRef(
3560
+ ({
3561
+ overlay: n,
3562
+ lockScreen: a,
3563
+ locked: i = false,
3564
+ children: l,
3565
+ className: s,
3566
+ style: h,
3567
+ id: o,
3568
+ accessMode: b,
3569
+ ...r
3570
+ }, t) => {
3571
+ const u = ys(o);
3572
+ return ei(b, o) === "hidden" ? null : /* @__PURE__ */ jsx(
3573
+ "div",
3574
+ {
3575
+ ref: t,
3576
+ id: u,
3577
+ className: `nice-shell nice-shell--kiosk ${s ?? ""}`,
3578
+ style: { ...h, position: "fixed", inset: 0 },
3579
+ ...r,
3580
+ children: i && a ? /* @__PURE__ */ jsx("div", { className: "nice-shell__kiosk-lock", children: a }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3581
+ /* @__PURE__ */ jsx("main", { className: "nice-shell__kiosk-content", children: l }),
3582
+ n && /* @__PURE__ */ jsx("div", { className: "nice-shell__kiosk-overlay", children: n })
3583
+ ] })
3584
+ }
3585
+ );
3586
+ }
3587
+ );
3588
+ jn.displayName = "NiceKioskShell";
3589
+ const Wn = forwardRef(
3590
+ ({
3591
+ modes: n,
3592
+ activeMode: a,
3593
+ onModeChange: i,
3594
+ variant: l = "dropdown",
3595
+ gridColumns: s = 3,
3596
+ showDescription: h = true,
3597
+ showColorIndicator: o = true,
3598
+ compact: b = false,
3599
+ size: r = "md",
3600
+ className: t,
3601
+ style: u,
3602
+ id: m,
3603
+ accessMode: w,
3604
+ ...d
3605
+ }, g) => {
3606
+ const z = ys(m), M = ei(w, m); de(); const [f, $] = useState(false), p = useRef(null), y = n.find((C) => C.key === a);
3607
+ useEffect(() => {
3608
+ if (!f) return;
3609
+ const C = (A) => {
3610
+ p.current && !p.current.contains(A.target) && $(false);
3611
+ };
3612
+ return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
3613
+ }, [f]);
3614
+ const x = useCallback(
3615
+ (C) => {
3616
+ i?.(C), $(false);
3617
+ },
3618
+ [i]
3619
+ );
3620
+ return M === "hidden" ? null : l === "dropdown" ? /* @__PURE__ */ jsxs(
3621
+ "div",
3622
+ {
3623
+ ref: (C) => {
3624
+ p.current = C, typeof g == "function" ? g(C) : g && (g.current = C);
3625
+ },
3626
+ id: z,
3627
+ className: `nice-mode-selector nice-mode-selector--dropdown nice-mode-selector--${r} ${t ?? ""}`,
3628
+ style: u,
3629
+ ...d,
3630
+ children: [
3631
+ /* @__PURE__ */ jsxs(
3632
+ "button",
3633
+ {
3634
+ className: "nice-mode-selector__trigger",
3635
+ onClick: () => $((C) => !C),
3636
+ "aria-expanded": f,
3637
+ "aria-haspopup": "listbox",
3638
+ type: "button",
3639
+ children: [
3640
+ o && y?.color && /* @__PURE__ */ jsx(
3641
+ "span",
3642
+ {
3643
+ className: "nice-mode-selector__color",
3644
+ style: { backgroundColor: y.color }
3645
+ }
3646
+ ),
3647
+ y?.icon && /* @__PURE__ */ jsx("span", { className: "nice-mode-selector__icon", children: y.icon }),
3648
+ /* @__PURE__ */ jsx("span", { className: "nice-mode-selector__label", children: y?.displayName ?? a }),
3649
+ /* @__PURE__ */ jsx("span", { className: "nice-mode-selector__chevron", children: f ? "▴" : "▾" })
3650
+ ]
3651
+ }
3652
+ ),
3653
+ f && /* @__PURE__ */ jsx("ul", { className: "nice-mode-selector__menu", role: "listbox", children: n.map((C) => /* @__PURE__ */ jsxs(
3654
+ "li",
3655
+ {
3656
+ className: `nice-mode-selector__option ${C.key === a ? "nice-mode-selector__option--active" : ""}`,
3657
+ role: "option",
3658
+ "aria-selected": C.key === a,
3659
+ onClick: () => x(C),
3660
+ children: [
3661
+ o && C.color && /* @__PURE__ */ jsx(
3662
+ "span",
3663
+ {
3664
+ className: "nice-mode-selector__color",
3665
+ style: { backgroundColor: C.color }
3666
+ }
3667
+ ),
3668
+ C.icon && /* @__PURE__ */ jsx("span", { className: "nice-mode-selector__icon", children: C.icon }),
3669
+ /* @__PURE__ */ jsxs("div", { children: [
3670
+ /* @__PURE__ */ jsx("div", { className: "nice-mode-selector__name", children: C.displayName }),
3671
+ h && C.description && /* @__PURE__ */ jsx("div", { className: "nice-mode-selector__desc", children: C.description })
3672
+ ] })
3673
+ ]
3674
+ },
3675
+ C.key
3676
+ )) })
3677
+ ]
3678
+ }
3679
+ ) : l === "pills" ? /* @__PURE__ */ jsx(
3680
+ "div",
3681
+ {
3682
+ ref: g,
3683
+ id: z,
3684
+ className: `nice-mode-selector nice-mode-selector--pills ${t ?? ""}`,
3685
+ style: u,
3686
+ role: "radiogroup",
3687
+ ...d,
3688
+ children: n.map((C) => /* @__PURE__ */ jsxs(
3689
+ "button",
3690
+ {
3691
+ className: `nice-mode-selector__pill ${C.key === a ? "nice-mode-selector__pill--active" : ""}`,
3692
+ style: o && C.color ? { borderColor: C.color } : void 0,
3693
+ onClick: () => x(C),
3694
+ role: "radio",
3695
+ "aria-checked": C.key === a,
3696
+ type: "button",
3697
+ children: [
3698
+ C.icon && /* @__PURE__ */ jsx("span", { children: C.icon }),
3699
+ /* @__PURE__ */ jsx("span", { children: C.displayName })
3700
+ ]
3701
+ },
3702
+ C.key
3703
+ ))
3704
+ }
3705
+ ) : /* @__PURE__ */ jsx(
3706
+ "div",
3707
+ {
3708
+ ref: g,
3709
+ id: z,
3710
+ className: `nice-mode-selector nice-mode-selector--card-grid ${t ?? ""}`,
3711
+ style: { ...u, gridTemplateColumns: `repeat(${s}, 1fr)` },
3712
+ role: "radiogroup",
3713
+ ...d,
3714
+ children: n.map((C) => /* @__PURE__ */ jsxs(
3715
+ "button",
3716
+ {
3717
+ className: `nice-mode-selector__card ${C.key === a ? "nice-mode-selector__card--active" : ""} ${b ? "nice-mode-selector__card--compact" : ""}`,
3718
+ onClick: () => x(C),
3719
+ role: "radio",
3720
+ "aria-checked": C.key === a,
3721
+ type: "button",
3722
+ children: [
3723
+ o && C.color && /* @__PURE__ */ jsx(
3724
+ "div",
3725
+ {
3726
+ className: "nice-mode-selector__card-stripe",
3727
+ style: { backgroundColor: C.color }
3728
+ }
3729
+ ),
3730
+ C.icon && /* @__PURE__ */ jsx("div", { className: "nice-mode-selector__card-icon", children: C.icon }),
3731
+ /* @__PURE__ */ jsx("div", { className: "nice-mode-selector__card-name", children: C.displayName }),
3732
+ h && C.description && !b && /* @__PURE__ */ jsx("div", { className: "nice-mode-selector__card-desc", children: C.description }),
3733
+ C.sourcePackage && !b && /* @__PURE__ */ jsx("div", { className: "nice-mode-selector__card-pkg", children: C.sourcePackage })
3734
+ ]
3735
+ },
3736
+ C.key
3737
+ ))
3738
+ }
3739
+ );
3740
+ }
3741
+ );
3742
+ Wn.displayName = "NiceModeSelector";
3743
+ function Bn(n) {
3744
+ const a = /* @__PURE__ */ new Map();
3745
+ for (const i of n.sort((l, s) => l.orderIndex - s.orderIndex))
3746
+ a.has(i.category) || a.set(i.category, []), a.get(i.category).push(i);
3747
+ return Array.from(a, ([i, l]) => ({ category: i, items: l }));
3748
+ }
3749
+ const Un = ({ question: n, value: a, onChange: i }) => {
3750
+ switch (n.questionType) {
3751
+ case "boolean":
3752
+ return /* @__PURE__ */ jsxs("div", { className: "nice-onboarding__field nice-onboarding__field--boolean", children: [
3753
+ /* @__PURE__ */ jsxs("label", { className: "nice-onboarding__label", children: [
3754
+ n.question,
3755
+ n.isRequired && /* @__PURE__ */ jsx("span", { className: "nice-onboarding__required", children: "*" })
3756
+ ] }),
3757
+ n.helpText && /* @__PURE__ */ jsx("p", { className: "nice-onboarding__help", children: n.helpText }),
3758
+ /* @__PURE__ */ jsxs("div", { className: "nice-onboarding__boolean-group", children: [
3759
+ /* @__PURE__ */ jsx(
3760
+ "button",
3761
+ {
3762
+ className: `nice-onboarding__bool-btn ${a === "true" ? "nice-onboarding__bool-btn--active" : ""}`,
3763
+ onClick: () => i("true"),
3764
+ type: "button",
3765
+ children: "✓"
3766
+ }
3767
+ ),
3768
+ /* @__PURE__ */ jsx(
3769
+ "button",
3770
+ {
3771
+ className: `nice-onboarding__bool-btn ${a === "false" ? "nice-onboarding__bool-btn--active" : ""}`,
3772
+ onClick: () => i("false"),
3773
+ type: "button",
3774
+ children: "✗"
3775
+ }
3776
+ )
3777
+ ] })
3778
+ ] });
3779
+ case "select":
3780
+ return /* @__PURE__ */ jsxs("div", { className: "nice-onboarding__field nice-onboarding__field--select", children: [
3781
+ /* @__PURE__ */ jsxs("label", { className: "nice-onboarding__label", children: [
3782
+ n.question,
3783
+ n.isRequired && /* @__PURE__ */ jsx("span", { className: "nice-onboarding__required", children: "*" })
3784
+ ] }),
3785
+ n.helpText && /* @__PURE__ */ jsx("p", { className: "nice-onboarding__help", children: n.helpText }),
3786
+ /* @__PURE__ */ jsx("div", { className: "nice-onboarding__options", children: n.options?.map((l) => /* @__PURE__ */ jsx(
3787
+ "button",
3788
+ {
3789
+ className: `nice-onboarding__option ${a === l ? "nice-onboarding__option--selected" : ""}`,
3790
+ onClick: () => i(l),
3791
+ type: "button",
3792
+ children: l
3793
+ },
3794
+ l
3795
+ )) })
3796
+ ] });
3797
+ case "multiSelect":
3798
+ return /* @__PURE__ */ jsxs("div", { className: "nice-onboarding__field nice-onboarding__field--multi", children: [
3799
+ /* @__PURE__ */ jsxs("label", { className: "nice-onboarding__label", children: [
3800
+ n.question,
3801
+ n.isRequired && /* @__PURE__ */ jsx("span", { className: "nice-onboarding__required", children: "*" })
3802
+ ] }),
3803
+ n.helpText && /* @__PURE__ */ jsx("p", { className: "nice-onboarding__help", children: n.helpText }),
3804
+ /* @__PURE__ */ jsx("div", { className: "nice-onboarding__options", children: n.options?.map((l) => {
3805
+ const s = a.split(",").filter(Boolean), h = s.includes(l);
3806
+ return /* @__PURE__ */ jsx(
3807
+ "button",
3808
+ {
3809
+ className: `nice-onboarding__option ${h ? "nice-onboarding__option--selected" : ""}`,
3810
+ onClick: () => {
3811
+ const o = h ? s.filter((b) => b !== l) : [...s, l];
3812
+ i(o.join(","));
3813
+ },
3814
+ type: "button",
3815
+ children: l
3816
+ },
3817
+ l
3818
+ );
3819
+ }) })
3820
+ ] });
3821
+ case "number":
3822
+ return /* @__PURE__ */ jsxs("div", { className: "nice-onboarding__field nice-onboarding__field--number", children: [
3823
+ /* @__PURE__ */ jsxs("label", { className: "nice-onboarding__label", children: [
3824
+ n.question,
3825
+ n.isRequired && /* @__PURE__ */ jsx("span", { className: "nice-onboarding__required", children: "*" })
3826
+ ] }),
3827
+ n.helpText && /* @__PURE__ */ jsx("p", { className: "nice-onboarding__help", children: n.helpText }),
3828
+ /* @__PURE__ */ jsx(
3829
+ "input",
3830
+ {
3831
+ type: "number",
3832
+ className: "nice-onboarding__input",
3833
+ value: a,
3834
+ onChange: (l) => i(l.target.value)
3835
+ }
3836
+ )
3837
+ ] });
3838
+ case "date":
3839
+ return /* @__PURE__ */ jsxs("div", { className: "nice-onboarding__field nice-onboarding__field--date", children: [
3840
+ /* @__PURE__ */ jsxs("label", { className: "nice-onboarding__label", children: [
3841
+ n.question,
3842
+ n.isRequired && /* @__PURE__ */ jsx("span", { className: "nice-onboarding__required", children: "*" })
3843
+ ] }),
3844
+ n.helpText && /* @__PURE__ */ jsx("p", { className: "nice-onboarding__help", children: n.helpText }),
3845
+ /* @__PURE__ */ jsx(
3846
+ "input",
3847
+ {
3848
+ type: "date",
3849
+ className: "nice-onboarding__input",
3850
+ value: a,
3851
+ onChange: (l) => i(l.target.value)
3852
+ }
3853
+ )
3854
+ ] });
3855
+ default:
3856
+ return /* @__PURE__ */ jsxs("div", { className: "nice-onboarding__field nice-onboarding__field--text", children: [
3857
+ /* @__PURE__ */ jsxs("label", { className: "nice-onboarding__label", children: [
3858
+ n.question,
3859
+ n.isRequired && /* @__PURE__ */ jsx("span", { className: "nice-onboarding__required", children: "*" })
3860
+ ] }),
3861
+ n.helpText && /* @__PURE__ */ jsx("p", { className: "nice-onboarding__help", children: n.helpText }),
3862
+ /* @__PURE__ */ jsx(
3863
+ "input",
3864
+ {
3865
+ type: "text",
3866
+ className: "nice-onboarding__input",
3867
+ value: a,
3868
+ onChange: (l) => i(l.target.value),
3869
+ placeholder: n.defaultValue
3870
+ }
3871
+ )
3872
+ ] });
3873
+ }
3874
+ }, Pn = forwardRef(
3875
+ ({
3876
+ questions: n,
3877
+ initialAnswers: a = [],
3878
+ stepLabels: i,
3879
+ onComplete: l,
3880
+ onCancel: s,
3881
+ onStepChange: h,
3882
+ welcomeContent: o,
3883
+ completionContent: b,
3884
+ showProgress: r = true,
3885
+ allowBack: t = true,
3886
+ logo: u,
3887
+ size: m = "md",
3888
+ className: w,
3889
+ style: d,
3890
+ id: g,
3891
+ accessMode: z,
3892
+ ...M
3893
+ }, T) => {
3894
+ const f = ys(g), $ = ei(z, g), { t: p } = de(), y = useMemo(() => Bn(n), [n]), x = !!o, C = !!b, A = x ? -1 : 0, S = C ? y.length : y.length - 1, [k, N] = useState(A), [D, _] = useState(() => {
3895
+ const B = /* @__PURE__ */ new Map();
3896
+ for (const O of a) B.set(O.questionId, O.answer);
3897
+ for (const O of n)
3898
+ !B.has(O.id) && O.defaultValue && B.set(O.id, O.defaultValue);
3899
+ return B;
3900
+ }), Y = useCallback((B, O) => {
3901
+ _((X) => {
3902
+ const q = new Map(X);
3903
+ return q.set(B, O), q;
3904
+ });
3905
+ }, []), K = useMemo(() => k < 0 || k >= y.length ? true : y[k].items.every(
3906
+ (O) => !O.isRequired || (D.get(O.id) ?? "").trim().length > 0
3907
+ ), [k, y, D]), Q = useCallback(() => {
3908
+ if (k >= S) {
3909
+ const O = [];
3910
+ D.forEach((X, q) => O.push({ questionId: q, answer: X })), l?.(O);
3911
+ return;
3912
+ }
3913
+ const B = k + 1;
3914
+ N(B), h?.(B);
3915
+ }, [k, S, D, l, h]), W = useCallback(() => {
3916
+ if (k <= A) return;
3917
+ const B = k - 1;
3918
+ N(B), h?.(B);
3919
+ }, [k, A, h]), V = y.length + (x ? 1 : 0) + (C ? 1 : 0), j = k - A, J = Math.round(j / Math.max(V - 1, 1) * 100);
3920
+ return $ === "hidden" ? null : /* @__PURE__ */ jsxs(
3921
+ "div",
3922
+ {
3923
+ ref: T,
3924
+ id: f,
3925
+ className: `nice-onboarding nice-onboarding--${m} ${w ?? ""}`,
3926
+ style: d,
3927
+ ...M,
3928
+ children: [
3929
+ /* @__PURE__ */ jsxs("div", { className: "nice-onboarding__header", children: [
3930
+ u && /* @__PURE__ */ jsx("div", { className: "nice-onboarding__logo", children: u }),
3931
+ r && /* @__PURE__ */ jsx("div", { className: "nice-onboarding__progress", children: /* @__PURE__ */ jsx("div", { className: "nice-onboarding__progress-bar", style: { width: `${J}%` } }) }),
3932
+ /* @__PURE__ */ jsx("div", { className: "nice-onboarding__steps", children: y.map((B, O) => /* @__PURE__ */ jsxs(
3933
+ "div",
3934
+ {
3935
+ className: `nice-onboarding__step-dot ${O === k ? "nice-onboarding__step-dot--active" : ""} ${O < k ? "nice-onboarding__step-dot--done" : ""}`,
3936
+ children: [
3937
+ /* @__PURE__ */ jsx("span", { children: O + 1 }),
3938
+ /* @__PURE__ */ jsx("span", { className: "nice-onboarding__step-label", children: i?.[O] ?? B.category })
3939
+ ]
3940
+ },
3941
+ O
3942
+ )) })
3943
+ ] }),
3944
+ /* @__PURE__ */ jsxs("div", { className: "nice-onboarding__body", children: [
3945
+ k === -1 && o,
3946
+ k >= 0 && k < y.length && /* @__PURE__ */ jsxs("div", { className: "nice-onboarding__questions", children: [
3947
+ /* @__PURE__ */ jsx("h2", { className: "nice-onboarding__category", children: y[k].category }),
3948
+ y[k].items.map((B) => /* @__PURE__ */ jsx(
3949
+ Un,
3950
+ {
3951
+ question: B,
3952
+ value: D.get(B.id) ?? "",
3953
+ onChange: (O) => Y(B.id, O)
3954
+ },
3955
+ B.id
3956
+ ))
3957
+ ] }),
3958
+ k === y.length && b
3959
+ ] }),
3960
+ /* @__PURE__ */ jsxs("div", { className: "nice-onboarding__footer", children: [
3961
+ s && /* @__PURE__ */ jsx(
3962
+ "button",
3963
+ {
3964
+ className: "nice-onboarding__btn nice-onboarding__btn--cancel",
3965
+ onClick: s,
3966
+ type: "button",
3967
+ children: p("cancel", "Cancel")
3968
+ }
3969
+ ),
3970
+ /* @__PURE__ */ jsxs("div", { className: "nice-onboarding__footer-right", children: [
3971
+ t && k > A && /* @__PURE__ */ jsx(
3972
+ "button",
3973
+ {
3974
+ className: "nice-onboarding__btn nice-onboarding__btn--back",
3975
+ onClick: W,
3976
+ type: "button",
3977
+ children: p("back", "Back")
3978
+ }
3979
+ ),
3980
+ /* @__PURE__ */ jsx(
3981
+ "button",
3982
+ {
3983
+ className: "nice-onboarding__btn nice-onboarding__btn--next",
3984
+ onClick: Q,
3985
+ disabled: !K,
3986
+ type: "button",
3987
+ children: k >= S ? p("finish", "Finish") : p("next", "Next")
3988
+ }
3989
+ )
3990
+ ] })
3991
+ ] })
3992
+ ]
3993
+ }
3994
+ );
3995
+ }
3996
+ );
3997
+ Pn.displayName = "NiceOnboardingWizard";
3998
+ const Vn = [
3999
+ { key: "Mon", label: "Monday" },
4000
+ { key: "Tue", label: "Tuesday" },
4001
+ { key: "Wed", label: "Wednesday" },
4002
+ { key: "Thu", label: "Thursday" },
4003
+ { key: "Fri", label: "Friday" },
4004
+ { key: "Sat", label: "Saturday" },
4005
+ { key: "Sun", label: "Sunday" }
4006
+ ], Hn = [
4007
+ { value: "YYYY-MM-DD", label: "YYYY-MM-DD" },
4008
+ { value: "DD/MM/YYYY", label: "DD/MM/YYYY" },
4009
+ { value: "MM/DD/YYYY", label: "MM/DD/YYYY" },
4010
+ { value: "DD.MM.YYYY", label: "DD.MM.YYYY" }
4011
+ ], We = [
4012
+ "basic",
4013
+ "contact",
4014
+ "address",
4015
+ "branding",
4016
+ "localization",
4017
+ "fiscal",
4018
+ "preferences"
4019
+ ], ge = ({ title: n, expanded: a, onToggle: i }) => /* @__PURE__ */ jsxs(
4020
+ "button",
4021
+ {
4022
+ className: `nice-org-form__section-header ${a ? "nice-org-form__section-header--expanded" : ""}`,
4023
+ onClick: i,
4024
+ type: "button",
4025
+ "aria-expanded": a,
4026
+ children: [
4027
+ /* @__PURE__ */ jsx("span", { className: "nice-org-form__section-title", children: n }),
4028
+ /* @__PURE__ */ jsx("span", { className: "nice-org-form__section-chevron", children: a ? "▾" : "▸" })
4029
+ ]
4030
+ }
4031
+ ), Kn = forwardRef(
4032
+ ({
4033
+ profile: n,
4034
+ onChange: a,
4035
+ onSave: i,
4036
+ onCancel: l,
4037
+ sections: s,
4038
+ expandedSections: h,
4039
+ showActions: o = true,
4040
+ countryOptions: b,
4041
+ languageOptions: r,
4042
+ currencyOptions: t,
4043
+ timezoneOptions: u,
4044
+ saving: m = false,
4045
+ className: w,
4046
+ style: d,
4047
+ id: g,
4048
+ accessMode: z,
4049
+ ...M
4050
+ }, T) => {
4051
+ const f = ys(g), $ = ei(z, g), { t: p } = de(), y = useMemo(
4052
+ () => s && s.length > 0 ? s : We,
4053
+ [s]
4054
+ ), [x, C] = useState(
4055
+ () => new Set(h ?? We)
4056
+ ), A = useCallback((_) => {
4057
+ C((Y) => {
4058
+ const K = new Set(Y);
4059
+ return K.has(_) ? K.delete(_) : K.add(_), K;
4060
+ });
4061
+ }, []), S = $ === "readOnly", k = $ === "disabled", N = useCallback(
4062
+ (_, Y) => {
4063
+ a?.({ ...n, [_]: Y });
4064
+ },
4065
+ [n, a]
4066
+ ), D = useCallback(() => {
4067
+ i?.(n);
4068
+ }, [n, i]);
4069
+ return $ === "hidden" ? null : /* @__PURE__ */ jsxs(
4070
+ "div",
4071
+ {
4072
+ ref: T,
4073
+ id: f,
4074
+ className: `nice-org-form ${w ?? ""}`,
4075
+ style: d,
4076
+ ...M,
4077
+ children: [
4078
+ y.includes("basic") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__section", children: [
4079
+ /* @__PURE__ */ jsx(
4080
+ ge,
4081
+ {
4082
+ title: p("org.basic", "Company Information"),
4083
+ expanded: x.has("basic"),
4084
+ onToggle: () => A("basic")
4085
+ }
4086
+ ),
4087
+ x.has("basic") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__fields", children: [
4088
+ /* @__PURE__ */ jsx(
4089
+ Re,
4090
+ {
4091
+ label: p("org.name", "Company Name"),
4092
+ value: n.name,
4093
+ onChange: (_) => N("name", _),
4094
+ required: true,
4095
+ disabled: k,
4096
+ readOnly: S
4097
+ }
4098
+ ),
4099
+ /* @__PURE__ */ jsx(
4100
+ Re,
4101
+ {
4102
+ label: p("org.legalName", "Legal Name"),
4103
+ value: n.legalName ?? "",
4104
+ onChange: (_) => N("legalName", _),
4105
+ disabled: k,
4106
+ readOnly: S
4107
+ }
4108
+ ),
4109
+ /* @__PURE__ */ jsx(
4110
+ Re,
4111
+ {
4112
+ label: p("org.taxId", "Tax ID"),
4113
+ value: n.taxId ?? "",
4114
+ onChange: (_) => N("taxId", _),
4115
+ disabled: k,
4116
+ readOnly: S
4117
+ }
4118
+ ),
4119
+ /* @__PURE__ */ jsx(
4120
+ Re,
4121
+ {
4122
+ label: p("org.regNumber", "Registration Number"),
4123
+ value: n.registrationNumber ?? "",
4124
+ onChange: (_) => N("registrationNumber", _),
4125
+ disabled: k,
4126
+ readOnly: S
4127
+ }
4128
+ ),
4129
+ /* @__PURE__ */ jsx(
4130
+ Re,
4131
+ {
4132
+ label: p("org.industry", "Industry"),
4133
+ value: n.industry ?? "",
4134
+ onChange: (_) => N("industry", _),
4135
+ disabled: k,
4136
+ readOnly: S
4137
+ }
4138
+ ),
4139
+ /* @__PURE__ */ jsx(
4140
+ ie,
4141
+ {
4142
+ label: p("org.employees", "Number of Employees"),
4143
+ value: n.employeeCount ?? null,
4144
+ onChange: (_) => N("employeeCount", _ ?? void 0),
4145
+ min: 1,
4146
+ disabled: k,
4147
+ readOnly: S
4148
+ }
4149
+ )
4150
+ ] })
4151
+ ] }),
4152
+ y.includes("contact") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__section", children: [
4153
+ /* @__PURE__ */ jsx(
4154
+ ge,
4155
+ {
4156
+ title: p("org.contact", "Contact Details"),
4157
+ expanded: x.has("contact"),
4158
+ onToggle: () => A("contact")
4159
+ }
4160
+ ),
4161
+ x.has("contact") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__fields", children: [
4162
+ /* @__PURE__ */ jsx(
4163
+ Re,
4164
+ {
4165
+ label: p("org.email", "Email"),
4166
+ value: n.email ?? "",
4167
+ onChange: (_) => N("email", _),
4168
+ type: "email",
4169
+ disabled: k,
4170
+ readOnly: S
4171
+ }
4172
+ ),
4173
+ /* @__PURE__ */ jsx(
4174
+ Re,
4175
+ {
4176
+ label: p("org.phone", "Phone"),
4177
+ value: n.phone ?? "",
4178
+ onChange: (_) => N("phone", _),
4179
+ type: "tel",
4180
+ disabled: k,
4181
+ readOnly: S
4182
+ }
4183
+ ),
4184
+ /* @__PURE__ */ jsx(
4185
+ Re,
4186
+ {
4187
+ label: p("org.website", "Website"),
4188
+ value: n.website ?? "",
4189
+ onChange: (_) => N("website", _),
4190
+ type: "url",
4191
+ disabled: k,
4192
+ readOnly: S
4193
+ }
4194
+ ),
4195
+ /* @__PURE__ */ jsx(
4196
+ Re,
4197
+ {
4198
+ label: p("org.fax", "Fax"),
4199
+ value: n.fax ?? "",
4200
+ onChange: (_) => N("fax", _),
4201
+ type: "tel",
4202
+ disabled: k,
4203
+ readOnly: S
4204
+ }
4205
+ )
4206
+ ] })
4207
+ ] }),
4208
+ y.includes("address") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__section", children: [
4209
+ /* @__PURE__ */ jsx(
4210
+ ge,
4211
+ {
4212
+ title: p("org.address", "Address"),
4213
+ expanded: x.has("address"),
4214
+ onToggle: () => A("address")
4215
+ }
4216
+ ),
4217
+ x.has("address") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__fields", children: [
4218
+ /* @__PURE__ */ jsx(
4219
+ Re,
4220
+ {
4221
+ label: p("org.street", "Street"),
4222
+ value: n.street ?? "",
4223
+ onChange: (_) => N("street", _),
4224
+ disabled: k,
4225
+ readOnly: S
4226
+ }
4227
+ ),
4228
+ /* @__PURE__ */ jsx(
4229
+ Re,
4230
+ {
4231
+ label: p("org.city", "City"),
4232
+ value: n.city ?? "",
4233
+ onChange: (_) => N("city", _),
4234
+ disabled: k,
4235
+ readOnly: S
4236
+ }
4237
+ ),
4238
+ /* @__PURE__ */ jsx(
4239
+ Re,
4240
+ {
4241
+ label: p("org.state", "State / Province"),
4242
+ value: n.state ?? "",
4243
+ onChange: (_) => N("state", _),
4244
+ disabled: k,
4245
+ readOnly: S
4246
+ }
4247
+ ),
4248
+ /* @__PURE__ */ jsx(
4249
+ Re,
4250
+ {
4251
+ label: p("org.postalCode", "Postal Code"),
4252
+ value: n.postalCode ?? "",
4253
+ onChange: (_) => N("postalCode", _),
4254
+ disabled: k,
4255
+ readOnly: S
4256
+ }
4257
+ ),
4258
+ b ? /* @__PURE__ */ jsx(
4259
+ De,
4260
+ {
4261
+ label: p("org.country", "Country"),
4262
+ value: n.country ?? "",
4263
+ onChange: (_) => N("country", _),
4264
+ options: b,
4265
+ searchable: true,
4266
+ disabled: k,
4267
+ readOnly: S
4268
+ }
4269
+ ) : /* @__PURE__ */ jsx(
4270
+ Re,
4271
+ {
4272
+ label: p("org.country", "Country"),
4273
+ value: n.country ?? "",
4274
+ onChange: (_) => N("country", _),
4275
+ disabled: k,
4276
+ readOnly: S
4277
+ }
4278
+ )
4279
+ ] })
4280
+ ] }),
4281
+ y.includes("branding") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__section", children: [
4282
+ /* @__PURE__ */ jsx(
4283
+ ge,
4284
+ {
4285
+ title: p("org.branding", "Branding"),
4286
+ expanded: x.has("branding"),
4287
+ onToggle: () => A("branding")
4288
+ }
4289
+ ),
4290
+ x.has("branding") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__fields", children: [
4291
+ /* @__PURE__ */ jsx(
4292
+ Re,
4293
+ {
4294
+ label: p("org.logoUrl", "Logo URL"),
4295
+ value: n.logoUrl ?? "",
4296
+ onChange: (_) => N("logoUrl", _),
4297
+ type: "url",
4298
+ disabled: k,
4299
+ readOnly: S
4300
+ }
4301
+ ),
4302
+ /* @__PURE__ */ jsx(
4303
+ Ae,
4304
+ {
4305
+ label: p("org.primaryColor", "Primary Color"),
4306
+ value: n.primaryColor ?? "#3b82f6",
4307
+ onChange: (_) => N("primaryColor", _),
4308
+ disabled: k,
4309
+ readOnly: S
4310
+ }
4311
+ ),
4312
+ /* @__PURE__ */ jsx(
4313
+ Ae,
4314
+ {
4315
+ label: p("org.secondaryColor", "Secondary Color"),
4316
+ value: n.secondaryColor ?? "#8b5cf6",
4317
+ onChange: (_) => N("secondaryColor", _),
4318
+ disabled: k,
4319
+ readOnly: S
4320
+ }
4321
+ )
4322
+ ] })
4323
+ ] }),
4324
+ y.includes("localization") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__section", children: [
4325
+ /* @__PURE__ */ jsx(
4326
+ ge,
4327
+ {
4328
+ title: p("org.localization", "Localization"),
4329
+ expanded: x.has("localization"),
4330
+ onToggle: () => A("localization")
4331
+ }
4332
+ ),
4333
+ x.has("localization") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__fields", children: [
4334
+ r ? /* @__PURE__ */ jsx(
4335
+ De,
4336
+ {
4337
+ label: p("org.language", "Default Language"),
4338
+ value: n.defaultLanguage ?? "",
4339
+ onChange: (_) => N("defaultLanguage", _),
4340
+ options: r,
4341
+ searchable: true,
4342
+ disabled: k,
4343
+ readOnly: S
4344
+ }
4345
+ ) : /* @__PURE__ */ jsx(
4346
+ Re,
4347
+ {
4348
+ label: p("org.language", "Default Language"),
4349
+ value: n.defaultLanguage ?? "",
4350
+ onChange: (_) => N("defaultLanguage", _),
4351
+ disabled: k,
4352
+ readOnly: S
4353
+ }
4354
+ ),
4355
+ t ? /* @__PURE__ */ jsx(
4356
+ De,
4357
+ {
4358
+ label: p("org.currency", "Default Currency"),
4359
+ value: n.defaultCurrency ?? "",
4360
+ onChange: (_) => N("defaultCurrency", _),
4361
+ options: t,
4362
+ searchable: true,
4363
+ disabled: k,
4364
+ readOnly: S
4365
+ }
4366
+ ) : /* @__PURE__ */ jsx(
4367
+ Re,
4368
+ {
4369
+ label: p("org.currency", "Default Currency"),
4370
+ value: n.defaultCurrency ?? "",
4371
+ onChange: (_) => N("defaultCurrency", _),
4372
+ disabled: k,
4373
+ readOnly: S
4374
+ }
4375
+ ),
4376
+ u ? /* @__PURE__ */ jsx(
4377
+ De,
4378
+ {
4379
+ label: p("org.timezone", "Default Timezone"),
4380
+ value: n.defaultTimezone ?? "",
4381
+ onChange: (_) => N("defaultTimezone", _),
4382
+ options: u,
4383
+ searchable: true,
4384
+ disabled: k,
4385
+ readOnly: S
4386
+ }
4387
+ ) : /* @__PURE__ */ jsx(
4388
+ Re,
4389
+ {
4390
+ label: p("org.timezone", "Default Timezone"),
4391
+ value: n.defaultTimezone ?? "",
4392
+ onChange: (_) => N("defaultTimezone", _),
4393
+ disabled: k,
4394
+ readOnly: S
4395
+ }
4396
+ ),
4397
+ /* @__PURE__ */ jsx(
4398
+ De,
4399
+ {
4400
+ label: p("org.dateFormat", "Date Format"),
4401
+ value: n.dateFormat ?? "YYYY-MM-DD",
4402
+ onChange: (_) => N("dateFormat", _),
4403
+ options: Hn,
4404
+ disabled: k,
4405
+ readOnly: S
4406
+ }
4407
+ )
4408
+ ] })
4409
+ ] }),
4410
+ y.includes("fiscal") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__section", children: [
4411
+ /* @__PURE__ */ jsx(
4412
+ ge,
4413
+ {
4414
+ title: p("org.fiscal", "Fiscal Settings"),
4415
+ expanded: x.has("fiscal"),
4416
+ onToggle: () => A("fiscal")
4417
+ }
4418
+ ),
4419
+ x.has("fiscal") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__fields", children: [
4420
+ /* @__PURE__ */ jsx(
4421
+ Re,
4422
+ {
4423
+ label: p("org.fiscalYearStart", "Fiscal Year Start"),
4424
+ value: n.fiscalYearStart ?? "",
4425
+ onChange: (_) => N("fiscalYearStart", _),
4426
+ placeholder: "MM-DD",
4427
+ disabled: k,
4428
+ readOnly: S
4429
+ }
4430
+ ),
4431
+ /* @__PURE__ */ jsx(
4432
+ le,
4433
+ {
4434
+ label: p("org.vatEnabled", "VAT Enabled"),
4435
+ checked: n.vatEnabled ?? false,
4436
+ onChange: (_) => N("vatEnabled", _),
4437
+ disabled: k || S
4438
+ }
4439
+ ),
4440
+ n.vatEnabled && /* @__PURE__ */ jsx(
4441
+ ie,
4442
+ {
4443
+ label: p("org.defaultVatRate", "Default VAT Rate (%)"),
4444
+ value: n.defaultVatRate ?? null,
4445
+ onChange: (_) => N("defaultVatRate", _ ?? void 0),
4446
+ min: 0,
4447
+ max: 100,
4448
+ step: 0.5,
4449
+ disabled: k,
4450
+ readOnly: S
4451
+ }
4452
+ )
4453
+ ] })
4454
+ ] }),
4455
+ y.includes("preferences") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__section", children: [
4456
+ /* @__PURE__ */ jsx(
4457
+ ge,
4458
+ {
4459
+ title: p("org.preferences", "Work Preferences"),
4460
+ expanded: x.has("preferences"),
4461
+ onToggle: () => A("preferences")
4462
+ }
4463
+ ),
4464
+ x.has("preferences") && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__fields", children: [
4465
+ /* @__PURE__ */ jsxs("div", { className: "nice-org-form__field-group", children: [
4466
+ /* @__PURE__ */ jsx("label", { className: "nice-org-form__group-label", children: p("org.workingDays", "Working Days") }),
4467
+ /* @__PURE__ */ jsx("div", { className: "nice-org-form__checkboxes", children: Vn.map((_) => /* @__PURE__ */ jsx(
4468
+ se,
4469
+ {
4470
+ label: _.label,
4471
+ checked: (n.workingDays ?? ["Mon", "Tue", "Wed", "Thu", "Fri"]).includes(_.key),
4472
+ onChange: (Y) => {
4473
+ const K = n.workingDays ?? ["Mon", "Tue", "Wed", "Thu", "Fri"], Q = Y ? [...K, _.key] : K.filter((W) => W !== _.key);
4474
+ N("workingDays", Q);
4475
+ },
4476
+ disabled: k || S
4477
+ },
4478
+ _.key
4479
+ )) })
4480
+ ] }),
4481
+ /* @__PURE__ */ jsx(
4482
+ Re,
4483
+ {
4484
+ label: p("org.workStart", "Working Hours Start"),
4485
+ value: n.workingHoursStart ?? "09:00",
4486
+ onChange: (_) => N("workingHoursStart", _),
4487
+ placeholder: "HH:MM",
4488
+ disabled: k,
4489
+ readOnly: S
4490
+ }
4491
+ ),
4492
+ /* @__PURE__ */ jsx(
4493
+ Re,
4494
+ {
4495
+ label: p("org.workEnd", "Working Hours End"),
4496
+ value: n.workingHoursEnd ?? "17:00",
4497
+ onChange: (_) => N("workingHoursEnd", _),
4498
+ placeholder: "HH:MM",
4499
+ disabled: k,
4500
+ readOnly: S
4501
+ }
4502
+ )
4503
+ ] })
4504
+ ] }),
4505
+ o && /* @__PURE__ */ jsxs("div", { className: "nice-org-form__actions", children: [
4506
+ l && /* @__PURE__ */ jsx(Fe$1, { variant: "secondary", onClick: l, disabled: m, children: p("cancel", "Cancel") }),
4507
+ i && /* @__PURE__ */ jsx(Fe$1, { variant: "primary", onClick: D, loading: m, disabled: S || k, children: p("save", "Save") })
4508
+ ] })
4509
+ ]
4510
+ }
4511
+ );
4512
+ }
4513
+ );
4514
+ Kn.displayName = "NiceOrganizationProfileForm";
4515
+ const Qn = {
4516
+ available: { color: "#6b7280", icon: "○" },
4517
+ installed: { color: "#3b82f6", icon: "◉" },
4518
+ active: { color: "#10b981", icon: "●" },
4519
+ disabled: { color: "#f59e0b", icon: "◌" },
4520
+ error: { color: "#ef4444", icon: "⊘" },
4521
+ updating: { color: "#8b5cf6", icon: "↻" }
4522
+ };
4523
+ function Xn(n, a) {
4524
+ switch (n) {
4525
+ case "available":
4526
+ return ["install"];
4527
+ case "installed":
4528
+ return ["activate", ...a ? [] : ["uninstall"]];
4529
+ case "active":
4530
+ return ["deactivate"];
4531
+ case "disabled":
4532
+ return ["activate", ...a ? [] : ["uninstall"]];
4533
+ case "error":
4534
+ return ["activate", ...a ? [] : ["uninstall"]];
4535
+ case "updating":
4536
+ return [];
4537
+ default:
4538
+ return [];
4539
+ }
4540
+ }
4541
+ const Gn = ({ module: n, onAction: a, onClick: i, showDependencies: l, showAuthor: s, showVersion: h, processing: o, disabled: b, readOnly: r, t, layout: u }) => {
4542
+ const m = Qn[n.status], w = Xn(n.status, n.isCore);
4543
+ return /* @__PURE__ */ jsxs(
4544
+ "div",
4545
+ {
4546
+ className: `nice-module-card nice-module-card--${u} nice-module-card--${n.status}`,
4547
+ onClick: i,
4548
+ role: i ? "button" : void 0,
4549
+ tabIndex: i ? 0 : void 0,
4550
+ onKeyDown: i ? (d) => {
4551
+ (d.key === "Enter" || d.key === " ") && (d.preventDefault(), i());
4552
+ } : void 0,
4553
+ children: [
4554
+ /* @__PURE__ */ jsxs("div", { className: "nice-module-card__header", children: [
4555
+ /* @__PURE__ */ jsx("span", { className: "nice-module-card__icon", children: n.icon ?? "📦" }),
4556
+ /* @__PURE__ */ jsxs("div", { className: "nice-module-card__info", children: [
4557
+ /* @__PURE__ */ jsx("div", { className: "nice-module-card__name", children: n.label }),
4558
+ h && /* @__PURE__ */ jsxs("span", { className: "nice-module-card__version", children: [
4559
+ "v",
4560
+ n.version
4561
+ ] })
4562
+ ] }),
4563
+ /* @__PURE__ */ jsxs(
4564
+ "span",
4565
+ {
4566
+ className: "nice-module-card__status",
4567
+ style: { color: m.color },
4568
+ title: n.status,
4569
+ children: [
4570
+ o ? "⟳" : m.icon,
4571
+ " ",
4572
+ n.status
4573
+ ]
4574
+ }
4575
+ )
4576
+ ] }),
4577
+ /* @__PURE__ */ jsx("div", { className: "nice-module-card__desc", children: n.description }),
4578
+ /* @__PURE__ */ jsxs("div", { className: "nice-module-card__meta", children: [
4579
+ s && n.author && /* @__PURE__ */ jsx("span", { className: "nice-module-card__author", children: n.author }),
4580
+ n.isCore && /* @__PURE__ */ jsx("span", { className: "nice-module-card__badge nice-module-card__badge--core", children: t("module.core", "Core") })
4581
+ ] }),
4582
+ l && n.dependencies && n.dependencies.length > 0 && /* @__PURE__ */ jsxs("div", { className: "nice-module-card__deps", children: [
4583
+ /* @__PURE__ */ jsxs("span", { className: "nice-module-card__deps-label", children: [
4584
+ t("module.deps", "Dependencies"),
4585
+ ":"
4586
+ ] }),
4587
+ n.dependencies.map((d) => /* @__PURE__ */ jsx("span", { className: "nice-module-card__dep-tag", children: d }, d))
4588
+ ] }),
4589
+ !r && w.length > 0 && /* @__PURE__ */ jsx("div", { className: "nice-module-card__actions", children: w.map((d) => /* @__PURE__ */ jsx(
4590
+ Fe$1,
4591
+ {
4592
+ size: "sm",
4593
+ variant: d === "uninstall" ? "error" : d === "activate" ? "primary" : "secondary",
4594
+ onClick: (g) => {
4595
+ g.stopPropagation(), a(d);
4596
+ },
4597
+ disabled: b || o,
4598
+ loading: o,
4599
+ children: t(`module.${d}`, d.charAt(0).toUpperCase() + d.slice(1))
4600
+ },
4601
+ d
4602
+ )) })
4603
+ ]
4604
+ }
4605
+ );
4606
+ }, Jn = forwardRef(
4607
+ ({
4608
+ modules: n,
4609
+ onAction: a,
4610
+ statusFilter: i,
4611
+ searchable: l = true,
4612
+ showDependencies: s = true,
4613
+ showAuthor: h = true,
4614
+ showVersion: o = true,
4615
+ processingModules: b,
4616
+ layout: r = "list",
4617
+ gridColumns: t = 3,
4618
+ onModuleClick: u,
4619
+ className: m,
4620
+ style: w,
4621
+ id: d,
4622
+ accessMode: g,
4623
+ ...z
4624
+ }, M) => {
4625
+ const T = ys(d), f = ei(g, d), { t: $ } = de(), [p, y] = useState(""), [x, C] = useState("all"), A = f === "readOnly", S = f === "disabled", k = useMemo(() => {
4626
+ let _ = n;
4627
+ if (i && i.length > 0 && (_ = _.filter((Y) => i.includes(Y.status))), x !== "all" && (_ = _.filter((Y) => Y.status === x)), p) {
4628
+ const Y = p.toLowerCase();
4629
+ _ = _.filter(
4630
+ (K) => K.label.toLowerCase().includes(Y) || K.name.toLowerCase().includes(Y) || K.description.toLowerCase().includes(Y)
4631
+ );
4632
+ }
4633
+ return _;
4634
+ }, [n, i, x, p]), N = useMemo(() => {
4635
+ const _ = { all: n.length };
4636
+ for (const Y of n)
4637
+ _[Y.status] = (_[Y.status] ?? 0) + 1;
4638
+ return _;
4639
+ }, [n]), D = useCallback(
4640
+ (_, Y) => {
4641
+ a?.(_, Y);
4642
+ },
4643
+ [a]
4644
+ );
4645
+ return f === "hidden" ? null : /* @__PURE__ */ jsxs(
4646
+ "div",
4647
+ {
4648
+ ref: M,
4649
+ id: T,
4650
+ className: `nice-module-panel ${m ?? ""}`,
4651
+ style: w,
4652
+ ...z,
4653
+ children: [
4654
+ /* @__PURE__ */ jsxs("div", { className: "nice-module-panel__toolbar", children: [
4655
+ l && /* @__PURE__ */ jsx(
4656
+ Re,
4657
+ {
4658
+ value: p,
4659
+ onChange: y,
4660
+ placeholder: $("module.search", "Search modules…"),
4661
+ type: "search",
4662
+ clearable: true,
4663
+ className: "nice-module-panel__search"
4664
+ }
4665
+ ),
4666
+ /* @__PURE__ */ jsx("div", { className: "nice-module-panel__filters", role: "tablist", children: ["all", "active", "installed", "disabled", "available", "error"].map((_) => /* @__PURE__ */ jsxs(
4667
+ "button",
4668
+ {
4669
+ className: `nice-module-panel__filter ${x === _ ? "nice-module-panel__filter--active" : ""}`,
4670
+ onClick: () => C(_),
4671
+ role: "tab",
4672
+ "aria-selected": x === _,
4673
+ type: "button",
4674
+ children: [
4675
+ $(`module.status.${_}`, _ === "all" ? "All" : _.charAt(0).toUpperCase() + _.slice(1)),
4676
+ /* @__PURE__ */ jsx("span", { className: "nice-module-panel__filter-count", children: N[_] ?? 0 })
4677
+ ]
4678
+ },
4679
+ _
4680
+ )) })
4681
+ ] }),
4682
+ /* @__PURE__ */ jsx(
4683
+ "div",
4684
+ {
4685
+ className: `nice-module-panel__grid nice-module-panel__grid--${r}`,
4686
+ style: r === "grid" ? { gridTemplateColumns: `repeat(${t}, 1fr)` } : void 0,
4687
+ children: k.length === 0 ? /* @__PURE__ */ jsx("div", { className: "nice-module-panel__empty", children: $("module.empty", "No modules found") }) : k.map((_) => /* @__PURE__ */ jsx(
4688
+ Gn,
4689
+ {
4690
+ module: _,
4691
+ onAction: (Y) => D(_.id, Y),
4692
+ onClick: u ? () => u(_) : void 0,
4693
+ showDependencies: s,
4694
+ showAuthor: h,
4695
+ showVersion: o,
4696
+ processing: b?.has(_.id) ?? false,
4697
+ disabled: S,
4698
+ readOnly: A,
4699
+ t: $,
4700
+ layout: r
4701
+ },
4702
+ _.id
4703
+ ))
4704
+ }
4705
+ ),
4706
+ /* @__PURE__ */ jsxs("div", { className: "nice-module-panel__summary", children: [
4707
+ $("module.total", "Total"),
4708
+ ": ",
4709
+ n.length,
4710
+ " ·",
4711
+ $("module.status.active", "Active"),
4712
+ ": ",
4713
+ N.active ?? 0,
4714
+ " ·",
4715
+ $("module.status.disabled", "Disabled"),
4716
+ ": ",
4717
+ N.disabled ?? 0,
4718
+ " ·",
4719
+ $("module.status.error", "Error"),
4720
+ ": ",
4721
+ N.error ?? 0
4722
+ ] })
4723
+ ]
4724
+ }
4725
+ );
4726
+ }
4727
+ );
4728
+ Jn.displayName = "NiceModuleLifecyclePanel";
4729
+
4730
+ export { Pn as A, Kn as B, ta as C, Ue as D, vn as E, ua as G, da as H, ia as I, gn as J, _a as K, yn as L, pn as M, ca as N, xe as S, _n as a, un as b, on as c, dn as d, Fe as e, ln as f, tn as g, la as h, sa as i, Yn as j, Fn as k, bn as l, ra as m, cn as n, Rn as o, hn as p, rn as q, $n as r, jn as s, An as t, sn as u, an as v, Wn as w, Jn as x, oa as y, Nn as z };
4731
+ //# sourceMappingURL=NiceModuleLifecyclePanel-BapdidD6.js.map