@khencahyo13/notifin-react 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,749 @@
1
+ import de, { useSyncExternalStore as ue, useEffect as Z, useState as me, useMemo as he } from "react";
2
+ import * as b from "@radix-ui/react-alert-dialog";
3
+ import { Root as be } from "@radix-ui/react-visually-hidden";
4
+ import { clsx as pe } from "clsx";
5
+ import { twMerge as ge } from "tailwind-merge";
6
+ const ve = ":root{--nf-overlay-bg: rgb(0 0 0 / .5);--nf-content-width: min(92vw, 24rem);--nf-content-max-height: 90dvh;--nf-content-radius: .75rem;--nf-content-padding: 1rem;--nf-content-shadow: 0 20px 30px -12px rgb(0 0 0 / .25);--nf-text-title-size: 1rem;--nf-text-title-weight: 600;--nf-text-description-size: .875rem;--nf-text-pending-size: .75rem;--nf-icon-wrap-size: 1.75rem;--nf-icon-size: 1rem;--nf-button-height: 2rem;--nf-button-radius: .375rem;--nf-button-padding-x: 1rem;--nf-button-font-size: .875rem;--nf-button-min-width-sm: 6rem;--nf-focus-ring: 0 0 0 2px #a3a3a3}.nf-icon-wrap{flex-shrink:0;display:flex;width:var(--nf-icon-wrap-size);height:var(--nf-icon-wrap-size);align-items:center;justify-content:center;border:1px solid transparent;border-radius:9999px}.nf-icon{width:var(--nf-icon-size);height:var(--nf-icon-size)}.nf-icon-spin{animation:nf-spin 1s linear infinite}.nf-title{margin:0;font-size:var(--nf-text-title-size);font-weight:var(--nf-text-title-weight);line-height:1.35;word-break:break-word}.nf-description{margin:0;color:#525252;font-size:var(--nf-text-description-size);line-height:1.45;word-break:break-word}.nf-pending{color:#737373;font-size:var(--nf-text-pending-size)}.nf-button{height:var(--nf-button-height);width:100%;min-width:0;display:inline-flex;align-items:center;justify-content:center;padding:0 var(--nf-button-padding-x);border-radius:var(--nf-button-radius);border:1px solid transparent;font-size:var(--nf-button-font-size);font-weight:500;line-height:1;cursor:pointer;transition:background-color .15s ease,color .15s ease,border-color .15s ease}.nf-button:focus-visible{outline:none;box-shadow:var(--nf-focus-ring)}.nf-button:disabled{cursor:not-allowed;opacity:.6}.nf-button-cancel{border-color:#d4d4d4;background:#fff;color:#404040}.nf-button-cancel:hover:not(:disabled){background:#f5f5f5}.nf-button-action{color:#fff}@media(min-width:640px){.nf-button{width:auto;min-width:var(--nf-button-min-width-sm)}}.nf-title-row{display:flex;align-items:center;gap:.5rem}.nf-actions{display:flex;width:100%;align-items:center;gap:.5rem}@media(min-width:640px){.nf-actions{justify-content:flex-end}}.nf-overlay{position:fixed;inset:0;z-index:50;background:var(--nf-overlay-bg)}.nf-content{position:fixed;top:50%;left:50%;z-index:50;width:var(--nf-content-width);max-height:var(--nf-content-max-height);overflow-y:auto;transform:translate(-50%,-50%);border:1px solid transparent;border-radius:var(--nf-content-radius);padding:var(--nf-content-padding);box-shadow:var(--nf-content-shadow);outline:none}.nf-header{display:grid;gap:.375rem}.nf-footer{margin-top:1rem;display:grid;gap:.5rem}.nf-action-default{background:#171717}.nf-action-default:hover:not(:disabled){background:#262626}.nf-action-error{background:#dc2626}.nf-action-error:hover:not(:disabled){background:#b91c1c}.nf-action-info{background:#2563eb}.nf-action-info:hover:not(:disabled){background:#1d4ed8}.nf-action-success{background:#16a34a}.nf-action-success:hover:not(:disabled){background:#15803d}.nf-action-warning{background:#ca8a04}.nf-action-warning:hover:not(:disabled){background:#a16207}.nf-dialog-tone-default{border-color:#e5e5e5;background:#fff;color:#0a0a0a}.nf-dialog-tone-error{border-color:#fecaca;background:#fff;color:#7f1d1d}.nf-dialog-tone-info{border-color:#bfdbfe;background:#fff;color:#1e3a8a}.nf-dialog-tone-loading{border-color:#e5e5e5;background:#fff;color:#0a0a0a}.nf-dialog-tone-success{border-color:#bbf7d0;background:#fff;color:#14532d}.nf-dialog-tone-warning{border-color:#fde68a;background:#fff;color:#713f12}.nf-icon-tone-default{border-color:#e5e5e5;background:#f5f5f5;color:#404040}.nf-icon-tone-error{border-color:#fca5a5;background:#fef2f2;color:#dc2626}.nf-icon-tone-info{border-color:#93c5fd;background:#eff6ff;color:#2563eb}.nf-icon-tone-loading{border-color:#e5e5e5;background:#f5f5f5;color:#525252}.nf-icon-tone-success{border-color:#86efac;background:#f0fdf4;color:#16a34a}.nf-icon-tone-warning{border-color:#fcd34d;background:#fefce8;color:#ca8a04}.nf-scheme-dark{--nf-overlay-bg: rgb(0 0 0 / .72);--nf-content-shadow: 0 20px 35px -14px rgb(0 0 0 / .7);--nf-focus-ring: 0 0 0 2px #525252}.nf-scheme-dark.nf-dialog-tone-default,.nf-scheme-dark.nf-dialog-tone-loading{border-color:#404040;background:#171717;color:#fafafa}.nf-scheme-dark.nf-dialog-tone-error{border-color:#7f1d1d;background:#1f1416;color:#fecaca}.nf-scheme-dark.nf-dialog-tone-info{border-color:#1e3a8a;background:#111827;color:#bfdbfe}.nf-scheme-dark.nf-dialog-tone-success{border-color:#14532d;background:#0d1f14;color:#bbf7d0}.nf-scheme-dark.nf-dialog-tone-warning{border-color:#713f12;background:#22180b;color:#fde68a}.nf-scheme-dark .nf-description{color:#d4d4d4}.nf-scheme-dark .nf-pending{color:#a3a3a3}.nf-scheme-dark .nf-button-cancel{border-color:#525252;background:#262626;color:#f5f5f5}.nf-scheme-dark .nf-button-cancel:hover:not(:disabled){background:#333}.nf-scheme-dark .nf-icon-tone-default,.nf-scheme-dark .nf-icon-tone-loading{border-color:#525252;background:#262626;color:#d4d4d4}.nf-scheme-dark .nf-icon-tone-error{border-color:#7f1d1d;background:#2b1318;color:#f87171}.nf-scheme-dark .nf-icon-tone-info{border-color:#1d4ed8;background:#172554;color:#93c5fd}.nf-scheme-dark .nf-icon-tone-success{border-color:#166534;background:#13271a;color:#86efac}.nf-scheme-dark .nf-icon-tone-warning{border-color:#92400e;background:#2c2110;color:#facc15}.nf-overlay:not(.nf-motion-none)[data-state=open]{animation:nf-fade-in .2s ease-out both}.nf-overlay:not(.nf-motion-none)[data-state=closed]{animation:nf-fade-out .2s ease-in both}.nf-content.nf-motion-subtle[data-state=open]{animation:nf-fade-in .2s ease-out both,nf-zoom-in-subtle .2s ease-out both}.nf-content.nf-motion-subtle[data-state=closed]{animation:nf-fade-out .2s ease-in both,nf-zoom-out-subtle .2s ease-in both}.nf-content.nf-motion-slide[data-state=open]{animation:nf-fade-in .22s ease-out both,nf-slide-in-top .22s ease-out both}.nf-content.nf-motion-slide[data-state=closed]{animation:nf-fade-out .18s ease-in both,nf-slide-out-top .2s ease-in both}.nf-content.nf-motion-scale[data-state=open]{animation:nf-fade-in .2s ease-out both,nf-scale-in .2s ease-out both}.nf-content.nf-motion-scale[data-state=closed]{animation:nf-fade-out .18s ease-in both,nf-scale-out .18s ease-in both}.nf-content.nf-motion-bounce[data-state=open]{animation:nf-fade-in .24s ease-out both,nf-bounce-in .24s cubic-bezier(.2,.8,.2,1) both}.nf-content.nf-motion-bounce[data-state=closed]{animation:nf-fade-out .18s ease-in both,nf-bounce-out .18s ease-in both}.nf-content.nf-motion-none,.nf-overlay.nf-motion-none{animation:none!important;transition:none!important}@media(prefers-reduced-motion:reduce){.nf-overlay,.nf-content,.nf-icon-spin{animation:none!important;transition:none!important}}@keyframes nf-fade-in{0%{opacity:0}to{opacity:1}}@keyframes nf-fade-out{0%{opacity:1}to{opacity:0}}@keyframes nf-zoom-in-subtle{0%{transform:translate(-50%,-50%) scale(.95)}to{transform:translate(-50%,-50%) scale(1)}}@keyframes nf-zoom-out-subtle{0%{transform:translate(-50%,-50%) scale(1)}to{transform:translate(-50%,-50%) scale(.95)}}@keyframes nf-slide-in-top{0%{transform:translate(-50%,calc(-50% - 8px))}to{transform:translate(-50%,-50%)}}@keyframes nf-slide-out-top{0%{transform:translate(-50%,-50%)}to{transform:translate(-50%,calc(-50% - 8px))}}@keyframes nf-scale-in{0%{transform:translate(-50%,-50%) scale(.9)}to{transform:translate(-50%,-50%) scale(1)}}@keyframes nf-scale-out{0%{transform:translate(-50%,-50%) scale(1)}to{transform:translate(-50%,-50%) scale(.9)}}@keyframes nf-bounce-in{0%{transform:translate(-50%,calc(-50% - 12px)) scale(.92)}60%{transform:translate(-50%,-50%) scale(1.03)}to{transform:translate(-50%,-50%) scale(1)}}@keyframes nf-bounce-out{0%{transform:translate(-50%,-50%) scale(1)}to{transform:translate(-50%,calc(-50% - 8px)) scale(.95)}}@keyframes nf-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}", q = "notifin-style";
7
+ let M = !1;
8
+ function ke() {
9
+ if (M || typeof document > "u")
10
+ return;
11
+ if (document.getElementById(q)) {
12
+ M = !0;
13
+ return;
14
+ }
15
+ const t = document.createElement("style");
16
+ t.id = q, t.textContent = ve, document.head.appendChild(t), M = !0;
17
+ }
18
+ const xe = 120, ye = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}`;
19
+ class we {
20
+ constructor() {
21
+ this.listeners = /* @__PURE__ */ new Set(), this.dialogs = /* @__PURE__ */ new Map(), this.order = [], this.activeId = null, this.snapshot = {
22
+ current: null,
23
+ pendingCount: 0
24
+ }, this.removeTimeouts = /* @__PURE__ */ new Map(), this.durationTimeouts = /* @__PURE__ */ new Map(), this.hostCount = 0;
25
+ }
26
+ subscribe(n) {
27
+ return this.listeners.add(n), () => this.listeners.delete(n);
28
+ }
29
+ registerHost() {
30
+ return this.hostCount += 1, () => {
31
+ this.hostCount = Math.max(0, this.hostCount - 1);
32
+ };
33
+ }
34
+ hasHost() {
35
+ return this.hostCount > 0;
36
+ }
37
+ getSnapshot() {
38
+ return this.snapshot;
39
+ }
40
+ create(n, r, s = {}) {
41
+ const o = s.id ?? ye(), c = this.dialogs.get(o), f = this.activeId === o || this.activeId === null, m = {
42
+ action: s.action,
43
+ allowEscapeClose: s.allowEscapeClose,
44
+ cancel: s.cancel,
45
+ createdAt: c?.createdAt ?? Date.now(),
46
+ description: s.description,
47
+ dismissible: s.dismissible ?? !0,
48
+ duration: s.duration,
49
+ id: o,
50
+ onDismiss: s.onDismiss,
51
+ open: f,
52
+ title: r,
53
+ type: n
54
+ };
55
+ return this.clearDurationTimer(o), this.clearRemoveTimer(o), this.dialogs.set(o, m), this.order.includes(o) || this.order.push(o), this.activeId === null && (this.activeId = o, this.startDurationTimer(o)), this.emit(), o;
56
+ }
57
+ update(n, r) {
58
+ const s = this.dialogs.get(n);
59
+ if (!s)
60
+ return;
61
+ const o = {
62
+ ...s,
63
+ ...r,
64
+ createdAt: s.createdAt,
65
+ id: n
66
+ };
67
+ this.dialogs.set(n, o), this.activeId === n && this.startDurationTimer(n), this.emit();
68
+ }
69
+ dismiss(n) {
70
+ if (!n) {
71
+ this.activeId && this.dismissActive(this.activeId);
72
+ return;
73
+ }
74
+ if (this.activeId === n) {
75
+ this.dismissActive(n);
76
+ return;
77
+ }
78
+ this.removeImmediately(n);
79
+ }
80
+ dismissActive(n) {
81
+ const r = this.dialogs.get(n);
82
+ if (!r || !r.open)
83
+ return;
84
+ this.clearDurationTimer(n), this.dialogs.set(n, {
85
+ ...r,
86
+ open: !1
87
+ }), this.emit();
88
+ const s = setTimeout(() => {
89
+ this.removeImmediately(n), this.promoteNext();
90
+ }, xe);
91
+ this.removeTimeouts.set(n, s);
92
+ }
93
+ removeImmediately(n) {
94
+ const r = this.dialogs.get(n);
95
+ r && (this.clearDurationTimer(n), this.clearRemoveTimer(n), this.dialogs.delete(n), this.order = this.order.filter((s) => s !== n), this.activeId === n && (this.activeId = null), r.onDismiss?.(), this.emit());
96
+ }
97
+ promoteNext() {
98
+ if (this.activeId !== null)
99
+ return;
100
+ const n = this.order[0];
101
+ if (!n)
102
+ return;
103
+ const r = this.dialogs.get(n);
104
+ if (!r) {
105
+ this.order.shift(), this.promoteNext();
106
+ return;
107
+ }
108
+ this.activeId = n, this.dialogs.set(n, {
109
+ ...r,
110
+ open: !0
111
+ }), this.startDurationTimer(n), this.emit();
112
+ }
113
+ startDurationTimer(n) {
114
+ this.clearDurationTimer(n);
115
+ const r = this.dialogs.get(n);
116
+ if (!r?.duration || this.activeId !== n)
117
+ return;
118
+ const s = setTimeout(() => this.dismiss(n), r.duration);
119
+ this.durationTimeouts.set(n, s);
120
+ }
121
+ clearDurationTimer(n) {
122
+ const r = this.durationTimeouts.get(n);
123
+ r && (clearTimeout(r), this.durationTimeouts.delete(n));
124
+ }
125
+ clearRemoveTimer(n) {
126
+ const r = this.removeTimeouts.get(n);
127
+ r && (clearTimeout(r), this.removeTimeouts.delete(n));
128
+ }
129
+ emit() {
130
+ const n = this.activeId ? this.dialogs.get(this.activeId) ?? null : null, r = Math.max(this.order.length - (n ? 1 : 0), 0);
131
+ this.snapshot = {
132
+ current: n,
133
+ pendingCount: r
134
+ };
135
+ for (const s of this.listeners)
136
+ s();
137
+ }
138
+ }
139
+ const h = new we();
140
+ function Y() {
141
+ if (!h.hasHost())
142
+ throw new Error(
143
+ "[notifin] <Notifin /> is not mounted. Render <Notifin /> once in your app root before calling notifin(...)."
144
+ );
145
+ }
146
+ function L(t) {
147
+ return typeof t == "string" ? {
148
+ title: t
149
+ } : t;
150
+ }
151
+ function J(t, n) {
152
+ return typeof t == "function" ? t(n) : t;
153
+ }
154
+ function g(t, n, r) {
155
+ return Y(), h.create(t, n, r);
156
+ }
157
+ const We = Object.assign(
158
+ (t, n) => g("default", t, n),
159
+ {
160
+ dismiss: (t) => {
161
+ Y(), h.dismiss(t);
162
+ },
163
+ error: (t, n) => g("error", t, n),
164
+ info: (t, n) => g("info", t, n),
165
+ loading: (t, n) => g("loading", t, { dismissible: !1, ...n }),
166
+ async promise(t, n) {
167
+ const r = L(n.loading), s = g(
168
+ "loading",
169
+ r.title ?? "Loading...",
170
+ {
171
+ dismissible: !1,
172
+ ...r
173
+ }
174
+ );
175
+ try {
176
+ const o = await t, c = J(n.success, o), f = L(c);
177
+ return h.update(s, {
178
+ ...f,
179
+ dismissible: f.dismissible ?? !0,
180
+ open: !0,
181
+ title: f.title ?? "Success",
182
+ type: "success"
183
+ }), o;
184
+ } catch (o) {
185
+ const c = J(n.error, o), f = L(c);
186
+ throw h.update(s, {
187
+ ...f,
188
+ dismissible: f.dismissible ?? !0,
189
+ open: !0,
190
+ title: f.title ?? "Something went wrong",
191
+ type: "error"
192
+ }), o;
193
+ }
194
+ },
195
+ success: (t, n) => g("success", t, n),
196
+ update: (t, n) => {
197
+ Y(), h.update(t, {
198
+ ...n,
199
+ title: n.title,
200
+ type: n.type
201
+ });
202
+ },
203
+ warning: (t, n) => g("warning", t, n)
204
+ }
205
+ );
206
+ var S = { exports: {} }, j = {};
207
+ var H;
208
+ function Te() {
209
+ if (H) return j;
210
+ H = 1;
211
+ var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), n = /* @__PURE__ */ Symbol.for("react.fragment");
212
+ function r(s, o, c) {
213
+ var f = null;
214
+ if (c !== void 0 && (f = "" + c), o.key !== void 0 && (f = "" + o.key), "key" in o) {
215
+ c = {};
216
+ for (var m in o)
217
+ m !== "key" && (c[m] = o[m]);
218
+ } else c = o;
219
+ return o = c.ref, {
220
+ $$typeof: t,
221
+ type: s,
222
+ key: f,
223
+ ref: o !== void 0 ? o : null,
224
+ props: c
225
+ };
226
+ }
227
+ return j.Fragment = n, j.jsx = r, j.jsxs = r, j;
228
+ }
229
+ var _ = {};
230
+ var G;
231
+ function Ee() {
232
+ return G || (G = 1, process.env.NODE_ENV !== "production" && (function() {
233
+ function t(e) {
234
+ if (e == null) return null;
235
+ if (typeof e == "function")
236
+ return e.$$typeof === ce ? null : e.displayName || e.name || null;
237
+ if (typeof e == "string") return e;
238
+ switch (e) {
239
+ case A:
240
+ return "Fragment";
241
+ case ee:
242
+ return "Profiler";
243
+ case K:
244
+ return "StrictMode";
245
+ case re:
246
+ return "Suspense";
247
+ case se:
248
+ return "SuspenseList";
249
+ case ae:
250
+ return "Activity";
251
+ }
252
+ if (typeof e == "object")
253
+ switch (typeof e.tag == "number" && console.error(
254
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
255
+ ), e.$$typeof) {
256
+ case N:
257
+ return "Portal";
258
+ case te:
259
+ return e.displayName || "Context";
260
+ case ne:
261
+ return (e._context.displayName || "Context") + ".Consumer";
262
+ case oe:
263
+ var i = e.render;
264
+ return e = e.displayName, e || (e = i.displayName || i.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
265
+ case ie:
266
+ return i = e.displayName || null, i !== null ? i : t(e.type) || "Memo";
267
+ case I:
268
+ i = e._payload, e = e._init;
269
+ try {
270
+ return t(e(i));
271
+ } catch {
272
+ }
273
+ }
274
+ return null;
275
+ }
276
+ function n(e) {
277
+ return "" + e;
278
+ }
279
+ function r(e) {
280
+ try {
281
+ n(e);
282
+ var i = !1;
283
+ } catch {
284
+ i = !0;
285
+ }
286
+ if (i) {
287
+ i = console;
288
+ var l = i.error, d = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
289
+ return l.call(
290
+ i,
291
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
292
+ d
293
+ ), n(e);
294
+ }
295
+ }
296
+ function s(e) {
297
+ if (e === A) return "<>";
298
+ if (typeof e == "object" && e !== null && e.$$typeof === I)
299
+ return "<...>";
300
+ try {
301
+ var i = t(e);
302
+ return i ? "<" + i + ">" : "<...>";
303
+ } catch {
304
+ return "<...>";
305
+ }
306
+ }
307
+ function o() {
308
+ var e = O.A;
309
+ return e === null ? null : e.getOwner();
310
+ }
311
+ function c() {
312
+ return Error("react-stack-top-frame");
313
+ }
314
+ function f(e) {
315
+ if ($.call(e, "key")) {
316
+ var i = Object.getOwnPropertyDescriptor(e, "key").get;
317
+ if (i && i.isReactWarning) return !1;
318
+ }
319
+ return e.key !== void 0;
320
+ }
321
+ function m(e, i) {
322
+ function l() {
323
+ W || (W = !0, console.error(
324
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
325
+ i
326
+ ));
327
+ }
328
+ l.isReactWarning = !0, Object.defineProperty(e, "key", {
329
+ get: l,
330
+ configurable: !0
331
+ });
332
+ }
333
+ function T() {
334
+ var e = t(this.type);
335
+ return F[e] || (F[e] = !0, console.error(
336
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
337
+ )), e = this.props.ref, e !== void 0 ? e : null;
338
+ }
339
+ function E(e, i, l, d, C, D) {
340
+ var u = l.ref;
341
+ return e = {
342
+ $$typeof: R,
343
+ type: e,
344
+ key: i,
345
+ props: l,
346
+ _owner: d
347
+ }, (u !== void 0 ? u : null) !== null ? Object.defineProperty(e, "ref", {
348
+ enumerable: !1,
349
+ get: T
350
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
351
+ configurable: !1,
352
+ enumerable: !1,
353
+ writable: !0,
354
+ value: 0
355
+ }), Object.defineProperty(e, "_debugInfo", {
356
+ configurable: !1,
357
+ enumerable: !1,
358
+ writable: !0,
359
+ value: null
360
+ }), Object.defineProperty(e, "_debugStack", {
361
+ configurable: !1,
362
+ enumerable: !1,
363
+ writable: !0,
364
+ value: C
365
+ }), Object.defineProperty(e, "_debugTask", {
366
+ configurable: !1,
367
+ enumerable: !1,
368
+ writable: !0,
369
+ value: D
370
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
371
+ }
372
+ function v(e, i, l, d, C, D) {
373
+ var u = i.children;
374
+ if (u !== void 0)
375
+ if (d)
376
+ if (fe(u)) {
377
+ for (d = 0; d < u.length; d++)
378
+ p(u[d]);
379
+ Object.freeze && Object.freeze(u);
380
+ } else
381
+ console.error(
382
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
383
+ );
384
+ else p(u);
385
+ if ($.call(i, "key")) {
386
+ u = t(e);
387
+ var y = Object.keys(i).filter(function(le) {
388
+ return le !== "key";
389
+ });
390
+ d = 0 < y.length ? "{key: someKey, " + y.join(": ..., ") + ": ...}" : "{key: someKey}", V[u + d] || (y = 0 < y.length ? "{" + y.join(": ..., ") + ": ...}" : "{}", console.error(
391
+ `A props object containing a "key" prop is being spread into JSX:
392
+ let props = %s;
393
+ <%s {...props} />
394
+ React keys must be passed directly to JSX without using spread:
395
+ let props = %s;
396
+ <%s key={someKey} {...props} />`,
397
+ d,
398
+ u,
399
+ y,
400
+ u
401
+ ), V[u + d] = !0);
402
+ }
403
+ if (u = null, l !== void 0 && (r(l), u = "" + l), f(i) && (r(i.key), u = "" + i.key), "key" in i) {
404
+ l = {};
405
+ for (var z in i)
406
+ z !== "key" && (l[z] = i[z]);
407
+ } else l = i;
408
+ return u && m(
409
+ l,
410
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
411
+ ), E(
412
+ e,
413
+ u,
414
+ l,
415
+ o(),
416
+ C,
417
+ D
418
+ );
419
+ }
420
+ function p(e) {
421
+ k(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === I && (e._payload.status === "fulfilled" ? k(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
422
+ }
423
+ function k(e) {
424
+ return typeof e == "object" && e !== null && e.$$typeof === R;
425
+ }
426
+ var x = de, R = /* @__PURE__ */ Symbol.for("react.transitional.element"), N = /* @__PURE__ */ Symbol.for("react.portal"), A = /* @__PURE__ */ Symbol.for("react.fragment"), K = /* @__PURE__ */ Symbol.for("react.strict_mode"), ee = /* @__PURE__ */ Symbol.for("react.profiler"), ne = /* @__PURE__ */ Symbol.for("react.consumer"), te = /* @__PURE__ */ Symbol.for("react.context"), oe = /* @__PURE__ */ Symbol.for("react.forward_ref"), re = /* @__PURE__ */ Symbol.for("react.suspense"), se = /* @__PURE__ */ Symbol.for("react.suspense_list"), ie = /* @__PURE__ */ Symbol.for("react.memo"), I = /* @__PURE__ */ Symbol.for("react.lazy"), ae = /* @__PURE__ */ Symbol.for("react.activity"), ce = /* @__PURE__ */ Symbol.for("react.client.reference"), O = x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, $ = Object.prototype.hasOwnProperty, fe = Array.isArray, P = console.createTask ? console.createTask : function() {
427
+ return null;
428
+ };
429
+ x = {
430
+ react_stack_bottom_frame: function(e) {
431
+ return e();
432
+ }
433
+ };
434
+ var W, F = {}, U = x.react_stack_bottom_frame.bind(
435
+ x,
436
+ c
437
+ )(), B = P(s(c)), V = {};
438
+ _.Fragment = A, _.jsx = function(e, i, l) {
439
+ var d = 1e4 > O.recentlyCreatedOwnerStacks++;
440
+ return v(
441
+ e,
442
+ i,
443
+ l,
444
+ !1,
445
+ d ? Error("react-stack-top-frame") : U,
446
+ d ? P(s(e)) : B
447
+ );
448
+ }, _.jsxs = function(e, i, l) {
449
+ var d = 1e4 > O.recentlyCreatedOwnerStacks++;
450
+ return v(
451
+ e,
452
+ i,
453
+ l,
454
+ !0,
455
+ d ? Error("react-stack-top-frame") : U,
456
+ d ? P(s(e)) : B
457
+ );
458
+ };
459
+ })()), _;
460
+ }
461
+ var X;
462
+ function je() {
463
+ return X || (X = 1, process.env.NODE_ENV === "production" ? S.exports = Te() : S.exports = Ee()), S.exports;
464
+ }
465
+ var a = je();
466
+ function _e() {
467
+ return ue(
468
+ (t) => h.subscribe(t),
469
+ () => h.getSnapshot(),
470
+ () => h.getSnapshot()
471
+ );
472
+ }
473
+ function w(...t) {
474
+ return ge(pe(t));
475
+ }
476
+ function Re({ className: t }) {
477
+ return /* @__PURE__ */ a.jsxs(
478
+ "svg",
479
+ {
480
+ className: t,
481
+ fill: "none",
482
+ stroke: "currentColor",
483
+ strokeLinecap: "round",
484
+ strokeLinejoin: "round",
485
+ strokeWidth: "2",
486
+ viewBox: "0 0 24 24",
487
+ children: [
488
+ /* @__PURE__ */ a.jsx("circle", { cx: "12", cy: "12", r: "10" }),
489
+ /* @__PURE__ */ a.jsx("path", { d: "m9 12 2 2 4-4" })
490
+ ]
491
+ }
492
+ );
493
+ }
494
+ function Ce({ className: t }) {
495
+ return /* @__PURE__ */ a.jsxs(
496
+ "svg",
497
+ {
498
+ className: t,
499
+ fill: "none",
500
+ stroke: "currentColor",
501
+ strokeLinecap: "round",
502
+ strokeLinejoin: "round",
503
+ strokeWidth: "2",
504
+ viewBox: "0 0 24 24",
505
+ children: [
506
+ /* @__PURE__ */ a.jsx("circle", { cx: "12", cy: "12", r: "10" }),
507
+ /* @__PURE__ */ a.jsx("line", { x1: "12", x2: "12", y1: "8", y2: "12" }),
508
+ /* @__PURE__ */ a.jsx("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })
509
+ ]
510
+ }
511
+ );
512
+ }
513
+ function Se({ className: t }) {
514
+ return /* @__PURE__ */ a.jsxs(
515
+ "svg",
516
+ {
517
+ className: t,
518
+ fill: "none",
519
+ stroke: "currentColor",
520
+ strokeLinecap: "round",
521
+ strokeLinejoin: "round",
522
+ strokeWidth: "2",
523
+ viewBox: "0 0 24 24",
524
+ children: [
525
+ /* @__PURE__ */ a.jsx("circle", { cx: "12", cy: "12", r: "10" }),
526
+ /* @__PURE__ */ a.jsx("path", { d: "m15 9-6 6" }),
527
+ /* @__PURE__ */ a.jsx("path", { d: "m9 9 6 6" })
528
+ ]
529
+ }
530
+ );
531
+ }
532
+ function Q({ className: t }) {
533
+ return /* @__PURE__ */ a.jsxs(
534
+ "svg",
535
+ {
536
+ className: t,
537
+ fill: "none",
538
+ stroke: "currentColor",
539
+ strokeLinecap: "round",
540
+ strokeLinejoin: "round",
541
+ strokeWidth: "2",
542
+ viewBox: "0 0 24 24",
543
+ children: [
544
+ /* @__PURE__ */ a.jsx("circle", { cx: "12", cy: "12", r: "10" }),
545
+ /* @__PURE__ */ a.jsx("path", { d: "M12 16v-4" }),
546
+ /* @__PURE__ */ a.jsx("path", { d: "M12 8h.01" })
547
+ ]
548
+ }
549
+ );
550
+ }
551
+ function Ne({ className: t }) {
552
+ return /* @__PURE__ */ a.jsx(
553
+ "svg",
554
+ {
555
+ className: t,
556
+ fill: "none",
557
+ stroke: "currentColor",
558
+ strokeLinecap: "round",
559
+ strokeLinejoin: "round",
560
+ strokeWidth: "2",
561
+ viewBox: "0 0 24 24",
562
+ children: /* @__PURE__ */ a.jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
563
+ }
564
+ );
565
+ }
566
+ const Ae = {
567
+ default: Q,
568
+ error: Se,
569
+ info: Q,
570
+ loading: Ne,
571
+ success: Re,
572
+ warning: Ce
573
+ }, Ie = {
574
+ default: "nf-dialog-tone-default",
575
+ error: "nf-dialog-tone-error",
576
+ info: "nf-dialog-tone-info",
577
+ loading: "nf-dialog-tone-loading",
578
+ success: "nf-dialog-tone-success",
579
+ warning: "nf-dialog-tone-warning"
580
+ }, Oe = {
581
+ default: "nf-icon-tone-default",
582
+ error: "nf-icon-tone-error",
583
+ info: "nf-icon-tone-info",
584
+ loading: "nf-icon-tone-loading",
585
+ success: "nf-icon-tone-success",
586
+ warning: "nf-icon-tone-warning"
587
+ }, Pe = {
588
+ bounce: "nf-motion-bounce",
589
+ none: "nf-motion-none",
590
+ scale: "nf-motion-scale",
591
+ slide: "nf-motion-slide",
592
+ subtle: "nf-motion-subtle"
593
+ };
594
+ function Fe({
595
+ colorScheme: t,
596
+ motion: n = "subtle",
597
+ showQueueCount: r = !0,
598
+ theme: s
599
+ }) {
600
+ const { current: o, pendingCount: c } = _e(), f = De(t), m = s?.schemes?.[f], T = Pe[n];
601
+ Z(() => h.registerHost(), []);
602
+ const E = {
603
+ ...Ae,
604
+ ...s?.icons
605
+ }, v = {
606
+ ...Ie,
607
+ ...s?.dialogToneClasses,
608
+ ...m?.dialogToneClasses
609
+ }, p = {
610
+ ...Oe,
611
+ ...s?.iconToneClasses,
612
+ ...m?.iconToneClasses
613
+ };
614
+ return /* @__PURE__ */ a.jsx(
615
+ b.Root,
616
+ {
617
+ onOpenChange: (k) => {
618
+ !k && o?.dismissible && h.dismiss(o.id);
619
+ },
620
+ open: !!o?.open,
621
+ children: o ? /* @__PURE__ */ a.jsx(
622
+ ze,
623
+ {
624
+ dialog: o,
625
+ dialogToneClasses: v,
626
+ icons: E,
627
+ iconToneClasses: p,
628
+ pendingCount: c,
629
+ scheme: f,
630
+ motionClassName: T,
631
+ schemeClassName: m?.className,
632
+ showQueueCount: r
633
+ }
634
+ ) : null
635
+ }
636
+ );
637
+ }
638
+ function De(t) {
639
+ const n = t ?? "system", [r, s] = me(
640
+ () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-color-scheme: dark)").matches
641
+ );
642
+ return Z(() => {
643
+ if (n !== "system" || typeof window > "u" || typeof window.matchMedia != "function")
644
+ return;
645
+ const o = window.matchMedia("(prefers-color-scheme: dark)"), c = (f) => s(f.matches);
646
+ return s(o.matches), o.addEventListener("change", c), () => o.removeEventListener("change", c);
647
+ }, [n]), he(() => n === "dark" ? "dark" : n === "light" ? "light" : r ? "dark" : "light", [r, n]);
648
+ }
649
+ function ze({
650
+ dialog: t,
651
+ dialogToneClasses: n,
652
+ icons: r,
653
+ iconToneClasses: s,
654
+ pendingCount: o,
655
+ scheme: c,
656
+ motionClassName: f,
657
+ schemeClassName: m,
658
+ showQueueCount: T
659
+ }) {
660
+ const E = r[t.type], v = !!t.action || t.dismissible, p = t.type === "loading", k = n[t.type], x = s[t.type], R = w(
661
+ t.type === "error" && "nf-action-error",
662
+ t.type === "info" && "nf-action-info",
663
+ t.type === "success" && "nf-action-success",
664
+ t.type === "warning" && "nf-action-warning",
665
+ (t.type === "default" || t.type === "loading") && "nf-action-default"
666
+ );
667
+ return /* @__PURE__ */ a.jsxs(b.Portal, { children: [
668
+ /* @__PURE__ */ a.jsx(b.Overlay, { className: w("nf-overlay", f) }),
669
+ /* @__PURE__ */ a.jsxs(
670
+ b.Content,
671
+ {
672
+ className: w(
673
+ "nf-content",
674
+ f,
675
+ c === "dark" && "nf-scheme-dark",
676
+ k,
677
+ m
678
+ ),
679
+ onEscapeKeyDown: (N) => {
680
+ (!t.dismissible || !t.allowEscapeClose) && N.preventDefault();
681
+ },
682
+ children: [
683
+ /* @__PURE__ */ a.jsxs("div", { className: "nf-header", children: [
684
+ /* @__PURE__ */ a.jsxs("div", { className: "nf-title-row", children: [
685
+ /* @__PURE__ */ a.jsx("div", { className: w("nf-icon-wrap", x), children: /* @__PURE__ */ a.jsx(
686
+ E,
687
+ {
688
+ className: w(
689
+ "nf-icon",
690
+ t.type === "loading" && "nf-icon-spin"
691
+ )
692
+ }
693
+ ) }),
694
+ /* @__PURE__ */ a.jsx(b.Title, { className: "nf-title", children: t.title })
695
+ ] }),
696
+ /* @__PURE__ */ a.jsx(
697
+ b.Description,
698
+ {
699
+ "aria-live": t.type === "error" ? "assertive" : "polite",
700
+ className: "nf-description",
701
+ children: t.description ? t.description : /* @__PURE__ */ a.jsx(be, { children: "Notification dialog" })
702
+ }
703
+ )
704
+ ] }),
705
+ /* @__PURE__ */ a.jsxs("div", { className: "nf-footer", children: [
706
+ T && o > 0 ? /* @__PURE__ */ a.jsxs("div", { className: "nf-pending", children: [
707
+ o,
708
+ " pending"
709
+ ] }) : null,
710
+ /* @__PURE__ */ a.jsxs("div", { className: "nf-actions", children: [
711
+ t.cancel ? /* @__PURE__ */ a.jsx(b.Cancel, { asChild: !0, children: /* @__PURE__ */ a.jsx(
712
+ "button",
713
+ {
714
+ className: "nf-button nf-button-cancel",
715
+ disabled: p,
716
+ onClick: () => {
717
+ t.cancel?.onClick?.(), h.dismiss(t.id);
718
+ },
719
+ type: "button",
720
+ children: t.cancel.label
721
+ }
722
+ ) }) : null,
723
+ v ? /* @__PURE__ */ a.jsx(b.Action, { asChild: !0, children: /* @__PURE__ */ a.jsx(
724
+ "button",
725
+ {
726
+ className: w(
727
+ "nf-button nf-button-action",
728
+ R
729
+ ),
730
+ disabled: p,
731
+ onClick: () => {
732
+ t.action?.onClick?.(), h.dismiss(t.id);
733
+ },
734
+ type: "button",
735
+ children: t.action?.label ?? "OK"
736
+ }
737
+ ) }) : null
738
+ ] })
739
+ ] })
740
+ ]
741
+ }
742
+ )
743
+ ] });
744
+ }
745
+ ke();
746
+ export {
747
+ Fe as Notifin,
748
+ We as notifin
749
+ };