@nice2dev/ui 1.1.10 → 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 (114) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/README.md +12 -20
  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/NiceColorPicker-DCgmE-3H.cjs +1 -0
  8. package/dist/NiceColorPicker-DK30kJgy.js +486 -0
  9. package/dist/NiceColorPicker-DtPFxDKM.cjs +1 -0
  10. package/dist/NiceColorPicker-bNJBAU_c.js +598 -0
  11. package/dist/NiceDataGrid-BOCJr6XF.js +2217 -0
  12. package/dist/NiceDataGrid-BV5Oh-gy.cjs +10 -0
  13. package/dist/NiceDataGrid-Dd7SI-M6.cjs +10 -0
  14. package/dist/NiceDataGrid-DjZchXYG.js +2217 -0
  15. package/dist/NiceForm-BCEXovJR.cjs +1 -0
  16. package/dist/NiceForm-D7oyWHXg.js +4820 -0
  17. package/dist/NiceForm-DUhxXArr.js +4817 -0
  18. package/dist/NiceForm-uCeVmTrD.cjs +1 -0
  19. package/dist/NiceHtmlEditor-BYk1roA4.cjs +10 -0
  20. package/dist/NiceHtmlEditor-C5kLeF9H.cjs +10 -0
  21. package/dist/NiceHtmlEditor-CFVMIC5L.js +848 -0
  22. package/dist/NiceHtmlEditor-mWebBmy1.js +849 -0
  23. package/dist/NiceLoginForm-BHyDY7br.cjs +1 -0
  24. package/dist/NiceLoginForm-BuxFY2Rk.js +750 -0
  25. package/dist/NiceLoginForm.css +1 -0
  26. package/dist/NiceMention-CA7CL5BI.js +11263 -0
  27. package/dist/NiceMention-CHcKRl-L.cjs +430 -0
  28. package/dist/NiceMention-DJD0BLcp.js +11269 -0
  29. package/dist/NiceMention-DcaUEMSg.cjs +430 -0
  30. package/dist/NiceMention.css +1 -1
  31. package/dist/NiceModal-C4p8a82e.cjs +1 -0
  32. package/dist/NiceModal-TNlkaL_i.js +85 -0
  33. package/dist/NiceModuleLifecyclePanel-BWbKdVC_.js +7054 -0
  34. package/dist/NiceModuleLifecyclePanel-CZHIzvkE.cjs +1 -0
  35. package/dist/NiceModuleLifecyclePanel-OC9YK2kG.js +7052 -0
  36. package/dist/NiceModuleLifecyclePanel-_OcfDmtC.cjs +1 -0
  37. package/dist/NicePagination-8XsBbMNx.js +165 -0
  38. package/dist/NicePagination-CkOoXf0f.js +165 -0
  39. package/dist/NicePagination-D7lek1G7.cjs +1 -0
  40. package/dist/NicePagination-OjTEfZJE.cjs +1 -0
  41. package/dist/NicePivotGrid-BJRSciWl.js +1183 -0
  42. package/dist/NicePivotGrid-CS1dPmNI.cjs +152 -0
  43. package/dist/NicePivotGrid-D2AxqDzJ.js +1183 -0
  44. package/dist/NicePivotGrid-DxQ6Py9D.cjs +152 -0
  45. package/dist/NiceSavedQueryPanel-B5HhqlAI.cjs +586 -0
  46. package/dist/NiceSavedQueryPanel-CMStDOKe.js +5125 -0
  47. package/dist/NiceSavedQueryPanel-D2i34e_b.cjs +586 -0
  48. package/dist/NiceSavedQueryPanel-mPO2THs7.js +5142 -0
  49. package/dist/NiceSavedQueryPanel.css +1 -1
  50. package/dist/NiceScheduler-7gP7vcLy.cjs +5 -0
  51. package/dist/NiceScheduler-Cy7F9tgH.js +1693 -0
  52. package/dist/NiceScheduler-DquRUZxD.cjs +5 -0
  53. package/dist/NiceScheduler-l8N4yCWd.js +1716 -0
  54. package/dist/NiceSelect-DZB1Rs9x.js +435 -0
  55. package/dist/NiceSelect-tMz9QQUs.cjs +1 -0
  56. package/dist/NiceStreamDashboard.doc-74KUXya1.cjs +8 -0
  57. package/dist/NiceStreamDashboard.doc-k8PQfCM0.js +32 -0
  58. package/dist/NiceWindow-BEov3s9F.js +2094 -0
  59. package/dist/NiceWindow-CDt6PCEg.cjs +1 -0
  60. package/dist/NiceWindow.css +1 -1
  61. package/dist/charts-C047IMVn.cjs +768 -0
  62. package/dist/charts-CCXSb3xk.js +4752 -0
  63. package/dist/charts-CqETcUhH.js +4752 -0
  64. package/dist/charts-DouiiHOT.cjs +768 -0
  65. package/dist/charts.cjs +1 -1
  66. package/dist/charts.mjs +1 -1
  67. package/dist/core-BL-KmGYC.js +795 -0
  68. package/dist/core-Chg-oYCr.cjs +1 -0
  69. package/dist/core-CxBnKAhs.cjs +1 -0
  70. package/dist/core-D_LRh59n.js +795 -0
  71. package/dist/data-branching-Km4lc8P_.cjs +1 -0
  72. package/dist/data-branching-YQtJJEtn.js +6273 -0
  73. package/dist/data-branching.cjs +1 -1
  74. package/dist/data-branching.mjs +1 -1
  75. package/dist/data.cjs +1 -1
  76. package/dist/data.d.ts +0 -51
  77. package/dist/data.mjs +3 -3
  78. package/dist/devops-D5yIDM3e.js +8312 -0
  79. package/dist/devops-rVpB0ZAX.cjs +17 -0
  80. package/dist/devops.cjs +1 -1
  81. package/dist/devops.mjs +1 -1
  82. package/dist/editors.cjs +1 -1
  83. package/dist/editors.d.ts +6 -25
  84. package/dist/editors.mjs +55 -54
  85. package/dist/feedback.cjs +1 -1
  86. package/dist/feedback.d.ts +5 -0
  87. package/dist/feedback.mjs +2 -2
  88. package/dist/index.cjs +284 -284
  89. package/dist/index.css +1 -1
  90. package/dist/index.d.ts +194 -208
  91. package/dist/index.mjs +20312 -19511
  92. package/dist/lazy.cjs +1 -1
  93. package/dist/lazy.mjs +29 -29
  94. package/dist/navigation.cjs +1 -1
  95. package/dist/navigation.mjs +3 -3
  96. package/dist/no-code-6WyYb3hL.cjs +331 -0
  97. package/dist/no-code-BH5oVFC6.js +8186 -0
  98. package/dist/no-code-CnHG5_Vn.js +8186 -0
  99. package/dist/no-code-DMKlg1Zl.cjs +331 -0
  100. package/dist/no-code.cjs +1 -1
  101. package/dist/no-code.css +1 -1
  102. package/dist/no-code.d.ts +25 -18
  103. package/dist/no-code.mjs +3 -3
  104. package/dist/overlays.cjs +1 -1
  105. package/dist/overlays.d.ts +24 -24
  106. package/dist/overlays.mjs +24 -490
  107. package/dist/pickerCommons-0vyK1Knv.js +547 -0
  108. package/dist/pickerCommons-BFbItm8o.cjs +1 -0
  109. package/dist/pickerCommons-BHirHJyn.js +548 -0
  110. package/dist/pickerCommons-Bt8JIaTN.cjs +1 -0
  111. package/dist/pickerCommons.css +1 -1
  112. package/dist/style.css +10 -7
  113. package/package.json +4 -6
  114. package/css/legacy-bg-text-aliases.css +0 -87
@@ -0,0 +1,2094 @@
1
+ import { jsxs as M, Fragment as _e, jsx as t } from "react/jsx-runtime";
2
+ import { useNiceTranslation as Pe, useComponentDisplayClass as xt, useFocusTrap as je, triggerHaptic as Be, useClickOutside as et, usePan as Nt, NiceThemeContext as kt, useControlId as Ge, NiceIcon as fe, sanitizeHtml as Et, useNiceAccessMode as Mt } from "@nice2dev/ui-core";
3
+ import zt, { useRef as K, useState as D, useCallback as k, useEffect as B, useContext as Ve, useReducer as Ct, useMemo as Oe, createContext as tt, forwardRef as Qe } from "react";
4
+ import { createPortal as Ee } from "react-dom";
5
+ const Zt = ({
6
+ visible: e,
7
+ onClose: n,
8
+ title: r,
9
+ items: o,
10
+ showCancelButton: d = !0,
11
+ cancelText: a,
12
+ size: u = "md",
13
+ disabled: w,
14
+ readOnly: m,
15
+ loading: N,
16
+ error: C,
17
+ className: T,
18
+ style: $
19
+ }) => {
20
+ const { t: l } = Pe();
21
+ if (!e)
22
+ return null;
23
+ const f = w || N || m;
24
+ return /* @__PURE__ */ M(_e, { children: [
25
+ /* @__PURE__ */ t("div", { className: "nice-actionsheet__overlay", onClick: n }),
26
+ /* @__PURE__ */ M(
27
+ "div",
28
+ {
29
+ className: `nice-actionsheet nice-actionsheet--${u} ${w ? "nice-actionsheet--disabled" : ""} ${m ? "nice-actionsheet--readonly" : ""} ${N ? "nice-actionsheet--loading" : ""} ${C ? "nice-actionsheet--error" : ""} ${T || ""}`,
30
+ style: $,
31
+ "aria-disabled": w || void 0,
32
+ "aria-readonly": m || void 0,
33
+ "aria-busy": N || void 0,
34
+ children: [
35
+ C && /* @__PURE__ */ t("div", { className: "nice-actionsheet__error", role: "alert", children: C }),
36
+ N && /* @__PURE__ */ t("span", { className: "nice-actionsheet__spinner", "aria-hidden": "true", children: /* @__PURE__ */ t("span", { className: "nice-spinner nice-spinner--sm" }) }),
37
+ r && /* @__PURE__ */ t("div", { className: "nice-actionsheet__title", children: r }),
38
+ /* @__PURE__ */ t("div", { className: "nice-actionsheet__items", children: o.map((g, h) => /* @__PURE__ */ M(
39
+ "button",
40
+ {
41
+ className: `nice-actionsheet__item ${g.type === "danger" ? "nice-actionsheet__item--danger" : ""}`,
42
+ disabled: g.disabled || f,
43
+ onClick: () => {
44
+ f || (g.onClick?.(), n());
45
+ },
46
+ children: [
47
+ g.icon && /* @__PURE__ */ t("span", { className: "nice-actionsheet__icon", children: g.icon }),
48
+ g.text
49
+ ]
50
+ },
51
+ h
52
+ )) }),
53
+ d && /* @__PURE__ */ t("button", { className: "nice-actionsheet__cancel", onClick: n, children: a || l("cancel", "Cancel") })
54
+ ]
55
+ }
56
+ )
57
+ ] });
58
+ }, Jt = ({
59
+ visible: e,
60
+ onClose: n,
61
+ targetRef: r,
62
+ position: o = "bottom",
63
+ title: d,
64
+ showArrow: a = !0,
65
+ width: u,
66
+ children: w,
67
+ className: m,
68
+ style: N,
69
+ displayStyle: C
70
+ }) => {
71
+ xt("tooltip", C);
72
+ const T = K(null), [$, l] = D({ top: 0, left: 0 }), f = k(() => {
73
+ const g = r.current, h = T.current;
74
+ if (!g || !h)
75
+ return;
76
+ const c = g.getBoundingClientRect(), b = h.getBoundingClientRect();
77
+ let s = 0, L = 0;
78
+ const z = 8;
79
+ switch (o) {
80
+ case "top":
81
+ s = c.top - b.height - z, L = c.left + (c.width - b.width) / 2;
82
+ break;
83
+ case "bottom":
84
+ s = c.bottom + z, L = c.left + (c.width - b.width) / 2;
85
+ break;
86
+ case "left":
87
+ s = c.top + (c.height - b.height) / 2, L = c.left - b.width - z;
88
+ break;
89
+ case "right":
90
+ s = c.top + (c.height - b.height) / 2, L = c.right + z;
91
+ break;
92
+ }
93
+ l({ top: s + window.scrollY, left: L + window.scrollX });
94
+ }, [r, o]);
95
+ return B(() => {
96
+ if (e) {
97
+ requestAnimationFrame(f);
98
+ const g = (h) => {
99
+ T.current && !T.current.contains(h.target) && r.current && !r.current.contains(h.target) && n();
100
+ };
101
+ return document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
102
+ }
103
+ }, [e, f, n, r]), e ? /* @__PURE__ */ M(
104
+ "div",
105
+ {
106
+ ref: T,
107
+ className: `nice-popover nice-popover--${o} ${m || ""}`,
108
+ style: { ...N, position: "absolute", top: $.top, left: $.left, width: u },
109
+ children: [
110
+ a && /* @__PURE__ */ t("div", { className: `nice-popover__arrow nice-popover__arrow--${o}` }),
111
+ d && /* @__PURE__ */ t("div", { className: "nice-popover__title", children: d }),
112
+ /* @__PURE__ */ t("div", { className: "nice-popover__content", children: w })
113
+ ]
114
+ }
115
+ ) : null;
116
+ }, en = ({
117
+ visible: e,
118
+ message: n,
119
+ container: r,
120
+ showIndicator: o = !0,
121
+ shading: d = !0,
122
+ className: a,
123
+ style: u
124
+ }) => {
125
+ const { t: w } = Pe();
126
+ if (!e)
127
+ return null;
128
+ const m = !!r?.current, N = /* @__PURE__ */ M("div", { className: `nice-loadpanel ${a || ""}`, style: u, children: [
129
+ d && /* @__PURE__ */ t("div", { className: "nice-loadpanel__shade" }),
130
+ /* @__PURE__ */ M("div", { className: "nice-loadpanel__box", children: [
131
+ o && /* @__PURE__ */ t("div", { className: "nice-spinner nice-spinner--md" }),
132
+ /* @__PURE__ */ t("span", { className: "nice-loadpanel__text", children: n || w("loading", "Loading...") })
133
+ ] })
134
+ ] });
135
+ if (m && r.current) {
136
+ const C = r.current;
137
+ return C.style.position = C.style.position || "relative", N;
138
+ }
139
+ return N;
140
+ }, tn = ({
141
+ direction: e = "row",
142
+ align: n,
143
+ justify: r,
144
+ wrap: o,
145
+ gap: d,
146
+ flex: a,
147
+ children: u,
148
+ className: w,
149
+ style: m
150
+ }) => /* @__PURE__ */ t(
151
+ "div",
152
+ {
153
+ className: `nice-box ${w || ""}`,
154
+ style: {
155
+ display: "flex",
156
+ flexDirection: e,
157
+ alignItems: n,
158
+ justifyContent: r,
159
+ flexWrap: o ? "wrap" : void 0,
160
+ gap: d,
161
+ flex: a,
162
+ ...m
163
+ },
164
+ children: u
165
+ }
166
+ ), nn = ({
167
+ direction: e = "row",
168
+ items: n,
169
+ gap: r,
170
+ className: o,
171
+ style: d
172
+ }) => /* @__PURE__ */ t(
173
+ "div",
174
+ {
175
+ className: `nice-responsivebox ${o || ""}`,
176
+ style: { display: "flex", flexDirection: e, gap: r, ...d },
177
+ children: n.map((a, u) => /* @__PURE__ */ t(
178
+ "div",
179
+ {
180
+ style: { flex: a.ratio ?? 1, flexBasis: a.baseSize, flexShrink: a.shrink ?? 1 },
181
+ children: a.children
182
+ },
183
+ u
184
+ ))
185
+ }
186
+ ), on = ({
187
+ width: e = 200,
188
+ height: n = 200,
189
+ minWidth: r = 50,
190
+ minHeight: o = 50,
191
+ maxWidth: d = 1 / 0,
192
+ maxHeight: a = 1 / 0,
193
+ handles: u = ["right", "bottom", "bottomRight"],
194
+ onResize: w,
195
+ children: m,
196
+ className: N,
197
+ style: C
198
+ }) => {
199
+ const [T, $] = D({ width: e, height: n }), l = K(null), f = (c, b) => {
200
+ b.preventDefault();
201
+ const s = b.clientX, L = b.clientY, z = T.width, O = T.height, x = {
202
+ n: "top",
203
+ s: "bottom",
204
+ e: "right",
205
+ w: "left",
206
+ ne: "topRight",
207
+ se: "bottomRight",
208
+ sw: "bottomLeft",
209
+ nw: "topLeft"
210
+ }[c] ?? c, i = x === "right" || x === "topRight" || x === "bottomRight", y = x === "left" || x === "topLeft" || x === "bottomLeft", E = x === "bottom" || x === "bottomRight" || x === "bottomLeft", I = x === "top" || x === "topRight" || x === "topLeft", S = (Y) => {
211
+ const p = Y.clientX - s, v = Y.clientY - L;
212
+ let _ = z, q = O;
213
+ i && (_ = z + p), y && (_ = z - p), E && (q = O + v), I && (q = O - v), _ = Math.max(r, Math.min(d, _)), q = Math.max(o, Math.min(a, q)), $({ width: _, height: q }), w?.({ width: _, height: q });
214
+ }, P = () => {
215
+ document.removeEventListener("pointermove", S), document.removeEventListener("pointerup", P);
216
+ };
217
+ document.addEventListener("pointermove", S), document.addEventListener("pointerup", P);
218
+ }, g = (c) => {
219
+ switch (c) {
220
+ case "top":
221
+ case "bottom":
222
+ return "ns-resize";
223
+ case "left":
224
+ case "right":
225
+ return "ew-resize";
226
+ case "topLeft":
227
+ case "bottomRight":
228
+ return "nwse-resize";
229
+ case "topRight":
230
+ case "bottomLeft":
231
+ return "nesw-resize";
232
+ default:
233
+ return "default";
234
+ }
235
+ }, h = (c) => {
236
+ const b = { position: "absolute", zIndex: 1 }, s = 8;
237
+ return c === "right" ? {
238
+ ...b,
239
+ top: 0,
240
+ right: -s / 2,
241
+ width: s,
242
+ height: "100%",
243
+ cursor: g(c)
244
+ } : c === "bottom" ? {
245
+ ...b,
246
+ left: 0,
247
+ bottom: -s / 2,
248
+ width: "100%",
249
+ height: s,
250
+ cursor: g(c)
251
+ } : c === "left" ? { ...b, top: 0, left: -s / 2, width: s, height: "100%", cursor: g(c) } : c === "top" ? { ...b, top: -s / 2, left: 0, width: "100%", height: s, cursor: g(c) } : c === "bottomRight" ? {
252
+ ...b,
253
+ bottom: -s / 2,
254
+ right: -s / 2,
255
+ width: s * 2,
256
+ height: s * 2,
257
+ cursor: g(c)
258
+ } : c === "bottomLeft" ? {
259
+ ...b,
260
+ bottom: -s / 2,
261
+ left: -s / 2,
262
+ width: s * 2,
263
+ height: s * 2,
264
+ cursor: g(c)
265
+ } : c === "topRight" ? {
266
+ ...b,
267
+ top: -s / 2,
268
+ right: -s / 2,
269
+ width: s * 2,
270
+ height: s * 2,
271
+ cursor: g(c)
272
+ } : c === "topLeft" ? {
273
+ ...b,
274
+ top: -s / 2,
275
+ left: -s / 2,
276
+ width: s * 2,
277
+ height: s * 2,
278
+ cursor: g(c)
279
+ } : b;
280
+ };
281
+ return /* @__PURE__ */ M(
282
+ "div",
283
+ {
284
+ ref: l,
285
+ className: `nice-resizable ${N || ""}`,
286
+ style: {
287
+ ...C,
288
+ width: T.width,
289
+ height: T.height,
290
+ position: "relative",
291
+ overflow: "hidden"
292
+ },
293
+ children: [
294
+ m,
295
+ u.map((c) => /* @__PURE__ */ t("div", { style: h(c), onPointerDown: (b) => f(c, b) }, c))
296
+ ]
297
+ }
298
+ );
299
+ }, rn = ({
300
+ direction: e = "vertical",
301
+ showScrollbar: n = "onInteraction",
302
+ width: r,
303
+ height: o,
304
+ onScroll: d,
305
+ children: a,
306
+ className: u,
307
+ style: w
308
+ }) => {
309
+ const m = e === "horizontal" || e === "both" ? "auto" : "hidden", N = e === "vertical" || e === "both" ? "auto" : "hidden";
310
+ return /* @__PURE__ */ t(
311
+ "div",
312
+ {
313
+ className: `nice-scrollview ${n === "never" ? "nice-scrollview--hide-sb" : n === "always" ? "nice-scrollview--show-sb" : ""} ${u || ""}`,
314
+ style: { ...w, width: r, height: o, overflowX: m, overflowY: N },
315
+ onScroll: d,
316
+ children: a
317
+ }
318
+ );
319
+ };
320
+ function Me() {
321
+ const e = Ve(kt);
322
+ return e?.portalTarget ? e.portalTarget : typeof document < "u" ? document.body : null;
323
+ }
324
+ const cn = ({
325
+ open: e,
326
+ onClose: n,
327
+ children: r,
328
+ title: o,
329
+ size: d = "md",
330
+ closeOnBackdropClick: a = !0,
331
+ closeOnEscape: u = !0,
332
+ disableFocusTrap: w = !1,
333
+ disableBodyScroll: m = !0,
334
+ zIndex: N = 1e3,
335
+ className: C,
336
+ style: T
337
+ }) => {
338
+ const $ = K(null);
339
+ je($, e && !w);
340
+ const l = Me();
341
+ B(() => {
342
+ if (!m && e) {
343
+ const h = document.body.style.overflow;
344
+ return document.body.style.overflow = "hidden", () => {
345
+ document.body.style.overflow = h;
346
+ };
347
+ }
348
+ }, [e, m]), B(() => {
349
+ if (!u || !e)
350
+ return;
351
+ const h = (c) => {
352
+ c.key === "Escape" && (c.preventDefault(), n());
353
+ };
354
+ return document.addEventListener("keydown", h), () => document.removeEventListener("keydown", h);
355
+ }, [u, e, n]);
356
+ const f = k(
357
+ (h) => {
358
+ a && h.target === h.currentTarget && n();
359
+ },
360
+ [a, n]
361
+ );
362
+ if (!e)
363
+ return null;
364
+ const g = {
365
+ sm: "nice-modal--sm",
366
+ md: "nice-modal--md",
367
+ lg: "nice-modal--lg",
368
+ xl: "nice-modal--xl",
369
+ full: "nice-modal--full"
370
+ }[d];
371
+ return Ee(
372
+ /* @__PURE__ */ t(
373
+ "div",
374
+ {
375
+ className: "nice-modal__overlay",
376
+ style: { zIndex: N },
377
+ onClick: f,
378
+ role: "presentation",
379
+ children: /* @__PURE__ */ t(
380
+ "div",
381
+ {
382
+ ref: $,
383
+ className: `nice-modal ${g} ${C || ""}`,
384
+ role: "dialog",
385
+ "aria-modal": "true",
386
+ "aria-label": o,
387
+ style: T,
388
+ tabIndex: -1,
389
+ children: r
390
+ }
391
+ )
392
+ }
393
+ ),
394
+ l
395
+ );
396
+ }, sn = ({
397
+ children: e,
398
+ showClose: n = !0,
399
+ onClose: r,
400
+ className: o
401
+ }) => /* @__PURE__ */ M("div", { className: `nice-modal__header ${o || ""}`, children: [
402
+ /* @__PURE__ */ t("div", { className: "nice-modal__title", children: e }),
403
+ n && r && /* @__PURE__ */ t("button", { type: "button", className: "nice-modal__close", onClick: r, "aria-label": "Close", children: /* @__PURE__ */ t(
404
+ "svg",
405
+ {
406
+ width: "20",
407
+ height: "20",
408
+ viewBox: "0 0 20 20",
409
+ fill: "none",
410
+ stroke: "currentColor",
411
+ strokeWidth: "2",
412
+ children: /* @__PURE__ */ t("path", { d: "M4 4l12 12M4 16L16 4" })
413
+ }
414
+ ) })
415
+ ] }), ln = ({ children: e, className: n }) => /* @__PURE__ */ t("div", { className: `nice-modal__body ${n || ""}`, children: e }), an = ({ children: e, className: n }) => /* @__PURE__ */ t("div", { className: `nice-modal__footer ${n || ""}`, children: e }), dn = ({
416
+ open: e,
417
+ onClose: n,
418
+ children: r,
419
+ position: o = "right",
420
+ size: d = 320,
421
+ title: a,
422
+ closeOnBackdropClick: u = !0,
423
+ closeOnEscape: w = !0,
424
+ swipeToClose: m = !0,
425
+ zIndex: N = 1e3,
426
+ className: C,
427
+ style: T
428
+ }) => {
429
+ const $ = K(null), [l, f] = D(!1), [g, h] = D(0);
430
+ je($, e);
431
+ const c = Me();
432
+ B(() => {
433
+ if (!w || !e)
434
+ return;
435
+ const i = (y) => {
436
+ y.key === "Escape" && (y.preventDefault(), n());
437
+ };
438
+ return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
439
+ }, [w, e, n]);
440
+ const b = k(
441
+ (i) => {
442
+ let y = 0;
443
+ switch (o) {
444
+ case "left":
445
+ y = Math.min(0, i.deltaX);
446
+ break;
447
+ case "right":
448
+ y = Math.max(0, i.deltaX);
449
+ break;
450
+ case "top":
451
+ y = Math.min(0, i.deltaY);
452
+ break;
453
+ case "bottom":
454
+ y = Math.max(0, i.deltaY);
455
+ break;
456
+ }
457
+ h(y);
458
+ },
459
+ [o]
460
+ ), s = k(
461
+ (i) => {
462
+ let E = !1;
463
+ switch (o) {
464
+ case "left":
465
+ E = i.deltaX < -100;
466
+ break;
467
+ case "right":
468
+ E = i.deltaX > 100;
469
+ break;
470
+ case "top":
471
+ E = i.deltaY < -100;
472
+ break;
473
+ case "bottom":
474
+ E = i.deltaY > 100;
475
+ break;
476
+ }
477
+ E && (Be("light"), n()), h(0), f(!1);
478
+ },
479
+ [o, n]
480
+ ), { ref: L } = Nt({
481
+ enabled: m && e,
482
+ onPanStart: () => f(!0),
483
+ onPan: b,
484
+ onPanEnd: s
485
+ }), z = k(
486
+ (i) => {
487
+ u && i.target === i.currentTarget && n();
488
+ },
489
+ [u, n]
490
+ );
491
+ if (!e)
492
+ return null;
493
+ const O = o === "left" || o === "right", H = O ? { width: typeof d == "number" ? `${d}px` : d } : { height: typeof d == "number" ? `${d}px` : d }, x = () => {
494
+ if (l)
495
+ return O ? `translateX(${g}px)` : `translateY(${g}px)`;
496
+ };
497
+ return Ee(
498
+ /* @__PURE__ */ M(_e, { children: [
499
+ /* @__PURE__ */ t(
500
+ "div",
501
+ {
502
+ className: `nice-drawer__overlay ${e ? "nice-drawer__overlay--visible" : ""}`,
503
+ style: { zIndex: N },
504
+ onClick: z
505
+ }
506
+ ),
507
+ /* @__PURE__ */ t(
508
+ "div",
509
+ {
510
+ ref: (i) => {
511
+ $.current = i, L.current = i;
512
+ },
513
+ className: `nice-drawer nice-drawer--${o} ${e ? "nice-drawer--open" : ""} ${C || ""}`,
514
+ style: {
515
+ ...H,
516
+ zIndex: N + 1,
517
+ transform: x(),
518
+ transition: l ? "none" : void 0,
519
+ ...T
520
+ },
521
+ role: "dialog",
522
+ "aria-modal": "true",
523
+ "aria-label": a,
524
+ tabIndex: -1,
525
+ children: r
526
+ }
527
+ )
528
+ ] }),
529
+ c
530
+ );
531
+ }, un = ({
532
+ open: e,
533
+ onClose: n,
534
+ children: r,
535
+ title: o,
536
+ showHandle: d = !0,
537
+ snapPoints: a = [0.5, 0.9],
538
+ initialSnap: u = 0,
539
+ expandable: w = !0,
540
+ closeOnBackdropClick: m = !0,
541
+ closeOnEscape: N = !0,
542
+ hapticFeedback: C = !0,
543
+ zIndex: T = 1e3,
544
+ className: $,
545
+ style: l
546
+ }) => {
547
+ const f = K(null), g = K(null), [h, c] = D(u), [b, s] = D(!1), [L, z] = D(0), O = K(0);
548
+ B(() => {
549
+ e && (c(u), z(0));
550
+ }, [e, u]), je(f, e);
551
+ const H = Me();
552
+ B(() => {
553
+ if (!N || !e)
554
+ return;
555
+ const P = (Y) => {
556
+ Y.key === "Escape" && (Y.preventDefault(), n());
557
+ };
558
+ return document.addEventListener("keydown", P), () => document.removeEventListener("keydown", P);
559
+ }, [N, e, n]), B(() => {
560
+ if (e) {
561
+ const P = document.body.style.overflow;
562
+ return document.body.style.overflow = "hidden", () => {
563
+ document.body.style.overflow = P;
564
+ };
565
+ }
566
+ }, [e]);
567
+ const x = k((P) => {
568
+ const Y = P.target.closest(".nice-bottom-sheet__handle"), p = g.current, v = !p || p.scrollTop <= 0;
569
+ !Y && !v || (s(!0), O.current = P.touches[0].clientY);
570
+ }, []), i = k(
571
+ (P) => {
572
+ if (!b)
573
+ return;
574
+ const Y = P.touches[0].clientY - O.current;
575
+ (Y > 0 || h < a.length - 1) && z(Y);
576
+ },
577
+ [b, h, a.length]
578
+ ), y = k(() => {
579
+ if (!b)
580
+ return;
581
+ const P = window.innerHeight;
582
+ a[h] * P;
583
+ const Y = -L, p = P * 0.15;
584
+ Y > p && w && h < a.length - 1 ? (c(h + 1), C && Be("selection")) : Y < -p && (h > 0 ? (c(h - 1), C && Be("selection")) : (C && Be("light"), n())), s(!1), z(0);
585
+ }, [b, L, h, a, w, C, n]), E = k(() => {
586
+ m && n();
587
+ }, [m, n]);
588
+ if (!e)
589
+ return null;
590
+ const I = a[h] * 100, S = b ? L : 0;
591
+ return Ee(
592
+ /* @__PURE__ */ M(_e, { children: [
593
+ /* @__PURE__ */ t(
594
+ "div",
595
+ {
596
+ className: `nice-bottom-sheet__overlay ${e ? "nice-bottom-sheet__overlay--visible" : ""}`,
597
+ style: { zIndex: T },
598
+ onClick: E
599
+ }
600
+ ),
601
+ /* @__PURE__ */ M(
602
+ "div",
603
+ {
604
+ ref: f,
605
+ className: `nice-bottom-sheet ${e ? "nice-bottom-sheet--open" : ""} ${$ || ""}`,
606
+ style: {
607
+ zIndex: T + 1,
608
+ height: `${I}vh`,
609
+ transform: `translateY(${Math.max(0, S)}px)`,
610
+ transition: b ? "none" : "transform 0.3s ease-out, height 0.3s ease-out",
611
+ ...l
612
+ },
613
+ role: "dialog",
614
+ "aria-modal": "true",
615
+ "aria-label": o,
616
+ tabIndex: -1,
617
+ onTouchStart: x,
618
+ onTouchMove: i,
619
+ onTouchEnd: y,
620
+ children: [
621
+ d && /* @__PURE__ */ t("div", { className: "nice-bottom-sheet__handle", "aria-hidden": "true" }),
622
+ o && /* @__PURE__ */ t("div", { className: "nice-bottom-sheet__title", children: o }),
623
+ /* @__PURE__ */ t("div", { ref: g, className: "nice-bottom-sheet__content", children: r })
624
+ ]
625
+ }
626
+ )
627
+ ] }),
628
+ H
629
+ );
630
+ }, mn = ({
631
+ trigger: e,
632
+ children: n,
633
+ placement: r = "bottom",
634
+ triggerMode: o = "click",
635
+ open: d,
636
+ onOpenChange: a,
637
+ hoverDelay: u = 200,
638
+ offset: w = 8,
639
+ className: m,
640
+ showArrow: N = !0
641
+ }) => {
642
+ const [C, T] = D(!1), $ = K(null), l = K(null), f = K(null), g = Me(), h = d !== void 0, c = h ? d : C, b = k(
643
+ (x) => {
644
+ h || T(x), a?.(x);
645
+ },
646
+ [h, a]
647
+ );
648
+ et(l, () => {
649
+ o !== "manual" && c && b(!1);
650
+ });
651
+ const s = k(() => {
652
+ o === "click" && b(!c);
653
+ }, [o, c, b]), L = k(() => {
654
+ o === "hover" && (f.current && window.clearTimeout(f.current), f.current = window.setTimeout(() => b(!0), u));
655
+ }, [o, u, b]), z = k(() => {
656
+ o === "hover" && (f.current && window.clearTimeout(f.current), f.current = window.setTimeout(() => b(!1), u));
657
+ }, [o, u, b]), [O, H] = D({ top: 0, left: 0 });
658
+ return B(() => {
659
+ if (!c || !$.current || !l.current)
660
+ return;
661
+ const x = $.current.getBoundingClientRect(), i = l.current.getBoundingClientRect(), y = window.innerWidth, E = window.innerHeight;
662
+ let I = 0, S = 0;
663
+ const [P, Y = "center"] = r.split("-");
664
+ switch (P) {
665
+ case "top":
666
+ I = x.top - i.height - w, S = x.left + (x.width - i.width) / 2;
667
+ break;
668
+ case "bottom":
669
+ I = x.bottom + w, S = x.left + (x.width - i.width) / 2;
670
+ break;
671
+ case "left":
672
+ I = x.top + (x.height - i.height) / 2, S = x.left - i.width - w;
673
+ break;
674
+ case "right":
675
+ I = x.top + (x.height - i.height) / 2, S = x.right + w;
676
+ break;
677
+ }
678
+ P === "top" || P === "bottom" ? (Y === "start" && (S = x.left), Y === "end" && (S = x.right - i.width)) : (Y === "start" && (I = x.top), Y === "end" && (I = x.bottom - i.height)), S = Math.max(8, Math.min(y - i.width - 8, S)), I = Math.max(8, Math.min(E - i.height - 8, I)), H({ top: I, left: S });
679
+ }, [c, r, w]), /* @__PURE__ */ M(_e, { children: [
680
+ /* @__PURE__ */ t(
681
+ "div",
682
+ {
683
+ ref: $,
684
+ className: "nice-popover__trigger",
685
+ onClick: s,
686
+ onMouseEnter: L,
687
+ onMouseLeave: z,
688
+ style: { display: "inline-block" },
689
+ children: e
690
+ }
691
+ ),
692
+ c && Ee(
693
+ /* @__PURE__ */ M(
694
+ "div",
695
+ {
696
+ ref: l,
697
+ className: `nice-popover nice-popover--${r} ${m || ""}`,
698
+ style: {
699
+ position: "fixed",
700
+ top: O.top,
701
+ left: O.left,
702
+ zIndex: 1100
703
+ },
704
+ onMouseEnter: L,
705
+ onMouseLeave: z,
706
+ role: "tooltip",
707
+ children: [
708
+ N && /* @__PURE__ */ t("div", { className: "nice-popover__arrow" }),
709
+ /* @__PURE__ */ t("div", { className: "nice-popover__content", children: n })
710
+ ]
711
+ }
712
+ ),
713
+ g
714
+ )
715
+ ] });
716
+ }, hn = ({
717
+ items: e,
718
+ children: n,
719
+ onOpen: r,
720
+ onClose: o,
721
+ className: d
722
+ }) => {
723
+ const [a, u] = D(!1), [w, m] = D({ x: 0, y: 0 }), N = K(null), C = K(null), T = Me();
724
+ et(N, () => {
725
+ a && (u(!1), o?.());
726
+ });
727
+ const $ = k(
728
+ (g) => {
729
+ g.preventDefault(), m({ x: g.clientX, y: g.clientY }), u(!0), r?.();
730
+ },
731
+ [r]
732
+ ), l = k(
733
+ (g) => {
734
+ !g.disabled && g.onClick && (g.onClick(), u(!1), o?.());
735
+ },
736
+ [o]
737
+ );
738
+ B(() => {
739
+ if (!a)
740
+ return;
741
+ const g = (h) => {
742
+ h.key === "Escape" && (u(!1), o?.());
743
+ };
744
+ return document.addEventListener("keydown", g), () => document.removeEventListener("keydown", g);
745
+ }, [a, o]);
746
+ const f = (g) => /* @__PURE__ */ t("ul", { className: "nice-context-menu__list", role: "menu", children: g.map((h) => h.divider ? /* @__PURE__ */ t("li", { className: "nice-context-menu__divider", role: "separator" }, h.key) : /* @__PURE__ */ t("li", { role: "presentation", children: /* @__PURE__ */ M(
747
+ "button",
748
+ {
749
+ type: "button",
750
+ className: `nice-context-menu__item ${h.disabled ? "nice-context-menu__item--disabled" : ""} ${h.danger ? "nice-context-menu__item--danger" : ""}`,
751
+ role: "menuitem",
752
+ disabled: h.disabled,
753
+ onClick: () => l(h),
754
+ children: [
755
+ h.icon && /* @__PURE__ */ t("span", { className: "nice-context-menu__icon", children: h.icon }),
756
+ /* @__PURE__ */ t("span", { className: "nice-context-menu__label", children: h.label })
757
+ ]
758
+ }
759
+ ) }, h.key)) });
760
+ return /* @__PURE__ */ M(_e, { children: [
761
+ /* @__PURE__ */ t("div", { ref: C, onContextMenu: $, style: { display: "contents" }, children: n }),
762
+ a && Ee(
763
+ /* @__PURE__ */ t(
764
+ "div",
765
+ {
766
+ ref: N,
767
+ className: `nice-context-menu ${d || ""}`,
768
+ style: {
769
+ position: "fixed",
770
+ left: w.x,
771
+ top: w.y,
772
+ zIndex: 1200
773
+ },
774
+ role: "menu",
775
+ children: f(e)
776
+ }
777
+ ),
778
+ T
779
+ )
780
+ ] });
781
+ };
782
+ function Ue(e, n) {
783
+ if (!e)
784
+ return { score: 1, indices: [] };
785
+ const r = e.toLowerCase(), o = n.toLowerCase();
786
+ let d = 0;
787
+ const a = [];
788
+ let u = 0, w = -1;
789
+ for (let m = 0; m < o.length && d < r.length; m++)
790
+ o[m] === r[d] && (a.push(m), w === m - 1 && (u += 3), (m === 0 || /[\s\-_/.]/.test(n[m - 1])) && (u += 5), n[m] === e[d] && (u += 1), u += 1, w = m, d++);
791
+ return d < r.length ? null : (u -= a[0] * 0.1, { score: u, indices: a });
792
+ }
793
+ function It(e, n) {
794
+ if (n.length === 0)
795
+ return [e];
796
+ const r = [];
797
+ let o = 0;
798
+ const d = new Set(n);
799
+ for (let a = 0; a < e.length; a++)
800
+ d.has(a) && (o < a && r.push(e.slice(o, a)), r.push(
801
+ zt.createElement(
802
+ "mark",
803
+ { key: `m-${a}`, className: "nice-command-palette__match" },
804
+ e[a]
805
+ )
806
+ ), o = a + 1);
807
+ return o < e.length && r.push(e.slice(o)), r;
808
+ }
809
+ function Tt(e, n) {
810
+ switch (n.type) {
811
+ case "REGISTER": {
812
+ const r = new Map(e.commands);
813
+ return r.set(n.command.id, n.command), { ...e, commands: r };
814
+ }
815
+ case "REGISTER_BATCH": {
816
+ const r = new Map(e.commands);
817
+ for (const o of n.commands)
818
+ r.set(o.id, o);
819
+ return { ...e, commands: r };
820
+ }
821
+ case "UNREGISTER": {
822
+ const r = new Map(e.commands);
823
+ return r.delete(n.id), { ...e, commands: r };
824
+ }
825
+ case "OPEN":
826
+ return { ...e, isOpen: !0, query: "", selectedIndex: 0 };
827
+ case "CLOSE":
828
+ return { ...e, isOpen: !1, query: "", selectedIndex: 0 };
829
+ case "SET_QUERY":
830
+ return { ...e, query: n.query, selectedIndex: 0 };
831
+ case "SET_SELECTED":
832
+ return { ...e, selectedIndex: n.index };
833
+ case "ADD_RECENT": {
834
+ const r = e.recentIds.filter((o) => o !== n.id);
835
+ return {
836
+ ...e,
837
+ recentIds: [n.id, ...r].slice(0, n.maxRecent)
838
+ };
839
+ }
840
+ default:
841
+ return e;
842
+ }
843
+ }
844
+ const nt = tt(null);
845
+ function $t() {
846
+ const e = Ve(nt);
847
+ if (!e)
848
+ throw new Error("useCommandPalette must be used within NiceCommandPaletteProvider");
849
+ return e;
850
+ }
851
+ const Lt = ({
852
+ children: e,
853
+ commands: n,
854
+ placeholder: r,
855
+ maxVisible: o = 10,
856
+ maxRecent: d = 5,
857
+ className: a,
858
+ emptyText: u,
859
+ closeOnAction: w = !0,
860
+ onOpen: m,
861
+ onClose: N
862
+ }) => {
863
+ const { t: C } = Pe(), T = C("commandPalette.general", "General"), $ = Me(), [l, f] = Ct(Tt, {
864
+ commands: new Map(n?.map((p) => [p.id, p]) ?? []),
865
+ isOpen: !1,
866
+ query: "",
867
+ selectedIndex: 0,
868
+ recentIds: []
869
+ }), g = K(null), h = K(null), [c, b] = D(!1), s = k((p) => {
870
+ f({ type: "REGISTER", command: p });
871
+ }, []), L = k((p) => {
872
+ f({ type: "UNREGISTER", id: p });
873
+ }, []), z = k((p) => {
874
+ f({ type: "REGISTER_BATCH", commands: p });
875
+ }, []), O = k(() => {
876
+ f({ type: "OPEN" }), m?.();
877
+ }, [m]), H = k(() => {
878
+ f({ type: "CLOSE" }), N?.();
879
+ }, [N]), x = k(() => {
880
+ l.isOpen ? H() : O();
881
+ }, [l.isOpen, H, O]), y = Oe(() => {
882
+ const p = Array.from(l.commands.values()).filter((_) => !_.hidden);
883
+ if (!l.query.trim()) {
884
+ const _ = l.recentIds.map((W) => l.commands.get(W)).filter((W) => !!W && !W.hidden), q = p.filter((W) => !l.recentIds.includes(W.id));
885
+ return q.sort((W, J) => W.label.localeCompare(J.label)), [..._, ...q].map((W) => ({
886
+ command: W,
887
+ match: null,
888
+ isRecent: l.recentIds.includes(W.id)
889
+ }));
890
+ }
891
+ return p.map((_) => {
892
+ const q = Ue(l.query, _.label), W = _.description ? Ue(l.query, _.description) : null, J = _.keywords?.map((te) => Ue(l.query, te)).filter(Boolean)[0] ?? null, ee = [q, W, J].filter(Boolean).sort((te, ce) => (ce?.score ?? 0) - (te?.score ?? 0))[0] ?? null;
893
+ return { command: _, match: ee, isRecent: !1 };
894
+ }).filter((_) => _.match !== null).sort((_, q) => (q.match?.score ?? 0) - (_.match?.score ?? 0));
895
+ }, [l.commands, l.query, l.recentIds]).slice(0, o), E = k(
896
+ async (p) => {
897
+ const v = l.commands.get(p);
898
+ if (!(!v || v.disabled)) {
899
+ b(!0);
900
+ try {
901
+ await v.action(), f({ type: "ADD_RECENT", id: p, maxRecent: d });
902
+ } finally {
903
+ b(!1), w && H();
904
+ }
905
+ }
906
+ },
907
+ [l.commands, d, w, H]
908
+ );
909
+ B(() => {
910
+ const p = (v) => {
911
+ (v.metaKey || v.ctrlKey) && v.key === "k" && (v.preventDefault(), x()), v.key === "Escape" && l.isOpen && (v.preventDefault(), H());
912
+ };
913
+ return document.addEventListener("keydown", p), () => document.removeEventListener("keydown", p);
914
+ }, [x, l.isOpen, H]), B(() => {
915
+ l.isOpen && requestAnimationFrame(() => g.current?.focus());
916
+ }, [l.isOpen]);
917
+ const I = k(
918
+ (p) => {
919
+ const v = y.length;
920
+ if (v) {
921
+ if (p.key === "ArrowDown")
922
+ p.preventDefault(), f({ type: "SET_SELECTED", index: (l.selectedIndex + 1) % v });
923
+ else if (p.key === "ArrowUp")
924
+ p.preventDefault(), f({ type: "SET_SELECTED", index: (l.selectedIndex - 1 + v) % v });
925
+ else if (p.key === "Enter") {
926
+ p.preventDefault();
927
+ const _ = y[l.selectedIndex];
928
+ _ && E(_.command.id);
929
+ }
930
+ }
931
+ },
932
+ [y, l.selectedIndex, E]
933
+ );
934
+ B(() => {
935
+ if (!h.current)
936
+ return;
937
+ h.current.children[l.selectedIndex]?.scrollIntoView({ block: "nearest" });
938
+ }, [l.selectedIndex]);
939
+ const S = Oe(
940
+ () => ({
941
+ registerCommand: s,
942
+ unregisterCommand: L,
943
+ registerCommands: z,
944
+ open: O,
945
+ close: H,
946
+ toggle: x,
947
+ isOpen: l.isOpen,
948
+ executeCommand: E
949
+ }),
950
+ [
951
+ s,
952
+ L,
953
+ z,
954
+ O,
955
+ H,
956
+ x,
957
+ l.isOpen,
958
+ E
959
+ ]
960
+ ), P = Oe(() => {
961
+ const p = /* @__PURE__ */ new Map();
962
+ for (const v of y) {
963
+ const _ = v.command.category ?? T;
964
+ p.has(_) || p.set(_, []), p.get(_).push(v);
965
+ }
966
+ return p;
967
+ }, [y, T]);
968
+ let Y = 0;
969
+ return /* @__PURE__ */ M(nt.Provider, { value: S, children: [
970
+ e,
971
+ l.isOpen && Ee(
972
+ /* @__PURE__ */ t("div", { className: `nice-command-palette__overlay ${a ?? ""}`, onClick: H, children: /* @__PURE__ */ M(
973
+ "div",
974
+ {
975
+ className: "nice-command-palette",
976
+ role: "dialog",
977
+ "aria-label": C("commandPalette.title", "Command palette"),
978
+ "aria-modal": "true",
979
+ onClick: (p) => p.stopPropagation(),
980
+ children: [
981
+ /* @__PURE__ */ t("div", { className: "nice-command-palette__input-wrapper", children: /* @__PURE__ */ t(
982
+ "input",
983
+ {
984
+ ref: g,
985
+ className: "nice-command-palette__input",
986
+ type: "text",
987
+ placeholder: r ?? C("commandPalette.placeholder", "Type a command..."),
988
+ value: l.query,
989
+ onChange: (p) => f({ type: "SET_QUERY", query: p.target.value }),
990
+ onKeyDown: I,
991
+ "aria-label": C("commandPalette.search", "Search commands"),
992
+ "aria-autocomplete": "list",
993
+ "aria-controls": "nice-command-palette-list",
994
+ "aria-activedescendant": y[l.selectedIndex] ? `nice-cmd-${y[l.selectedIndex].command.id}` : void 0
995
+ }
996
+ ) }),
997
+ /* @__PURE__ */ M(
998
+ "div",
999
+ {
1000
+ ref: h,
1001
+ id: "nice-command-palette-list",
1002
+ className: "nice-command-palette__list",
1003
+ role: "listbox",
1004
+ children: [
1005
+ y.length === 0 && /* @__PURE__ */ t("div", { className: "nice-command-palette__empty", children: u ?? C("commandPalette.empty", "No commands found") }),
1006
+ Array.from(P.entries()).map(([p, v]) => /* @__PURE__ */ M("div", { className: "nice-command-palette__group", children: [
1007
+ /* @__PURE__ */ t("div", { className: "nice-command-palette__category", children: p }),
1008
+ v.map((_) => {
1009
+ const q = Y++, W = q === l.selectedIndex;
1010
+ return /* @__PURE__ */ M(
1011
+ "div",
1012
+ {
1013
+ id: `nice-cmd-${_.command.id}`,
1014
+ className: `nice-command-palette__item ${W ? "nice-command-palette__item--selected" : ""} ${_.command.disabled ? "nice-command-palette__item--disabled" : ""}`,
1015
+ role: "option",
1016
+ "aria-selected": W,
1017
+ "aria-disabled": _.command.disabled,
1018
+ onClick: () => !_.command.disabled && E(_.command.id),
1019
+ onMouseEnter: () => f({ type: "SET_SELECTED", index: q }),
1020
+ children: [
1021
+ _.command.icon && /* @__PURE__ */ t("span", { className: "nice-command-palette__icon", children: _.command.icon }),
1022
+ /* @__PURE__ */ M("div", { className: "nice-command-palette__label-group", children: [
1023
+ /* @__PURE__ */ t("span", { className: "nice-command-palette__label", children: _.match && l.query ? It(_.command.label, _.match.indices) : _.command.label }),
1024
+ _.command.description && /* @__PURE__ */ t("span", { className: "nice-command-palette__description", children: _.command.description })
1025
+ ] }),
1026
+ _.command.shortcut && /* @__PURE__ */ t("kbd", { className: "nice-command-palette__shortcut", children: _.command.shortcut }),
1027
+ _.isRecent && /* @__PURE__ */ t("span", { className: "nice-command-palette__recent-badge", children: C("commandPalette.recent", "Recent") })
1028
+ ]
1029
+ },
1030
+ _.command.id
1031
+ );
1032
+ })
1033
+ ] }, p))
1034
+ ]
1035
+ }
1036
+ ),
1037
+ c && /* @__PURE__ */ t("div", { className: "nice-command-palette__executing", children: C("commandPalette.executing", "Executing...") })
1038
+ ]
1039
+ }
1040
+ ) }),
1041
+ $
1042
+ )
1043
+ ] });
1044
+ };
1045
+ Lt.displayName = "NiceCommandPaletteProvider";
1046
+ function fn(e) {
1047
+ const { registerCommands: n, unregisterCommand: r } = $t();
1048
+ B(() => (n(e), () => {
1049
+ for (const o of e)
1050
+ r(o.id);
1051
+ }), []);
1052
+ }
1053
+ const Rt = Qe(
1054
+ ({ blocked: e, message: n, spinner: r, blur: o, children: d, className: a, style: u, id: w }, m) => {
1055
+ const N = Ge(w);
1056
+ return /* @__PURE__ */ M(
1057
+ "div",
1058
+ {
1059
+ ref: m,
1060
+ id: N,
1061
+ className: `nice-block-ui ${a || ""}`,
1062
+ style: { position: "relative", ...u },
1063
+ children: [
1064
+ d,
1065
+ e && /* @__PURE__ */ t(
1066
+ "div",
1067
+ {
1068
+ className: `nice-block-ui__overlay${o ? " nice-block-ui__overlay--blur" : ""}`,
1069
+ "aria-busy": "true",
1070
+ role: "alert",
1071
+ children: (r || n) && /* @__PURE__ */ M("div", { className: "nice-block-ui__content", children: [
1072
+ r && /* @__PURE__ */ t("div", { className: "nice-block-ui__spinner", "aria-hidden": "true" }),
1073
+ n && /* @__PURE__ */ t("div", { className: "nice-block-ui__message", children: n })
1074
+ ] })
1075
+ }
1076
+ )
1077
+ ]
1078
+ }
1079
+ );
1080
+ }
1081
+ );
1082
+ Rt.displayName = "NiceBlockUI";
1083
+ const St = Qe(
1084
+ ({
1085
+ windows: e,
1086
+ children: n,
1087
+ onChange: r,
1088
+ onClose: o,
1089
+ onFocus: d,
1090
+ showTaskbar: a = !0,
1091
+ size: u = "md",
1092
+ className: w,
1093
+ style: m,
1094
+ id: N,
1095
+ ...C
1096
+ }, T) => {
1097
+ const $ = Ge(N), { t: l } = Pe(), [f, g] = D(null), h = K(null), c = e ?? [], b = Math.max(1, ...c.map((i) => i.zIndex ?? 1)), s = k(
1098
+ (i, y) => {
1099
+ const E = c.map((I) => I.key === i ? { ...I, ...y } : I);
1100
+ r?.(E);
1101
+ },
1102
+ [c, r]
1103
+ ), L = k(
1104
+ (i) => {
1105
+ s(i, { zIndex: b + 1 }), d?.(i);
1106
+ },
1107
+ [s, b, d]
1108
+ ), z = k(
1109
+ (i) => {
1110
+ o?.(i), r?.(c.filter((y) => y.key !== i));
1111
+ },
1112
+ [c, r, o]
1113
+ ), O = k(
1114
+ (i) => {
1115
+ const y = c.find((E) => E.key === i);
1116
+ y && s(i, { minimized: !y.minimized, maximized: !1 });
1117
+ },
1118
+ [c, s]
1119
+ ), H = k(
1120
+ (i) => {
1121
+ const y = c.find((E) => E.key === i);
1122
+ y && s(i, { maximized: !y.maximized, minimized: !1 });
1123
+ },
1124
+ [c, s]
1125
+ );
1126
+ B(() => {
1127
+ if (!f)
1128
+ return;
1129
+ const i = (E) => {
1130
+ const I = c.find((S) => S.key === f.key);
1131
+ if (I)
1132
+ if (f.mode === "move")
1133
+ s(f.key, {
1134
+ x: E.clientX - f.offsetX,
1135
+ y: E.clientY - f.offsetY
1136
+ });
1137
+ else {
1138
+ const P = h.current?.getBoundingClientRect(), Y = P?.left ?? 0, p = P?.top ?? 0;
1139
+ s(f.key, {
1140
+ width: Math.max(200, E.clientX - Y - I.x),
1141
+ height: Math.max(100, E.clientY - p - I.y)
1142
+ });
1143
+ }
1144
+ }, y = () => g(null);
1145
+ return document.addEventListener("mousemove", i), document.addEventListener("mouseup", y), () => {
1146
+ document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", y);
1147
+ };
1148
+ }, [f, c, s]);
1149
+ const x = k(
1150
+ (i, y, E) => {
1151
+ y.preventDefault();
1152
+ const I = c.find((S) => S.key === i);
1153
+ I && (L(i), g({
1154
+ key: i,
1155
+ offsetX: E === "move" ? y.clientX - I.x : 0,
1156
+ offsetY: E === "move" ? y.clientY - I.y : 0,
1157
+ mode: E
1158
+ }));
1159
+ },
1160
+ [c, L]
1161
+ );
1162
+ return /* @__PURE__ */ M(
1163
+ "div",
1164
+ {
1165
+ ref: (i) => {
1166
+ h.current = i, typeof T == "function" ? T(i) : T && (T.current = i);
1167
+ },
1168
+ id: $,
1169
+ className: `nice-wm nice-wm--${u} ${w ?? ""}`,
1170
+ style: { ...m, position: "relative", overflow: "hidden" },
1171
+ ...C,
1172
+ children: [
1173
+ c.map((i) => {
1174
+ if (i.minimized)
1175
+ return null;
1176
+ const y = i.maximized, E = y ? {
1177
+ position: "absolute",
1178
+ top: 0,
1179
+ left: 0,
1180
+ width: "100%",
1181
+ height: "100%",
1182
+ zIndex: i.zIndex ?? 1
1183
+ } : {
1184
+ position: "absolute",
1185
+ top: i.y,
1186
+ left: i.x,
1187
+ width: i.width,
1188
+ height: i.height,
1189
+ zIndex: i.zIndex ?? 1
1190
+ };
1191
+ return /* @__PURE__ */ M(
1192
+ "div",
1193
+ {
1194
+ className: `nice-wm__window ${y ? "nice-wm__window--maximized" : ""}`,
1195
+ style: E,
1196
+ onMouseDown: () => L(i.key),
1197
+ role: "dialog",
1198
+ "aria-label": i.title,
1199
+ children: [
1200
+ /* @__PURE__ */ M(
1201
+ "div",
1202
+ {
1203
+ className: "nice-wm__titlebar",
1204
+ onMouseDown: (I) => !y && x(i.key, I, "move"),
1205
+ children: [
1206
+ i.icon && /* @__PURE__ */ t("span", { className: "nice-wm__icon", children: i.icon }),
1207
+ /* @__PURE__ */ t("span", { className: "nice-wm__title", children: i.title }),
1208
+ /* @__PURE__ */ M("div", { className: "nice-wm__controls", children: [
1209
+ (i.minimizable ?? !0) && /* @__PURE__ */ t(
1210
+ "button",
1211
+ {
1212
+ type: "button",
1213
+ className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--min",
1214
+ onClick: () => O(i.key),
1215
+ title: l("wm.minimize", "Minimize"),
1216
+ children: /* @__PURE__ */ t(fe, { name: "minus", size: 14 })
1217
+ }
1218
+ ),
1219
+ (i.maximizable ?? !0) && /* @__PURE__ */ t(
1220
+ "button",
1221
+ {
1222
+ type: "button",
1223
+ className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--max",
1224
+ onClick: () => H(i.key),
1225
+ title: l("wm.maximize", "Maximize"),
1226
+ children: /* @__PURE__ */ t(fe, { name: y ? "copy" : "window", size: 14 })
1227
+ }
1228
+ ),
1229
+ (i.closable ?? !0) && /* @__PURE__ */ t(
1230
+ "button",
1231
+ {
1232
+ type: "button",
1233
+ className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--close",
1234
+ onClick: () => z(i.key),
1235
+ title: l("wm.close", "Close"),
1236
+ children: /* @__PURE__ */ t(fe, { name: "close", size: 14 })
1237
+ }
1238
+ )
1239
+ ] })
1240
+ ]
1241
+ }
1242
+ ),
1243
+ /* @__PURE__ */ t("div", { className: "nice-wm__body", children: i.content }),
1244
+ (i.resizable ?? !0) && !y && /* @__PURE__ */ t(
1245
+ "div",
1246
+ {
1247
+ className: "nice-wm__resize-handle",
1248
+ onMouseDown: (I) => x(i.key, I, "resize")
1249
+ }
1250
+ )
1251
+ ]
1252
+ },
1253
+ i.key
1254
+ );
1255
+ }),
1256
+ e === void 0 && n,
1257
+ a && /* @__PURE__ */ t("div", { className: "nice-wm__taskbar", role: "toolbar", "aria-label": l("wm.taskbar", "Taskbar"), children: c.map((i) => /* @__PURE__ */ M(
1258
+ "button",
1259
+ {
1260
+ type: "button",
1261
+ className: `nice-wm__taskbar-btn ${i.minimized ? "nice-wm__taskbar-btn--minimized" : ""}`,
1262
+ onClick: () => {
1263
+ i.minimized && O(i.key), L(i.key);
1264
+ },
1265
+ children: [
1266
+ i.icon && /* @__PURE__ */ t("span", { className: "nice-wm__taskbar-icon", children: i.icon }),
1267
+ /* @__PURE__ */ t("span", { className: "nice-wm__taskbar-label", children: i.title })
1268
+ ]
1269
+ },
1270
+ i.key
1271
+ )) })
1272
+ ]
1273
+ }
1274
+ );
1275
+ }
1276
+ );
1277
+ St.displayName = "NiceWindowManager";
1278
+ function Pt(e, n) {
1279
+ const r = document.querySelector(e);
1280
+ if (!r)
1281
+ return null;
1282
+ const o = r.getBoundingClientRect();
1283
+ return {
1284
+ top: o.top - n + window.scrollY,
1285
+ left: o.left - n + window.scrollX,
1286
+ width: o.width + n * 2,
1287
+ height: o.height + n * 2
1288
+ };
1289
+ }
1290
+ function Yt(e, n, r, o) {
1291
+ const a = { w: window.innerWidth, h: window.innerHeight + window.scrollY }, u = {
1292
+ top: {
1293
+ top: e.top - r - 12,
1294
+ left: e.left + e.width / 2 - n / 2
1295
+ },
1296
+ bottom: {
1297
+ top: e.top + e.height + 12,
1298
+ left: e.left + e.width / 2 - n / 2
1299
+ },
1300
+ left: {
1301
+ top: e.top + e.height / 2 - r / 2,
1302
+ left: e.left - n - 12
1303
+ },
1304
+ right: {
1305
+ top: e.top + e.height / 2 - r / 2,
1306
+ left: e.left + e.width + 12
1307
+ }
1308
+ };
1309
+ if (o && o !== "auto")
1310
+ return { ...u[o], actualPlacement: o };
1311
+ for (const w of ["bottom", "top", "right", "left"]) {
1312
+ const m = u[w];
1313
+ if (m.top >= 0 && m.left >= 0 && m.top + r <= a.h && m.left + n <= a.w)
1314
+ return { ...m, actualPlacement: w };
1315
+ }
1316
+ return { ...u.bottom, actualPlacement: "bottom" };
1317
+ }
1318
+ const ze = {
1319
+ width: 16,
1320
+ height: 16,
1321
+ viewBox: "0 0 24 24",
1322
+ fill: "none",
1323
+ stroke: "currentColor",
1324
+ strokeWidth: 2,
1325
+ strokeLinecap: "round",
1326
+ strokeLinejoin: "round",
1327
+ "aria-hidden": !0
1328
+ };
1329
+ function Dt() {
1330
+ return /* @__PURE__ */ M("svg", { ...ze, children: [
1331
+ /* @__PURE__ */ t("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1332
+ /* @__PURE__ */ t("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1333
+ ] });
1334
+ }
1335
+ function Xt() {
1336
+ return /* @__PURE__ */ t("svg", { ...ze, children: /* @__PURE__ */ t("polyline", { points: "15 18 9 12 15 6" }) });
1337
+ }
1338
+ function Bt() {
1339
+ return /* @__PURE__ */ t("svg", { ...ze, children: /* @__PURE__ */ t("polyline", { points: "9 18 15 12 9 6" }) });
1340
+ }
1341
+ function Ot() {
1342
+ return /* @__PURE__ */ M("svg", { ...ze, children: [
1343
+ /* @__PURE__ */ t("polygon", { points: "5 4 15 12 5 20 5 4" }),
1344
+ /* @__PURE__ */ t("line", { x1: "19", y1: "5", x2: "19", y2: "19" })
1345
+ ] });
1346
+ }
1347
+ function Ht() {
1348
+ return /* @__PURE__ */ t("svg", { ...ze, children: /* @__PURE__ */ t("polygon", { points: "6 4 20 12 6 20 6 4", fill: "currentColor" }) });
1349
+ }
1350
+ function qt() {
1351
+ return /* @__PURE__ */ M("svg", { ...ze, children: [
1352
+ /* @__PURE__ */ t("rect", { x: "6", y: "4", width: "4", height: "16", fill: "currentColor" }),
1353
+ /* @__PURE__ */ t("rect", { x: "14", y: "4", width: "4", height: "16", fill: "currentColor" })
1354
+ ] });
1355
+ }
1356
+ function Xe(e, n, r) {
1357
+ return r === "text" ? /* @__PURE__ */ t("span", { className: "nice-tutorial__btn-label", children: n }) : r === "icon-text" ? /* @__PURE__ */ M(_e, { children: [
1358
+ e,
1359
+ /* @__PURE__ */ t("span", { className: "nice-tutorial__btn-label", children: n })
1360
+ ] }) : e;
1361
+ }
1362
+ const Wt = [], it = ({
1363
+ steps: e = Wt,
1364
+ active: n,
1365
+ onFinish: r,
1366
+ onSkip: o,
1367
+ onStepChange: d,
1368
+ closeOnEscape: a = !0,
1369
+ closeOnOverlayClick: u = !1,
1370
+ showProgress: w = !0,
1371
+ showSkipButton: m = !0,
1372
+ labels: N,
1373
+ animationDuration: C = 300,
1374
+ overlayOpacity: T = 0.6,
1375
+ zIndex: $ = 1e4,
1376
+ buttonsPlacement: l = "floating-bottom",
1377
+ buttonsDisplay: f = "icon",
1378
+ showAutoplay: g = !0,
1379
+ autoplayInterval: h = 5e3,
1380
+ autoplaySpeedRange: c = { min: 2e3, max: 15e3 },
1381
+ onAutoplayChange: b
1382
+ }) => {
1383
+ const [s, L] = D(0), [z, O] = D(null), [H, x] = D({ w: 340, h: 200 }), [i, y] = D(!0), [E, I] = D(!1), [S, P] = D(h), Y = K(null), p = K(-1), v = e[s], _ = s === e.length - 1, q = s === 0, W = N?.next ?? "Next", J = N?.back ?? "Back", ee = N?.finish ?? "Finish", te = N?.skip ?? "Skip", ce = N?.stepOf ?? "of", ge = N?.play ?? "Play", ve = N?.pause ?? "Pause", Ye = N?.speed ?? "Speed", Ce = N?.close ?? "Close";
1384
+ B(() => {
1385
+ n && (L(0), I(!1), P(h));
1386
+ }, [n, h]), B(() => {
1387
+ if (Y.current) {
1388
+ const X = Y.current.getBoundingClientRect();
1389
+ x({ w: X.width, h: X.height });
1390
+ }
1391
+ }, [s, n]), B(() => {
1392
+ if (!n || !v)
1393
+ return;
1394
+ const X = v.highlightPadding ?? 0, A = () => {
1395
+ const G = Pt(v.target, X);
1396
+ O(G);
1397
+ };
1398
+ if (A(), v.scrollIntoView !== !1) {
1399
+ document.querySelector(v.target)?.scrollIntoView({ behavior: "smooth", block: "center" });
1400
+ const ne = setTimeout(A, 350);
1401
+ return () => clearTimeout(ne);
1402
+ }
1403
+ }, [n, v, s]), B(() => {
1404
+ !n || !v || p.current !== s && (p.current >= 0 && p.current < e.length && e[p.current]?.onLeave?.(), v.onEnter?.(), p.current = s);
1405
+ }, [n, v, s, e]);
1406
+ const se = k(() => {
1407
+ if (_)
1408
+ v?.onLeave?.(), r?.();
1409
+ else {
1410
+ const X = s + 1;
1411
+ L(X), d?.(X);
1412
+ }
1413
+ }, [s, _, r, d, v]), be = k(() => {
1414
+ if (!q) {
1415
+ const X = s - 1;
1416
+ L(X), d?.(X);
1417
+ }
1418
+ }, [s, q, d]);
1419
+ B(() => {
1420
+ if (!n || !v?.advanceOn)
1421
+ return;
1422
+ const X = document.querySelector(v.target);
1423
+ if (!X)
1424
+ return;
1425
+ const A = () => se();
1426
+ return X.addEventListener(v.advanceOn.event, A), () => X.removeEventListener(v.advanceOn.event, A);
1427
+ }, [n, v, s, se]), B(() => {
1428
+ if (!n)
1429
+ return;
1430
+ const X = (A) => {
1431
+ A.key === "Escape" && a ? o?.() : A.key === "ArrowRight" ? se() : A.key === "ArrowLeft" && be();
1432
+ };
1433
+ return document.addEventListener("keydown", X), () => document.removeEventListener("keydown", X);
1434
+ }, [n, s, a, se, be, o]), B(() => {
1435
+ y(!0);
1436
+ const X = setTimeout(() => y(!1), C);
1437
+ return () => clearTimeout(X);
1438
+ }, [s, C]), B(() => {
1439
+ if (!n || !E)
1440
+ return;
1441
+ const X = setInterval(
1442
+ () => {
1443
+ L((A) => {
1444
+ if (A >= e.length - 1)
1445
+ return I(!1), b?.(!1), e[A]?.onLeave?.(), r?.(), A;
1446
+ const G = A + 1;
1447
+ return d?.(G), G;
1448
+ });
1449
+ },
1450
+ Math.max(500, S)
1451
+ );
1452
+ return () => clearInterval(X);
1453
+ }, [n, E, S, e, b, r, d]);
1454
+ const De = k(() => {
1455
+ I((X) => {
1456
+ const A = !X;
1457
+ return b?.(A), A;
1458
+ });
1459
+ }, [b]), ye = Oe(() => z ? Yt(z, H.w, H.h, v?.placement) : {
1460
+ top: typeof window < "u" ? window.innerHeight / 2 : 0,
1461
+ left: typeof window < "u" ? window.innerWidth / 2 : 0,
1462
+ actualPlacement: "bottom"
1463
+ }, [z, H, v?.placement]), Ie = e.length === 0 ? 0 : (s + 1) / e.length * 100, Z = k(
1464
+ (X) => {
1465
+ const A = g && e.length > 1, G = m && !_ && /* @__PURE__ */ t(
1466
+ "button",
1467
+ {
1468
+ type: "button",
1469
+ className: `nice-tutorial__btn nice-tutorial__btn--skip nice-tutorial__btn--${f}`,
1470
+ onClick: o,
1471
+ "aria-label": te,
1472
+ title: te,
1473
+ children: Xe(/* @__PURE__ */ t(Ot, {}), te, f)
1474
+ }
1475
+ ), ne = !q && /* @__PURE__ */ t(
1476
+ "button",
1477
+ {
1478
+ type: "button",
1479
+ className: `nice-tutorial__btn nice-tutorial__btn--back nice-tutorial__btn--${f}`,
1480
+ onClick: be,
1481
+ "aria-label": J,
1482
+ title: J,
1483
+ children: Xe(/* @__PURE__ */ t(Xt, {}), J, f)
1484
+ }
1485
+ ), xe = !v?.waitForAction && /* @__PURE__ */ t(
1486
+ "button",
1487
+ {
1488
+ type: "button",
1489
+ className: `nice-tutorial__btn nice-tutorial__btn--next nice-tutorial__btn--${f}`,
1490
+ onClick: se,
1491
+ "aria-label": _ ? ee : W,
1492
+ title: _ ? ee : W,
1493
+ children: Xe(/* @__PURE__ */ t(Bt, {}), _ ? ee : W, f)
1494
+ }
1495
+ ), Ne = A && /* @__PURE__ */ t(
1496
+ "button",
1497
+ {
1498
+ type: "button",
1499
+ className: [
1500
+ "nice-tutorial__btn",
1501
+ "nice-tutorial__btn--play",
1502
+ `nice-tutorial__btn--${f}`,
1503
+ E ? "nice-tutorial__btn--active" : ""
1504
+ ].filter(Boolean).join(" "),
1505
+ onClick: De,
1506
+ "aria-label": E ? ve : ge,
1507
+ title: E ? ve : ge,
1508
+ "aria-pressed": E,
1509
+ children: Xe(
1510
+ E ? /* @__PURE__ */ t(qt, {}) : /* @__PURE__ */ t(Ht, {}),
1511
+ E ? ve : ge,
1512
+ f
1513
+ )
1514
+ }
1515
+ );
1516
+ return /* @__PURE__ */ M(
1517
+ "div",
1518
+ {
1519
+ className: [
1520
+ "nice-tutorial__controls",
1521
+ X ? "nice-tutorial__controls--inline" : "nice-tutorial__controls--floating-bottom"
1522
+ ].join(" "),
1523
+ style: X ? void 0 : { zIndex: $ + 2 },
1524
+ role: "group",
1525
+ "aria-label": "Tutorial controls",
1526
+ children: [
1527
+ G,
1528
+ ne,
1529
+ w && /* @__PURE__ */ M("span", { className: "nice-tutorial__step-label", "aria-live": "polite", children: [
1530
+ s + 1,
1531
+ " ",
1532
+ ce,
1533
+ " ",
1534
+ e.length
1535
+ ] }),
1536
+ xe,
1537
+ A && /* @__PURE__ */ t(
1538
+ "div",
1539
+ {
1540
+ className: "nice-tutorial__progress-bar",
1541
+ role: "progressbar",
1542
+ "aria-valuenow": Math.round(Ie),
1543
+ "aria-valuemin": 0,
1544
+ "aria-valuemax": 100,
1545
+ "aria-label": `${s + 1} ${ce} ${e.length}`,
1546
+ children: /* @__PURE__ */ t(
1547
+ "div",
1548
+ {
1549
+ className: "nice-tutorial__progress-bar-fill",
1550
+ style: { width: `${Ie}%` }
1551
+ }
1552
+ )
1553
+ }
1554
+ ),
1555
+ Ne,
1556
+ A && /* @__PURE__ */ M("label", { className: "nice-tutorial__speed", children: [
1557
+ /* @__PURE__ */ t(
1558
+ "input",
1559
+ {
1560
+ type: "range",
1561
+ className: "nice-tutorial__speed-slider",
1562
+ min: c.min,
1563
+ max: c.max,
1564
+ step: 500,
1565
+ value: c.min + c.max - S,
1566
+ onChange: (He) => P(c.min + c.max - Number(He.target.value)),
1567
+ "aria-label": Ye
1568
+ }
1569
+ ),
1570
+ /* @__PURE__ */ M("span", { className: "nice-tutorial__speed-value", children: [
1571
+ (S / 1e3).toFixed(1),
1572
+ "s"
1573
+ ] })
1574
+ ] })
1575
+ ]
1576
+ }
1577
+ );
1578
+ },
1579
+ [
1580
+ g,
1581
+ m,
1582
+ w,
1583
+ f,
1584
+ q,
1585
+ _,
1586
+ o,
1587
+ te,
1588
+ J,
1589
+ W,
1590
+ ee,
1591
+ ge,
1592
+ ve,
1593
+ Ye,
1594
+ ce,
1595
+ be,
1596
+ se,
1597
+ v,
1598
+ E,
1599
+ De,
1600
+ s,
1601
+ e.length,
1602
+ Ie,
1603
+ S,
1604
+ c,
1605
+ $
1606
+ ]
1607
+ );
1608
+ if (!n || !v)
1609
+ return null;
1610
+ const Te = typeof document < "u" ? Math.max(document.documentElement.scrollWidth, window.innerWidth) : 0, U = typeof document < "u" ? Math.max(document.documentElement.scrollHeight, window.innerHeight) : 0;
1611
+ return /* @__PURE__ */ M(
1612
+ "div",
1613
+ {
1614
+ className: "nice-tutorial",
1615
+ style: { zIndex: $ },
1616
+ "aria-modal": "true",
1617
+ role: "dialog",
1618
+ "aria-label": "Tutorial",
1619
+ children: [
1620
+ /* @__PURE__ */ M(
1621
+ "svg",
1622
+ {
1623
+ className: "nice-tutorial__overlay",
1624
+ style: {
1625
+ position: "absolute",
1626
+ top: 0,
1627
+ left: 0,
1628
+ width: Te,
1629
+ height: U,
1630
+ pointerEvents: "auto"
1631
+ },
1632
+ onClick: u ? o : void 0,
1633
+ children: [
1634
+ /* @__PURE__ */ t("defs", { children: /* @__PURE__ */ M("mask", { id: "nice-tutorial-mask", children: [
1635
+ /* @__PURE__ */ t("rect", { x: "0", y: "0", width: "100%", height: "100%", fill: "white" }),
1636
+ z && /* @__PURE__ */ t(
1637
+ "rect",
1638
+ {
1639
+ x: z.left,
1640
+ y: z.top,
1641
+ width: z.width,
1642
+ height: z.height,
1643
+ rx: "4",
1644
+ fill: "black",
1645
+ className: i ? "nice-tutorial__spotlight--entering" : ""
1646
+ }
1647
+ )
1648
+ ] }) }),
1649
+ /* @__PURE__ */ t(
1650
+ "rect",
1651
+ {
1652
+ x: "0",
1653
+ y: "0",
1654
+ width: "100%",
1655
+ height: "100%",
1656
+ fill: `rgba(0,0,0,${T})`,
1657
+ mask: "url(#nice-tutorial-mask)"
1658
+ }
1659
+ )
1660
+ ]
1661
+ }
1662
+ ),
1663
+ z && /* @__PURE__ */ t(
1664
+ "div",
1665
+ {
1666
+ className: `nice-tutorial__highlight ${i ? "nice-tutorial__highlight--entering" : ""}`,
1667
+ style: {
1668
+ position: "absolute",
1669
+ top: z.top,
1670
+ left: z.left,
1671
+ width: z.width,
1672
+ height: z.height,
1673
+ transition: `all ${C}ms ease`
1674
+ }
1675
+ }
1676
+ ),
1677
+ v.disableInteraction && z && /* @__PURE__ */ t(
1678
+ "div",
1679
+ {
1680
+ className: "nice-tutorial__blocker",
1681
+ style: {
1682
+ position: "absolute",
1683
+ top: z.top,
1684
+ left: z.left,
1685
+ width: z.width,
1686
+ height: z.height
1687
+ }
1688
+ }
1689
+ ),
1690
+ /* @__PURE__ */ M(
1691
+ "div",
1692
+ {
1693
+ ref: Y,
1694
+ className: `nice-tutorial__tooltip nice-tutorial__tooltip--${ye.actualPlacement} ${i ? "nice-tutorial__tooltip--entering" : ""}`,
1695
+ style: {
1696
+ position: "absolute",
1697
+ top: ye.top,
1698
+ left: ye.left,
1699
+ transition: `all ${C}ms ease`,
1700
+ maxWidth: 380,
1701
+ zIndex: $ + 1
1702
+ },
1703
+ children: [
1704
+ v.showArrow !== !1 && /* @__PURE__ */ t(
1705
+ "div",
1706
+ {
1707
+ className: `nice-tutorial__arrow nice-tutorial__arrow--${ye.actualPlacement}`
1708
+ }
1709
+ ),
1710
+ /* @__PURE__ */ M("div", { className: "nice-tutorial__header", children: [
1711
+ /* @__PURE__ */ t("h4", { className: "nice-tutorial__title", children: v.title }),
1712
+ m && /* @__PURE__ */ t(
1713
+ "button",
1714
+ {
1715
+ type: "button",
1716
+ className: "nice-tutorial__close",
1717
+ onClick: o,
1718
+ "aria-label": Ce,
1719
+ title: Ce,
1720
+ children: /* @__PURE__ */ t(Dt, {})
1721
+ }
1722
+ )
1723
+ ] }),
1724
+ /* @__PURE__ */ t(
1725
+ "div",
1726
+ {
1727
+ className: "nice-tutorial__content",
1728
+ dangerouslySetInnerHTML: { __html: Et(v.content) }
1729
+ }
1730
+ ),
1731
+ l === "inline" && Z(!0)
1732
+ ]
1733
+ }
1734
+ ),
1735
+ l === "floating-bottom" && Z(!1)
1736
+ ]
1737
+ }
1738
+ );
1739
+ };
1740
+ it.displayName = "NiceTutorial";
1741
+ const ot = tt({
1742
+ startTutorial: () => {
1743
+ },
1744
+ stopTutorial: () => {
1745
+ },
1746
+ isActive: !1,
1747
+ currentStep: 0,
1748
+ nextStep: () => {
1749
+ },
1750
+ prevStep: () => {
1751
+ },
1752
+ goToStep: () => {
1753
+ }
1754
+ });
1755
+ function pn() {
1756
+ return Ve(ot);
1757
+ }
1758
+ const At = ({ children: e }) => {
1759
+ const [n, r] = D([]), [o, d] = D(!1), [a, u] = D(0), w = k((l) => {
1760
+ r(l), u(0), d(!0);
1761
+ }, []), m = k(() => {
1762
+ d(!1), u(0), r([]);
1763
+ }, []), N = k(() => {
1764
+ u((l) => Math.min(l + 1, n.length - 1));
1765
+ }, [n.length]), C = k(() => {
1766
+ u((l) => Math.max(l - 1, 0));
1767
+ }, []), T = k(
1768
+ (l) => {
1769
+ u(Math.max(0, Math.min(l, n.length - 1)));
1770
+ },
1771
+ [n.length]
1772
+ ), $ = {
1773
+ startTutorial: w,
1774
+ stopTutorial: m,
1775
+ isActive: o,
1776
+ currentStep: a,
1777
+ nextStep: N,
1778
+ prevStep: C,
1779
+ goToStep: T
1780
+ };
1781
+ return /* @__PURE__ */ M(ot.Provider, { value: $, children: [
1782
+ e,
1783
+ o && n.length > 0 && /* @__PURE__ */ t(
1784
+ it,
1785
+ {
1786
+ steps: n,
1787
+ active: o,
1788
+ onFinish: m,
1789
+ onSkip: m,
1790
+ onStepChange: u
1791
+ }
1792
+ )
1793
+ ] });
1794
+ };
1795
+ At.displayName = "NiceTutorialProvider";
1796
+ function Kt(e, n, r, o, d) {
1797
+ const a = e <= d, u = e + d >= r, w = n <= d, m = n + d >= o;
1798
+ return w && a ? "top-left" : w && u ? "top-right" : m && a ? "bottom-left" : m && u ? "bottom-right" : a ? "left" : u ? "right" : w ? "top" : m ? "bottom" : "none";
1799
+ }
1800
+ function Ft(e) {
1801
+ switch (e) {
1802
+ case "left":
1803
+ return { left: 0, top: 0, width: "50%", height: "100%" };
1804
+ case "right":
1805
+ return { left: "50%", top: 0, width: "50%", height: "100%" };
1806
+ case "top":
1807
+ return { left: 0, top: 0, width: "100%", height: "50%" };
1808
+ case "bottom":
1809
+ return { left: 0, top: "50%", width: "100%", height: "50%" };
1810
+ case "top-left":
1811
+ return { left: 0, top: 0, width: "50%", height: "50%" };
1812
+ case "top-right":
1813
+ return { left: "50%", top: 0, width: "50%", height: "50%" };
1814
+ case "bottom-left":
1815
+ return { left: 0, top: "50%", width: "50%", height: "50%" };
1816
+ case "bottom-right":
1817
+ return { left: "50%", top: "50%", width: "50%", height: "50%" };
1818
+ default:
1819
+ return null;
1820
+ }
1821
+ }
1822
+ const Ut = Qe(
1823
+ ({
1824
+ windowKey: e,
1825
+ title: n,
1826
+ icon: r,
1827
+ children: o,
1828
+ footer: d,
1829
+ x: a,
1830
+ y: u,
1831
+ defaultPosition: w,
1832
+ width: m = 480,
1833
+ height: N = 360,
1834
+ minWidth: C = 200,
1835
+ minHeight: T = 120,
1836
+ maxWidth: $,
1837
+ maxHeight: l,
1838
+ zIndex: f = 1,
1839
+ closable: g = !0,
1840
+ minimizable: h = !0,
1841
+ maximizable: c = !0,
1842
+ fullscreenable: b = !1,
1843
+ pinnable: s = !1,
1844
+ resizable: L = !0,
1845
+ draggable: z = !0,
1846
+ snappable: O = !0,
1847
+ snapThreshold: H = 20,
1848
+ minimized: x,
1849
+ maximized: i,
1850
+ fullscreen: y,
1851
+ pinned: E,
1852
+ focused: I,
1853
+ onClose: S,
1854
+ onMinimize: P,
1855
+ onMaximize: Y,
1856
+ onFullscreen: p,
1857
+ onPin: v,
1858
+ onFocus: _,
1859
+ onMove: q,
1860
+ onResize: W,
1861
+ onSnap: J,
1862
+ onTitleBarDoubleClick: ee,
1863
+ size: te = "md",
1864
+ statusBar: ce,
1865
+ titleBarActions: ge,
1866
+ className: ve,
1867
+ style: Ye,
1868
+ id: Ce,
1869
+ accessMode: se,
1870
+ ...be
1871
+ }, De) => {
1872
+ const ye = Ge(Ce), Ie = Mt(se, Ce), { t: Z } = Pe(), Te = K(null);
1873
+ Te.current == null && (Te.current = `nice-window-${Math.random().toString(36).slice(2, 10)}`);
1874
+ const U = e ?? Te.current, X = a ?? w?.x ?? 100, A = u ?? w?.y ?? 100, [G, ne] = D({ x: X, y: A }), [xe, Ne] = D({ width: m, height: N }), [He, rt] = D(!1), [ct, st] = D(!1), [lt, at] = D(!1), [dt, ut] = D(!1), [oe, qe] = D("none"), mt = x ?? He, ie = i ?? ct, V = y ?? lt, $e = E ?? dt, We = I ?? !0, pe = G.x, we = G.y, le = xe.width, ae = xe.height, de = K(
1875
+ null
1876
+ ), Q = K(null), F = K(null), ht = k(() => {
1877
+ S?.(U);
1878
+ }, [U, S]), ft = k(() => {
1879
+ rt(!0), P?.(U);
1880
+ }, [U, P]), Ae = k(() => {
1881
+ const R = !ie;
1882
+ st(R), !R && F.current ? (ne({ x: F.current.x, y: F.current.y }), Ne({ width: F.current.w, height: F.current.h }), F.current = null) : R && (F.current = { x: pe, y: we, w: le, h: ae }), qe("none"), Y?.(U, R);
1883
+ }, [U, ie, pe, we, le, ae, Y]), Ke = k(() => {
1884
+ const R = !V;
1885
+ at(R), R ? F.current = { x: pe, y: we, w: le, h: ae } : F.current && (ne({ x: F.current.x, y: F.current.y }), Ne({ width: F.current.w, height: F.current.h }), F.current = null), p?.(U, R);
1886
+ }, [U, V, pe, we, le, ae, p]), pt = k(() => {
1887
+ const R = !$e;
1888
+ ut(R), v?.(U, R);
1889
+ }, [U, $e, v]), Le = k(() => {
1890
+ _?.(U);
1891
+ }, [U, _]), wt = k(() => {
1892
+ ee ? ee(U) : c && Ae();
1893
+ }, [U, c, Ae, ee]);
1894
+ B(() => {
1895
+ const R = (ue) => {
1896
+ if (!de.current)
1897
+ return;
1898
+ const re = ue.clientX - de.current.startX + de.current.origX, Re = ue.clientY - de.current.startY + de.current.origY;
1899
+ ne({ x: re, y: Re }), q?.(U, { x: re, y: Re });
1900
+ }, j = (ue) => {
1901
+ if (de.current) {
1902
+ if (O) {
1903
+ const re = Kt(
1904
+ ue.clientX,
1905
+ ue.clientY,
1906
+ window.innerWidth,
1907
+ window.innerHeight,
1908
+ H
1909
+ );
1910
+ re !== "none" && (F.current = { x: G.x, y: G.y, w: le, h: ae }, qe(re), J?.(U, re));
1911
+ }
1912
+ de.current = null;
1913
+ }
1914
+ };
1915
+ return document.addEventListener("mousemove", R), document.addEventListener("mouseup", j), () => {
1916
+ document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", j);
1917
+ };
1918
+ });
1919
+ const _t = k(
1920
+ (R) => {
1921
+ !z || ie || V || (R.preventDefault(), oe !== "none" && (F.current && (ne({ x: F.current.x, y: F.current.y }), Ne({ width: F.current.w, height: F.current.h })), qe("none")), Le(), de.current = { startX: R.clientX, startY: R.clientY, origX: pe, origY: we });
1922
+ },
1923
+ [z, ie, V, oe, pe, we, Le]
1924
+ );
1925
+ B(() => {
1926
+ const R = (ue) => {
1927
+ if (!Q.current)
1928
+ return;
1929
+ const re = ue.clientX - Q.current.startX, Re = ue.clientY - Q.current.startY, ke = Q.current.handle;
1930
+ let me = Q.current.origW, he = Q.current.origH;
1931
+ if (ke.includes("e") && (me = Q.current.origW + re), ke.includes("w") && (me = Q.current.origW - re), ke.includes("s") && (he = Q.current.origH + Re), ke.includes("n") && (he = Q.current.origH - Re), me = Math.max(C, $ ? Math.min($, me) : me), he = Math.max(T, l ? Math.min(l, he) : he), ke.includes("w")) {
1932
+ const Fe = xe.width - me;
1933
+ ne((Se) => ({ ...Se, x: Se.x + Fe }));
1934
+ }
1935
+ if (ke.includes("n")) {
1936
+ const Fe = xe.height - he;
1937
+ ne((Se) => ({ ...Se, y: Se.y + Fe }));
1938
+ }
1939
+ Ne({ width: me, height: he }), W?.(U, { width: me, height: he });
1940
+ }, j = () => {
1941
+ Q.current = null;
1942
+ };
1943
+ return document.addEventListener("mousemove", R), document.addEventListener("mouseup", j), () => {
1944
+ document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", j);
1945
+ };
1946
+ });
1947
+ const gt = k(
1948
+ (R, j) => {
1949
+ !L || ie || V || oe !== "none" || (j.preventDefault(), j.stopPropagation(), Le(), Q.current = { startX: j.clientX, startY: j.clientY, origW: le, origH: ae, handle: R });
1950
+ },
1951
+ [L, ie, V, oe, le, ae, Le]
1952
+ );
1953
+ if (B(() => {
1954
+ if (!We)
1955
+ return;
1956
+ const R = (j) => {
1957
+ j.key === "Escape" && V && Ke();
1958
+ };
1959
+ return document.addEventListener("keydown", R), () => document.removeEventListener("keydown", R);
1960
+ }, [We, V, Ke]), Ie === "hidden" || mt)
1961
+ return null;
1962
+ const Ze = oe !== "none" ? Ft(oe) : null, Je = ie || V, vt = V ? { position: "fixed", top: 0, left: 0, width: "100vw", height: "100vh", zIndex: 999999 } : ie ? { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", zIndex: f } : Ze ? { position: "absolute", ...Ze, zIndex: f } : { position: "absolute", top: we, left: pe, width: le, height: ae, zIndex: f }, bt = ["n", "e", "s", "w", "ne", "se", "sw", "nw"], yt = {
1963
+ n: "ns-resize",
1964
+ s: "ns-resize",
1965
+ e: "ew-resize",
1966
+ w: "ew-resize",
1967
+ ne: "nesw-resize",
1968
+ sw: "nesw-resize",
1969
+ nw: "nwse-resize",
1970
+ se: "nwse-resize"
1971
+ };
1972
+ return /* @__PURE__ */ M(
1973
+ "div",
1974
+ {
1975
+ ref: De,
1976
+ id: ye,
1977
+ className: `nice-window nice-window--${te} ${We ? "nice-window--focused" : ""} ${$e ? "nice-window--pinned" : ""} ${Je ? "nice-window--maximized" : ""} ${oe !== "none" ? `nice-window--snapped-${oe}` : ""} ${ve ?? ""}`,
1978
+ style: { ...vt, ...Ye },
1979
+ onMouseDown: Le,
1980
+ role: "dialog",
1981
+ "aria-label": n,
1982
+ ...be,
1983
+ children: [
1984
+ /* @__PURE__ */ M(
1985
+ "div",
1986
+ {
1987
+ className: "nice-window__titlebar",
1988
+ onMouseDown: _t,
1989
+ onDoubleClick: wt,
1990
+ children: [
1991
+ r && /* @__PURE__ */ t("span", { className: "nice-window__icon", children: r }),
1992
+ /* @__PURE__ */ t("span", { className: "nice-window__title", children: n }),
1993
+ /* @__PURE__ */ M("div", { className: "nice-window__actions", children: [
1994
+ ge,
1995
+ s && /* @__PURE__ */ t(
1996
+ "button",
1997
+ {
1998
+ type: "button",
1999
+ className: `nice-window__action nice-window__action--pin ${$e ? "nice-window__action--active" : ""}`,
2000
+ onClick: pt,
2001
+ title: $e ? Z("window.unpin", "Unpin") : Z("window.pin", "Pin"),
2002
+ children: /* @__PURE__ */ t(fe, { name: "paperclip", size: 14 })
2003
+ }
2004
+ ),
2005
+ h && /* @__PURE__ */ t(
2006
+ "button",
2007
+ {
2008
+ type: "button",
2009
+ className: "nice-window__action nice-window__action--minimize",
2010
+ onClick: ft,
2011
+ title: Z("window.minimize", "Minimize"),
2012
+ children: /* @__PURE__ */ t(fe, { name: "minus", size: 14 })
2013
+ }
2014
+ ),
2015
+ c && /* @__PURE__ */ t(
2016
+ "button",
2017
+ {
2018
+ type: "button",
2019
+ className: "nice-window__action nice-window__action--maximize",
2020
+ onClick: Ae,
2021
+ title: ie ? Z("window.restore", "Restore") : Z("window.maximize", "Maximize"),
2022
+ children: /* @__PURE__ */ t(fe, { name: ie ? "copy" : "window", size: 14 })
2023
+ }
2024
+ ),
2025
+ b && /* @__PURE__ */ t(
2026
+ "button",
2027
+ {
2028
+ type: "button",
2029
+ className: "nice-window__action nice-window__action--fullscreen",
2030
+ onClick: Ke,
2031
+ title: V ? Z("window.exitFullscreen", "Exit Full Screen") : Z("window.fullscreen", "Full Screen"),
2032
+ children: /* @__PURE__ */ t(fe, { name: V ? "collapse" : "expand", size: 14 })
2033
+ }
2034
+ ),
2035
+ g && /* @__PURE__ */ t(
2036
+ "button",
2037
+ {
2038
+ type: "button",
2039
+ className: "nice-window__action nice-window__action--close",
2040
+ onClick: ht,
2041
+ title: Z("window.close", "Close"),
2042
+ children: /* @__PURE__ */ t(fe, { name: "close", size: 14 })
2043
+ }
2044
+ )
2045
+ ] })
2046
+ ]
2047
+ }
2048
+ ),
2049
+ /* @__PURE__ */ t("div", { className: "nice-window__body", children: o }),
2050
+ d && /* @__PURE__ */ t("div", { className: "nice-window__footer", children: d }),
2051
+ ce && /* @__PURE__ */ t("div", { className: "nice-window__statusbar", children: ce }),
2052
+ L && !Je && oe === "none" && /* @__PURE__ */ t(_e, { children: bt.map((R) => /* @__PURE__ */ t(
2053
+ "div",
2054
+ {
2055
+ className: `nice-window__resize nice-window__resize--${R}`,
2056
+ style: { cursor: yt[R] },
2057
+ onMouseDown: (j) => gt(R, j)
2058
+ },
2059
+ R
2060
+ )) })
2061
+ ]
2062
+ }
2063
+ );
2064
+ }
2065
+ );
2066
+ Ut.displayName = "NiceWindow";
2067
+ export {
2068
+ Zt as N,
2069
+ Rt as a,
2070
+ tn as b,
2071
+ Lt as c,
2072
+ en as d,
2073
+ ln as e,
2074
+ an as f,
2075
+ sn as g,
2076
+ un as h,
2077
+ hn as i,
2078
+ dn as j,
2079
+ cn as k,
2080
+ mn as l,
2081
+ Jt as m,
2082
+ on as n,
2083
+ nn as o,
2084
+ rn as p,
2085
+ it as q,
2086
+ At as r,
2087
+ Ut as s,
2088
+ St as t,
2089
+ $t as u,
2090
+ fn as v,
2091
+ Ue as w,
2092
+ It as x,
2093
+ pn as y
2094
+ };