@neurobot/sdk-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.
Files changed (53) hide show
  1. package/INTEGRATION.md +140 -0
  2. package/LICENSE +21 -0
  3. package/MOCK_MODE.md +245 -0
  4. package/README.md +114 -0
  5. package/dist/components/ChatWindow.d.ts +25 -0
  6. package/dist/components/ChatWindow.d.ts.map +1 -0
  7. package/dist/components/ChatWindow.js +14 -0
  8. package/dist/components/ChatWindow.js.map +1 -0
  9. package/dist/components/FloatingButton.d.ts +9 -0
  10. package/dist/components/FloatingButton.d.ts.map +1 -0
  11. package/dist/components/FloatingButton.js +8 -0
  12. package/dist/components/FloatingButton.js.map +1 -0
  13. package/dist/components/InputForm.d.ts +11 -0
  14. package/dist/components/InputForm.d.ts.map +1 -0
  15. package/dist/components/InputForm.js +9 -0
  16. package/dist/components/InputForm.js.map +1 -0
  17. package/dist/components/MessageList.d.ts +11 -0
  18. package/dist/components/MessageList.d.ts.map +1 -0
  19. package/dist/components/MessageList.js +12 -0
  20. package/dist/components/MessageList.js.map +1 -0
  21. package/dist/components/NeuroBot.d.ts +4 -0
  22. package/dist/components/NeuroBot.d.ts.map +1 -0
  23. package/dist/components/NeuroBot.js +110 -0
  24. package/dist/components/NeuroBot.js.map +1 -0
  25. package/dist/context/NeuroBotContext.d.ts +18 -0
  26. package/dist/context/NeuroBotContext.d.ts.map +1 -0
  27. package/dist/context/NeuroBotContext.js +20 -0
  28. package/dist/context/NeuroBotContext.js.map +1 -0
  29. package/dist/index.d.ts +6 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.esm.js +1776 -0
  32. package/dist/index.esm.js.map +1 -0
  33. package/dist/index.js +1783 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/index.umd.js +1787 -0
  36. package/dist/index.umd.js.map +1 -0
  37. package/dist/types/index.d.ts +25 -0
  38. package/dist/types/index.d.ts.map +1 -0
  39. package/dist/types/index.js +2 -0
  40. package/dist/types/index.js.map +1 -0
  41. package/dist/utils/api.d.ts +25 -0
  42. package/dist/utils/api.d.ts.map +1 -0
  43. package/dist/utils/api.js +49 -0
  44. package/dist/utils/api.js.map +1 -0
  45. package/dist/utils/auth.d.ts +20 -0
  46. package/dist/utils/auth.d.ts.map +1 -0
  47. package/dist/utils/auth.js +30 -0
  48. package/dist/utils/auth.js.map +1 -0
  49. package/dist/utils/mock.d.ts +20 -0
  50. package/dist/utils/mock.d.ts.map +1 -0
  51. package/dist/utils/mock.js +67 -0
  52. package/dist/utils/mock.js.map +1 -0
  53. package/package.json +64 -0
@@ -0,0 +1,1787 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.NeuroBot = {}, global.React));
5
+ })(this, (function (exports, require$$0) { 'use strict';
6
+
7
+ var jsxRuntime = {exports: {}};
8
+
9
+ var reactJsxRuntime_production_min = {};
10
+
11
+ /**
12
+ * @license React
13
+ * react-jsx-runtime.production.min.js
14
+ *
15
+ * Copyright (c) Facebook, Inc. and its affiliates.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */
20
+
21
+ var hasRequiredReactJsxRuntime_production_min;
22
+
23
+ function requireReactJsxRuntime_production_min () {
24
+ if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
25
+ hasRequiredReactJsxRuntime_production_min = 1;
26
+ var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
27
+ function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
28
+ return reactJsxRuntime_production_min;
29
+ }
30
+
31
+ var reactJsxRuntime_development = {};
32
+
33
+ /**
34
+ * @license React
35
+ * react-jsx-runtime.development.js
36
+ *
37
+ * Copyright (c) Facebook, Inc. and its affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */
42
+
43
+ var hasRequiredReactJsxRuntime_development;
44
+
45
+ function requireReactJsxRuntime_development () {
46
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
47
+ hasRequiredReactJsxRuntime_development = 1;
48
+
49
+ if (process.env.NODE_ENV !== "production") {
50
+ (function() {
51
+
52
+ var React = require$$0;
53
+
54
+ // ATTENTION
55
+ // When adding new symbols to this file,
56
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
57
+ // The Symbol used to tag the ReactElement-like types.
58
+ var REACT_ELEMENT_TYPE = Symbol.for('react.element');
59
+ var REACT_PORTAL_TYPE = Symbol.for('react.portal');
60
+ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
61
+ var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
62
+ var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
63
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
64
+ var REACT_CONTEXT_TYPE = Symbol.for('react.context');
65
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
66
+ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
67
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
68
+ var REACT_MEMO_TYPE = Symbol.for('react.memo');
69
+ var REACT_LAZY_TYPE = Symbol.for('react.lazy');
70
+ var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
71
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
72
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
73
+ function getIteratorFn(maybeIterable) {
74
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
75
+ return null;
76
+ }
77
+
78
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
79
+
80
+ if (typeof maybeIterator === 'function') {
81
+ return maybeIterator;
82
+ }
83
+
84
+ return null;
85
+ }
86
+
87
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
88
+
89
+ function error(format) {
90
+ {
91
+ {
92
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
93
+ args[_key2 - 1] = arguments[_key2];
94
+ }
95
+
96
+ printWarning('error', format, args);
97
+ }
98
+ }
99
+ }
100
+
101
+ function printWarning(level, format, args) {
102
+ // When changing this logic, you might want to also
103
+ // update consoleWithStackDev.www.js as well.
104
+ {
105
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
106
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
107
+
108
+ if (stack !== '') {
109
+ format += '%s';
110
+ args = args.concat([stack]);
111
+ } // eslint-disable-next-line react-internal/safe-string-coercion
112
+
113
+
114
+ var argsWithFormat = args.map(function (item) {
115
+ return String(item);
116
+ }); // Careful: RN currently depends on this prefix
117
+
118
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
119
+ // breaks IE9: https://github.com/facebook/react/issues/13610
120
+ // eslint-disable-next-line react-internal/no-production-logging
121
+
122
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
123
+ }
124
+ }
125
+
126
+ // -----------------------------------------------------------------------------
127
+
128
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
129
+ var enableCacheElement = false;
130
+ var enableTransitionTracing = false; // No known bugs, but needs performance testing
131
+
132
+ var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
133
+ // stuff. Intended to enable React core members to more easily debug scheduling
134
+ // issues in DEV builds.
135
+
136
+ var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
137
+
138
+ var REACT_MODULE_REFERENCE;
139
+
140
+ {
141
+ REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
142
+ }
143
+
144
+ function isValidElementType(type) {
145
+ if (typeof type === 'string' || typeof type === 'function') {
146
+ return true;
147
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
148
+
149
+
150
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
151
+ return true;
152
+ }
153
+
154
+ if (typeof type === 'object' && type !== null) {
155
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
156
+ // types supported by any Flight configuration anywhere since
157
+ // we don't know which Flight build this will end up being used
158
+ // with.
159
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
160
+ return true;
161
+ }
162
+ }
163
+
164
+ return false;
165
+ }
166
+
167
+ function getWrappedName(outerType, innerType, wrapperName) {
168
+ var displayName = outerType.displayName;
169
+
170
+ if (displayName) {
171
+ return displayName;
172
+ }
173
+
174
+ var functionName = innerType.displayName || innerType.name || '';
175
+ return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
176
+ } // Keep in sync with react-reconciler/getComponentNameFromFiber
177
+
178
+
179
+ function getContextName(type) {
180
+ return type.displayName || 'Context';
181
+ } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
182
+
183
+
184
+ function getComponentNameFromType(type) {
185
+ if (type == null) {
186
+ // Host root, text node or just invalid type.
187
+ return null;
188
+ }
189
+
190
+ {
191
+ if (typeof type.tag === 'number') {
192
+ error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
193
+ }
194
+ }
195
+
196
+ if (typeof type === 'function') {
197
+ return type.displayName || type.name || null;
198
+ }
199
+
200
+ if (typeof type === 'string') {
201
+ return type;
202
+ }
203
+
204
+ switch (type) {
205
+ case REACT_FRAGMENT_TYPE:
206
+ return 'Fragment';
207
+
208
+ case REACT_PORTAL_TYPE:
209
+ return 'Portal';
210
+
211
+ case REACT_PROFILER_TYPE:
212
+ return 'Profiler';
213
+
214
+ case REACT_STRICT_MODE_TYPE:
215
+ return 'StrictMode';
216
+
217
+ case REACT_SUSPENSE_TYPE:
218
+ return 'Suspense';
219
+
220
+ case REACT_SUSPENSE_LIST_TYPE:
221
+ return 'SuspenseList';
222
+
223
+ }
224
+
225
+ if (typeof type === 'object') {
226
+ switch (type.$$typeof) {
227
+ case REACT_CONTEXT_TYPE:
228
+ var context = type;
229
+ return getContextName(context) + '.Consumer';
230
+
231
+ case REACT_PROVIDER_TYPE:
232
+ var provider = type;
233
+ return getContextName(provider._context) + '.Provider';
234
+
235
+ case REACT_FORWARD_REF_TYPE:
236
+ return getWrappedName(type, type.render, 'ForwardRef');
237
+
238
+ case REACT_MEMO_TYPE:
239
+ var outerName = type.displayName || null;
240
+
241
+ if (outerName !== null) {
242
+ return outerName;
243
+ }
244
+
245
+ return getComponentNameFromType(type.type) || 'Memo';
246
+
247
+ case REACT_LAZY_TYPE:
248
+ {
249
+ var lazyComponent = type;
250
+ var payload = lazyComponent._payload;
251
+ var init = lazyComponent._init;
252
+
253
+ try {
254
+ return getComponentNameFromType(init(payload));
255
+ } catch (x) {
256
+ return null;
257
+ }
258
+ }
259
+
260
+ // eslint-disable-next-line no-fallthrough
261
+ }
262
+ }
263
+
264
+ return null;
265
+ }
266
+
267
+ var assign = Object.assign;
268
+
269
+ // Helpers to patch console.logs to avoid logging during side-effect free
270
+ // replaying on render function. This currently only patches the object
271
+ // lazily which won't cover if the log function was extracted eagerly.
272
+ // We could also eagerly patch the method.
273
+ var disabledDepth = 0;
274
+ var prevLog;
275
+ var prevInfo;
276
+ var prevWarn;
277
+ var prevError;
278
+ var prevGroup;
279
+ var prevGroupCollapsed;
280
+ var prevGroupEnd;
281
+
282
+ function disabledLog() {}
283
+
284
+ disabledLog.__reactDisabledLog = true;
285
+ function disableLogs() {
286
+ {
287
+ if (disabledDepth === 0) {
288
+ /* eslint-disable react-internal/no-production-logging */
289
+ prevLog = console.log;
290
+ prevInfo = console.info;
291
+ prevWarn = console.warn;
292
+ prevError = console.error;
293
+ prevGroup = console.group;
294
+ prevGroupCollapsed = console.groupCollapsed;
295
+ prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
296
+
297
+ var props = {
298
+ configurable: true,
299
+ enumerable: true,
300
+ value: disabledLog,
301
+ writable: true
302
+ }; // $FlowFixMe Flow thinks console is immutable.
303
+
304
+ Object.defineProperties(console, {
305
+ info: props,
306
+ log: props,
307
+ warn: props,
308
+ error: props,
309
+ group: props,
310
+ groupCollapsed: props,
311
+ groupEnd: props
312
+ });
313
+ /* eslint-enable react-internal/no-production-logging */
314
+ }
315
+
316
+ disabledDepth++;
317
+ }
318
+ }
319
+ function reenableLogs() {
320
+ {
321
+ disabledDepth--;
322
+
323
+ if (disabledDepth === 0) {
324
+ /* eslint-disable react-internal/no-production-logging */
325
+ var props = {
326
+ configurable: true,
327
+ enumerable: true,
328
+ writable: true
329
+ }; // $FlowFixMe Flow thinks console is immutable.
330
+
331
+ Object.defineProperties(console, {
332
+ log: assign({}, props, {
333
+ value: prevLog
334
+ }),
335
+ info: assign({}, props, {
336
+ value: prevInfo
337
+ }),
338
+ warn: assign({}, props, {
339
+ value: prevWarn
340
+ }),
341
+ error: assign({}, props, {
342
+ value: prevError
343
+ }),
344
+ group: assign({}, props, {
345
+ value: prevGroup
346
+ }),
347
+ groupCollapsed: assign({}, props, {
348
+ value: prevGroupCollapsed
349
+ }),
350
+ groupEnd: assign({}, props, {
351
+ value: prevGroupEnd
352
+ })
353
+ });
354
+ /* eslint-enable react-internal/no-production-logging */
355
+ }
356
+
357
+ if (disabledDepth < 0) {
358
+ error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
359
+ }
360
+ }
361
+ }
362
+
363
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
364
+ var prefix;
365
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
366
+ {
367
+ if (prefix === undefined) {
368
+ // Extract the VM specific prefix used by each line.
369
+ try {
370
+ throw Error();
371
+ } catch (x) {
372
+ var match = x.stack.trim().match(/\n( *(at )?)/);
373
+ prefix = match && match[1] || '';
374
+ }
375
+ } // We use the prefix to ensure our stacks line up with native stack frames.
376
+
377
+
378
+ return '\n' + prefix + name;
379
+ }
380
+ }
381
+ var reentry = false;
382
+ var componentFrameCache;
383
+
384
+ {
385
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
386
+ componentFrameCache = new PossiblyWeakMap();
387
+ }
388
+
389
+ function describeNativeComponentFrame(fn, construct) {
390
+ // If something asked for a stack inside a fake render, it should get ignored.
391
+ if ( !fn || reentry) {
392
+ return '';
393
+ }
394
+
395
+ {
396
+ var frame = componentFrameCache.get(fn);
397
+
398
+ if (frame !== undefined) {
399
+ return frame;
400
+ }
401
+ }
402
+
403
+ var control;
404
+ reentry = true;
405
+ var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
406
+
407
+ Error.prepareStackTrace = undefined;
408
+ var previousDispatcher;
409
+
410
+ {
411
+ previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
412
+ // for warnings.
413
+
414
+ ReactCurrentDispatcher.current = null;
415
+ disableLogs();
416
+ }
417
+
418
+ try {
419
+ // This should throw.
420
+ if (construct) {
421
+ // Something should be setting the props in the constructor.
422
+ var Fake = function () {
423
+ throw Error();
424
+ }; // $FlowFixMe
425
+
426
+
427
+ Object.defineProperty(Fake.prototype, 'props', {
428
+ set: function () {
429
+ // We use a throwing setter instead of frozen or non-writable props
430
+ // because that won't throw in a non-strict mode function.
431
+ throw Error();
432
+ }
433
+ });
434
+
435
+ if (typeof Reflect === 'object' && Reflect.construct) {
436
+ // We construct a different control for this case to include any extra
437
+ // frames added by the construct call.
438
+ try {
439
+ Reflect.construct(Fake, []);
440
+ } catch (x) {
441
+ control = x;
442
+ }
443
+
444
+ Reflect.construct(fn, [], Fake);
445
+ } else {
446
+ try {
447
+ Fake.call();
448
+ } catch (x) {
449
+ control = x;
450
+ }
451
+
452
+ fn.call(Fake.prototype);
453
+ }
454
+ } else {
455
+ try {
456
+ throw Error();
457
+ } catch (x) {
458
+ control = x;
459
+ }
460
+
461
+ fn();
462
+ }
463
+ } catch (sample) {
464
+ // This is inlined manually because closure doesn't do it for us.
465
+ if (sample && control && typeof sample.stack === 'string') {
466
+ // This extracts the first frame from the sample that isn't also in the control.
467
+ // Skipping one frame that we assume is the frame that calls the two.
468
+ var sampleLines = sample.stack.split('\n');
469
+ var controlLines = control.stack.split('\n');
470
+ var s = sampleLines.length - 1;
471
+ var c = controlLines.length - 1;
472
+
473
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
474
+ // We expect at least one stack frame to be shared.
475
+ // Typically this will be the root most one. However, stack frames may be
476
+ // cut off due to maximum stack limits. In this case, one maybe cut off
477
+ // earlier than the other. We assume that the sample is longer or the same
478
+ // and there for cut off earlier. So we should find the root most frame in
479
+ // the sample somewhere in the control.
480
+ c--;
481
+ }
482
+
483
+ for (; s >= 1 && c >= 0; s--, c--) {
484
+ // Next we find the first one that isn't the same which should be the
485
+ // frame that called our sample function and the control.
486
+ if (sampleLines[s] !== controlLines[c]) {
487
+ // In V8, the first line is describing the message but other VMs don't.
488
+ // If we're about to return the first line, and the control is also on the same
489
+ // line, that's a pretty good indicator that our sample threw at same line as
490
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
491
+ // This can happen if you passed a class to function component, or non-function.
492
+ if (s !== 1 || c !== 1) {
493
+ do {
494
+ s--;
495
+ c--; // We may still have similar intermediate frames from the construct call.
496
+ // The next one that isn't the same should be our match though.
497
+
498
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
499
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
500
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
501
+ // but we have a user-provided "displayName"
502
+ // splice it in to make the stack more readable.
503
+
504
+
505
+ if (fn.displayName && _frame.includes('<anonymous>')) {
506
+ _frame = _frame.replace('<anonymous>', fn.displayName);
507
+ }
508
+
509
+ {
510
+ if (typeof fn === 'function') {
511
+ componentFrameCache.set(fn, _frame);
512
+ }
513
+ } // Return the line we found.
514
+
515
+
516
+ return _frame;
517
+ }
518
+ } while (s >= 1 && c >= 0);
519
+ }
520
+
521
+ break;
522
+ }
523
+ }
524
+ }
525
+ } finally {
526
+ reentry = false;
527
+
528
+ {
529
+ ReactCurrentDispatcher.current = previousDispatcher;
530
+ reenableLogs();
531
+ }
532
+
533
+ Error.prepareStackTrace = previousPrepareStackTrace;
534
+ } // Fallback to just using the name if we couldn't make it throw.
535
+
536
+
537
+ var name = fn ? fn.displayName || fn.name : '';
538
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
539
+
540
+ {
541
+ if (typeof fn === 'function') {
542
+ componentFrameCache.set(fn, syntheticFrame);
543
+ }
544
+ }
545
+
546
+ return syntheticFrame;
547
+ }
548
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
549
+ {
550
+ return describeNativeComponentFrame(fn, false);
551
+ }
552
+ }
553
+
554
+ function shouldConstruct(Component) {
555
+ var prototype = Component.prototype;
556
+ return !!(prototype && prototype.isReactComponent);
557
+ }
558
+
559
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
560
+
561
+ if (type == null) {
562
+ return '';
563
+ }
564
+
565
+ if (typeof type === 'function') {
566
+ {
567
+ return describeNativeComponentFrame(type, shouldConstruct(type));
568
+ }
569
+ }
570
+
571
+ if (typeof type === 'string') {
572
+ return describeBuiltInComponentFrame(type);
573
+ }
574
+
575
+ switch (type) {
576
+ case REACT_SUSPENSE_TYPE:
577
+ return describeBuiltInComponentFrame('Suspense');
578
+
579
+ case REACT_SUSPENSE_LIST_TYPE:
580
+ return describeBuiltInComponentFrame('SuspenseList');
581
+ }
582
+
583
+ if (typeof type === 'object') {
584
+ switch (type.$$typeof) {
585
+ case REACT_FORWARD_REF_TYPE:
586
+ return describeFunctionComponentFrame(type.render);
587
+
588
+ case REACT_MEMO_TYPE:
589
+ // Memo may contain any component type so we recursively resolve it.
590
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
591
+
592
+ case REACT_LAZY_TYPE:
593
+ {
594
+ var lazyComponent = type;
595
+ var payload = lazyComponent._payload;
596
+ var init = lazyComponent._init;
597
+
598
+ try {
599
+ // Lazy may contain any component type so we recursively resolve it.
600
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
601
+ } catch (x) {}
602
+ }
603
+ }
604
+ }
605
+
606
+ return '';
607
+ }
608
+
609
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
610
+
611
+ var loggedTypeFailures = {};
612
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
613
+
614
+ function setCurrentlyValidatingElement(element) {
615
+ {
616
+ if (element) {
617
+ var owner = element._owner;
618
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
619
+ ReactDebugCurrentFrame.setExtraStackFrame(stack);
620
+ } else {
621
+ ReactDebugCurrentFrame.setExtraStackFrame(null);
622
+ }
623
+ }
624
+ }
625
+
626
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
627
+ {
628
+ // $FlowFixMe This is okay but Flow doesn't know it.
629
+ var has = Function.call.bind(hasOwnProperty);
630
+
631
+ for (var typeSpecName in typeSpecs) {
632
+ if (has(typeSpecs, typeSpecName)) {
633
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
634
+ // fail the render phase where it didn't fail before. So we log it.
635
+ // After these have been cleaned up, we'll let them throw.
636
+
637
+ try {
638
+ // This is intentionally an invariant that gets caught. It's the same
639
+ // behavior as without this statement except with a better message.
640
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
641
+ // eslint-disable-next-line react-internal/prod-error-codes
642
+ var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
643
+ err.name = 'Invariant Violation';
644
+ throw err;
645
+ }
646
+
647
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
648
+ } catch (ex) {
649
+ error$1 = ex;
650
+ }
651
+
652
+ if (error$1 && !(error$1 instanceof Error)) {
653
+ setCurrentlyValidatingElement(element);
654
+
655
+ error('%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).', componentName || 'React class', location, typeSpecName, typeof error$1);
656
+
657
+ setCurrentlyValidatingElement(null);
658
+ }
659
+
660
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
661
+ // Only monitor this failure once because there tends to be a lot of the
662
+ // same error.
663
+ loggedTypeFailures[error$1.message] = true;
664
+ setCurrentlyValidatingElement(element);
665
+
666
+ error('Failed %s type: %s', location, error$1.message);
667
+
668
+ setCurrentlyValidatingElement(null);
669
+ }
670
+ }
671
+ }
672
+ }
673
+ }
674
+
675
+ var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
676
+
677
+ function isArray(a) {
678
+ return isArrayImpl(a);
679
+ }
680
+
681
+ /*
682
+ * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
683
+ * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
684
+ *
685
+ * The functions in this module will throw an easier-to-understand,
686
+ * easier-to-debug exception with a clear errors message message explaining the
687
+ * problem. (Instead of a confusing exception thrown inside the implementation
688
+ * of the `value` object).
689
+ */
690
+ // $FlowFixMe only called in DEV, so void return is not possible.
691
+ function typeName(value) {
692
+ {
693
+ // toStringTag is needed for namespaced types like Temporal.Instant
694
+ var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
695
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
696
+ return type;
697
+ }
698
+ } // $FlowFixMe only called in DEV, so void return is not possible.
699
+
700
+
701
+ function willCoercionThrow(value) {
702
+ {
703
+ try {
704
+ testStringCoercion(value);
705
+ return false;
706
+ } catch (e) {
707
+ return true;
708
+ }
709
+ }
710
+ }
711
+
712
+ function testStringCoercion(value) {
713
+ // If you ended up here by following an exception call stack, here's what's
714
+ // happened: you supplied an object or symbol value to React (as a prop, key,
715
+ // DOM attribute, CSS property, string ref, etc.) and when React tried to
716
+ // coerce it to a string using `'' + value`, an exception was thrown.
717
+ //
718
+ // The most common types that will cause this exception are `Symbol` instances
719
+ // and Temporal objects like `Temporal.Instant`. But any object that has a
720
+ // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
721
+ // exception. (Library authors do this to prevent users from using built-in
722
+ // numeric operators like `+` or comparison operators like `>=` because custom
723
+ // methods are needed to perform accurate arithmetic or comparison.)
724
+ //
725
+ // To fix the problem, coerce this object or symbol value to a string before
726
+ // passing it to React. The most reliable way is usually `String(value)`.
727
+ //
728
+ // To find which value is throwing, check the browser or debugger console.
729
+ // Before this exception was thrown, there should be `console.error` output
730
+ // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
731
+ // problem and how that type was used: key, atrribute, input value prop, etc.
732
+ // In most cases, this console output also shows the component and its
733
+ // ancestor components where the exception happened.
734
+ //
735
+ // eslint-disable-next-line react-internal/safe-string-coercion
736
+ return '' + value;
737
+ }
738
+ function checkKeyStringCoercion(value) {
739
+ {
740
+ if (willCoercionThrow(value)) {
741
+ error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
742
+
743
+ return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
744
+ }
745
+ }
746
+ }
747
+
748
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
749
+ var RESERVED_PROPS = {
750
+ key: true,
751
+ ref: true,
752
+ __self: true,
753
+ __source: true
754
+ };
755
+ var specialPropKeyWarningShown;
756
+ var specialPropRefWarningShown;
757
+ var didWarnAboutStringRefs;
758
+
759
+ {
760
+ didWarnAboutStringRefs = {};
761
+ }
762
+
763
+ function hasValidRef(config) {
764
+ {
765
+ if (hasOwnProperty.call(config, 'ref')) {
766
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
767
+
768
+ if (getter && getter.isReactWarning) {
769
+ return false;
770
+ }
771
+ }
772
+ }
773
+
774
+ return config.ref !== undefined;
775
+ }
776
+
777
+ function hasValidKey(config) {
778
+ {
779
+ if (hasOwnProperty.call(config, 'key')) {
780
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
781
+
782
+ if (getter && getter.isReactWarning) {
783
+ return false;
784
+ }
785
+ }
786
+ }
787
+
788
+ return config.key !== undefined;
789
+ }
790
+
791
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
792
+ {
793
+ if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
794
+ var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
795
+
796
+ if (!didWarnAboutStringRefs[componentName]) {
797
+ error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
798
+
799
+ didWarnAboutStringRefs[componentName] = true;
800
+ }
801
+ }
802
+ }
803
+ }
804
+
805
+ function defineKeyPropWarningGetter(props, displayName) {
806
+ {
807
+ var warnAboutAccessingKey = function () {
808
+ if (!specialPropKeyWarningShown) {
809
+ specialPropKeyWarningShown = true;
810
+
811
+ error('%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)', displayName);
812
+ }
813
+ };
814
+
815
+ warnAboutAccessingKey.isReactWarning = true;
816
+ Object.defineProperty(props, 'key', {
817
+ get: warnAboutAccessingKey,
818
+ configurable: true
819
+ });
820
+ }
821
+ }
822
+
823
+ function defineRefPropWarningGetter(props, displayName) {
824
+ {
825
+ var warnAboutAccessingRef = function () {
826
+ if (!specialPropRefWarningShown) {
827
+ specialPropRefWarningShown = true;
828
+
829
+ error('%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)', displayName);
830
+ }
831
+ };
832
+
833
+ warnAboutAccessingRef.isReactWarning = true;
834
+ Object.defineProperty(props, 'ref', {
835
+ get: warnAboutAccessingRef,
836
+ configurable: true
837
+ });
838
+ }
839
+ }
840
+ /**
841
+ * Factory method to create a new React element. This no longer adheres to
842
+ * the class pattern, so do not use new to call it. Also, instanceof check
843
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
844
+ * if something is a React Element.
845
+ *
846
+ * @param {*} type
847
+ * @param {*} props
848
+ * @param {*} key
849
+ * @param {string|object} ref
850
+ * @param {*} owner
851
+ * @param {*} self A *temporary* helper to detect places where `this` is
852
+ * different from the `owner` when React.createElement is called, so that we
853
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
854
+ * functions, and as long as `this` and owner are the same, there will be no
855
+ * change in behavior.
856
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
857
+ * indicating filename, line number, and/or other information.
858
+ * @internal
859
+ */
860
+
861
+
862
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
863
+ var element = {
864
+ // This tag allows us to uniquely identify this as a React Element
865
+ $$typeof: REACT_ELEMENT_TYPE,
866
+ // Built-in properties that belong on the element
867
+ type: type,
868
+ key: key,
869
+ ref: ref,
870
+ props: props,
871
+ // Record the component responsible for creating this element.
872
+ _owner: owner
873
+ };
874
+
875
+ {
876
+ // The validation flag is currently mutative. We put it on
877
+ // an external backing store so that we can freeze the whole object.
878
+ // This can be replaced with a WeakMap once they are implemented in
879
+ // commonly used development environments.
880
+ element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
881
+ // the validation flag non-enumerable (where possible, which should
882
+ // include every environment we run tests in), so the test framework
883
+ // ignores it.
884
+
885
+ Object.defineProperty(element._store, 'validated', {
886
+ configurable: false,
887
+ enumerable: false,
888
+ writable: true,
889
+ value: false
890
+ }); // self and source are DEV only properties.
891
+
892
+ Object.defineProperty(element, '_self', {
893
+ configurable: false,
894
+ enumerable: false,
895
+ writable: false,
896
+ value: self
897
+ }); // Two elements created in two different places should be considered
898
+ // equal for testing purposes and therefore we hide it from enumeration.
899
+
900
+ Object.defineProperty(element, '_source', {
901
+ configurable: false,
902
+ enumerable: false,
903
+ writable: false,
904
+ value: source
905
+ });
906
+
907
+ if (Object.freeze) {
908
+ Object.freeze(element.props);
909
+ Object.freeze(element);
910
+ }
911
+ }
912
+
913
+ return element;
914
+ };
915
+ /**
916
+ * https://github.com/reactjs/rfcs/pull/107
917
+ * @param {*} type
918
+ * @param {object} props
919
+ * @param {string} key
920
+ */
921
+
922
+ function jsxDEV(type, config, maybeKey, source, self) {
923
+ {
924
+ var propName; // Reserved names are extracted
925
+
926
+ var props = {};
927
+ var key = null;
928
+ var ref = null; // Currently, key can be spread in as a prop. This causes a potential
929
+ // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
930
+ // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
931
+ // but as an intermediary step, we will use jsxDEV for everything except
932
+ // <div {...props} key="Hi" />, because we aren't currently able to tell if
933
+ // key is explicitly declared to be undefined or not.
934
+
935
+ if (maybeKey !== undefined) {
936
+ {
937
+ checkKeyStringCoercion(maybeKey);
938
+ }
939
+
940
+ key = '' + maybeKey;
941
+ }
942
+
943
+ if (hasValidKey(config)) {
944
+ {
945
+ checkKeyStringCoercion(config.key);
946
+ }
947
+
948
+ key = '' + config.key;
949
+ }
950
+
951
+ if (hasValidRef(config)) {
952
+ ref = config.ref;
953
+ warnIfStringRefCannotBeAutoConverted(config, self);
954
+ } // Remaining properties are added to a new props object
955
+
956
+
957
+ for (propName in config) {
958
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
959
+ props[propName] = config[propName];
960
+ }
961
+ } // Resolve default props
962
+
963
+
964
+ if (type && type.defaultProps) {
965
+ var defaultProps = type.defaultProps;
966
+
967
+ for (propName in defaultProps) {
968
+ if (props[propName] === undefined) {
969
+ props[propName] = defaultProps[propName];
970
+ }
971
+ }
972
+ }
973
+
974
+ if (key || ref) {
975
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
976
+
977
+ if (key) {
978
+ defineKeyPropWarningGetter(props, displayName);
979
+ }
980
+
981
+ if (ref) {
982
+ defineRefPropWarningGetter(props, displayName);
983
+ }
984
+ }
985
+
986
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
987
+ }
988
+ }
989
+
990
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
991
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
992
+
993
+ function setCurrentlyValidatingElement$1(element) {
994
+ {
995
+ if (element) {
996
+ var owner = element._owner;
997
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
998
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
999
+ } else {
1000
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1001
+ }
1002
+ }
1003
+ }
1004
+
1005
+ var propTypesMisspellWarningShown;
1006
+
1007
+ {
1008
+ propTypesMisspellWarningShown = false;
1009
+ }
1010
+ /**
1011
+ * Verifies the object is a ReactElement.
1012
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
1013
+ * @param {?object} object
1014
+ * @return {boolean} True if `object` is a ReactElement.
1015
+ * @final
1016
+ */
1017
+
1018
+
1019
+ function isValidElement(object) {
1020
+ {
1021
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1022
+ }
1023
+ }
1024
+
1025
+ function getDeclarationErrorAddendum() {
1026
+ {
1027
+ if (ReactCurrentOwner$1.current) {
1028
+ var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
1029
+
1030
+ if (name) {
1031
+ return '\n\nCheck the render method of `' + name + '`.';
1032
+ }
1033
+ }
1034
+
1035
+ return '';
1036
+ }
1037
+ }
1038
+
1039
+ function getSourceInfoErrorAddendum(source) {
1040
+ {
1041
+ if (source !== undefined) {
1042
+ var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1043
+ var lineNumber = source.lineNumber;
1044
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1045
+ }
1046
+
1047
+ return '';
1048
+ }
1049
+ }
1050
+ /**
1051
+ * Warn if there's no key explicitly set on dynamic arrays of children or
1052
+ * object keys are not valid. This allows us to keep track of children between
1053
+ * updates.
1054
+ */
1055
+
1056
+
1057
+ var ownerHasKeyUseWarning = {};
1058
+
1059
+ function getCurrentComponentErrorInfo(parentType) {
1060
+ {
1061
+ var info = getDeclarationErrorAddendum();
1062
+
1063
+ if (!info) {
1064
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1065
+
1066
+ if (parentName) {
1067
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1068
+ }
1069
+ }
1070
+
1071
+ return info;
1072
+ }
1073
+ }
1074
+ /**
1075
+ * Warn if the element doesn't have an explicit key assigned to it.
1076
+ * This element is in an array. The array could grow and shrink or be
1077
+ * reordered. All children that haven't already been validated are required to
1078
+ * have a "key" property assigned to it. Error statuses are cached so a warning
1079
+ * will only be shown once.
1080
+ *
1081
+ * @internal
1082
+ * @param {ReactElement} element Element that requires a key.
1083
+ * @param {*} parentType element's parent's type.
1084
+ */
1085
+
1086
+
1087
+ function validateExplicitKey(element, parentType) {
1088
+ {
1089
+ if (!element._store || element._store.validated || element.key != null) {
1090
+ return;
1091
+ }
1092
+
1093
+ element._store.validated = true;
1094
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1095
+
1096
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1097
+ return;
1098
+ }
1099
+
1100
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1101
+ // property, it may be the creator of the child that's responsible for
1102
+ // assigning it a key.
1103
+
1104
+ var childOwner = '';
1105
+
1106
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1107
+ // Give the component that originally created this child.
1108
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1109
+ }
1110
+
1111
+ setCurrentlyValidatingElement$1(element);
1112
+
1113
+ error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1114
+
1115
+ setCurrentlyValidatingElement$1(null);
1116
+ }
1117
+ }
1118
+ /**
1119
+ * Ensure that every element either is passed in a static location, in an
1120
+ * array with an explicit keys property defined, or in an object literal
1121
+ * with valid key property.
1122
+ *
1123
+ * @internal
1124
+ * @param {ReactNode} node Statically passed child of any type.
1125
+ * @param {*} parentType node's parent's type.
1126
+ */
1127
+
1128
+
1129
+ function validateChildKeys(node, parentType) {
1130
+ {
1131
+ if (typeof node !== 'object') {
1132
+ return;
1133
+ }
1134
+
1135
+ if (isArray(node)) {
1136
+ for (var i = 0; i < node.length; i++) {
1137
+ var child = node[i];
1138
+
1139
+ if (isValidElement(child)) {
1140
+ validateExplicitKey(child, parentType);
1141
+ }
1142
+ }
1143
+ } else if (isValidElement(node)) {
1144
+ // This element was passed in a valid location.
1145
+ if (node._store) {
1146
+ node._store.validated = true;
1147
+ }
1148
+ } else if (node) {
1149
+ var iteratorFn = getIteratorFn(node);
1150
+
1151
+ if (typeof iteratorFn === 'function') {
1152
+ // Entry iterators used to provide implicit keys,
1153
+ // but now we print a separate warning for them later.
1154
+ if (iteratorFn !== node.entries) {
1155
+ var iterator = iteratorFn.call(node);
1156
+ var step;
1157
+
1158
+ while (!(step = iterator.next()).done) {
1159
+ if (isValidElement(step.value)) {
1160
+ validateExplicitKey(step.value, parentType);
1161
+ }
1162
+ }
1163
+ }
1164
+ }
1165
+ }
1166
+ }
1167
+ }
1168
+ /**
1169
+ * Given an element, validate that its props follow the propTypes definition,
1170
+ * provided by the type.
1171
+ *
1172
+ * @param {ReactElement} element
1173
+ */
1174
+
1175
+
1176
+ function validatePropTypes(element) {
1177
+ {
1178
+ var type = element.type;
1179
+
1180
+ if (type === null || type === undefined || typeof type === 'string') {
1181
+ return;
1182
+ }
1183
+
1184
+ var propTypes;
1185
+
1186
+ if (typeof type === 'function') {
1187
+ propTypes = type.propTypes;
1188
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1189
+ // Inner props are checked in the reconciler.
1190
+ type.$$typeof === REACT_MEMO_TYPE)) {
1191
+ propTypes = type.propTypes;
1192
+ } else {
1193
+ return;
1194
+ }
1195
+
1196
+ if (propTypes) {
1197
+ // Intentionally inside to avoid triggering lazy initializers:
1198
+ var name = getComponentNameFromType(type);
1199
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
1200
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1201
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1202
+
1203
+ var _name = getComponentNameFromType(type);
1204
+
1205
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1206
+ }
1207
+
1208
+ if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1209
+ error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1210
+ }
1211
+ }
1212
+ }
1213
+ /**
1214
+ * Given a fragment, validate that it can only be provided with fragment props
1215
+ * @param {ReactElement} fragment
1216
+ */
1217
+
1218
+
1219
+ function validateFragmentProps(fragment) {
1220
+ {
1221
+ var keys = Object.keys(fragment.props);
1222
+
1223
+ for (var i = 0; i < keys.length; i++) {
1224
+ var key = keys[i];
1225
+
1226
+ if (key !== 'children' && key !== 'key') {
1227
+ setCurrentlyValidatingElement$1(fragment);
1228
+
1229
+ error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1230
+
1231
+ setCurrentlyValidatingElement$1(null);
1232
+ break;
1233
+ }
1234
+ }
1235
+
1236
+ if (fragment.ref !== null) {
1237
+ setCurrentlyValidatingElement$1(fragment);
1238
+
1239
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
1240
+
1241
+ setCurrentlyValidatingElement$1(null);
1242
+ }
1243
+ }
1244
+ }
1245
+
1246
+ var didWarnAboutKeySpread = {};
1247
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1248
+ {
1249
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1250
+ // succeed and there will likely be errors in render.
1251
+
1252
+ if (!validType) {
1253
+ var info = '';
1254
+
1255
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1256
+ info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
1257
+ }
1258
+
1259
+ var sourceInfo = getSourceInfoErrorAddendum(source);
1260
+
1261
+ if (sourceInfo) {
1262
+ info += sourceInfo;
1263
+ } else {
1264
+ info += getDeclarationErrorAddendum();
1265
+ }
1266
+
1267
+ var typeString;
1268
+
1269
+ if (type === null) {
1270
+ typeString = 'null';
1271
+ } else if (isArray(type)) {
1272
+ typeString = 'array';
1273
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1274
+ typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1275
+ info = ' Did you accidentally export a JSX literal instead of a component?';
1276
+ } else {
1277
+ typeString = typeof type;
1278
+ }
1279
+
1280
+ error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1281
+ }
1282
+
1283
+ var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1284
+ // TODO: Drop this when these are no longer allowed as the type argument.
1285
+
1286
+ if (element == null) {
1287
+ return element;
1288
+ } // Skip key warning if the type isn't valid since our key validation logic
1289
+ // doesn't expect a non-string/function type and can throw confusing errors.
1290
+ // We don't want exception behavior to differ between dev and prod.
1291
+ // (Rendering will throw with a helpful message and as soon as the type is
1292
+ // fixed, the key warnings will appear.)
1293
+
1294
+
1295
+ if (validType) {
1296
+ var children = props.children;
1297
+
1298
+ if (children !== undefined) {
1299
+ if (isStaticChildren) {
1300
+ if (isArray(children)) {
1301
+ for (var i = 0; i < children.length; i++) {
1302
+ validateChildKeys(children[i], type);
1303
+ }
1304
+
1305
+ if (Object.freeze) {
1306
+ Object.freeze(children);
1307
+ }
1308
+ } else {
1309
+ error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
1310
+ }
1311
+ } else {
1312
+ validateChildKeys(children, type);
1313
+ }
1314
+ }
1315
+ }
1316
+
1317
+ {
1318
+ if (hasOwnProperty.call(props, 'key')) {
1319
+ var componentName = getComponentNameFromType(type);
1320
+ var keys = Object.keys(props).filter(function (k) {
1321
+ return k !== 'key';
1322
+ });
1323
+ var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
1324
+
1325
+ if (!didWarnAboutKeySpread[componentName + beforeExample]) {
1326
+ var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
1327
+
1328
+ error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
1329
+
1330
+ didWarnAboutKeySpread[componentName + beforeExample] = true;
1331
+ }
1332
+ }
1333
+ }
1334
+
1335
+ if (type === REACT_FRAGMENT_TYPE) {
1336
+ validateFragmentProps(element);
1337
+ } else {
1338
+ validatePropTypes(element);
1339
+ }
1340
+
1341
+ return element;
1342
+ }
1343
+ } // These two functions exist to still get child warnings in dev
1344
+ // even with the prod transform. This means that jsxDEV is purely
1345
+ // opt-in behavior for better messages but that we won't stop
1346
+ // giving you warnings if you use production apis.
1347
+
1348
+ function jsxWithValidationStatic(type, props, key) {
1349
+ {
1350
+ return jsxWithValidation(type, props, key, true);
1351
+ }
1352
+ }
1353
+ function jsxWithValidationDynamic(type, props, key) {
1354
+ {
1355
+ return jsxWithValidation(type, props, key, false);
1356
+ }
1357
+ }
1358
+
1359
+ var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
1360
+ // for now we can ship identical prod functions
1361
+
1362
+ var jsxs = jsxWithValidationStatic ;
1363
+
1364
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
1365
+ reactJsxRuntime_development.jsx = jsx;
1366
+ reactJsxRuntime_development.jsxs = jsxs;
1367
+ })();
1368
+ }
1369
+ return reactJsxRuntime_development;
1370
+ }
1371
+
1372
+ if (process.env.NODE_ENV === 'production') {
1373
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
1374
+ } else {
1375
+ jsxRuntime.exports = requireReactJsxRuntime_development();
1376
+ }
1377
+
1378
+ var jsxRuntimeExports = jsxRuntime.exports;
1379
+
1380
+ /**
1381
+ * Client-side authentication utilities
1382
+ * SECURITY: Secret key validation happens on backend only
1383
+ */
1384
+ // NeuroBot API endpoint (fallbacks to app API URL in local dev)
1385
+ const NEUROBOT_API_URL = process.env.REACT_APP_NEUROBOT_API_URL ||
1386
+ process.env.REACT_APP_API_URL ||
1387
+ 'http://localhost:8000';
1388
+ /**
1389
+ * Get NeuroBot API URL
1390
+ */
1391
+ function getApiUrl() {
1392
+ return NEUROBOT_API_URL;
1393
+ }
1394
+ /**
1395
+ * Generate client-side headers for API requests
1396
+ * These headers are sent to NeuroBot API
1397
+ */
1398
+ function generateClientHeaders(publicKey, opts) {
1399
+ const headers = {
1400
+ 'Content-Type': 'application/json',
1401
+ 'X-API-Key': publicKey,
1402
+ };
1403
+ if (opts?.pipelineId)
1404
+ headers['X-Pipeline-Id'] = opts.pipelineId;
1405
+ if (opts?.chatbotId)
1406
+ headers['X-Chatbot-Id'] = opts.chatbotId;
1407
+ return headers;
1408
+ }
1409
+
1410
+ /**
1411
+ * Mock responses for testing SDK without a real backend
1412
+ * Remove or disable in production
1413
+ */
1414
+ const mockResponses = [
1415
+ "That's a great question! I'd be happy to help you with that.",
1416
+ "Thanks for reaching out. Let me provide you with more information about that.",
1417
+ "I understand your concern. Here's what I can tell you about that topic.",
1418
+ "That's an interesting point. Based on what you're asking, here's my response.",
1419
+ "I appreciate you asking. Let me explain that in more detail.",
1420
+ "Good question! Here's what you need to know about that.",
1421
+ "I'm glad you asked. That's something many people wonder about.",
1422
+ "That's a common question. Here's the answer you're looking for.",
1423
+ "Thanks for the question. I can help clarify that for you.",
1424
+ "I see what you're asking. Here's the information you need.",
1425
+ ];
1426
+ const contextualResponses = {
1427
+ 'hello': 'Hello! How can I assist you today?',
1428
+ 'hi': 'Hi there! What can I help you with?',
1429
+ 'how are you': "I'm doing great, thanks for asking! How can I help you?",
1430
+ 'thanks': "You're welcome! Is there anything else I can help you with?",
1431
+ 'thank you': "Happy to help! Feel free to ask if you need anything else.",
1432
+ 'bye': "Goodbye! Feel free to reach out anytime you need help.",
1433
+ 'goodbye': "Take care! I'm here whenever you need assistance.",
1434
+ 'help': "I'm here to help! What would you like to know?",
1435
+ 'what can you do': "I can answer questions, provide information, and assist with various topics. What would you like to know?",
1436
+ 'who are you': "I'm an AI assistant here to help answer your questions and provide support.",
1437
+ 'return policy': "We offer 30-day returns on most items with original receipt. Items must be in original condition. You can return items in-store or by mail.",
1438
+ 'shipping': "We offer free shipping on orders over $50. Standard shipping takes 5-7 business days. Express shipping is available for an additional fee.",
1439
+ 'refund': "Refunds are processed within 5-10 business days after we receive your return. You'll receive a confirmation email with tracking information.",
1440
+ 'contact': "You can reach us via email at support@example.com or call 1-800-EXAMPLE. Our team is available Monday-Friday, 9am-5pm EST.",
1441
+ 'hours': "We're open Monday-Friday from 9am to 5pm EST. We're closed on weekends and holidays.",
1442
+ 'price': "Prices vary depending on the product. Feel free to browse our catalog or ask about a specific item.",
1443
+ 'discount': "We offer various discounts and promotions throughout the year. Sign up for our newsletter to stay updated on current offers.",
1444
+ 'warranty': "Most of our products come with a 1-year manufacturer's warranty. Extended warranties are also available for purchase.",
1445
+ };
1446
+ /**
1447
+ * Get a mock response based on user input
1448
+ * Checks for contextual keywords first, then returns random response
1449
+ */
1450
+ function getMockResponse(userMessage) {
1451
+ const lowerMessage = userMessage.toLowerCase().trim();
1452
+ // Check for exact or partial matches in contextual responses
1453
+ for (const [key, response] of Object.entries(contextualResponses)) {
1454
+ if (lowerMessage.includes(key)) {
1455
+ return response;
1456
+ }
1457
+ }
1458
+ // Return random response if no contextual match
1459
+ return mockResponses[Math.floor(Math.random() * mockResponses.length)];
1460
+ }
1461
+ /**
1462
+ * Simulate API delay (realistic response time)
1463
+ */
1464
+ async function simulateDelay(ms = 800) {
1465
+ return new Promise(resolve => setTimeout(resolve, ms));
1466
+ }
1467
+ /**
1468
+ * Mock chat response with realistic delay
1469
+ */
1470
+ async function getMockChatResponse(userMessage) {
1471
+ // Simulate network delay
1472
+ await simulateDelay(Math.random() * 1000 + 500); // 500-1500ms
1473
+ const response = getMockResponse(userMessage);
1474
+ return { response };
1475
+ }
1476
+
1477
+ /**
1478
+ * Send message to NeuroBot API
1479
+ * NeuroBot backend processes the conversation, calls LLM models, and returns response
1480
+ *
1481
+ * For testing without a real backend, set useMock=true
1482
+ */
1483
+ async function sendMessage(request, options) {
1484
+ const { publicKey, timeout = 30000, useMock = false } = options;
1485
+ // Use mock responses for testing
1486
+ if (useMock) {
1487
+ return getMockChatResponse(request.message);
1488
+ }
1489
+ const apiUrl = getApiUrl();
1490
+ const headers = generateClientHeaders(publicKey, {
1491
+ pipelineId: request.pipelineId,
1492
+ chatbotId: request.chatbotId,
1493
+ });
1494
+ const controller = new AbortController();
1495
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
1496
+ try {
1497
+ // Send to NeuroBot API
1498
+ const response = await fetch(`${apiUrl}/chat`, {
1499
+ method: 'POST',
1500
+ headers,
1501
+ body: JSON.stringify(request),
1502
+ signal: controller.signal,
1503
+ });
1504
+ clearTimeout(timeoutId);
1505
+ if (!response.ok) {
1506
+ const errorText = await response.text();
1507
+ throw new Error(errorText || `API error: ${response.status}`);
1508
+ }
1509
+ const data = await response.json();
1510
+ return data;
1511
+ }
1512
+ catch (error) {
1513
+ clearTimeout(timeoutId);
1514
+ if (error instanceof TypeError && error.message === 'Failed to fetch') {
1515
+ throw new Error('Network error. Please check your connection.');
1516
+ }
1517
+ if (error instanceof Error && error.name === 'AbortError') {
1518
+ throw new Error('Request timeout. Please try again.');
1519
+ }
1520
+ throw error;
1521
+ }
1522
+ }
1523
+
1524
+ const NeuroBotContext = require$$0.createContext(undefined);
1525
+ const NeuroBotProvider = ({ publicKey, timeout = 30000, children, }) => {
1526
+ if (!publicKey) {
1527
+ throw new Error('NeuroBotProvider requires publicKey prop');
1528
+ }
1529
+ return (jsxRuntimeExports.jsx(NeuroBotContext.Provider, { value: {
1530
+ publicKey,
1531
+ timeout,
1532
+ }, children: children }));
1533
+ };
1534
+ const useNeuroBotContext = () => {
1535
+ const context = require$$0.useContext(NeuroBotContext);
1536
+ if (!context) {
1537
+ throw new Error('useNeuroBotContext must be used within NeuroBotProvider');
1538
+ }
1539
+ return context;
1540
+ };
1541
+
1542
+ /**
1543
+ * lucide-react v0.292.0 - ISC
1544
+ */
1545
+
1546
+ var defaultAttributes = {
1547
+ xmlns: "http://www.w3.org/2000/svg",
1548
+ width: 24,
1549
+ height: 24,
1550
+ viewBox: "0 0 24 24",
1551
+ fill: "none",
1552
+ stroke: "currentColor",
1553
+ strokeWidth: 2,
1554
+ strokeLinecap: "round",
1555
+ strokeLinejoin: "round"
1556
+ };
1557
+
1558
+ /**
1559
+ * lucide-react v0.292.0 - ISC
1560
+ */
1561
+
1562
+
1563
+ const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1564
+ const createLucideIcon = (iconName, iconNode) => {
1565
+ const Component = require$$0.forwardRef(
1566
+ ({ color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, children, ...rest }, ref) => require$$0.createElement(
1567
+ "svg",
1568
+ {
1569
+ ref,
1570
+ ...defaultAttributes,
1571
+ width: size,
1572
+ height: size,
1573
+ stroke: color,
1574
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
1575
+ className: `lucide lucide-${toKebabCase(iconName)}`,
1576
+ ...rest
1577
+ },
1578
+ [
1579
+ ...iconNode.map(([tag, attrs]) => require$$0.createElement(tag, attrs)),
1580
+ ...(Array.isArray(children) ? children : [children]) || []
1581
+ ]
1582
+ )
1583
+ );
1584
+ Component.displayName = `${iconName}`;
1585
+ return Component;
1586
+ };
1587
+
1588
+ /**
1589
+ * lucide-react v0.292.0 - ISC
1590
+ */
1591
+
1592
+
1593
+ const Maximize2 = createLucideIcon("Maximize2", [
1594
+ ["polyline", { points: "15 3 21 3 21 9", key: "mznyad" }],
1595
+ ["polyline", { points: "9 21 3 21 3 15", key: "1avn1i" }],
1596
+ ["line", { x1: "21", x2: "14", y1: "3", y2: "10", key: "ota7mn" }],
1597
+ ["line", { x1: "3", x2: "10", y1: "21", y2: "14", key: "1atl0r" }]
1598
+ ]);
1599
+
1600
+ /**
1601
+ * lucide-react v0.292.0 - ISC
1602
+ */
1603
+
1604
+
1605
+ const MessageCircle = createLucideIcon("MessageCircle", [
1606
+ ["path", { d: "m3 21 1.9-5.7a8.5 8.5 0 1 1 3.8 3.8z", key: "v2veuj" }]
1607
+ ]);
1608
+
1609
+ /**
1610
+ * lucide-react v0.292.0 - ISC
1611
+ */
1612
+
1613
+
1614
+ const Minimize2 = createLucideIcon("Minimize2", [
1615
+ ["polyline", { points: "4 14 10 14 10 20", key: "11kfnr" }],
1616
+ ["polyline", { points: "20 10 14 10 14 4", key: "rlmsce" }],
1617
+ ["line", { x1: "14", x2: "21", y1: "10", y2: "3", key: "o5lafz" }],
1618
+ ["line", { x1: "3", x2: "10", y1: "21", y2: "14", key: "1atl0r" }]
1619
+ ]);
1620
+
1621
+ /**
1622
+ * lucide-react v0.292.0 - ISC
1623
+ */
1624
+
1625
+
1626
+ const Send = createLucideIcon("Send", [
1627
+ ["path", { d: "m22 2-7 20-4-9-9-4Z", key: "1q3vgg" }],
1628
+ ["path", { d: "M22 2 11 13", key: "nzbqef" }]
1629
+ ]);
1630
+
1631
+ /**
1632
+ * lucide-react v0.292.0 - ISC
1633
+ */
1634
+
1635
+
1636
+ const X = createLucideIcon("X", [
1637
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1638
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1639
+ ]);
1640
+
1641
+ const MessageList = ({ messages, messagesEndRef, textColor, primaryColor, }) => {
1642
+ return (jsxRuntimeExports.jsxs("div", { className: "flex-1 overflow-y-auto p-4 space-y-3 bg-gradient-to-b from-neutral-50/50 to-neutral-50 dark:from-neutral-800/50 dark:to-neutral-800", children: [messages.map((msg) => (jsxRuntimeExports.jsx("div", { className: `flex ${msg.type === 'user' ? 'justify-end' : 'justify-start'} animate-fadeIn`, children: jsxRuntimeExports.jsx("div", { className: `max-w-xs px-4 py-2.5 rounded-xl shadow-sm transition-all ${msg.type === 'user'
1643
+ ? 'text-white rounded-br-none'
1644
+ : 'bg-white dark:bg-neutral-700 text-neutral-900 dark:text-neutral-100 rounded-bl-none'}`, style: msg.type === 'user'
1645
+ ? {
1646
+ backgroundColor: primaryColor,
1647
+ boxShadow: `0 2px 8px ${primaryColor}20`
1648
+ }
1649
+ : {}, children: jsxRuntimeExports.jsx("p", { className: "text-sm leading-relaxed", children: msg.text }) }) }, msg.id))), jsxRuntimeExports.jsx("div", { ref: messagesEndRef })] }));
1650
+ };
1651
+
1652
+ const InputForm = ({ inputValue, isLoading, onInputChange, onSubmit, primaryColor, }) => {
1653
+ return (jsxRuntimeExports.jsx("form", { onSubmit: onSubmit, className: "border-t border-neutral-200/50 dark:border-neutral-700/50 bg-gradient-to-r from-white to-neutral-50/50 dark:from-neutral-800 dark:to-neutral-800/50 p-4 flex-shrink-0", children: jsxRuntimeExports.jsxs("div", { className: "flex gap-2.5", children: [jsxRuntimeExports.jsx("input", { type: "text", value: inputValue, onChange: (e) => onInputChange(e.target.value), placeholder: "Type a message...", disabled: isLoading, className: "flex-1 px-4 py-2.5 border border-neutral-200 dark:border-neutral-600 rounded-xl focus:outline-none focus:ring-2 focus:border-transparent dark:bg-neutral-700 dark:text-white placeholder-neutral-400 dark:placeholder-neutral-500 transition-all", style: { '--tw-ring-color': primaryColor } }), jsxRuntimeExports.jsx("button", { type: "submit", disabled: isLoading || !inputValue.trim(), className: "px-4 py-2.5 text-white rounded-xl hover:shadow-lg disabled:opacity-50 transition-all duration-200 hover:scale-105 flex items-center justify-center", style: {
1654
+ backgroundColor: primaryColor,
1655
+ boxShadow: `0 2px 8px ${primaryColor}30`
1656
+ }, children: isLoading ? (jsxRuntimeExports.jsx("div", { className: "w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin" })) : (jsxRuntimeExports.jsx(Send, { size: 20 })) })] }) }));
1657
+ };
1658
+
1659
+ const ChatWindow = ({ title, messages, inputValue, isLoading, isMinimized, messagesEndRef, config, onInputChange, onSubmit, onMinimize, onClose, }) => {
1660
+ return (jsxRuntimeExports.jsxs("div", { className: "w-96 flex flex-col overflow-hidden rounded-2xl border border-neutral-200/50 dark:border-neutral-700/50 shadow-2xl transition-all duration-300", style: {
1661
+ height: isMinimized ? '56px' : '600px',
1662
+ backgroundColor: config.backgroundColor,
1663
+ fontSize: config.fontSize,
1664
+ }, children: [jsxRuntimeExports.jsxs("div", { className: "text-white px-6 py-4 flex items-center justify-between flex-shrink-0 shadow-lg", style: {
1665
+ background: `linear-gradient(135deg, ${config.primaryColor} 0%, ${config.accentColor} 100%)`,
1666
+ }, children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [jsxRuntimeExports.jsx("h3", { className: "font-bold text-base leading-tight", children: title }), jsxRuntimeExports.jsx("p", { className: "text-xs text-white/70 mt-0.5", children: "Always here to help" })] }), jsxRuntimeExports.jsxs("div", { className: "flex gap-1", children: [jsxRuntimeExports.jsx("button", { onClick: onMinimize, className: "p-2 hover:bg-white/20 rounded-lg transition-all duration-200 hover:scale-110", "aria-label": "Minimize chat", children: isMinimized ? jsxRuntimeExports.jsx(Maximize2, { size: 18 }) : jsxRuntimeExports.jsx(Minimize2, { size: 18 }) }), jsxRuntimeExports.jsx("button", { onClick: onClose, className: "p-2 hover:bg-white/20 rounded-lg transition-all duration-200 hover:scale-110", "aria-label": "Close chat", children: jsxRuntimeExports.jsx(X, { size: 18 }) })] })] }), !isMinimized && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(MessageList, { messages: messages, messagesEndRef: messagesEndRef, textColor: config.textColor, primaryColor: config.primaryColor }), jsxRuntimeExports.jsx(InputForm, { inputValue: inputValue, isLoading: isLoading, onInputChange: onInputChange, onSubmit: onSubmit, primaryColor: config.primaryColor })] }))] }));
1667
+ };
1668
+
1669
+ const FloatingButton = ({ onClick, primaryColor, accentColor, }) => {
1670
+ return (jsxRuntimeExports.jsx("button", { onClick: onClick, className: "w-14 h-14 text-white rounded-full shadow-lg hover:shadow-xl hover:scale-110 flex items-center justify-center transition-all mb-1", style: {
1671
+ background: `linear-gradient(135deg, ${primaryColor}, ${accentColor})`,
1672
+ }, "aria-label": "Open chat", children: jsxRuntimeExports.jsx(MessageCircle, { size: 28 }) }));
1673
+ };
1674
+
1675
+ // SDK logger - separate from main app logger to avoid dependencies
1676
+ const sdkLogger = {
1677
+ error: (message, error) => {
1678
+ if (process.env.NODE_ENV === 'development') {
1679
+ console.error(`[NeuroBot SDK] ${message}`, error);
1680
+ }
1681
+ },
1682
+ debug: (message, data) => {
1683
+ if (process.env.NODE_ENV === 'development') {
1684
+ console.debug(`[NeuroBot SDK] ${message}`, data);
1685
+ }
1686
+ },
1687
+ };
1688
+ const NeuroBot = ({ pipelineId, chatbotId, title = 'NeuroBot Assistant', position = 'bottom-right', config = {}, onMessageSent, onMessageReceived, useMock = false, }) => {
1689
+ const context = useNeuroBotContext();
1690
+ const [isOpen, setIsOpen] = require$$0.useState(false);
1691
+ const [isMinimized, setIsMinimized] = require$$0.useState(false);
1692
+ const [messages, setMessages] = require$$0.useState([
1693
+ {
1694
+ id: 1,
1695
+ type: 'bot',
1696
+ text: `Hello! I'm ${title}. How can I help you today?`,
1697
+ timestamp: new Date(),
1698
+ },
1699
+ ]);
1700
+ const [inputValue, setInputValue] = require$$0.useState('');
1701
+ const [isLoading, setIsLoading] = require$$0.useState(false);
1702
+ const messagesEndRef = require$$0.useRef(null);
1703
+ const chatConfig = {
1704
+ primaryColor: config.primaryColor || '#3b82f6',
1705
+ accentColor: config.accentColor || '#1e40af',
1706
+ backgroundColor: config.backgroundColor || '#ffffff',
1707
+ textColor: config.textColor || '#1f2937',
1708
+ borderRadius: config.borderRadius || '12px',
1709
+ fontSize: config.fontSize || '14px',
1710
+ };
1711
+ const scrollToBottom = () => {
1712
+ messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
1713
+ };
1714
+ require$$0.useEffect(() => {
1715
+ scrollToBottom();
1716
+ }, [messages]);
1717
+ const handleSendMessage = async (e) => {
1718
+ e.preventDefault();
1719
+ if (!inputValue.trim())
1720
+ return;
1721
+ const userMessage = {
1722
+ id: messages.length + 1,
1723
+ type: 'user',
1724
+ text: inputValue,
1725
+ timestamp: new Date(),
1726
+ };
1727
+ setMessages((prev) => [...prev, userMessage]);
1728
+ setInputValue('');
1729
+ setIsLoading(true);
1730
+ onMessageSent?.(inputValue);
1731
+ try {
1732
+ sdkLogger.debug('Sending message to NeuroBot API', { pipelineId, chatbotId, message: inputValue });
1733
+ const data = await sendMessage({
1734
+ pipelineId,
1735
+ chatbotId,
1736
+ message: inputValue,
1737
+ context: {
1738
+ pageUrl: typeof window !== 'undefined' ? window.location.href : '',
1739
+ pageTitle: typeof document !== 'undefined' ? document.title : '',
1740
+ },
1741
+ }, {
1742
+ publicKey: context.publicKey,
1743
+ timeout: context.timeout,
1744
+ useMock,
1745
+ });
1746
+ const botMessage = {
1747
+ id: messages.length + 2,
1748
+ type: 'bot',
1749
+ text: data.response || 'I could not process that request.',
1750
+ timestamp: new Date(),
1751
+ };
1752
+ sdkLogger.debug('Received response from NeuroBot API', { response: data.response });
1753
+ setMessages((prev) => [...prev, botMessage]);
1754
+ onMessageReceived?.(data.response);
1755
+ }
1756
+ catch (error) {
1757
+ sdkLogger.error('Failed to send message to NeuroBot API', error);
1758
+ const errorMessage = {
1759
+ id: messages.length + 2,
1760
+ type: 'bot',
1761
+ text: 'Sorry, I encountered an error. Please try again.',
1762
+ timestamp: new Date(),
1763
+ };
1764
+ setMessages((prev) => [...prev, errorMessage]);
1765
+ }
1766
+ finally {
1767
+ setIsLoading(false);
1768
+ }
1769
+ };
1770
+ const positionClasses = {
1771
+ 'bottom-right': 'bottom-12 right-12',
1772
+ 'bottom-left': 'bottom-12 left-12',
1773
+ 'top-right': 'top-12 right-12',
1774
+ 'top-left': 'top-12 left-12',
1775
+ };
1776
+ return (jsxRuntimeExports.jsx("div", { className: `fixed ${positionClasses[position]} z-50 font-sans`, children: isOpen ? (jsxRuntimeExports.jsx(ChatWindow, { title: title, messages: messages, inputValue: inputValue, isLoading: isLoading, isMinimized: isMinimized, messagesEndRef: messagesEndRef, config: chatConfig, onInputChange: setInputValue, onSubmit: handleSendMessage, onMinimize: () => setIsMinimized(!isMinimized), onClose: () => setIsOpen(false) })) : (jsxRuntimeExports.jsx(FloatingButton, { onClick: () => setIsOpen(true), primaryColor: chatConfig.primaryColor, accentColor: chatConfig.accentColor })) }));
1777
+ };
1778
+
1779
+ exports.NeuroBot = NeuroBot;
1780
+ exports.NeuroBotProvider = NeuroBotProvider;
1781
+ exports.default = NeuroBot;
1782
+ exports.useNeuroBotContext = useNeuroBotContext;
1783
+
1784
+ Object.defineProperty(exports, '__esModule', { value: true });
1785
+
1786
+ }));
1787
+ //# sourceMappingURL=index.umd.js.map