@metricshift/react 1.0.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.
@@ -0,0 +1,1234 @@
1
+ import $e, { useState as $, useRef as ze, useEffect as Me, createContext as br, useContext as gr } from "react";
2
+ var ve = { exports: {} }, J = {};
3
+ /**
4
+ * @license React
5
+ * react-jsx-runtime.production.min.js
6
+ *
7
+ * Copyright (c) Facebook, Inc. and its affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
12
+ var We;
13
+ function xr() {
14
+ if (We) return J;
15
+ We = 1;
16
+ var d = $e, k = Symbol.for("react.element"), O = Symbol.for("react.fragment"), f = Object.prototype.hasOwnProperty, p = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 };
17
+ function F(E, b, T) {
18
+ var y, R = {}, v = null, z = null;
19
+ T !== void 0 && (v = "" + T), b.key !== void 0 && (v = "" + b.key), b.ref !== void 0 && (z = b.ref);
20
+ for (y in b) f.call(b, y) && !o.hasOwnProperty(y) && (R[y] = b[y]);
21
+ if (E && E.defaultProps) for (y in b = E.defaultProps, b) R[y] === void 0 && (R[y] = b[y]);
22
+ return { $$typeof: k, type: E, key: v, ref: z, props: R, _owner: p.current };
23
+ }
24
+ return J.Fragment = O, J.jsx = F, J.jsxs = F, J;
25
+ }
26
+ var K = {};
27
+ /**
28
+ * @license React
29
+ * react-jsx-runtime.development.js
30
+ *
31
+ * Copyright (c) Facebook, Inc. and its affiliates.
32
+ *
33
+ * This source code is licensed under the MIT license found in the
34
+ * LICENSE file in the root directory of this source tree.
35
+ */
36
+ var Ye;
37
+ function yr() {
38
+ return Ye || (Ye = 1, process.env.NODE_ENV !== "production" && function() {
39
+ var d = $e, k = Symbol.for("react.element"), O = Symbol.for("react.portal"), f = Symbol.for("react.fragment"), p = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), F = Symbol.for("react.provider"), E = Symbol.for("react.context"), b = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), z = Symbol.for("react.offscreen"), D = Symbol.iterator, C = "@@iterator";
40
+ function B(e) {
41
+ if (e === null || typeof e != "object")
42
+ return null;
43
+ var r = D && e[D] || e[C];
44
+ return typeof r == "function" ? r : null;
45
+ }
46
+ var P = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
47
+ function h(e) {
48
+ {
49
+ for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++)
50
+ t[a - 1] = arguments[a];
51
+ L("error", e, t);
52
+ }
53
+ }
54
+ function L(e, r, t) {
55
+ {
56
+ var a = P.ReactDebugCurrentFrame, u = a.getStackAddendum();
57
+ u !== "" && (r += "%s", t = t.concat([u]));
58
+ var c = t.map(function(l) {
59
+ return String(l);
60
+ });
61
+ c.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, c);
62
+ }
63
+ }
64
+ var i = !1, j = !1, H = !1, re = !1, te = !1, G;
65
+ G = Symbol.for("react.module.reference");
66
+ function ne(e) {
67
+ return !!(typeof e == "string" || typeof e == "function" || e === f || e === o || te || e === p || e === T || e === y || re || e === z || i || j || H || typeof e == "object" && e !== null && (e.$$typeof === v || e.$$typeof === R || e.$$typeof === F || e.$$typeof === E || e.$$typeof === b || // This needs to include all possible module reference object
68
+ // types supported by any Flight configuration anywhere since
69
+ // we don't know which Flight build this will end up being used
70
+ // with.
71
+ e.$$typeof === G || e.getModuleId !== void 0));
72
+ }
73
+ function V(e, r, t) {
74
+ var a = e.displayName;
75
+ if (a)
76
+ return a;
77
+ var u = r.displayName || r.name || "";
78
+ return u !== "" ? t + "(" + u + ")" : t;
79
+ }
80
+ function ae(e) {
81
+ return e.displayName || "Context";
82
+ }
83
+ function I(e) {
84
+ if (e == null)
85
+ return null;
86
+ if (typeof e.tag == "number" && h("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
87
+ return e.displayName || e.name || null;
88
+ if (typeof e == "string")
89
+ return e;
90
+ switch (e) {
91
+ case f:
92
+ return "Fragment";
93
+ case O:
94
+ return "Portal";
95
+ case o:
96
+ return "Profiler";
97
+ case p:
98
+ return "StrictMode";
99
+ case T:
100
+ return "Suspense";
101
+ case y:
102
+ return "SuspenseList";
103
+ }
104
+ if (typeof e == "object")
105
+ switch (e.$$typeof) {
106
+ case E:
107
+ var r = e;
108
+ return ae(r) + ".Consumer";
109
+ case F:
110
+ var t = e;
111
+ return ae(t._context) + ".Provider";
112
+ case b:
113
+ return V(e, e.render, "ForwardRef");
114
+ case R:
115
+ var a = e.displayName || null;
116
+ return a !== null ? a : I(e.type) || "Memo";
117
+ case v: {
118
+ var u = e, c = u._payload, l = u._init;
119
+ try {
120
+ return I(l(c));
121
+ } catch {
122
+ return null;
123
+ }
124
+ }
125
+ }
126
+ return null;
127
+ }
128
+ var A = Object.assign, g = 0, M, W, be, ge, xe, ye, he;
129
+ function me() {
130
+ }
131
+ me.__reactDisabledLog = !0;
132
+ function Le() {
133
+ {
134
+ if (g === 0) {
135
+ M = console.log, W = console.info, be = console.warn, ge = console.error, xe = console.group, ye = console.groupCollapsed, he = console.groupEnd;
136
+ var e = {
137
+ configurable: !0,
138
+ enumerable: !0,
139
+ value: me,
140
+ writable: !0
141
+ };
142
+ Object.defineProperties(console, {
143
+ info: e,
144
+ log: e,
145
+ warn: e,
146
+ error: e,
147
+ group: e,
148
+ groupCollapsed: e,
149
+ groupEnd: e
150
+ });
151
+ }
152
+ g++;
153
+ }
154
+ }
155
+ function Ne() {
156
+ {
157
+ if (g--, g === 0) {
158
+ var e = {
159
+ configurable: !0,
160
+ enumerable: !0,
161
+ writable: !0
162
+ };
163
+ Object.defineProperties(console, {
164
+ log: A({}, e, {
165
+ value: M
166
+ }),
167
+ info: A({}, e, {
168
+ value: W
169
+ }),
170
+ warn: A({}, e, {
171
+ value: be
172
+ }),
173
+ error: A({}, e, {
174
+ value: ge
175
+ }),
176
+ group: A({}, e, {
177
+ value: xe
178
+ }),
179
+ groupCollapsed: A({}, e, {
180
+ value: ye
181
+ }),
182
+ groupEnd: A({}, e, {
183
+ value: he
184
+ })
185
+ });
186
+ }
187
+ g < 0 && h("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
188
+ }
189
+ }
190
+ var oe = P.ReactCurrentDispatcher, ie;
191
+ function X(e, r, t) {
192
+ {
193
+ if (ie === void 0)
194
+ try {
195
+ throw Error();
196
+ } catch (u) {
197
+ var a = u.stack.trim().match(/\n( *(at )?)/);
198
+ ie = a && a[1] || "";
199
+ }
200
+ return `
201
+ ` + ie + e;
202
+ }
203
+ }
204
+ var se = !1, Q;
205
+ {
206
+ var Ue = typeof WeakMap == "function" ? WeakMap : Map;
207
+ Q = new Ue();
208
+ }
209
+ function Ee(e, r) {
210
+ if (!e || se)
211
+ return "";
212
+ {
213
+ var t = Q.get(e);
214
+ if (t !== void 0)
215
+ return t;
216
+ }
217
+ var a;
218
+ se = !0;
219
+ var u = Error.prepareStackTrace;
220
+ Error.prepareStackTrace = void 0;
221
+ var c;
222
+ c = oe.current, oe.current = null, Le();
223
+ try {
224
+ if (r) {
225
+ var l = function() {
226
+ throw Error();
227
+ };
228
+ if (Object.defineProperty(l.prototype, "props", {
229
+ set: function() {
230
+ throw Error();
231
+ }
232
+ }), typeof Reflect == "object" && Reflect.construct) {
233
+ try {
234
+ Reflect.construct(l, []);
235
+ } catch (_) {
236
+ a = _;
237
+ }
238
+ Reflect.construct(e, [], l);
239
+ } else {
240
+ try {
241
+ l.call();
242
+ } catch (_) {
243
+ a = _;
244
+ }
245
+ e.call(l.prototype);
246
+ }
247
+ } else {
248
+ try {
249
+ throw Error();
250
+ } catch (_) {
251
+ a = _;
252
+ }
253
+ e();
254
+ }
255
+ } catch (_) {
256
+ if (_ && a && typeof _.stack == "string") {
257
+ for (var s = _.stack.split(`
258
+ `), S = a.stack.split(`
259
+ `), x = s.length - 1, m = S.length - 1; x >= 1 && m >= 0 && s[x] !== S[m]; )
260
+ m--;
261
+ for (; x >= 1 && m >= 0; x--, m--)
262
+ if (s[x] !== S[m]) {
263
+ if (x !== 1 || m !== 1)
264
+ do
265
+ if (x--, m--, m < 0 || s[x] !== S[m]) {
266
+ var w = `
267
+ ` + s[x].replace(" at new ", " at ");
268
+ return e.displayName && w.includes("<anonymous>") && (w = w.replace("<anonymous>", e.displayName)), typeof e == "function" && Q.set(e, w), w;
269
+ }
270
+ while (x >= 1 && m >= 0);
271
+ break;
272
+ }
273
+ }
274
+ } finally {
275
+ se = !1, oe.current = c, Ne(), Error.prepareStackTrace = u;
276
+ }
277
+ var U = e ? e.displayName || e.name : "", Y = U ? X(U) : "";
278
+ return typeof e == "function" && Q.set(e, Y), Y;
279
+ }
280
+ function Ve(e, r, t) {
281
+ return Ee(e, !1);
282
+ }
283
+ function qe(e) {
284
+ var r = e.prototype;
285
+ return !!(r && r.isReactComponent);
286
+ }
287
+ function Z(e, r, t) {
288
+ if (e == null)
289
+ return "";
290
+ if (typeof e == "function")
291
+ return Ee(e, qe(e));
292
+ if (typeof e == "string")
293
+ return X(e);
294
+ switch (e) {
295
+ case T:
296
+ return X("Suspense");
297
+ case y:
298
+ return X("SuspenseList");
299
+ }
300
+ if (typeof e == "object")
301
+ switch (e.$$typeof) {
302
+ case b:
303
+ return Ve(e.render);
304
+ case R:
305
+ return Z(e.type, r, t);
306
+ case v: {
307
+ var a = e, u = a._payload, c = a._init;
308
+ try {
309
+ return Z(c(u), r, t);
310
+ } catch {
311
+ }
312
+ }
313
+ }
314
+ return "";
315
+ }
316
+ var q = Object.prototype.hasOwnProperty, Re = {}, Se = P.ReactDebugCurrentFrame;
317
+ function ee(e) {
318
+ if (e) {
319
+ var r = e._owner, t = Z(e.type, e._source, r ? r.type : null);
320
+ Se.setExtraStackFrame(t);
321
+ } else
322
+ Se.setExtraStackFrame(null);
323
+ }
324
+ function Je(e, r, t, a, u) {
325
+ {
326
+ var c = Function.call.bind(q);
327
+ for (var l in e)
328
+ if (c(e, l)) {
329
+ var s = void 0;
330
+ try {
331
+ if (typeof e[l] != "function") {
332
+ var S = Error((a || "React class") + ": " + t + " type `" + l + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[l] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
333
+ throw S.name = "Invariant Violation", S;
334
+ }
335
+ s = e[l](r, l, a, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
336
+ } catch (x) {
337
+ s = x;
338
+ }
339
+ s && !(s instanceof Error) && (ee(u), h("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", a || "React class", t, l, typeof s), ee(null)), s instanceof Error && !(s.message in Re) && (Re[s.message] = !0, ee(u), h("Failed %s type: %s", t, s.message), ee(null));
340
+ }
341
+ }
342
+ }
343
+ var Ke = Array.isArray;
344
+ function le(e) {
345
+ return Ke(e);
346
+ }
347
+ function He(e) {
348
+ {
349
+ var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
350
+ return t;
351
+ }
352
+ }
353
+ function Ge(e) {
354
+ try {
355
+ return _e(e), !1;
356
+ } catch {
357
+ return !0;
358
+ }
359
+ }
360
+ function _e(e) {
361
+ return "" + e;
362
+ }
363
+ function ke(e) {
364
+ if (Ge(e))
365
+ return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", He(e)), _e(e);
366
+ }
367
+ var je = P.ReactCurrentOwner, Xe = {
368
+ key: !0,
369
+ ref: !0,
370
+ __self: !0,
371
+ __source: !0
372
+ }, we, Te;
373
+ function Qe(e) {
374
+ if (q.call(e, "ref")) {
375
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
376
+ if (r && r.isReactWarning)
377
+ return !1;
378
+ }
379
+ return e.ref !== void 0;
380
+ }
381
+ function Ze(e) {
382
+ if (q.call(e, "key")) {
383
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
384
+ if (r && r.isReactWarning)
385
+ return !1;
386
+ }
387
+ return e.key !== void 0;
388
+ }
389
+ function er(e, r) {
390
+ typeof e.ref == "string" && je.current;
391
+ }
392
+ function rr(e, r) {
393
+ {
394
+ var t = function() {
395
+ we || (we = !0, h("%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://reactjs.org/link/special-props)", r));
396
+ };
397
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
398
+ get: t,
399
+ configurable: !0
400
+ });
401
+ }
402
+ }
403
+ function tr(e, r) {
404
+ {
405
+ var t = function() {
406
+ Te || (Te = !0, h("%s: `ref` 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://reactjs.org/link/special-props)", r));
407
+ };
408
+ t.isReactWarning = !0, Object.defineProperty(e, "ref", {
409
+ get: t,
410
+ configurable: !0
411
+ });
412
+ }
413
+ }
414
+ var nr = function(e, r, t, a, u, c, l) {
415
+ var s = {
416
+ // This tag allows us to uniquely identify this as a React Element
417
+ $$typeof: k,
418
+ // Built-in properties that belong on the element
419
+ type: e,
420
+ key: r,
421
+ ref: t,
422
+ props: l,
423
+ // Record the component responsible for creating this element.
424
+ _owner: c
425
+ };
426
+ return s._store = {}, Object.defineProperty(s._store, "validated", {
427
+ configurable: !1,
428
+ enumerable: !1,
429
+ writable: !0,
430
+ value: !1
431
+ }), Object.defineProperty(s, "_self", {
432
+ configurable: !1,
433
+ enumerable: !1,
434
+ writable: !1,
435
+ value: a
436
+ }), Object.defineProperty(s, "_source", {
437
+ configurable: !1,
438
+ enumerable: !1,
439
+ writable: !1,
440
+ value: u
441
+ }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
442
+ };
443
+ function ar(e, r, t, a, u) {
444
+ {
445
+ var c, l = {}, s = null, S = null;
446
+ t !== void 0 && (ke(t), s = "" + t), Ze(r) && (ke(r.key), s = "" + r.key), Qe(r) && (S = r.ref, er(r, u));
447
+ for (c in r)
448
+ q.call(r, c) && !Xe.hasOwnProperty(c) && (l[c] = r[c]);
449
+ if (e && e.defaultProps) {
450
+ var x = e.defaultProps;
451
+ for (c in x)
452
+ l[c] === void 0 && (l[c] = x[c]);
453
+ }
454
+ if (s || S) {
455
+ var m = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
456
+ s && rr(l, m), S && tr(l, m);
457
+ }
458
+ return nr(e, s, S, u, a, je.current, l);
459
+ }
460
+ }
461
+ var ue = P.ReactCurrentOwner, Ce = P.ReactDebugCurrentFrame;
462
+ function N(e) {
463
+ if (e) {
464
+ var r = e._owner, t = Z(e.type, e._source, r ? r.type : null);
465
+ Ce.setExtraStackFrame(t);
466
+ } else
467
+ Ce.setExtraStackFrame(null);
468
+ }
469
+ var ce;
470
+ ce = !1;
471
+ function fe(e) {
472
+ return typeof e == "object" && e !== null && e.$$typeof === k;
473
+ }
474
+ function Pe() {
475
+ {
476
+ if (ue.current) {
477
+ var e = I(ue.current.type);
478
+ if (e)
479
+ return `
480
+
481
+ Check the render method of \`` + e + "`.";
482
+ }
483
+ return "";
484
+ }
485
+ }
486
+ function or(e) {
487
+ return "";
488
+ }
489
+ var Oe = {};
490
+ function ir(e) {
491
+ {
492
+ var r = Pe();
493
+ if (!r) {
494
+ var t = typeof e == "string" ? e : e.displayName || e.name;
495
+ t && (r = `
496
+
497
+ Check the top-level render call using <` + t + ">.");
498
+ }
499
+ return r;
500
+ }
501
+ }
502
+ function Fe(e, r) {
503
+ {
504
+ if (!e._store || e._store.validated || e.key != null)
505
+ return;
506
+ e._store.validated = !0;
507
+ var t = ir(r);
508
+ if (Oe[t])
509
+ return;
510
+ Oe[t] = !0;
511
+ var a = "";
512
+ e && e._owner && e._owner !== ue.current && (a = " It was passed a child from " + I(e._owner.type) + "."), N(e), h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, a), N(null);
513
+ }
514
+ }
515
+ function Ie(e, r) {
516
+ {
517
+ if (typeof e != "object")
518
+ return;
519
+ if (le(e))
520
+ for (var t = 0; t < e.length; t++) {
521
+ var a = e[t];
522
+ fe(a) && Fe(a, r);
523
+ }
524
+ else if (fe(e))
525
+ e._store && (e._store.validated = !0);
526
+ else if (e) {
527
+ var u = B(e);
528
+ if (typeof u == "function" && u !== e.entries)
529
+ for (var c = u.call(e), l; !(l = c.next()).done; )
530
+ fe(l.value) && Fe(l.value, r);
531
+ }
532
+ }
533
+ }
534
+ function sr(e) {
535
+ {
536
+ var r = e.type;
537
+ if (r == null || typeof r == "string")
538
+ return;
539
+ var t;
540
+ if (typeof r == "function")
541
+ t = r.propTypes;
542
+ else if (typeof r == "object" && (r.$$typeof === b || // Note: Memo only checks outer props here.
543
+ // Inner props are checked in the reconciler.
544
+ r.$$typeof === R))
545
+ t = r.propTypes;
546
+ else
547
+ return;
548
+ if (t) {
549
+ var a = I(r);
550
+ Je(t, e.props, "prop", a, e);
551
+ } else if (r.PropTypes !== void 0 && !ce) {
552
+ ce = !0;
553
+ var u = I(r);
554
+ h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", u || "Unknown");
555
+ }
556
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
557
+ }
558
+ }
559
+ function lr(e) {
560
+ {
561
+ for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
562
+ var a = r[t];
563
+ if (a !== "children" && a !== "key") {
564
+ N(e), h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", a), N(null);
565
+ break;
566
+ }
567
+ }
568
+ e.ref !== null && (N(e), h("Invalid attribute `ref` supplied to `React.Fragment`."), N(null));
569
+ }
570
+ }
571
+ var De = {};
572
+ function Ae(e, r, t, a, u, c) {
573
+ {
574
+ var l = ne(e);
575
+ if (!l) {
576
+ var s = "";
577
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (s += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
578
+ var S = or();
579
+ S ? s += S : s += Pe();
580
+ var x;
581
+ e === null ? x = "null" : le(e) ? x = "array" : e !== void 0 && e.$$typeof === k ? (x = "<" + (I(e.type) || "Unknown") + " />", s = " Did you accidentally export a JSX literal instead of a component?") : x = typeof e, h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", x, s);
582
+ }
583
+ var m = ar(e, r, t, u, c);
584
+ if (m == null)
585
+ return m;
586
+ if (l) {
587
+ var w = r.children;
588
+ if (w !== void 0)
589
+ if (a)
590
+ if (le(w)) {
591
+ for (var U = 0; U < w.length; U++)
592
+ Ie(w[U], e);
593
+ Object.freeze && Object.freeze(w);
594
+ } else
595
+ h("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
596
+ else
597
+ Ie(w, e);
598
+ }
599
+ if (q.call(r, "key")) {
600
+ var Y = I(e), _ = Object.keys(r).filter(function(vr) {
601
+ return vr !== "key";
602
+ }), de = _.length > 0 ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}";
603
+ if (!De[Y + de]) {
604
+ var pr = _.length > 0 ? "{" + _.join(": ..., ") + ": ...}" : "{}";
605
+ h(`A props object containing a "key" prop is being spread into JSX:
606
+ let props = %s;
607
+ <%s {...props} />
608
+ React keys must be passed directly to JSX without using spread:
609
+ let props = %s;
610
+ <%s key={someKey} {...props} />`, de, Y, pr, Y), De[Y + de] = !0;
611
+ }
612
+ }
613
+ return e === f ? lr(m) : sr(m), m;
614
+ }
615
+ }
616
+ function ur(e, r, t) {
617
+ return Ae(e, r, t, !0);
618
+ }
619
+ function cr(e, r, t) {
620
+ return Ae(e, r, t, !1);
621
+ }
622
+ var fr = cr, dr = ur;
623
+ K.Fragment = f, K.jsx = fr, K.jsxs = dr;
624
+ }()), K;
625
+ }
626
+ process.env.NODE_ENV === "production" ? ve.exports = xr() : ve.exports = yr();
627
+ var n = ve.exports;
628
+ const hr = ({
629
+ isOpen: d,
630
+ onClose: k,
631
+ onSubmit: O
632
+ }) => {
633
+ const [f, p] = $({
634
+ text: "",
635
+ rating: void 0,
636
+ feedbackType: "general",
637
+ userEmail: "",
638
+ userName: ""
639
+ }), [o, F] = $(!1), [E, b] = $("idle"), [T, y] = $(""), [R, v] = $(!1), z = ze(null), D = ze(null);
640
+ Me(() => (d ? (v(!0), document.body.style.overflow = "hidden", setTimeout(() => {
641
+ var i;
642
+ (i = D.current) == null || i.focus();
643
+ }, 150)) : document.body.style.overflow = "unset", () => {
644
+ document.body.style.overflow = "unset";
645
+ }), [d]), Me(() => {
646
+ const i = (j) => {
647
+ j.key === "Escape" && d && !o && C();
648
+ };
649
+ return d && document.addEventListener("keydown", i), () => {
650
+ document.removeEventListener("keydown", i);
651
+ };
652
+ }, [d, o]);
653
+ const C = () => {
654
+ v(!1), setTimeout(() => {
655
+ k(), setTimeout(() => {
656
+ p({
657
+ text: "",
658
+ rating: void 0,
659
+ feedbackType: "general",
660
+ userEmail: "",
661
+ userName: ""
662
+ }), b("idle"), y("");
663
+ }, 100);
664
+ }, 200);
665
+ }, B = async (i) => {
666
+ if (i.preventDefault(), !f.text.trim()) {
667
+ y("Please enter your feedback");
668
+ return;
669
+ }
670
+ F(!0), y("");
671
+ try {
672
+ await O(f), b("success"), setTimeout(() => {
673
+ C();
674
+ }, 2e3);
675
+ } catch (j) {
676
+ b("error"), y(j instanceof Error ? j.message : "Failed to submit feedback");
677
+ } finally {
678
+ F(!1);
679
+ }
680
+ };
681
+ if (!d) return null;
682
+ const P = (i) => {
683
+ i.target === i.currentTarget && !o && C();
684
+ }, h = {
685
+ position: "fixed",
686
+ top: 0,
687
+ left: 0,
688
+ right: 0,
689
+ bottom: 0,
690
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
691
+ display: "flex",
692
+ alignItems: "center",
693
+ justifyContent: "center",
694
+ zIndex: 1e4,
695
+ padding: "16px",
696
+ opacity: R ? 1 : 0,
697
+ transition: "opacity 0.2s ease-in-out"
698
+ }, L = {
699
+ backgroundColor: "white",
700
+ borderRadius: "12px",
701
+ padding: "24px",
702
+ maxWidth: "500px",
703
+ width: "100%",
704
+ maxHeight: "90vh",
705
+ overflowY: "auto",
706
+ boxShadow: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
707
+ transform: R ? "scale(1)" : "scale(0.95)",
708
+ opacity: R ? 1 : 0,
709
+ transition: "all 0.2s ease-in-out"
710
+ };
711
+ return /* @__PURE__ */ n.jsx(
712
+ "div",
713
+ {
714
+ onClick: P,
715
+ style: h,
716
+ role: "dialog",
717
+ "aria-modal": "true",
718
+ "aria-labelledby": "feedback-modal-title",
719
+ children: /* @__PURE__ */ n.jsxs(
720
+ "div",
721
+ {
722
+ ref: z,
723
+ style: L,
724
+ onClick: (i) => i.stopPropagation(),
725
+ children: [
726
+ /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "24px", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
727
+ /* @__PURE__ */ n.jsx(
728
+ "h2",
729
+ {
730
+ id: "feedback-modal-title",
731
+ style: { fontSize: "20px", fontWeight: "600", margin: 0, color: "#111827" },
732
+ children: "Send Feedback"
733
+ }
734
+ ),
735
+ /* @__PURE__ */ n.jsx(
736
+ "button",
737
+ {
738
+ onClick: C,
739
+ disabled: o,
740
+ "aria-label": "Close feedback form",
741
+ style: {
742
+ background: "none",
743
+ border: "none",
744
+ fontSize: "24px",
745
+ cursor: o ? "not-allowed" : "pointer",
746
+ color: "#6b7280",
747
+ padding: "0",
748
+ lineHeight: "1",
749
+ opacity: o ? 0.5 : 1,
750
+ transition: "color 0.2s"
751
+ },
752
+ onMouseEnter: (i) => !o && (i.currentTarget.style.color = "#111827"),
753
+ onMouseLeave: (i) => !o && (i.currentTarget.style.color = "#6b7280"),
754
+ children: "×"
755
+ }
756
+ )
757
+ ] }),
758
+ E === "success" && /* @__PURE__ */ n.jsxs(
759
+ "div",
760
+ {
761
+ style: {
762
+ backgroundColor: "#d1fae5",
763
+ border: "1px solid #6ee7b7",
764
+ borderRadius: "8px",
765
+ padding: "12px",
766
+ marginBottom: "16px",
767
+ color: "#065f46",
768
+ display: "flex",
769
+ alignItems: "center",
770
+ gap: "8px",
771
+ animation: "slideIn 0.3s ease-out"
772
+ },
773
+ role: "status",
774
+ "aria-live": "polite",
775
+ children: [
776
+ /* @__PURE__ */ n.jsx("span", { style: { fontSize: "18px" }, children: "✓" }),
777
+ /* @__PURE__ */ n.jsx("span", { children: "Thank you! Your feedback has been submitted." })
778
+ ]
779
+ }
780
+ ),
781
+ T && /* @__PURE__ */ n.jsxs(
782
+ "div",
783
+ {
784
+ style: {
785
+ backgroundColor: "#fee2e2",
786
+ border: "1px solid #fca5a5",
787
+ borderRadius: "8px",
788
+ padding: "12px",
789
+ marginBottom: "16px",
790
+ color: "#991b1b",
791
+ display: "flex",
792
+ alignItems: "center",
793
+ gap: "8px"
794
+ },
795
+ role: "alert",
796
+ "aria-live": "assertive",
797
+ children: [
798
+ /* @__PURE__ */ n.jsx("span", { style: { fontSize: "18px" }, children: "âš " }),
799
+ /* @__PURE__ */ n.jsx("span", { children: T })
800
+ ]
801
+ }
802
+ ),
803
+ /* @__PURE__ */ n.jsxs("form", { onSubmit: B, children: [
804
+ /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "16px" }, children: [
805
+ /* @__PURE__ */ n.jsx(
806
+ "label",
807
+ {
808
+ htmlFor: "feedback-type",
809
+ style: { display: "block", marginBottom: "8px", fontSize: "14px", fontWeight: "500", color: "#374151" },
810
+ children: "Type"
811
+ }
812
+ ),
813
+ /* @__PURE__ */ n.jsxs(
814
+ "select",
815
+ {
816
+ id: "feedback-type",
817
+ value: f.feedbackType,
818
+ onChange: (i) => p({ ...f, feedbackType: i.target.value }),
819
+ disabled: o,
820
+ style: {
821
+ width: "100%",
822
+ padding: "8px 12px",
823
+ border: "1px solid #d1d5db",
824
+ borderRadius: "6px",
825
+ fontSize: "14px",
826
+ backgroundColor: "white",
827
+ cursor: o ? "not-allowed" : "pointer",
828
+ opacity: o ? 0.6 : 1
829
+ },
830
+ children: [
831
+ /* @__PURE__ */ n.jsx("option", { value: "general", children: "General Feedback" }),
832
+ /* @__PURE__ */ n.jsx("option", { value: "bug", children: "Bug Report" }),
833
+ /* @__PURE__ */ n.jsx("option", { value: "feature_request", children: "Feature Request" }),
834
+ /* @__PURE__ */ n.jsx("option", { value: "question", children: "Question" }),
835
+ /* @__PURE__ */ n.jsx("option", { value: "praise", children: "Praise" })
836
+ ]
837
+ }
838
+ )
839
+ ] }),
840
+ /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "16px" }, children: [
841
+ /* @__PURE__ */ n.jsx("label", { style: { display: "block", marginBottom: "8px", fontSize: "14px", fontWeight: "500", color: "#374151" }, children: "Rating (optional)" }),
842
+ /* @__PURE__ */ n.jsx("div", { style: { display: "flex", gap: "8px" }, role: "group", "aria-label": "Rating", children: [1, 2, 3, 4, 5].map((i) => /* @__PURE__ */ n.jsx(
843
+ "button",
844
+ {
845
+ type: "button",
846
+ onClick: () => p({ ...f, rating: i }),
847
+ disabled: o,
848
+ "aria-label": `Rate ${i} stars`,
849
+ "aria-pressed": f.rating === i,
850
+ style: {
851
+ background: "none",
852
+ border: "none",
853
+ fontSize: "28px",
854
+ cursor: o ? "not-allowed" : "pointer",
855
+ padding: "0",
856
+ color: f.rating && f.rating >= i ? "#fbbf24" : "#d1d5db",
857
+ transition: "all 0.2s",
858
+ opacity: o ? 0.6 : 1,
859
+ transform: "scale(1)"
860
+ },
861
+ onMouseEnter: (j) => !o && (j.currentTarget.style.transform = "scale(1.2)"),
862
+ onMouseLeave: (j) => !o && (j.currentTarget.style.transform = "scale(1)"),
863
+ children: "★"
864
+ },
865
+ i
866
+ )) })
867
+ ] }),
868
+ /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "16px" }, children: [
869
+ /* @__PURE__ */ n.jsxs(
870
+ "label",
871
+ {
872
+ htmlFor: "feedback-text",
873
+ style: { display: "block", marginBottom: "8px", fontSize: "14px", fontWeight: "500", color: "#374151" },
874
+ children: [
875
+ "Your Feedback ",
876
+ /* @__PURE__ */ n.jsx("span", { style: { color: "#ef4444" }, children: "*" })
877
+ ]
878
+ }
879
+ ),
880
+ /* @__PURE__ */ n.jsx(
881
+ "textarea",
882
+ {
883
+ id: "feedback-text",
884
+ ref: D,
885
+ value: f.text,
886
+ onChange: (i) => p({ ...f, text: i.target.value }),
887
+ placeholder: "Tell us what you think...",
888
+ required: !0,
889
+ disabled: o,
890
+ rows: 4,
891
+ "aria-required": "true",
892
+ style: {
893
+ width: "100%",
894
+ padding: "8px 12px",
895
+ border: "1px solid #d1d5db",
896
+ borderRadius: "6px",
897
+ fontSize: "14px",
898
+ resize: "vertical",
899
+ fontFamily: "inherit",
900
+ opacity: o ? 0.6 : 1,
901
+ cursor: o ? "not-allowed" : "text"
902
+ }
903
+ }
904
+ )
905
+ ] }),
906
+ /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "16px" }, children: [
907
+ /* @__PURE__ */ n.jsx(
908
+ "label",
909
+ {
910
+ htmlFor: "feedback-name",
911
+ style: { display: "block", marginBottom: "8px", fontSize: "14px", fontWeight: "500", color: "#374151" },
912
+ children: "Name (optional)"
913
+ }
914
+ ),
915
+ /* @__PURE__ */ n.jsx(
916
+ "input",
917
+ {
918
+ id: "feedback-name",
919
+ type: "text",
920
+ value: f.userName,
921
+ onChange: (i) => p({ ...f, userName: i.target.value }),
922
+ placeholder: "Your name",
923
+ disabled: o,
924
+ style: {
925
+ width: "100%",
926
+ padding: "8px 12px",
927
+ border: "1px solid #d1d5db",
928
+ borderRadius: "6px",
929
+ fontSize: "14px",
930
+ opacity: o ? 0.6 : 1
931
+ }
932
+ }
933
+ )
934
+ ] }),
935
+ /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "24px" }, children: [
936
+ /* @__PURE__ */ n.jsx(
937
+ "label",
938
+ {
939
+ htmlFor: "feedback-email",
940
+ style: { display: "block", marginBottom: "8px", fontSize: "14px", fontWeight: "500", color: "#374151" },
941
+ children: "Email (optional)"
942
+ }
943
+ ),
944
+ /* @__PURE__ */ n.jsx(
945
+ "input",
946
+ {
947
+ id: "feedback-email",
948
+ type: "email",
949
+ value: f.userEmail,
950
+ onChange: (i) => p({ ...f, userEmail: i.target.value }),
951
+ placeholder: "your@email.com",
952
+ disabled: o,
953
+ style: {
954
+ width: "100%",
955
+ padding: "8px 12px",
956
+ border: "1px solid #d1d5db",
957
+ borderRadius: "6px",
958
+ fontSize: "14px",
959
+ opacity: o ? 0.6 : 1
960
+ }
961
+ }
962
+ )
963
+ ] }),
964
+ /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", gap: "12px", justifyContent: "flex-end" }, children: [
965
+ /* @__PURE__ */ n.jsx(
966
+ "button",
967
+ {
968
+ type: "button",
969
+ onClick: C,
970
+ disabled: o,
971
+ style: {
972
+ padding: "10px 20px",
973
+ border: "1px solid #d1d5db",
974
+ borderRadius: "6px",
975
+ backgroundColor: "white",
976
+ color: "#374151",
977
+ fontSize: "14px",
978
+ fontWeight: "500",
979
+ cursor: o ? "not-allowed" : "pointer",
980
+ opacity: o ? 0.5 : 1,
981
+ transition: "all 0.2s"
982
+ },
983
+ onMouseEnter: (i) => !o && (i.currentTarget.style.backgroundColor = "#f9fafb"),
984
+ onMouseLeave: (i) => !o && (i.currentTarget.style.backgroundColor = "white"),
985
+ children: "Cancel"
986
+ }
987
+ ),
988
+ /* @__PURE__ */ n.jsxs(
989
+ "button",
990
+ {
991
+ type: "submit",
992
+ disabled: o || E === "success",
993
+ style: {
994
+ padding: "10px 20px",
995
+ border: "none",
996
+ borderRadius: "6px",
997
+ backgroundColor: E === "success" ? "#10b981" : "#3b82f6",
998
+ color: "white",
999
+ fontSize: "14px",
1000
+ fontWeight: "500",
1001
+ cursor: o || E === "success" ? "not-allowed" : "pointer",
1002
+ opacity: o ? 0.7 : 1,
1003
+ transition: "all 0.2s",
1004
+ display: "flex",
1005
+ alignItems: "center",
1006
+ gap: "8px"
1007
+ },
1008
+ children: [
1009
+ o && /* @__PURE__ */ n.jsx(
1010
+ "span",
1011
+ {
1012
+ style: {
1013
+ display: "inline-block",
1014
+ width: "14px",
1015
+ height: "14px",
1016
+ border: "2px solid #ffffff",
1017
+ borderTopColor: "transparent",
1018
+ borderRadius: "50%",
1019
+ animation: "spin 0.6s linear infinite"
1020
+ }
1021
+ }
1022
+ ),
1023
+ /* @__PURE__ */ n.jsx("span", { children: o ? "Sending..." : E === "success" ? "✓ Sent!" : "Send Feedback" })
1024
+ ]
1025
+ }
1026
+ )
1027
+ ] })
1028
+ ] }),
1029
+ /* @__PURE__ */ n.jsx("style", { children: `
1030
+ @keyframes spin {
1031
+ to { transform: rotate(360deg); }
1032
+ }
1033
+ @keyframes slideIn {
1034
+ from {
1035
+ opacity: 0;
1036
+ transform: translateY(-10px);
1037
+ }
1038
+ to {
1039
+ opacity: 1;
1040
+ transform: translateY(0);
1041
+ }
1042
+ }
1043
+ ` })
1044
+ ]
1045
+ }
1046
+ )
1047
+ }
1048
+ );
1049
+ };
1050
+ async function mr(d, k, O) {
1051
+ const f = {
1052
+ "Content-Type": "application/json"
1053
+ };
1054
+ O && (f["X-API-Key"] = O);
1055
+ try {
1056
+ const p = await fetch(`${d}/api/feedback`, {
1057
+ method: "POST",
1058
+ headers: f,
1059
+ body: JSON.stringify(k)
1060
+ });
1061
+ if (!p.ok) {
1062
+ const o = await p.json().catch(() => ({}));
1063
+ throw new Error(o.message || `HTTP ${p.status}: ${p.statusText}`);
1064
+ }
1065
+ return await p.json();
1066
+ } catch (p) {
1067
+ throw p instanceof Error ? p : new Error("Failed to submit feedback");
1068
+ }
1069
+ }
1070
+ const Rr = ({
1071
+ projectId: d,
1072
+ apiKey: k,
1073
+ apiUrl: O = "http://localhost:3000",
1074
+ buttonText: f = "Feedback",
1075
+ showIcon: p = !0,
1076
+ position: o = "bottom-right",
1077
+ size: F = "medium",
1078
+ buttonColor: E = "#3b82f6",
1079
+ buttonHoverColor: b = "#2563eb",
1080
+ buttonTextColor: T = "#ffffff",
1081
+ customStyles: y,
1082
+ customClassName: R = "",
1083
+ disabled: v = !1,
1084
+ autoOpen: z = !1,
1085
+ onOpen: D,
1086
+ onClose: C,
1087
+ onSuccess: B,
1088
+ onError: P
1089
+ }) => {
1090
+ const [h, L] = $(z), [i, j] = $(!1), H = () => {
1091
+ v || (L(!0), D == null || D());
1092
+ }, re = () => {
1093
+ L(!1), C == null || C();
1094
+ }, te = async (g) => {
1095
+ try {
1096
+ const M = {
1097
+ ...g,
1098
+ project_id: d,
1099
+ page_url: window.location.href,
1100
+ page_title: document.title,
1101
+ user_agent: navigator.userAgent,
1102
+ user_identifier: g.userEmail || "anonymous",
1103
+ user_email: g.userEmail,
1104
+ user_name: g.userName,
1105
+ feedback_type: g.feedbackType
1106
+ }, W = await mr(O, M, k);
1107
+ B && (W != null && W.id) && B(W.id);
1108
+ } catch (M) {
1109
+ throw P && M instanceof Error && P(M), M;
1110
+ }
1111
+ }, G = {
1112
+ small: {
1113
+ padding: "8px 16px",
1114
+ fontSize: "14px",
1115
+ iconSize: "16px"
1116
+ },
1117
+ medium: {
1118
+ padding: "12px 20px",
1119
+ fontSize: "16px",
1120
+ iconSize: "20px"
1121
+ },
1122
+ large: {
1123
+ padding: "16px 28px",
1124
+ fontSize: "18px",
1125
+ iconSize: "24px"
1126
+ }
1127
+ }, ne = () => {
1128
+ if (o === "inline")
1129
+ return {
1130
+ display: "inline-flex",
1131
+ position: "relative"
1132
+ };
1133
+ const g = {
1134
+ position: "fixed",
1135
+ zIndex: 9999
1136
+ };
1137
+ return o.includes("bottom") ? g.bottom = "20px" : g.top = "20px", o.includes("right") ? g.right = "20px" : g.left = "20px", g;
1138
+ }, V = G[F], I = {
1139
+ ...ne(),
1140
+ padding: V.padding,
1141
+ backgroundColor: i && !v ? b : E,
1142
+ color: T,
1143
+ border: "none",
1144
+ borderRadius: "8px",
1145
+ fontSize: V.fontSize,
1146
+ fontWeight: "600",
1147
+ cursor: v ? "not-allowed" : "pointer",
1148
+ display: "flex",
1149
+ alignItems: "center",
1150
+ justifyContent: "center",
1151
+ gap: "8px",
1152
+ boxShadow: o !== "inline" ? "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)" : "none",
1153
+ transition: "all 0.2s ease",
1154
+ opacity: v ? 0.6 : 1,
1155
+ transform: i && !v ? "translateY(-2px)" : "translateY(0)",
1156
+ outline: "none",
1157
+ ...y
1158
+ }, A = {
1159
+ fontSize: V.iconSize,
1160
+ lineHeight: 1,
1161
+ display: "flex",
1162
+ alignItems: "center"
1163
+ };
1164
+ return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
1165
+ /* @__PURE__ */ n.jsxs(
1166
+ "button",
1167
+ {
1168
+ onClick: H,
1169
+ onMouseEnter: () => !v && j(!0),
1170
+ onMouseLeave: () => !v && j(!1),
1171
+ disabled: v,
1172
+ className: R,
1173
+ style: I,
1174
+ "aria-label": "Open feedback form",
1175
+ "aria-pressed": h,
1176
+ "aria-disabled": v,
1177
+ role: "button",
1178
+ tabIndex: v ? -1 : 0,
1179
+ onKeyDown: (g) => {
1180
+ !v && (g.key === "Enter" || g.key === " ") && (g.preventDefault(), H());
1181
+ },
1182
+ children: [
1183
+ p && /* @__PURE__ */ n.jsx("span", { style: A, "aria-hidden": "true", children: "💬" }),
1184
+ /* @__PURE__ */ n.jsx("span", { children: f })
1185
+ ]
1186
+ }
1187
+ ),
1188
+ /* @__PURE__ */ n.jsx(
1189
+ hr,
1190
+ {
1191
+ isOpen: h,
1192
+ onClose: re,
1193
+ onSubmit: te
1194
+ }
1195
+ )
1196
+ ] });
1197
+ }, Be = br(null), Sr = () => {
1198
+ const d = gr(Be);
1199
+ if (!d)
1200
+ throw new Error("useMetricShift must be used within MetricShiftProvider");
1201
+ return d;
1202
+ }, _r = ({
1203
+ config: d,
1204
+ children: k
1205
+ }) => /* @__PURE__ */ n.jsx(Be.Provider, { value: d, children: k });
1206
+ let pe = null;
1207
+ const kr = {
1208
+ /**
1209
+ * Initialize the MetricShift SDK
1210
+ * @param config - SDK configuration
1211
+ */
1212
+ init: (d) => {
1213
+ pe = {
1214
+ apiUrl: "http://localhost:3000",
1215
+ ...d
1216
+ }, console.log("✅ MetricShift SDK initialized", {
1217
+ projectId: d.projectId,
1218
+ apiUrl: pe.apiUrl
1219
+ });
1220
+ },
1221
+ /**
1222
+ * Get current SDK configuration
1223
+ */
1224
+ getConfig: () => pe
1225
+ };
1226
+ export {
1227
+ Rr as FeedbackButton,
1228
+ hr as FeedbackModal,
1229
+ kr as MetricShift,
1230
+ _r as MetricShiftProvider,
1231
+ mr as submitFeedback,
1232
+ Sr as useMetricShift
1233
+ };
1234
+ //# sourceMappingURL=index.esm.js.map