@nice2dev/ui 1.1.9 → 1.2.0

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 (163) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/README.md +27 -34
  3. package/dist/NiceButton-5tWvfXKl.cjs +1 -0
  4. package/dist/NiceButton-DHSgQT1_.js +112 -0
  5. package/dist/NiceCodeEditor-B8At55f5.js +1179 -0
  6. package/dist/NiceCodeEditor-BJSEzhcY.cjs +260 -0
  7. package/dist/NiceCodeEditor-BfkH1bsZ.cjs +260 -0
  8. package/dist/NiceCodeEditor-CduGYggj.js +1179 -0
  9. package/dist/NiceColorPicker-CdUnhM-A.cjs +1 -0
  10. package/dist/NiceColorPicker-DCgmE-3H.cjs +1 -0
  11. package/dist/NiceColorPicker-DK30kJgy.js +486 -0
  12. package/dist/NiceColorPicker-DpXwnDwL.js +598 -0
  13. package/dist/NiceColorPicker-DtPFxDKM.cjs +1 -0
  14. package/dist/NiceColorPicker-bNJBAU_c.js +598 -0
  15. package/dist/NiceConfirmDialog-B7aNRL2K.cjs +1 -0
  16. package/dist/NiceConfirmDialog-BdhWenrO.js +81 -0
  17. package/dist/NiceDataGrid-BOCJr6XF.js +2217 -0
  18. package/dist/NiceDataGrid-BV5Oh-gy.cjs +10 -0
  19. package/dist/NiceDataGrid-CVYEo_nv.cjs +10 -0
  20. package/dist/NiceDataGrid-D-rm4lu8.js +2217 -0
  21. package/dist/NiceDataGrid-Dd7SI-M6.cjs +10 -0
  22. package/dist/NiceDataGrid-DjZchXYG.js +2217 -0
  23. package/dist/NiceDocumentViewer-BgcgLWJ3.cjs +180 -0
  24. package/dist/NiceDocumentViewer-sukmGhRx.js +672 -0
  25. package/dist/NiceForm-BCEXovJR.cjs +1 -0
  26. package/dist/NiceForm-D7oyWHXg.js +4820 -0
  27. package/dist/NiceForm-DUhxXArr.js +4817 -0
  28. package/dist/NiceForm-DVc0Xoly.js +4819 -0
  29. package/dist/NiceForm-qD_RKPYz.cjs +1 -0
  30. package/dist/NiceForm-uCeVmTrD.cjs +1 -0
  31. package/dist/NiceGantt-4UBd4uJ8.cjs +1 -0
  32. package/dist/NiceGantt-B_1lwEsp.js +328 -0
  33. package/dist/NiceHtmlEditor-BYk1roA4.cjs +10 -0
  34. package/dist/NiceHtmlEditor-Bce9Vwe1.cjs +10 -0
  35. package/dist/NiceHtmlEditor-C5kLeF9H.cjs +10 -0
  36. package/dist/NiceHtmlEditor-CFVMIC5L.js +848 -0
  37. package/dist/NiceHtmlEditor-CGRgcu2h.js +848 -0
  38. package/dist/NiceHtmlEditor-mWebBmy1.js +849 -0
  39. package/dist/NiceLoginForm-BHyDY7br.cjs +1 -0
  40. package/dist/NiceLoginForm-BTuQ0eKk.cjs +1 -0
  41. package/dist/NiceLoginForm-BuxFY2Rk.js +750 -0
  42. package/dist/NiceLoginForm-o1A-TBcp.js +736 -0
  43. package/dist/NiceLoginForm.css +1 -0
  44. package/dist/NiceMention-CA7CL5BI.js +11263 -0
  45. package/dist/NiceMention-CHcKRl-L.cjs +430 -0
  46. package/dist/NiceMention-DJD0BLcp.js +11269 -0
  47. package/dist/NiceMention-DcaUEMSg.cjs +430 -0
  48. package/dist/NiceMention-Dds9GQzk.cjs +430 -0
  49. package/dist/NiceMention-DlLXWddO.js +11268 -0
  50. package/dist/NiceMention.css +1 -1
  51. package/dist/NiceModal-C4p8a82e.cjs +1 -0
  52. package/dist/NiceModal-Dr1e3nQZ.cjs +1 -0
  53. package/dist/NiceModal-TNlkaL_i.js +85 -0
  54. package/dist/NiceModal-sihGCfDy.js +95 -0
  55. package/dist/NiceModuleLifecyclePanel-BWbKdVC_.js +7054 -0
  56. package/dist/NiceModuleLifecyclePanel-CZHIzvkE.cjs +1 -0
  57. package/dist/NiceModuleLifecyclePanel-Du7G3-RG.js +7053 -0
  58. package/dist/NiceModuleLifecyclePanel-OC9YK2kG.js +7052 -0
  59. package/dist/NiceModuleLifecyclePanel-_OcfDmtC.cjs +1 -0
  60. package/dist/NiceModuleLifecyclePanel-js1p7LIY.cjs +1 -0
  61. package/dist/NicePagination-8XsBbMNx.js +165 -0
  62. package/dist/NicePagination-CkOoXf0f.js +165 -0
  63. package/dist/NicePagination-D44waj9o.cjs +1 -0
  64. package/dist/NicePagination-D7lek1G7.cjs +1 -0
  65. package/dist/NicePagination-DdxH8KMG.js +179 -0
  66. package/dist/NicePagination-OjTEfZJE.cjs +1 -0
  67. package/dist/NicePivotGrid-B2YHP3Z6.js +1183 -0
  68. package/dist/NicePivotGrid-BJRSciWl.js +1183 -0
  69. package/dist/NicePivotGrid-BtVUWiud.cjs +152 -0
  70. package/dist/NicePivotGrid-CS1dPmNI.cjs +152 -0
  71. package/dist/NicePivotGrid-D2AxqDzJ.js +1183 -0
  72. package/dist/NicePivotGrid-DxQ6Py9D.cjs +152 -0
  73. package/dist/NiceSavedQueryPanel-B5HhqlAI.cjs +586 -0
  74. package/dist/NiceSavedQueryPanel-C0A-eoYN.js +5142 -0
  75. package/dist/NiceSavedQueryPanel-CMStDOKe.js +5125 -0
  76. package/dist/NiceSavedQueryPanel-D2i34e_b.cjs +586 -0
  77. package/dist/NiceSavedQueryPanel-ZrilZRtf.cjs +586 -0
  78. package/dist/NiceSavedQueryPanel-mPO2THs7.js +5142 -0
  79. package/dist/NiceSavedQueryPanel.css +1 -1
  80. package/dist/NiceScheduler-7gP7vcLy.cjs +5 -0
  81. package/dist/NiceScheduler-Cy7F9tgH.js +1693 -0
  82. package/dist/NiceScheduler-DquRUZxD.cjs +5 -0
  83. package/dist/NiceScheduler-KSzaUQxC.js +1693 -0
  84. package/dist/NiceScheduler-O3AwmdGG.cjs +5 -0
  85. package/dist/NiceScheduler-l8N4yCWd.js +1716 -0
  86. package/dist/NiceSelect-BCbWtu1v.js +433 -0
  87. package/dist/NiceSelect-BqtiQbfD.cjs +1 -0
  88. package/dist/NiceSelect-DZB1Rs9x.js +435 -0
  89. package/dist/NiceSelect-tMz9QQUs.cjs +1 -0
  90. package/dist/NiceStreamDashboard.doc-74KUXya1.cjs +8 -0
  91. package/dist/NiceStreamDashboard.doc-k8PQfCM0.js +32 -0
  92. package/dist/NiceWindow-BEov3s9F.js +2094 -0
  93. package/dist/NiceWindow-BU1Ce7gS.js +1623 -0
  94. package/dist/NiceWindow-CDt6PCEg.cjs +1 -0
  95. package/dist/NiceWindow-jjdE6vGy.cjs +1 -0
  96. package/dist/NiceWindow.css +1 -1
  97. package/dist/charts-C047IMVn.cjs +768 -0
  98. package/dist/charts-C44vJber.cjs +768 -0
  99. package/dist/charts-CCXSb3xk.js +4752 -0
  100. package/dist/charts-CqETcUhH.js +4752 -0
  101. package/dist/charts-DouiiHOT.cjs +768 -0
  102. package/dist/charts-XVlDwU0y.js +4732 -0
  103. package/dist/charts.cjs +1 -1
  104. package/dist/charts.mjs +8 -8
  105. package/dist/core-BL-KmGYC.js +795 -0
  106. package/dist/core-BxiH7vkV.cjs +1 -0
  107. package/dist/core-Chg-oYCr.cjs +1 -0
  108. package/dist/core-CxBnKAhs.cjs +1 -0
  109. package/dist/core-DMV6_SEE.js +795 -0
  110. package/dist/core-D_LRh59n.js +795 -0
  111. package/dist/data-branching-Km4lc8P_.cjs +1 -0
  112. package/dist/data-branching-YQtJJEtn.js +6273 -0
  113. package/dist/data-branching-oEH04O3i.js +6273 -0
  114. package/dist/data-branching-wmsbLNfa.cjs +1 -0
  115. package/dist/data-branching.cjs +1 -1
  116. package/dist/data-branching.mjs +1 -1
  117. package/dist/data.cjs +1 -1
  118. package/dist/data.d.ts +2 -53
  119. package/dist/data.mjs +3 -3
  120. package/dist/devops-Bt6EsfPa.cjs +17 -0
  121. package/dist/devops-CnZQ1rU5.js +8312 -0
  122. package/dist/devops-D5yIDM3e.js +8312 -0
  123. package/dist/devops-rVpB0ZAX.cjs +17 -0
  124. package/dist/devops.cjs +1 -1
  125. package/dist/devops.mjs +1 -1
  126. package/dist/editors.cjs +1 -1
  127. package/dist/editors.d.ts +8 -26
  128. package/dist/editors.mjs +55 -54
  129. package/dist/feedback.cjs +1 -1
  130. package/dist/feedback.d.ts +5 -0
  131. package/dist/feedback.mjs +3 -3
  132. package/dist/index.cjs +290 -290
  133. package/dist/index.css +1 -1
  134. package/dist/index.d.ts +239 -234
  135. package/dist/index.mjs +20262 -19440
  136. package/dist/lazy.cjs +1 -1
  137. package/dist/lazy.mjs +29 -29
  138. package/dist/navigation.cjs +1 -1
  139. package/dist/navigation.d.ts +4 -4
  140. package/dist/navigation.mjs +69 -69
  141. package/dist/no-code-4GtIBr6f.js +7503 -0
  142. package/dist/no-code-6WyYb3hL.cjs +331 -0
  143. package/dist/no-code-BH5oVFC6.js +8186 -0
  144. package/dist/no-code-Bdwh1vyS.cjs +332 -0
  145. package/dist/no-code-CnHG5_Vn.js +8186 -0
  146. package/dist/no-code-DMKlg1Zl.cjs +331 -0
  147. package/dist/no-code.cjs +1 -1
  148. package/dist/no-code.css +1 -1
  149. package/dist/no-code.d.ts +25 -18
  150. package/dist/no-code.mjs +3 -3
  151. package/dist/overlays.cjs +1 -1
  152. package/dist/overlays.d.ts +24 -24
  153. package/dist/overlays.mjs +24 -490
  154. package/dist/pickerCommons-0vyK1Knv.js +547 -0
  155. package/dist/pickerCommons-31hyz1gs.js +1122 -0
  156. package/dist/pickerCommons-BFbItm8o.cjs +1 -0
  157. package/dist/pickerCommons-BHirHJyn.js +548 -0
  158. package/dist/pickerCommons-BifIkPdk.cjs +1 -0
  159. package/dist/pickerCommons-Bt8JIaTN.cjs +1 -0
  160. package/dist/pickerCommons.css +1 -1
  161. package/dist/style.css +10 -7
  162. package/package.json +5 -7
  163. package/css/legacy-bg-text-aliases.css +0 -87
@@ -0,0 +1,795 @@
1
+ import te, { useState as T, useRef as V, useEffect as k, useCallback as m, useMemo as v, useContext as re, createContext as ce, lazy as ie, Suspense as de } from "react";
2
+ import { DEFAULT_TRACELESS_POLICY as P, createPermissiveInstanceCeiling as H, resolveTracelessPolicy as U, generateTracelessComplianceReport as oe, auditStorageCompliance as se, TRACELESS_POLICY_HEADER as K, parsePolicyFromHeader as W, StorageAdapter as ne, getTracelessBadgeInfo as ae } from "@nice2dev/ui-core";
3
+ import { jsxs as J, jsx as i, Fragment as ue } from "react/jsx-runtime";
4
+ const q = ce(null);
5
+ function Se({
6
+ children: e,
7
+ initialPolicy: o,
8
+ policyEndpoint: t,
9
+ instanceCeiling: r,
10
+ tenantPolicy: s,
11
+ groupPolicy: n,
12
+ userPreference: d,
13
+ instanceId: a = "default",
14
+ tenantId: c,
15
+ onPolicyChange: f
16
+ }) {
17
+ const [l, p] = T(o || P), [g, D] = T(
18
+ d
19
+ ), [w, A] = T(!!t), [N, h] = T(null), S = V(/* @__PURE__ */ new Map());
20
+ k(() => {
21
+ const y = r || H(a), u = U(y, s, n, g);
22
+ p(u), f?.(u), S.current.forEach((M) => {
23
+ M.updatePolicy(u);
24
+ });
25
+ }, [r, s, n, g, a, f]), k(() => {
26
+ if (!t)
27
+ return;
28
+ (async () => {
29
+ A(!0), h(null);
30
+ try {
31
+ const u = await fetch(t, {
32
+ credentials: "include"
33
+ });
34
+ if (!u.ok)
35
+ throw new Error(`Failed to fetch policy: ${u.status}`);
36
+ const M = u.headers.get(K);
37
+ if (M) {
38
+ const I = W(M);
39
+ if (I) {
40
+ const O = r || H(a), $ = U(
41
+ O,
42
+ s ? { ...s, mode: I } : {
43
+ tenantId: "default",
44
+ mode: I,
45
+ allowGroupOverride: !0,
46
+ allowUserOverride: !0,
47
+ updatedAt: Date.now()
48
+ },
49
+ n,
50
+ g
51
+ );
52
+ p($), f?.($);
53
+ }
54
+ }
55
+ try {
56
+ const I = await u.json();
57
+ I.policy && (p(I.policy), f?.(I.policy));
58
+ } catch {
59
+ }
60
+ } catch (u) {
61
+ h(u instanceof Error ? u : new Error("Unknown error"));
62
+ } finally {
63
+ A(!1);
64
+ }
65
+ })();
66
+ }, [
67
+ t,
68
+ r,
69
+ s,
70
+ n,
71
+ g,
72
+ a,
73
+ f
74
+ ]);
75
+ const L = m((y) => {
76
+ D((u) => ({
77
+ userId: u?.userId || "anonymous",
78
+ preferredMode: y.preferredMode || u?.preferredMode || "traceless",
79
+ restrictCookies: y.restrictCookies ?? u?.restrictCookies,
80
+ restrictLocalStorage: y.restrictLocalStorage ?? u?.restrictLocalStorage,
81
+ restrictSessionStorage: y.restrictSessionStorage ?? u?.restrictSessionStorage,
82
+ setAt: Date.now()
83
+ }));
84
+ }, []), b = m(() => oe(l, a, c), [l, a, c]), G = m(() => se(l), [l]), F = m(async () => {
85
+ if (t) {
86
+ A(!0);
87
+ try {
88
+ const y = await fetch(t, {
89
+ credentials: "include",
90
+ cache: "no-cache"
91
+ });
92
+ if (y.ok) {
93
+ const u = y.headers.get(K);
94
+ if (u) {
95
+ const M = W(u);
96
+ if (M) {
97
+ const I = r || H(a), O = U(
98
+ I,
99
+ s ? { ...s, mode: M } : void 0,
100
+ n,
101
+ g
102
+ );
103
+ p(O), f?.(O);
104
+ }
105
+ }
106
+ }
107
+ } finally {
108
+ A(!1);
109
+ }
110
+ }
111
+ }, [
112
+ t,
113
+ r,
114
+ s,
115
+ n,
116
+ g,
117
+ a,
118
+ f
119
+ ]), j = m(
120
+ (y = "nice2dev") => {
121
+ let u = S.current.get(y);
122
+ return u || (u = new ne(l, y), S.current.set(y, u)), u;
123
+ },
124
+ [l]
125
+ ), _ = v(() => ae(l), [l]), le = v(
126
+ () => ({
127
+ policy: l,
128
+ canUseCookies: l.cookiesAllowed,
129
+ canUseLocalStorage: l.localStorageAllowed,
130
+ canUseSessionStorage: l.sessionStorageAllowed,
131
+ canPersist: l.localStorageAllowed,
132
+ mode: l.effectiveMode,
133
+ requiresConsentBanner: l.requiresConsentBanner,
134
+ badgeInfo: _,
135
+ setUserPreference: L,
136
+ generateReport: b,
137
+ runAudit: G,
138
+ refreshPolicy: F,
139
+ getStorageAdapter: j,
140
+ isLoading: w,
141
+ error: N
142
+ }),
143
+ [
144
+ l,
145
+ _,
146
+ L,
147
+ b,
148
+ G,
149
+ F,
150
+ j,
151
+ w,
152
+ N
153
+ ]
154
+ );
155
+ return te.createElement(q.Provider, { value: le }, e);
156
+ }
157
+ function ye() {
158
+ const e = re(q);
159
+ if (!e)
160
+ throw new Error("useTracelessPolicy must be used within a TracelessProvider");
161
+ return e;
162
+ }
163
+ function z() {
164
+ const e = re(q);
165
+ if (e)
166
+ return e;
167
+ const o = new ne(P);
168
+ return {
169
+ policy: P,
170
+ canUseCookies: !1,
171
+ canUseLocalStorage: !1,
172
+ canUseSessionStorage: !1,
173
+ canPersist: !1,
174
+ mode: "traceless",
175
+ requiresConsentBanner: !1,
176
+ badgeInfo: ae(P),
177
+ setUserPreference: () => {
178
+ },
179
+ generateReport: () => oe(P, "default"),
180
+ runAudit: () => se(P),
181
+ refreshPolicy: async () => {
182
+ },
183
+ getStorageAdapter: () => o,
184
+ isLoading: !1,
185
+ error: null
186
+ };
187
+ }
188
+ function B(e = "nice2dev") {
189
+ const { getStorageAdapter: o } = z();
190
+ return v(() => o(e), [o, e]);
191
+ }
192
+ function Y(e, o, t) {
193
+ const r = B(t?.namespace), { canPersist: s, canUseSessionStorage: n } = z(), d = t?.storageMode === "session" ? n : s, [a, c] = T(() => {
194
+ if (d) {
195
+ const l = r.get(e, t?.storageMode);
196
+ if (l !== null)
197
+ return l;
198
+ }
199
+ return o;
200
+ }), f = m(
201
+ (l) => {
202
+ c((p) => {
203
+ const g = typeof l == "function" ? l(p) : l;
204
+ return d && r.set(e, g, t?.storageMode === "session" ? "session" : "local"), g;
205
+ });
206
+ },
207
+ [r, e, d, t?.storageMode]
208
+ );
209
+ return [a, f, d];
210
+ }
211
+ function we() {
212
+ const { requiresConsentBanner: e, mode: o } = z(), t = B("nice2dev-consent"), [r, s] = T(() => t.get("banner-dismissed") === !0), n = m(() => {
213
+ s(!0), t.set("banner-dismissed", !0);
214
+ }, [t]);
215
+ return {
216
+ shouldShow: e && !r,
217
+ mode: o,
218
+ dismiss: n
219
+ };
220
+ }
221
+ function ve(e = !1) {
222
+ const { runAudit: o } = z(), [t, r] = T(null), s = m(() => {
223
+ const n = o();
224
+ return r(n), n;
225
+ }, [o]);
226
+ return k(() => {
227
+ e && s();
228
+ }, [e, s]), {
229
+ result: t,
230
+ run: s,
231
+ isCompliant: t?.compliant ?? null
232
+ };
233
+ }
234
+ function be() {
235
+ const { policy: e, getStorageAdapter: o } = z(), t = v(() => o("local"), [o]), r = m(
236
+ (a) => t.get(a),
237
+ [t]
238
+ ), s = m(
239
+ (a, c) => {
240
+ t.set(a, c);
241
+ },
242
+ [t]
243
+ ), n = m(
244
+ (a) => {
245
+ t.remove(a);
246
+ },
247
+ [t]
248
+ ), d = m(() => {
249
+ t.clear();
250
+ }, [t]);
251
+ return v(
252
+ () => ({
253
+ getItem: r,
254
+ setItem: s,
255
+ removeItem: n,
256
+ clear: d,
257
+ isAvailable: e.localStorageAllowed,
258
+ effectiveMode: e.effectiveMode,
259
+ policy: e
260
+ }),
261
+ [r, s, n, d, e]
262
+ );
263
+ }
264
+ function ke() {
265
+ const { policy: e, getStorageAdapter: o } = z(), t = v(() => o("session"), [o]), r = m(
266
+ (a) => t.get(a),
267
+ [t]
268
+ ), s = m(
269
+ (a, c) => {
270
+ t.set(a, c);
271
+ },
272
+ [t]
273
+ ), n = m(
274
+ (a) => {
275
+ t.remove(a);
276
+ },
277
+ [t]
278
+ ), d = m(() => {
279
+ t.clear();
280
+ }, [t]);
281
+ return v(
282
+ () => ({
283
+ getItem: r,
284
+ setItem: s,
285
+ removeItem: n,
286
+ clear: d,
287
+ isAvailable: e.sessionStorageAllowed,
288
+ effectiveMode: e.effectiveMode
289
+ }),
290
+ [r, s, n, d, e]
291
+ );
292
+ }
293
+ function Ae({
294
+ storageKey: e,
295
+ initialState: o = {},
296
+ onStateChange: t,
297
+ storageType: r = "auto"
298
+ }) {
299
+ const { policy: s, getStorageAdapter: n } = z(), d = `nice-datagrid-${e}`, a = v(() => {
300
+ if (r === "local" && s.localStorageAllowed)
301
+ return "local";
302
+ if (r === "session" && s.sessionStorageAllowed)
303
+ return "session";
304
+ if (r === "auto") {
305
+ if (s.localStorageAllowed)
306
+ return "local";
307
+ if (s.sessionStorageAllowed)
308
+ return "session";
309
+ }
310
+ return "memory";
311
+ }, [r, s]), c = v(() => n(a === "session" ? "session-grid" : "local-grid"), [n, a]), [f, l] = T(() => {
312
+ const w = c.get(d);
313
+ if (w)
314
+ try {
315
+ return { ...o, ...JSON.parse(w) };
316
+ } catch {
317
+ return o;
318
+ }
319
+ return o;
320
+ });
321
+ k(() => {
322
+ c.set(d, JSON.stringify(f)), t?.(f);
323
+ }, [f, c, d, t]);
324
+ const p = m((w) => {
325
+ l((A) => ({ ...A, ...w }));
326
+ }, []), g = m(() => {
327
+ c.remove(d), l(o);
328
+ }, [c, d, o]);
329
+ return {
330
+ state: f,
331
+ updateState: p,
332
+ setState: l,
333
+ clearState: g,
334
+ degraded: a === "memory",
335
+ effectiveStorageType: a,
336
+ policy: s
337
+ };
338
+ }
339
+ function Le({
340
+ storageKey: e,
341
+ autoSaveInterval: o = 5e3,
342
+ maxVersions: t = 10
343
+ }) {
344
+ const { policy: r, getStorageAdapter: s } = z(), n = `nice-editor-${e}`, d = `${n}-history`, a = v(() => s("editor"), [s]), [c, f] = Y(n, null, {
345
+ storageMode: r.localStorageAllowed ? "local" : "session"
346
+ }), [l, p] = Y(d, [], {
347
+ storageMode: "local"
348
+ }), g = m(
349
+ (h, S) => {
350
+ const L = {
351
+ content: h,
352
+ cursorPosition: S,
353
+ lastModified: Date.now(),
354
+ version: (c?.version ?? 0) + 1
355
+ };
356
+ f(L);
357
+ },
358
+ [c, f]
359
+ ), D = m(() => {
360
+ !c || !r.localStorageAllowed || p((h) => [...h, c].slice(-t));
361
+ }, [c, r.localStorageAllowed, t, p]), w = m(
362
+ (h) => {
363
+ const S = l.find((L) => L.version === h);
364
+ S && f(S);
365
+ },
366
+ [l, f]
367
+ ), A = m(() => {
368
+ a.remove(n), f(null);
369
+ }, [a, n, f]), N = V(null);
370
+ return k(() => {
371
+ if (!o || !c?.content || c.content === N.current)
372
+ return;
373
+ const h = setTimeout(() => {
374
+ N.current = c.content ?? null;
375
+ }, o);
376
+ return () => clearTimeout(h);
377
+ }, [c?.content, o]), {
378
+ draft: c,
379
+ saveDraft: g,
380
+ saveToHistory: D,
381
+ restoreVersion: w,
382
+ clearDraft: A,
383
+ history: l,
384
+ hasDraft: c !== null,
385
+ degraded: !r.localStorageAllowed && !r.sessionStorageAllowed,
386
+ policy: r
387
+ };
388
+ }
389
+ function Ce(e = "local") {
390
+ const o = B(e), t = V([]);
391
+ return v(
392
+ () => ({
393
+ getItem: (r) => o.get(r),
394
+ setItem: (r, s) => {
395
+ o.set(r, s), t.current.includes(r) || t.current.push(r);
396
+ },
397
+ removeItem: (r) => {
398
+ o.remove(r), t.current = t.current.filter((s) => s !== r);
399
+ },
400
+ clear: () => {
401
+ o.clear(), t.current = [];
402
+ },
403
+ get length() {
404
+ return t.current.length;
405
+ },
406
+ key: (r) => t.current[r] ?? null
407
+ }),
408
+ [o]
409
+ );
410
+ }
411
+ function Ee(e) {
412
+ const { policy: o } = z();
413
+ return v(() => {
414
+ const t = o.cookiesAllowed && e.cookies !== !1, r = o.localStorageAllowed && e.localStorage !== !1, s = o.sessionStorageAllowed && e.sessionStorage !== !1;
415
+ return {
416
+ cookiesAllowed: t,
417
+ localStorageAllowed: r,
418
+ sessionStorageAllowed: s,
419
+ effectiveMode: o.effectiveMode,
420
+ canPersist: r || s,
421
+ degraded: !r && !s
422
+ };
423
+ }, [o, e.cookies, e.localStorage, e.sessionStorage]);
424
+ }
425
+ const R = ({
426
+ height: e = 200
427
+ }) => /* @__PURE__ */ i(
428
+ "div",
429
+ {
430
+ className: "ntd-lazy-loading",
431
+ style: {
432
+ display: "flex",
433
+ alignItems: "center",
434
+ justifyContent: "center",
435
+ height: e,
436
+ background: "var(--ntd-color-surface, #f5f5f5)",
437
+ borderRadius: "var(--ntd-radius, 8px)",
438
+ animation: "ntd-pulse 1.5s ease-in-out infinite"
439
+ },
440
+ children: /* @__PURE__ */ i(
441
+ "div",
442
+ {
443
+ className: "ntd-lazy-loading-spinner",
444
+ style: {
445
+ width: 24,
446
+ height: 24,
447
+ border: "2px solid var(--ntd-color-border, #ddd)",
448
+ borderTopColor: "var(--ntd-color-primary, #6366f1)",
449
+ borderRadius: "50%",
450
+ animation: "ntd-spin 0.8s linear infinite"
451
+ }
452
+ }
453
+ )
454
+ }
455
+ ), fe = (e, o) => /* @__PURE__ */ J(
456
+ "div",
457
+ {
458
+ className: "ntd-lazy-error",
459
+ style: {
460
+ display: "flex",
461
+ flexDirection: "column",
462
+ alignItems: "center",
463
+ justifyContent: "center",
464
+ padding: 24,
465
+ background: "var(--ntd-color-error-bg, #fee2e2)",
466
+ borderRadius: "var(--ntd-radius, 8px)",
467
+ color: "var(--ntd-color-error, #dc2626)"
468
+ },
469
+ children: [
470
+ /* @__PURE__ */ J(
471
+ "svg",
472
+ {
473
+ width: "32",
474
+ height: "32",
475
+ viewBox: "0 0 24 24",
476
+ fill: "none",
477
+ stroke: "currentColor",
478
+ strokeWidth: "2",
479
+ children: [
480
+ /* @__PURE__ */ i("circle", { cx: "12", cy: "12", r: "10" }),
481
+ /* @__PURE__ */ i("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
482
+ /* @__PURE__ */ i("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
483
+ ]
484
+ }
485
+ ),
486
+ /* @__PURE__ */ i("p", { style: { margin: "12px 0 8px", fontWeight: 500 }, children: "Failed to load component" }),
487
+ /* @__PURE__ */ i("p", { style: { margin: 0, fontSize: "0.875em", opacity: 0.8 }, children: e.message }),
488
+ /* @__PURE__ */ i(
489
+ "button",
490
+ {
491
+ onClick: o,
492
+ style: {
493
+ marginTop: 16,
494
+ padding: "8px 16px",
495
+ border: "none",
496
+ borderRadius: "var(--ntd-radius, 8px)",
497
+ background: "var(--ntd-color-error, #dc2626)",
498
+ color: "var(--nice-text-on-primary, #fff)",
499
+ cursor: "pointer",
500
+ fontSize: "0.875em"
501
+ },
502
+ children: "Retry"
503
+ }
504
+ )
505
+ ]
506
+ }
507
+ );
508
+ class me extends te.Component {
509
+ constructor() {
510
+ super(...arguments), this.state = { error: null }, this.handleRetry = () => {
511
+ this.setState({ error: null });
512
+ };
513
+ }
514
+ static getDerivedStateFromError(o) {
515
+ return { error: o };
516
+ }
517
+ render() {
518
+ return this.state.error ? this.props.fallback(this.state.error, this.handleRetry) : this.props.children;
519
+ }
520
+ }
521
+ function C(e, o = {}) {
522
+ const {
523
+ fallback: t = /* @__PURE__ */ i(R, {}),
524
+ preloadOnMount: r = !1,
525
+ preloadOnHover: s = !1,
526
+ preloadAfterIdle: n,
527
+ minLoadingTime: d = 0,
528
+ ssrFallback: a,
529
+ errorFallback: c = fe,
530
+ displayName: f
531
+ } = o;
532
+ let l = null, p = !1;
533
+ const g = async () => {
534
+ if (l)
535
+ return l;
536
+ const h = Date.now();
537
+ l = e();
538
+ const S = await l;
539
+ if (d > 0) {
540
+ const L = Date.now() - h;
541
+ L < d && await new Promise((b) => setTimeout(b, d - L));
542
+ }
543
+ return p = !0, S;
544
+ }, D = ie(g), w = (h) => {
545
+ const S = V(null);
546
+ return k(() => {
547
+ r && !p && g();
548
+ }, []), k(() => {
549
+ if (n && !p) {
550
+ const b = "requestIdleCallback" in window ? window.requestIdleCallback(() => g(), {
551
+ timeout: n
552
+ }) : setTimeout(() => g(), n);
553
+ return () => {
554
+ "cancelIdleCallback" in window ? window.cancelIdleCallback(b) : clearTimeout(b);
555
+ };
556
+ }
557
+ }, []), k(() => {
558
+ if (!s || p)
559
+ return;
560
+ const b = S.current;
561
+ if (!b)
562
+ return;
563
+ const G = () => {
564
+ p || g();
565
+ };
566
+ return b.addEventListener("mouseenter", G, { once: !0 }), () => b.removeEventListener("mouseenter", G);
567
+ }, []), typeof window > "u" && a ? /* @__PURE__ */ i(ue, { children: a }) : /* @__PURE__ */ i("div", { ref: S, className: "ntd-lazy-wrapper", children: /* @__PURE__ */ i(me, { fallback: c, children: /* @__PURE__ */ i(de, { fallback: t, children: /* @__PURE__ */ i(D, { ...h }) }) }) });
568
+ }, A = async () => {
569
+ p || await g();
570
+ }, N = w;
571
+ return N.preload = A, N.displayName = f || "LazyComponent", N;
572
+ }
573
+ function xe(e = 0.1, o = "100px") {
574
+ const t = V(null), [r, s] = T(!1);
575
+ return k(() => {
576
+ if (!t.current || r)
577
+ return;
578
+ const n = new IntersectionObserver(
579
+ ([d]) => {
580
+ d.isIntersecting && (s(!0), n.disconnect());
581
+ },
582
+ { threshold: e, rootMargin: o }
583
+ );
584
+ return n.observe(t.current), () => n.disconnect();
585
+ }, [e, o, r]), [t, r];
586
+ }
587
+ function Ne(e, o = 2e3) {
588
+ k(() => {
589
+ if ("requestIdleCallback" in window) {
590
+ const t = window.requestIdleCallback(
591
+ () => {
592
+ e.forEach((r) => r());
593
+ },
594
+ { timeout: o }
595
+ );
596
+ return () => window.cancelIdleCallback(t);
597
+ } else {
598
+ const t = setTimeout(() => {
599
+ e.forEach((r) => r());
600
+ }, o);
601
+ return () => clearTimeout(t);
602
+ }
603
+ }, []);
604
+ }
605
+ function Ie(e, o) {
606
+ const t = V(/* @__PURE__ */ new Set());
607
+ k(() => {
608
+ const r = document.querySelectorAll("a[href]"), s = (n) => {
609
+ const a = n.currentTarget.getAttribute("href");
610
+ a && e[a] && !t.current.has(a) && (e[a](), t.current.add(a));
611
+ };
612
+ return r.forEach((n) => {
613
+ n.addEventListener("mouseenter", s);
614
+ }), () => {
615
+ r.forEach((n) => {
616
+ n.removeEventListener("mouseenter", s);
617
+ });
618
+ };
619
+ }, [o, e]);
620
+ }
621
+ const Q = () => /* @__PURE__ */ i(R, { height: 400 }), X = () => /* @__PURE__ */ i(R, { height: 300 }), Z = () => /* @__PURE__ */ i(R, { height: 500 }), ee = () => /* @__PURE__ */ i(R, { height: 600 }), E = (e) => e, x = {
622
+ /**
623
+ * Lazy-loaded NiceCodeEditor (Monaco ~2MB)
624
+ *
625
+ * @example
626
+ * ```tsx
627
+ * import { LazyComponents } from '@nice2dev/ui';
628
+ *
629
+ * <LazyComponents.CodeEditor
630
+ * value={code}
631
+ * language="typescript"
632
+ * onChange={setCode}
633
+ * />
634
+ * ```
635
+ */
636
+ CodeEditor: C(
637
+ E(
638
+ () => import("./NiceCodeEditor-CduGYggj.js").then((e) => ({ default: e.NiceCodeEditor }))
639
+ ),
640
+ {
641
+ fallback: /* @__PURE__ */ i(Q, {}),
642
+ preloadOnHover: !0,
643
+ displayName: "LazyCodeEditor"
644
+ }
645
+ ),
646
+ /**
647
+ * Lazy-loaded NiceHtmlEditor
648
+ */
649
+ HtmlEditor: C(
650
+ E(
651
+ () => import("./NiceHtmlEditor-CGRgcu2h.js").then((e) => ({ default: e.NiceHtmlEditor }))
652
+ ),
653
+ {
654
+ fallback: /* @__PURE__ */ i(Q, {}),
655
+ preloadOnHover: !0,
656
+ displayName: "LazyHtmlEditor"
657
+ }
658
+ ),
659
+ /**
660
+ * Lazy-loaded NiceDocumentViewer
661
+ */
662
+ DocumentViewer: C(
663
+ E(
664
+ () => import("./NiceDocumentViewer-sukmGhRx.js").then((e) => ({ default: e.NiceDocumentViewer }))
665
+ ),
666
+ {
667
+ fallback: /* @__PURE__ */ i(R, { height: 600 }),
668
+ displayName: "LazyDocumentViewer"
669
+ }
670
+ ),
671
+ /**
672
+ * Lazy-loaded NiceChart
673
+ */
674
+ Chart: C(
675
+ E(() => import("./charts-XVlDwU0y.js").then((e) => e.A).then((e) => ({ default: e.NiceChart }))),
676
+ {
677
+ fallback: /* @__PURE__ */ i(X, {}),
678
+ preloadAfterIdle: 3e3,
679
+ displayName: "LazyChart"
680
+ }
681
+ ),
682
+ /**
683
+ * Lazy-loaded NiceVectorMap
684
+ */
685
+ VectorMap: C(
686
+ E(
687
+ () => import("./charts-XVlDwU0y.js").then((e) => e.E).then((e) => ({ default: e.NiceVectorMap }))
688
+ ),
689
+ {
690
+ fallback: /* @__PURE__ */ i(R, { height: 400 }),
691
+ displayName: "LazyVectorMap"
692
+ }
693
+ ),
694
+ /**
695
+ * Lazy-loaded NiceSankey
696
+ */
697
+ Sankey: C(
698
+ E(
699
+ () => import("./charts-XVlDwU0y.js").then((e) => e.B).then((e) => ({ default: e.NiceSankey }))
700
+ ),
701
+ {
702
+ fallback: /* @__PURE__ */ i(X, {}),
703
+ displayName: "LazySankey"
704
+ }
705
+ ),
706
+ /**
707
+ * Lazy-loaded NiceScheduler
708
+ */
709
+ Scheduler: C(
710
+ E(
711
+ () => import("./NiceScheduler-KSzaUQxC.js").then((e) => e.b).then((e) => ({ default: e.NiceScheduler }))
712
+ ),
713
+ {
714
+ fallback: /* @__PURE__ */ i(ee, {}),
715
+ displayName: "LazyScheduler"
716
+ }
717
+ ),
718
+ /**
719
+ * Lazy-loaded NiceGantt
720
+ */
721
+ Gantt: C(
722
+ E(
723
+ () => import("./NiceGantt-B_1lwEsp.js").then((e) => ({ default: e.NiceGantt }))
724
+ ),
725
+ {
726
+ fallback: /* @__PURE__ */ i(ee, {}),
727
+ displayName: "LazyGantt"
728
+ }
729
+ ),
730
+ /**
731
+ * Lazy-loaded NicePivotGrid
732
+ */
733
+ PivotGrid: C(
734
+ E(
735
+ () => import("./NicePivotGrid-B2YHP3Z6.js").then((e) => e.o).then((e) => ({ default: e.NicePivotGrid }))
736
+ ),
737
+ {
738
+ fallback: /* @__PURE__ */ i(Z, {}),
739
+ displayName: "LazyPivotGrid"
740
+ }
741
+ ),
742
+ /**
743
+ * Lazy-loaded NiceDataGrid (for very heavy usage)
744
+ */
745
+ DataGrid: C(
746
+ E(
747
+ () => import("./NiceDataGrid-D-rm4lu8.js").then((e) => e.h).then((e) => ({ default: e.NiceDataGrid }))
748
+ ),
749
+ {
750
+ fallback: /* @__PURE__ */ i(Z, {}),
751
+ preloadAfterIdle: 2e3,
752
+ displayName: "LazyDataGrid"
753
+ }
754
+ )
755
+ };
756
+ async function Te() {
757
+ await Promise.all([
758
+ x.CodeEditor.preload(),
759
+ x.HtmlEditor.preload(),
760
+ x.DocumentViewer.preload(),
761
+ x.Chart.preload(),
762
+ x.VectorMap.preload(),
763
+ x.Sankey.preload(),
764
+ x.Scheduler.preload(),
765
+ x.Gantt.preload(),
766
+ x.PivotGrid.preload()
767
+ ]);
768
+ }
769
+ async function ze(e) {
770
+ await Promise.all(e.map((o) => x[o].preload()));
771
+ }
772
+ export {
773
+ fe as D,
774
+ x as L,
775
+ Se as T,
776
+ we as a,
777
+ z as b,
778
+ ve as c,
779
+ R as d,
780
+ C as e,
781
+ ze as f,
782
+ Le as g,
783
+ Ae as h,
784
+ xe as i,
785
+ Y as j,
786
+ Ne as k,
787
+ Ie as l,
788
+ Ee as m,
789
+ be as n,
790
+ ye as o,
791
+ Te as p,
792
+ ke as q,
793
+ Ce as r,
794
+ B as u
795
+ };