@archbee/app-widget 1.1.33 → 1.1.35

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,1429 @@
1
+ 'use strict';
2
+
3
+ var require$$0 = require('react');
4
+ var require$$0$1 = require('react-dom');
5
+
6
+ var jsxRuntime = {exports: {}};
7
+
8
+ var reactJsxRuntime_production_min = {};
9
+
10
+ var hasRequiredReactJsxRuntime_production_min;
11
+ function requireReactJsxRuntime_production_min() {
12
+ if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
13
+ hasRequiredReactJsxRuntime_production_min = 1;
14
+ 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 = {
15
+ key: true,
16
+ ref: true,
17
+ __self: true,
18
+ __source: true
19
+ };
20
+ function q(c, a, g) {
21
+ var b, d = {}, e = null, h = null;
22
+ void 0 !== g && (e = "" + g);
23
+ void 0 !== a.key && (e = "" + a.key);
24
+ void 0 !== a.ref && (h = a.ref);
25
+ for(b in a)m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
26
+ if (c && c.defaultProps) for(b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
27
+ return {
28
+ $$typeof: k,
29
+ type: c,
30
+ key: e,
31
+ ref: h,
32
+ props: d,
33
+ _owner: n.current
34
+ };
35
+ }
36
+ reactJsxRuntime_production_min.Fragment = l;
37
+ reactJsxRuntime_production_min.jsx = q;
38
+ reactJsxRuntime_production_min.jsxs = q;
39
+ return reactJsxRuntime_production_min;
40
+ }
41
+
42
+ var reactJsxRuntime_development = {};
43
+
44
+ var hasRequiredReactJsxRuntime_development;
45
+ function requireReactJsxRuntime_development() {
46
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
47
+ hasRequiredReactJsxRuntime_development = 1;
48
+ if (process.env.NODE_ENV !== "production") {
49
+ (function() {
50
+ var React = require$$0;
51
+ // ATTENTION
52
+ // When adding new symbols to this file,
53
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
54
+ // The Symbol used to tag the ReactElement-like types.
55
+ var REACT_ELEMENT_TYPE = Symbol.for('react.element');
56
+ var REACT_PORTAL_TYPE = Symbol.for('react.portal');
57
+ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
58
+ var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
59
+ var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
60
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
61
+ var REACT_CONTEXT_TYPE = Symbol.for('react.context');
62
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
63
+ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
64
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
65
+ var REACT_MEMO_TYPE = Symbol.for('react.memo');
66
+ var REACT_LAZY_TYPE = Symbol.for('react.lazy');
67
+ var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
68
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
69
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
70
+ function getIteratorFn(maybeIterable) {
71
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
72
+ return null;
73
+ }
74
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
75
+ if (typeof maybeIterator === 'function') {
76
+ return maybeIterator;
77
+ }
78
+ return null;
79
+ }
80
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
81
+ function error(format) {
82
+ {
83
+ {
84
+ for(var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++){
85
+ args[_key2 - 1] = arguments[_key2];
86
+ }
87
+ printWarning('error', format, args);
88
+ }
89
+ }
90
+ }
91
+ function printWarning(level, format, args) {
92
+ // When changing this logic, you might want to also
93
+ // update consoleWithStackDev.www.js as well.
94
+ {
95
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
96
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
97
+ if (stack !== '') {
98
+ format += '%s';
99
+ args = args.concat([
100
+ stack
101
+ ]);
102
+ } // eslint-disable-next-line react-internal/safe-string-coercion
103
+ var argsWithFormat = args.map(function(item) {
104
+ return String(item);
105
+ }); // Careful: RN currently depends on this prefix
106
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
107
+ // breaks IE9: https://github.com/facebook/react/issues/13610
108
+ // eslint-disable-next-line react-internal/no-production-logging
109
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
110
+ }
111
+ }
112
+ // -----------------------------------------------------------------------------
113
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
114
+ var enableCacheElement = false;
115
+ var enableTransitionTracing = false; // No known bugs, but needs performance testing
116
+ var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
117
+ // stuff. Intended to enable React core members to more easily debug scheduling
118
+ // issues in DEV builds.
119
+ var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
120
+ var REACT_MODULE_REFERENCE;
121
+ {
122
+ REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
123
+ }
124
+ function isValidElementType(type) {
125
+ if (typeof type === 'string' || typeof type === 'function') {
126
+ return true;
127
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
128
+ 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) {
129
+ return true;
130
+ }
131
+ if (typeof type === 'object' && type !== null) {
132
+ 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
133
+ // types supported by any Flight configuration anywhere since
134
+ // we don't know which Flight build this will end up being used
135
+ // with.
136
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
137
+ return true;
138
+ }
139
+ }
140
+ return false;
141
+ }
142
+ function getWrappedName(outerType, innerType, wrapperName) {
143
+ var displayName = outerType.displayName;
144
+ if (displayName) {
145
+ return displayName;
146
+ }
147
+ var functionName = innerType.displayName || innerType.name || '';
148
+ return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
149
+ } // Keep in sync with react-reconciler/getComponentNameFromFiber
150
+ function getContextName(type) {
151
+ return type.displayName || 'Context';
152
+ } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
153
+ function getComponentNameFromType(type) {
154
+ if (type == null) {
155
+ // Host root, text node or just invalid type.
156
+ return null;
157
+ }
158
+ {
159
+ if (typeof type.tag === 'number') {
160
+ error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
161
+ }
162
+ }
163
+ if (typeof type === 'function') {
164
+ return type.displayName || type.name || null;
165
+ }
166
+ if (typeof type === 'string') {
167
+ return type;
168
+ }
169
+ switch(type){
170
+ case REACT_FRAGMENT_TYPE:
171
+ return 'Fragment';
172
+ case REACT_PORTAL_TYPE:
173
+ return 'Portal';
174
+ case REACT_PROFILER_TYPE:
175
+ return 'Profiler';
176
+ case REACT_STRICT_MODE_TYPE:
177
+ return 'StrictMode';
178
+ case REACT_SUSPENSE_TYPE:
179
+ return 'Suspense';
180
+ case REACT_SUSPENSE_LIST_TYPE:
181
+ return 'SuspenseList';
182
+ }
183
+ if (typeof type === 'object') {
184
+ switch(type.$$typeof){
185
+ case REACT_CONTEXT_TYPE:
186
+ var context = type;
187
+ return getContextName(context) + '.Consumer';
188
+ case REACT_PROVIDER_TYPE:
189
+ var provider = type;
190
+ return getContextName(provider._context) + '.Provider';
191
+ case REACT_FORWARD_REF_TYPE:
192
+ return getWrappedName(type, type.render, 'ForwardRef');
193
+ case REACT_MEMO_TYPE:
194
+ var outerName = type.displayName || null;
195
+ if (outerName !== null) {
196
+ return outerName;
197
+ }
198
+ return getComponentNameFromType(type.type) || 'Memo';
199
+ case REACT_LAZY_TYPE:
200
+ {
201
+ var lazyComponent = type;
202
+ var payload = lazyComponent._payload;
203
+ var init = lazyComponent._init;
204
+ try {
205
+ return getComponentNameFromType(init(payload));
206
+ } catch (x) {
207
+ return null;
208
+ }
209
+ }
210
+ }
211
+ }
212
+ return null;
213
+ }
214
+ var assign = Object.assign;
215
+ // Helpers to patch console.logs to avoid logging during side-effect free
216
+ // replaying on render function. This currently only patches the object
217
+ // lazily which won't cover if the log function was extracted eagerly.
218
+ // We could also eagerly patch the method.
219
+ var disabledDepth = 0;
220
+ var prevLog;
221
+ var prevInfo;
222
+ var prevWarn;
223
+ var prevError;
224
+ var prevGroup;
225
+ var prevGroupCollapsed;
226
+ var prevGroupEnd;
227
+ function disabledLog() {}
228
+ disabledLog.__reactDisabledLog = true;
229
+ function disableLogs() {
230
+ {
231
+ if (disabledDepth === 0) {
232
+ /* eslint-disable react-internal/no-production-logging */ prevLog = console.log;
233
+ prevInfo = console.info;
234
+ prevWarn = console.warn;
235
+ prevError = console.error;
236
+ prevGroup = console.group;
237
+ prevGroupCollapsed = console.groupCollapsed;
238
+ prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
239
+ var props = {
240
+ configurable: true,
241
+ enumerable: true,
242
+ value: disabledLog,
243
+ writable: true
244
+ }; // $FlowFixMe Flow thinks console is immutable.
245
+ Object.defineProperties(console, {
246
+ info: props,
247
+ log: props,
248
+ warn: props,
249
+ error: props,
250
+ group: props,
251
+ groupCollapsed: props,
252
+ groupEnd: props
253
+ });
254
+ /* eslint-enable react-internal/no-production-logging */ }
255
+ disabledDepth++;
256
+ }
257
+ }
258
+ function reenableLogs() {
259
+ {
260
+ disabledDepth--;
261
+ if (disabledDepth === 0) {
262
+ /* eslint-disable react-internal/no-production-logging */ var props = {
263
+ configurable: true,
264
+ enumerable: true,
265
+ writable: true
266
+ }; // $FlowFixMe Flow thinks console is immutable.
267
+ Object.defineProperties(console, {
268
+ log: assign({}, props, {
269
+ value: prevLog
270
+ }),
271
+ info: assign({}, props, {
272
+ value: prevInfo
273
+ }),
274
+ warn: assign({}, props, {
275
+ value: prevWarn
276
+ }),
277
+ error: assign({}, props, {
278
+ value: prevError
279
+ }),
280
+ group: assign({}, props, {
281
+ value: prevGroup
282
+ }),
283
+ groupCollapsed: assign({}, props, {
284
+ value: prevGroupCollapsed
285
+ }),
286
+ groupEnd: assign({}, props, {
287
+ value: prevGroupEnd
288
+ })
289
+ });
290
+ /* eslint-enable react-internal/no-production-logging */ }
291
+ if (disabledDepth < 0) {
292
+ error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
293
+ }
294
+ }
295
+ }
296
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
297
+ var prefix;
298
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
299
+ {
300
+ if (prefix === undefined) {
301
+ // Extract the VM specific prefix used by each line.
302
+ try {
303
+ throw Error();
304
+ } catch (x) {
305
+ var match = x.stack.trim().match(/\n( *(at )?)/);
306
+ prefix = match && match[1] || '';
307
+ }
308
+ } // We use the prefix to ensure our stacks line up with native stack frames.
309
+ return '\n' + prefix + name;
310
+ }
311
+ }
312
+ var reentry = false;
313
+ var componentFrameCache;
314
+ {
315
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
316
+ componentFrameCache = new PossiblyWeakMap();
317
+ }
318
+ function describeNativeComponentFrame(fn, construct) {
319
+ // If something asked for a stack inside a fake render, it should get ignored.
320
+ if (!fn || reentry) {
321
+ return '';
322
+ }
323
+ {
324
+ var frame = componentFrameCache.get(fn);
325
+ if (frame !== undefined) {
326
+ return frame;
327
+ }
328
+ }
329
+ var control;
330
+ reentry = true;
331
+ var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
332
+ Error.prepareStackTrace = undefined;
333
+ var previousDispatcher;
334
+ {
335
+ previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
336
+ // for warnings.
337
+ ReactCurrentDispatcher.current = null;
338
+ disableLogs();
339
+ }
340
+ try {
341
+ // This should throw.
342
+ if (construct) {
343
+ // Something should be setting the props in the constructor.
344
+ var Fake = function() {
345
+ throw Error();
346
+ }; // $FlowFixMe
347
+ Object.defineProperty(Fake.prototype, 'props', {
348
+ set: function() {
349
+ // We use a throwing setter instead of frozen or non-writable props
350
+ // because that won't throw in a non-strict mode function.
351
+ throw Error();
352
+ }
353
+ });
354
+ if (typeof Reflect === 'object' && Reflect.construct) {
355
+ // We construct a different control for this case to include any extra
356
+ // frames added by the construct call.
357
+ try {
358
+ Reflect.construct(Fake, []);
359
+ } catch (x) {
360
+ control = x;
361
+ }
362
+ Reflect.construct(fn, [], Fake);
363
+ } else {
364
+ try {
365
+ Fake.call();
366
+ } catch (x) {
367
+ control = x;
368
+ }
369
+ fn.call(Fake.prototype);
370
+ }
371
+ } else {
372
+ try {
373
+ throw Error();
374
+ } catch (x) {
375
+ control = x;
376
+ }
377
+ fn();
378
+ }
379
+ } catch (sample) {
380
+ // This is inlined manually because closure doesn't do it for us.
381
+ if (sample && control && typeof sample.stack === 'string') {
382
+ // This extracts the first frame from the sample that isn't also in the control.
383
+ // Skipping one frame that we assume is the frame that calls the two.
384
+ var sampleLines = sample.stack.split('\n');
385
+ var controlLines = control.stack.split('\n');
386
+ var s = sampleLines.length - 1;
387
+ var c = controlLines.length - 1;
388
+ while(s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]){
389
+ // We expect at least one stack frame to be shared.
390
+ // Typically this will be the root most one. However, stack frames may be
391
+ // cut off due to maximum stack limits. In this case, one maybe cut off
392
+ // earlier than the other. We assume that the sample is longer or the same
393
+ // and there for cut off earlier. So we should find the root most frame in
394
+ // the sample somewhere in the control.
395
+ c--;
396
+ }
397
+ for(; s >= 1 && c >= 0; s--, c--){
398
+ // Next we find the first one that isn't the same which should be the
399
+ // frame that called our sample function and the control.
400
+ if (sampleLines[s] !== controlLines[c]) {
401
+ // In V8, the first line is describing the message but other VMs don't.
402
+ // If we're about to return the first line, and the control is also on the same
403
+ // line, that's a pretty good indicator that our sample threw at same line as
404
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
405
+ // This can happen if you passed a class to function component, or non-function.
406
+ if (s !== 1 || c !== 1) {
407
+ do {
408
+ s--;
409
+ c--; // We may still have similar intermediate frames from the construct call.
410
+ // The next one that isn't the same should be our match though.
411
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
412
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
413
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
414
+ // but we have a user-provided "displayName"
415
+ // splice it in to make the stack more readable.
416
+ if (fn.displayName && _frame.includes('<anonymous>')) {
417
+ _frame = _frame.replace('<anonymous>', fn.displayName);
418
+ }
419
+ {
420
+ if (typeof fn === 'function') {
421
+ componentFrameCache.set(fn, _frame);
422
+ }
423
+ }
424
+ return _frame;
425
+ }
426
+ }while (s >= 1 && c >= 0)
427
+ }
428
+ break;
429
+ }
430
+ }
431
+ }
432
+ } finally{
433
+ reentry = false;
434
+ {
435
+ ReactCurrentDispatcher.current = previousDispatcher;
436
+ reenableLogs();
437
+ }
438
+ Error.prepareStackTrace = previousPrepareStackTrace;
439
+ } // Fallback to just using the name if we couldn't make it throw.
440
+ var name = fn ? fn.displayName || fn.name : '';
441
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
442
+ {
443
+ if (typeof fn === 'function') {
444
+ componentFrameCache.set(fn, syntheticFrame);
445
+ }
446
+ }
447
+ return syntheticFrame;
448
+ }
449
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
450
+ {
451
+ return describeNativeComponentFrame(fn, false);
452
+ }
453
+ }
454
+ function shouldConstruct(Component) {
455
+ var prototype = Component.prototype;
456
+ return !!(prototype && prototype.isReactComponent);
457
+ }
458
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
459
+ if (type == null) {
460
+ return '';
461
+ }
462
+ if (typeof type === 'function') {
463
+ {
464
+ return describeNativeComponentFrame(type, shouldConstruct(type));
465
+ }
466
+ }
467
+ if (typeof type === 'string') {
468
+ return describeBuiltInComponentFrame(type);
469
+ }
470
+ switch(type){
471
+ case REACT_SUSPENSE_TYPE:
472
+ return describeBuiltInComponentFrame('Suspense');
473
+ case REACT_SUSPENSE_LIST_TYPE:
474
+ return describeBuiltInComponentFrame('SuspenseList');
475
+ }
476
+ if (typeof type === 'object') {
477
+ switch(type.$$typeof){
478
+ case REACT_FORWARD_REF_TYPE:
479
+ return describeFunctionComponentFrame(type.render);
480
+ case REACT_MEMO_TYPE:
481
+ // Memo may contain any component type so we recursively resolve it.
482
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
483
+ case REACT_LAZY_TYPE:
484
+ {
485
+ var lazyComponent = type;
486
+ var payload = lazyComponent._payload;
487
+ var init = lazyComponent._init;
488
+ try {
489
+ // Lazy may contain any component type so we recursively resolve it.
490
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
491
+ } catch (x) {}
492
+ }
493
+ }
494
+ }
495
+ return '';
496
+ }
497
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
498
+ var loggedTypeFailures = {};
499
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
500
+ function setCurrentlyValidatingElement(element) {
501
+ {
502
+ if (element) {
503
+ var owner = element._owner;
504
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
505
+ ReactDebugCurrentFrame.setExtraStackFrame(stack);
506
+ } else {
507
+ ReactDebugCurrentFrame.setExtraStackFrame(null);
508
+ }
509
+ }
510
+ }
511
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
512
+ {
513
+ // $FlowFixMe This is okay but Flow doesn't know it.
514
+ var has = Function.call.bind(hasOwnProperty);
515
+ for(var typeSpecName in typeSpecs){
516
+ if (has(typeSpecs, typeSpecName)) {
517
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
518
+ // fail the render phase where it didn't fail before. So we log it.
519
+ // After these have been cleaned up, we'll let them throw.
520
+ try {
521
+ // This is intentionally an invariant that gets caught. It's the same
522
+ // behavior as without this statement except with a better message.
523
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
524
+ // eslint-disable-next-line react-internal/prod-error-codes
525
+ 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`.');
526
+ err.name = 'Invariant Violation';
527
+ throw err;
528
+ }
529
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
530
+ } catch (ex) {
531
+ error$1 = ex;
532
+ }
533
+ if (error$1 && !(error$1 instanceof Error)) {
534
+ setCurrentlyValidatingElement(element);
535
+ 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);
536
+ setCurrentlyValidatingElement(null);
537
+ }
538
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
539
+ // Only monitor this failure once because there tends to be a lot of the
540
+ // same error.
541
+ loggedTypeFailures[error$1.message] = true;
542
+ setCurrentlyValidatingElement(element);
543
+ error('Failed %s type: %s', location, error$1.message);
544
+ setCurrentlyValidatingElement(null);
545
+ }
546
+ }
547
+ }
548
+ }
549
+ }
550
+ var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
551
+ function isArray(a) {
552
+ return isArrayImpl(a);
553
+ }
554
+ /*
555
+ * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
556
+ * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
557
+ *
558
+ * The functions in this module will throw an easier-to-understand,
559
+ * easier-to-debug exception with a clear errors message message explaining the
560
+ * problem. (Instead of a confusing exception thrown inside the implementation
561
+ * of the `value` object).
562
+ */ // $FlowFixMe only called in DEV, so void return is not possible.
563
+ function typeName(value) {
564
+ {
565
+ // toStringTag is needed for namespaced types like Temporal.Instant
566
+ var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
567
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
568
+ return type;
569
+ }
570
+ } // $FlowFixMe only called in DEV, so void return is not possible.
571
+ function willCoercionThrow(value) {
572
+ {
573
+ try {
574
+ testStringCoercion(value);
575
+ return false;
576
+ } catch (e) {
577
+ return true;
578
+ }
579
+ }
580
+ }
581
+ function testStringCoercion(value) {
582
+ // If you ended up here by following an exception call stack, here's what's
583
+ // happened: you supplied an object or symbol value to React (as a prop, key,
584
+ // DOM attribute, CSS property, string ref, etc.) and when React tried to
585
+ // coerce it to a string using `'' + value`, an exception was thrown.
586
+ //
587
+ // The most common types that will cause this exception are `Symbol` instances
588
+ // and Temporal objects like `Temporal.Instant`. But any object that has a
589
+ // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
590
+ // exception. (Library authors do this to prevent users from using built-in
591
+ // numeric operators like `+` or comparison operators like `>=` because custom
592
+ // methods are needed to perform accurate arithmetic or comparison.)
593
+ //
594
+ // To fix the problem, coerce this object or symbol value to a string before
595
+ // passing it to React. The most reliable way is usually `String(value)`.
596
+ //
597
+ // To find which value is throwing, check the browser or debugger console.
598
+ // Before this exception was thrown, there should be `console.error` output
599
+ // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
600
+ // problem and how that type was used: key, atrribute, input value prop, etc.
601
+ // In most cases, this console output also shows the component and its
602
+ // ancestor components where the exception happened.
603
+ //
604
+ // eslint-disable-next-line react-internal/safe-string-coercion
605
+ return '' + value;
606
+ }
607
+ function checkKeyStringCoercion(value) {
608
+ {
609
+ if (willCoercionThrow(value)) {
610
+ error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
611
+ return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
612
+ }
613
+ }
614
+ }
615
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
616
+ var RESERVED_PROPS = {
617
+ key: true,
618
+ ref: true,
619
+ __self: true,
620
+ __source: true
621
+ };
622
+ var specialPropKeyWarningShown;
623
+ var specialPropRefWarningShown;
624
+ function hasValidRef(config) {
625
+ {
626
+ if (hasOwnProperty.call(config, 'ref')) {
627
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
628
+ if (getter && getter.isReactWarning) {
629
+ return false;
630
+ }
631
+ }
632
+ }
633
+ return config.ref !== undefined;
634
+ }
635
+ function hasValidKey(config) {
636
+ {
637
+ if (hasOwnProperty.call(config, 'key')) {
638
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
639
+ if (getter && getter.isReactWarning) {
640
+ return false;
641
+ }
642
+ }
643
+ }
644
+ return config.key !== undefined;
645
+ }
646
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
647
+ {
648
+ if (typeof config.ref === 'string' && ReactCurrentOwner.current && self) ;
649
+ }
650
+ }
651
+ function defineKeyPropWarningGetter(props, displayName) {
652
+ {
653
+ var warnAboutAccessingKey = function() {
654
+ if (!specialPropKeyWarningShown) {
655
+ specialPropKeyWarningShown = true;
656
+ 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);
657
+ }
658
+ };
659
+ warnAboutAccessingKey.isReactWarning = true;
660
+ Object.defineProperty(props, 'key', {
661
+ get: warnAboutAccessingKey,
662
+ configurable: true
663
+ });
664
+ }
665
+ }
666
+ function defineRefPropWarningGetter(props, displayName) {
667
+ {
668
+ var warnAboutAccessingRef = function() {
669
+ if (!specialPropRefWarningShown) {
670
+ specialPropRefWarningShown = true;
671
+ 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);
672
+ }
673
+ };
674
+ warnAboutAccessingRef.isReactWarning = true;
675
+ Object.defineProperty(props, 'ref', {
676
+ get: warnAboutAccessingRef,
677
+ configurable: true
678
+ });
679
+ }
680
+ }
681
+ /**
682
+ * Factory method to create a new React element. This no longer adheres to
683
+ * the class pattern, so do not use new to call it. Also, instanceof check
684
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
685
+ * if something is a React Element.
686
+ *
687
+ * @param {*} type
688
+ * @param {*} props
689
+ * @param {*} key
690
+ * @param {string|object} ref
691
+ * @param {*} owner
692
+ * @param {*} self A *temporary* helper to detect places where `this` is
693
+ * different from the `owner` when React.createElement is called, so that we
694
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
695
+ * functions, and as long as `this` and owner are the same, there will be no
696
+ * change in behavior.
697
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
698
+ * indicating filename, line number, and/or other information.
699
+ * @internal
700
+ */ var ReactElement = function(type, key, ref, self, source, owner, props) {
701
+ var element = {
702
+ // This tag allows us to uniquely identify this as a React Element
703
+ $$typeof: REACT_ELEMENT_TYPE,
704
+ // Built-in properties that belong on the element
705
+ type: type,
706
+ key: key,
707
+ ref: ref,
708
+ props: props,
709
+ // Record the component responsible for creating this element.
710
+ _owner: owner
711
+ };
712
+ {
713
+ // The validation flag is currently mutative. We put it on
714
+ // an external backing store so that we can freeze the whole object.
715
+ // This can be replaced with a WeakMap once they are implemented in
716
+ // commonly used development environments.
717
+ element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
718
+ // the validation flag non-enumerable (where possible, which should
719
+ // include every environment we run tests in), so the test framework
720
+ // ignores it.
721
+ Object.defineProperty(element._store, 'validated', {
722
+ configurable: false,
723
+ enumerable: false,
724
+ writable: true,
725
+ value: false
726
+ }); // self and source are DEV only properties.
727
+ Object.defineProperty(element, '_self', {
728
+ configurable: false,
729
+ enumerable: false,
730
+ writable: false,
731
+ value: self
732
+ }); // Two elements created in two different places should be considered
733
+ // equal for testing purposes and therefore we hide it from enumeration.
734
+ Object.defineProperty(element, '_source', {
735
+ configurable: false,
736
+ enumerable: false,
737
+ writable: false,
738
+ value: source
739
+ });
740
+ if (Object.freeze) {
741
+ Object.freeze(element.props);
742
+ Object.freeze(element);
743
+ }
744
+ }
745
+ return element;
746
+ };
747
+ /**
748
+ * https://github.com/reactjs/rfcs/pull/107
749
+ * @param {*} type
750
+ * @param {object} props
751
+ * @param {string} key
752
+ */ function jsxDEV(type, config, maybeKey, source, self) {
753
+ {
754
+ var propName; // Reserved names are extracted
755
+ var props = {};
756
+ var key = null;
757
+ var ref = null; // Currently, key can be spread in as a prop. This causes a potential
758
+ // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
759
+ // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
760
+ // but as an intermediary step, we will use jsxDEV for everything except
761
+ // <div {...props} key="Hi" />, because we aren't currently able to tell if
762
+ // key is explicitly declared to be undefined or not.
763
+ if (maybeKey !== undefined) {
764
+ {
765
+ checkKeyStringCoercion(maybeKey);
766
+ }
767
+ key = '' + maybeKey;
768
+ }
769
+ if (hasValidKey(config)) {
770
+ {
771
+ checkKeyStringCoercion(config.key);
772
+ }
773
+ key = '' + config.key;
774
+ }
775
+ if (hasValidRef(config)) {
776
+ ref = config.ref;
777
+ warnIfStringRefCannotBeAutoConverted(config, self);
778
+ } // Remaining properties are added to a new props object
779
+ for(propName in config){
780
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
781
+ props[propName] = config[propName];
782
+ }
783
+ } // Resolve default props
784
+ if (type && type.defaultProps) {
785
+ var defaultProps = type.defaultProps;
786
+ for(propName in defaultProps){
787
+ if (props[propName] === undefined) {
788
+ props[propName] = defaultProps[propName];
789
+ }
790
+ }
791
+ }
792
+ if (key || ref) {
793
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
794
+ if (key) {
795
+ defineKeyPropWarningGetter(props, displayName);
796
+ }
797
+ if (ref) {
798
+ defineRefPropWarningGetter(props, displayName);
799
+ }
800
+ }
801
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
802
+ }
803
+ }
804
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
805
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
806
+ function setCurrentlyValidatingElement$1(element) {
807
+ {
808
+ if (element) {
809
+ var owner = element._owner;
810
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
811
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
812
+ } else {
813
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
814
+ }
815
+ }
816
+ }
817
+ var propTypesMisspellWarningShown;
818
+ {
819
+ propTypesMisspellWarningShown = false;
820
+ }
821
+ /**
822
+ * Verifies the object is a ReactElement.
823
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
824
+ * @param {?object} object
825
+ * @return {boolean} True if `object` is a ReactElement.
826
+ * @final
827
+ */ function isValidElement(object) {
828
+ {
829
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
830
+ }
831
+ }
832
+ function getDeclarationErrorAddendum() {
833
+ {
834
+ if (ReactCurrentOwner$1.current) {
835
+ var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
836
+ if (name) {
837
+ return '\n\nCheck the render method of `' + name + '`.';
838
+ }
839
+ }
840
+ return '';
841
+ }
842
+ }
843
+ function getSourceInfoErrorAddendum(source) {
844
+ {
845
+ return '';
846
+ }
847
+ }
848
+ /**
849
+ * Warn if there's no key explicitly set on dynamic arrays of children or
850
+ * object keys are not valid. This allows us to keep track of children between
851
+ * updates.
852
+ */ var ownerHasKeyUseWarning = {};
853
+ function getCurrentComponentErrorInfo(parentType) {
854
+ {
855
+ var info = getDeclarationErrorAddendum();
856
+ if (!info) {
857
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
858
+ if (parentName) {
859
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
860
+ }
861
+ }
862
+ return info;
863
+ }
864
+ }
865
+ /**
866
+ * Warn if the element doesn't have an explicit key assigned to it.
867
+ * This element is in an array. The array could grow and shrink or be
868
+ * reordered. All children that haven't already been validated are required to
869
+ * have a "key" property assigned to it. Error statuses are cached so a warning
870
+ * will only be shown once.
871
+ *
872
+ * @internal
873
+ * @param {ReactElement} element Element that requires a key.
874
+ * @param {*} parentType element's parent's type.
875
+ */ function validateExplicitKey(element, parentType) {
876
+ {
877
+ if (!element._store || element._store.validated || element.key != null) {
878
+ return;
879
+ }
880
+ element._store.validated = true;
881
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
882
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
883
+ return;
884
+ }
885
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
886
+ // property, it may be the creator of the child that's responsible for
887
+ // assigning it a key.
888
+ var childOwner = '';
889
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
890
+ // Give the component that originally created this child.
891
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
892
+ }
893
+ setCurrentlyValidatingElement$1(element);
894
+ 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);
895
+ setCurrentlyValidatingElement$1(null);
896
+ }
897
+ }
898
+ /**
899
+ * Ensure that every element either is passed in a static location, in an
900
+ * array with an explicit keys property defined, or in an object literal
901
+ * with valid key property.
902
+ *
903
+ * @internal
904
+ * @param {ReactNode} node Statically passed child of any type.
905
+ * @param {*} parentType node's parent's type.
906
+ */ function validateChildKeys(node, parentType) {
907
+ {
908
+ if (typeof node !== 'object') {
909
+ return;
910
+ }
911
+ if (isArray(node)) {
912
+ for(var i = 0; i < node.length; i++){
913
+ var child = node[i];
914
+ if (isValidElement(child)) {
915
+ validateExplicitKey(child, parentType);
916
+ }
917
+ }
918
+ } else if (isValidElement(node)) {
919
+ // This element was passed in a valid location.
920
+ if (node._store) {
921
+ node._store.validated = true;
922
+ }
923
+ } else if (node) {
924
+ var iteratorFn = getIteratorFn(node);
925
+ if (typeof iteratorFn === 'function') {
926
+ // Entry iterators used to provide implicit keys,
927
+ // but now we print a separate warning for them later.
928
+ if (iteratorFn !== node.entries) {
929
+ var iterator = iteratorFn.call(node);
930
+ var step;
931
+ while(!(step = iterator.next()).done){
932
+ if (isValidElement(step.value)) {
933
+ validateExplicitKey(step.value, parentType);
934
+ }
935
+ }
936
+ }
937
+ }
938
+ }
939
+ }
940
+ }
941
+ /**
942
+ * Given an element, validate that its props follow the propTypes definition,
943
+ * provided by the type.
944
+ *
945
+ * @param {ReactElement} element
946
+ */ function validatePropTypes(element) {
947
+ {
948
+ var type = element.type;
949
+ if (type === null || type === undefined || typeof type === 'string') {
950
+ return;
951
+ }
952
+ var propTypes;
953
+ if (typeof type === 'function') {
954
+ propTypes = type.propTypes;
955
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
956
+ // Inner props are checked in the reconciler.
957
+ type.$$typeof === REACT_MEMO_TYPE)) {
958
+ propTypes = type.propTypes;
959
+ } else {
960
+ return;
961
+ }
962
+ if (propTypes) {
963
+ // Intentionally inside to avoid triggering lazy initializers:
964
+ var name = getComponentNameFromType(type);
965
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
966
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
967
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
968
+ var _name = getComponentNameFromType(type);
969
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
970
+ }
971
+ if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
972
+ error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
973
+ }
974
+ }
975
+ }
976
+ /**
977
+ * Given a fragment, validate that it can only be provided with fragment props
978
+ * @param {ReactElement} fragment
979
+ */ function validateFragmentProps(fragment) {
980
+ {
981
+ var keys = Object.keys(fragment.props);
982
+ for(var i = 0; i < keys.length; i++){
983
+ var key = keys[i];
984
+ if (key !== 'children' && key !== 'key') {
985
+ setCurrentlyValidatingElement$1(fragment);
986
+ error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
987
+ setCurrentlyValidatingElement$1(null);
988
+ break;
989
+ }
990
+ }
991
+ if (fragment.ref !== null) {
992
+ setCurrentlyValidatingElement$1(fragment);
993
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
994
+ setCurrentlyValidatingElement$1(null);
995
+ }
996
+ }
997
+ }
998
+ var didWarnAboutKeySpread = {};
999
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1000
+ {
1001
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1002
+ // succeed and there will likely be errors in render.
1003
+ if (!validType) {
1004
+ var info = '';
1005
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1006
+ 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.";
1007
+ }
1008
+ var sourceInfo = getSourceInfoErrorAddendum();
1009
+ if (sourceInfo) {
1010
+ info += sourceInfo;
1011
+ } else {
1012
+ info += getDeclarationErrorAddendum();
1013
+ }
1014
+ var typeString;
1015
+ if (type === null) {
1016
+ typeString = 'null';
1017
+ } else if (isArray(type)) {
1018
+ typeString = 'array';
1019
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1020
+ typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1021
+ info = ' Did you accidentally export a JSX literal instead of a component?';
1022
+ } else {
1023
+ typeString = typeof type;
1024
+ }
1025
+ 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);
1026
+ }
1027
+ var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1028
+ // TODO: Drop this when these are no longer allowed as the type argument.
1029
+ if (element == null) {
1030
+ return element;
1031
+ } // Skip key warning if the type isn't valid since our key validation logic
1032
+ // doesn't expect a non-string/function type and can throw confusing errors.
1033
+ // We don't want exception behavior to differ between dev and prod.
1034
+ // (Rendering will throw with a helpful message and as soon as the type is
1035
+ // fixed, the key warnings will appear.)
1036
+ if (validType) {
1037
+ var children = props.children;
1038
+ if (children !== undefined) {
1039
+ if (isStaticChildren) {
1040
+ if (isArray(children)) {
1041
+ for(var i = 0; i < children.length; i++){
1042
+ validateChildKeys(children[i], type);
1043
+ }
1044
+ if (Object.freeze) {
1045
+ Object.freeze(children);
1046
+ }
1047
+ } else {
1048
+ 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.');
1049
+ }
1050
+ } else {
1051
+ validateChildKeys(children, type);
1052
+ }
1053
+ }
1054
+ }
1055
+ {
1056
+ if (hasOwnProperty.call(props, 'key')) {
1057
+ var componentName = getComponentNameFromType(type);
1058
+ var keys = Object.keys(props).filter(function(k) {
1059
+ return k !== 'key';
1060
+ });
1061
+ var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
1062
+ if (!didWarnAboutKeySpread[componentName + beforeExample]) {
1063
+ var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
1064
+ 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);
1065
+ didWarnAboutKeySpread[componentName + beforeExample] = true;
1066
+ }
1067
+ }
1068
+ }
1069
+ if (type === REACT_FRAGMENT_TYPE) {
1070
+ validateFragmentProps(element);
1071
+ } else {
1072
+ validatePropTypes(element);
1073
+ }
1074
+ return element;
1075
+ }
1076
+ } // These two functions exist to still get child warnings in dev
1077
+ // even with the prod transform. This means that jsxDEV is purely
1078
+ // opt-in behavior for better messages but that we won't stop
1079
+ // giving you warnings if you use production apis.
1080
+ function jsxWithValidationStatic(type, props, key) {
1081
+ {
1082
+ return jsxWithValidation(type, props, key, true);
1083
+ }
1084
+ }
1085
+ function jsxWithValidationDynamic(type, props, key) {
1086
+ {
1087
+ return jsxWithValidation(type, props, key, false);
1088
+ }
1089
+ }
1090
+ var jsx = jsxWithValidationDynamic; // we may want to special case jsxs internally to take advantage of static children.
1091
+ // for now we can ship identical prod functions
1092
+ var jsxs = jsxWithValidationStatic;
1093
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
1094
+ reactJsxRuntime_development.jsx = jsx;
1095
+ reactJsxRuntime_development.jsxs = jsxs;
1096
+ })();
1097
+ }
1098
+ return reactJsxRuntime_development;
1099
+ }
1100
+
1101
+ if (process.env.NODE_ENV === 'production') {
1102
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
1103
+ } else {
1104
+ jsxRuntime.exports = requireReactJsxRuntime_development();
1105
+ }
1106
+ var jsxRuntimeExports = jsxRuntime.exports;
1107
+
1108
+ exports.EVENT_TYPE_ENUM = void 0;
1109
+ (function(EVENT_TYPE_ENUM) {
1110
+ EVENT_TYPE_ENUM["init"] = "init";
1111
+ EVENT_TYPE_ENUM["showWidget"] = "show-widget";
1112
+ EVENT_TYPE_ENUM["hideWidget"] = "hide-widget";
1113
+ })(exports.EVENT_TYPE_ENUM || (exports.EVENT_TYPE_ENUM = {}));
1114
+ const EVENT_TYPE_LIST = [
1115
+ "init",
1116
+ "show-widget",
1117
+ "hide-widget"
1118
+ ];
1119
+ const showWidgetEvent = ()=>{
1120
+ if (typeof window === 'undefined') return;
1121
+ return new CustomEvent("show-widget");
1122
+ };
1123
+ const hideWidgetEvent = ()=>{
1124
+ if (typeof window === 'undefined') return;
1125
+ return new CustomEvent("hide-widget");
1126
+ };
1127
+
1128
+ const matchesMapping = (target, elementId)=>!!(target.closest(`#${CSS.escape(elementId)}`) || target.closest(`.${CSS.escape(elementId)}`));
1129
+ const initIdMappings = async (spaceId)=>{
1130
+ const apiUrl = process.env.APP_ARCHBEE_API_URL;
1131
+ if (!apiUrl || !spaceId) return;
1132
+ let mappings = [];
1133
+ try {
1134
+ const res = await fetch(`${apiUrl}/widget-id-mappings/public-list`, {
1135
+ method: 'POST',
1136
+ headers: {
1137
+ 'Content-Type': 'application/json'
1138
+ },
1139
+ body: JSON.stringify({
1140
+ spaceId
1141
+ })
1142
+ });
1143
+ const data = await res.json();
1144
+ if (Array.isArray(data?.data)) {
1145
+ mappings = data.data;
1146
+ }
1147
+ } catch {
1148
+ return;
1149
+ }
1150
+ if (!mappings.length) return;
1151
+ document.addEventListener('click', (e)=>{
1152
+ const target = e.target;
1153
+ if (!target) return;
1154
+ for (const mapping of mappings){
1155
+ if (matchesMapping(target, mapping.elementId)) {
1156
+ window._archbee.widget.isOpen = true;
1157
+ window._archbee.widget.docId = mapping.docId;
1158
+ window._archbee.widget.blockId = mapping.anchorId;
1159
+ window._archbee.widget.widgetType = 'docs';
1160
+ window.dispatchEvent(showWidgetEvent());
1161
+ break;
1162
+ }
1163
+ }
1164
+ });
1165
+ };
1166
+
1167
+ const initScripts = ()=>{
1168
+ const widgetcsslink = document.createElement('link');
1169
+ const link = document.getElementsByTagName('link')[0];
1170
+ const mainUrl = process.env.ARCHBEE_WIDGET_ASSETS_URL;
1171
+ widgetcsslink['rel'] = 'stylesheet';
1172
+ widgetcsslink['href'] = `${mainUrl}/main.css`;
1173
+ if (!link) {
1174
+ document.getElementsByTagName('head')[0].append(widgetcsslink);
1175
+ }
1176
+ link?.parentNode?.appendChild(widgetcsslink);
1177
+ };
1178
+ const initJsScripts = (loadingStrategy)=>{
1179
+ const mainUrl = process.env.ARCHBEE_WIDGET_ASSETS_URL;
1180
+ let scripttag = document.createElement('script');
1181
+ scripttag['async'] = loadingStrategy === 'lazy';
1182
+ scripttag['src'] = `${mainUrl}/main.js`;
1183
+ const script = document.getElementsByTagName('script')[0];
1184
+ script?.parentNode?.insertBefore(scripttag, script);
1185
+ };
1186
+ const authenticateJwt = async (spaceId, jwt)=>{
1187
+ const baseUrl = process.env.ARCHBEE_API_BASE_URL;
1188
+ try {
1189
+ await fetch(`${baseUrl}/doc-spaces/jwt-auth`, {
1190
+ method: 'POST',
1191
+ headers: {
1192
+ 'Content-Type': 'application/json'
1193
+ },
1194
+ body: JSON.stringify({
1195
+ docSpaceId: spaceId,
1196
+ jwtToken: jwt
1197
+ })
1198
+ });
1199
+ } catch (error) {}
1200
+ };
1201
+ const createArchbeeWidget = (spaceId, jwt, shareableToken, loadingStrategy = 'lazy', bubble = 'invisible', bubblePlaceholder, anchor, hideNavbar)=>{
1202
+ if (!window._archbee) {
1203
+ window._archbee = window._archbee || {
1204
+ queue: [],
1205
+ push: function(event) {
1206
+ window._archbee.queue.push(event);
1207
+ }
1208
+ };
1209
+ window._archbee.push({
1210
+ eventType: 'init',
1211
+ spaceId,
1212
+ jwt,
1213
+ shareableToken,
1214
+ bubble,
1215
+ bubblePlaceholder,
1216
+ anchor,
1217
+ hideNavbar
1218
+ });
1219
+ initJsScripts(loadingStrategy);
1220
+ }
1221
+ return window._archbee;
1222
+ };
1223
+
1224
+ var createRoot;
1225
+ var m = require$$0$1;
1226
+ if (process.env.NODE_ENV === 'production') {
1227
+ createRoot = m.createRoot;
1228
+ m.hydrateRoot;
1229
+ } else {
1230
+ var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
1231
+ createRoot = function(c, o) {
1232
+ i.usingClientEntryPoint = true;
1233
+ try {
1234
+ return m.createRoot(c, o);
1235
+ } finally{
1236
+ i.usingClientEntryPoint = false;
1237
+ }
1238
+ };
1239
+ }
1240
+
1241
+ const render = (component, createContainer, cb)=>{
1242
+ createContainer();
1243
+ const element = document.getElementsByClassName('ab-widget')[0];
1244
+ const root = createRoot(element);
1245
+ root.render(/*#__PURE__*/ jsxRuntimeExports.jsx(require$$0.StrictMode, {
1246
+ children: component
1247
+ }));
1248
+ if (cb) {
1249
+ cb(element);
1250
+ }
1251
+ };
1252
+
1253
+ const setWidget = (widget)=>{
1254
+ window._archbee.widget = {
1255
+ ...widget
1256
+ };
1257
+ window._archbee.widget.isOpen = false;
1258
+ };
1259
+ const loadWidget = (widg, render)=>{
1260
+ if (typeof document.addEventListener !== 'function') {
1261
+ return;
1262
+ }
1263
+ window._archbee.widget = {
1264
+ ...window._archbee?.widget,
1265
+ ...widg
1266
+ };
1267
+ try {
1268
+ render(createContainer, widg.onRenderFinish);
1269
+ } catch (err) {
1270
+ console.log(err);
1271
+ }
1272
+ };
1273
+ const createContainer = ()=>{
1274
+ if (document.getElementsByClassName('ab-widget').length) return;
1275
+ const widget = window._archbee?.widget;
1276
+ const abDiv = document.createElement('div');
1277
+ abDiv.style.cssText = `visibility:hidden;${widget.bubble === 'ask' ? '' : 'z-index:-2147483001;'}`;
1278
+ abDiv.className = `ab-widget ab-id-${Date.now()}`;
1279
+ if (!widget?.anchor) {
1280
+ document.body.appendChild(abDiv);
1281
+ return;
1282
+ }
1283
+ const anchor = document.querySelector(widget?.anchor);
1284
+ if (!anchor) return;
1285
+ abDiv.className = `${abDiv.className} ab-absolute`;
1286
+ anchor.appendChild(abDiv);
1287
+ };
1288
+
1289
+ const registerProxy = (component)=>{
1290
+ if (!('Proxy' in window)) {
1291
+ console.warn("Your browser doesn't support Proxies.");
1292
+ return;
1293
+ }
1294
+ const proxy = new Proxy(window._archbee.queue, {
1295
+ get (target, property, receiver) {
1296
+ return Reflect.get(target, property, receiver);
1297
+ },
1298
+ apply (target, thisArg, argumentsList) {
1299
+ return thisArg[target].apply(this, argumentsList);
1300
+ },
1301
+ set (target, property, value) {
1302
+ iterateProxy(target, component);
1303
+ return Reflect.set(target, property, value);
1304
+ },
1305
+ deleteProperty (target, property) {
1306
+ return Reflect.deleteProperty(target, property);
1307
+ }
1308
+ });
1309
+ return proxy;
1310
+ };
1311
+ const iterateProxy = (proxy, component)=>{
1312
+ if (!proxy.length) return;
1313
+ proxy.forEach((event, index)=>{
1314
+ // keep this here for now
1315
+ console.log('widget event received:', event.eventType, window._archbee.widget);
1316
+ if (event.hasExecuted || !EVENT_TYPE_LIST.includes(event.eventType)) {
1317
+ proxy.splice(index, 1);
1318
+ return;
1319
+ }
1320
+ if (event.eventType === exports.EVENT_TYPE_ENUM.init) {
1321
+ setWidget(event);
1322
+ loadWidget(event, render.bind(undefined, component));
1323
+ initIdMappings(event.spaceId);
1324
+ }
1325
+ if (event.eventType === exports.EVENT_TYPE_ENUM.showWidget) {
1326
+ window._archbee.widget.isOpen = true;
1327
+ if (event.spaceId) {
1328
+ window._archbee.widget.spaceId = event.spaceId;
1329
+ }
1330
+ if (event.docId) {
1331
+ window._archbee.widget.docId = event.docId;
1332
+ }
1333
+ if (event.blockId) {
1334
+ window._archbee.widget.blockId = event.blockId;
1335
+ }
1336
+ if (event.widgetType) {
1337
+ const widgetType = event.docId && event.widgetType === 'search' ? 'docs' : event.widgetType;
1338
+ window._archbee.widget.widgetType = widgetType;
1339
+ } else {
1340
+ window._archbee.widget.widgetType = 'docs';
1341
+ }
1342
+ if (Object.keys(event).includes('hideNavbar')) {
1343
+ window._archbee.widget.hideNavbar = event.hideNavbar;
1344
+ }
1345
+ window._archbee.widget.initialSearchQuery = event.initialSearchQuery || undefined;
1346
+ window.dispatchEvent(showWidgetEvent());
1347
+ }
1348
+ if (event.eventType === exports.EVENT_TYPE_ENUM.hideWidget) {
1349
+ window._archbee.widget.isOpen = false;
1350
+ window._archbee.widget.docId = undefined;
1351
+ window._archbee.widget.blockId = undefined;
1352
+ window._archbee.widget.widgetType = undefined;
1353
+ window._archbee.widget.initialSearchQuery = undefined;
1354
+ window.dispatchEvent(hideWidgetEvent());
1355
+ }
1356
+ event.hasExecuted = true;
1357
+ });
1358
+ };
1359
+
1360
+ const ArchbeeAppWidget = /*#__PURE__*/ require$$0.forwardRef(({ className, spaceId, jwt, shareableToken, docId, blockId, widgetType = 'docs', loadingStrategy = 'lazy', hideNavbar, onWidgetOpen, onWidgetClose, bubble, bubblePlaceholder, anchor, initialSearchQuery, children, ...rest }, ref)=>{
1361
+ const elementRef = require$$0.useRef(null);
1362
+ const widgetInstance = require$$0.useMemo(()=>{
1363
+ if (typeof window === 'undefined') return;
1364
+ return createArchbeeWidget(spaceId, jwt, shareableToken, loadingStrategy, bubble, bubblePlaceholder, anchor, hideNavbar);
1365
+ }, [
1366
+ spaceId,
1367
+ jwt,
1368
+ shareableToken,
1369
+ loadingStrategy,
1370
+ bubble,
1371
+ bubblePlaceholder,
1372
+ anchor,
1373
+ hideNavbar
1374
+ ]);
1375
+ require$$0.useImperativeHandle(ref, ()=>{
1376
+ return {
1377
+ open: onOpenWidget,
1378
+ close: onCloseWidget,
1379
+ instance: ()=>widgetInstance
1380
+ };
1381
+ });
1382
+ const onOpenWidget = ()=>{
1383
+ widgetInstance?.push({
1384
+ eventType: 'show-widget',
1385
+ spaceId,
1386
+ widgetType,
1387
+ docId,
1388
+ blockId,
1389
+ initialSearchQuery
1390
+ });
1391
+ onWidgetOpen?.();
1392
+ };
1393
+ const onCloseWidget = ()=>{
1394
+ widgetInstance?.push({
1395
+ eventType: 'hide-widget'
1396
+ });
1397
+ onWidgetClose?.();
1398
+ };
1399
+ const onElementClicked = (event)=>{
1400
+ if (typeof window !== 'undefined' && elementRef.current?.contains(event.target) && !ref) {
1401
+ event.preventDefault();
1402
+ onOpenWidget();
1403
+ }
1404
+ };
1405
+ return /*#__PURE__*/ jsxRuntimeExports.jsx("div", {
1406
+ className: className ?? '',
1407
+ ref: elementRef,
1408
+ onClick: onElementClicked,
1409
+ ...rest,
1410
+ children: children
1411
+ });
1412
+ });
1413
+
1414
+ exports.ArchbeeAppWidget = ArchbeeAppWidget;
1415
+ exports.EVENT_TYPE_LIST = EVENT_TYPE_LIST;
1416
+ exports.authenticateJwt = authenticateJwt;
1417
+ exports.createArchbeeWidget = createArchbeeWidget;
1418
+ exports.createContainer = createContainer;
1419
+ exports.hideWidgetEvent = hideWidgetEvent;
1420
+ exports.initIdMappings = initIdMappings;
1421
+ exports.initJsScripts = initJsScripts;
1422
+ exports.initScripts = initScripts;
1423
+ exports.iterateProxy = iterateProxy;
1424
+ exports.loadWidget = loadWidget;
1425
+ exports.registerProxy = registerProxy;
1426
+ exports.render = render;
1427
+ exports.setWidget = setWidget;
1428
+ exports.showWidgetEvent = showWidgetEvent;
1429
+ //# sourceMappingURL=index.cjs.js.map