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