@pie-element/boilerplate-item-type 5.3.3 → 5.3.4-next.3

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.
package/esm/element.js ADDED
@@ -0,0 +1,1186 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';
4
+ import { UiLayout, PreviewPrompt } from '@pie-lib/render-ui';
5
+ import { renderMath } from '@pie-lib/math-rendering';
6
+
7
+ var propTypes = {exports: {}};
8
+
9
+ var reactIs = {exports: {}};
10
+
11
+ var reactIs_production_min = {};
12
+
13
+ /** @license React v16.13.1
14
+ * react-is.production.min.js
15
+ *
16
+ * Copyright (c) Facebook, Inc. and its affiliates.
17
+ *
18
+ * This source code is licensed under the MIT license found in the
19
+ * LICENSE file in the root directory of this source tree.
20
+ */
21
+ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
22
+ Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
23
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
24
+ reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
25
+ reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
26
+ reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
27
+
28
+ var reactIs_development = {};
29
+
30
+ /** @license React v16.13.1
31
+ * react-is.development.js
32
+ *
33
+ * Copyright (c) Facebook, Inc. and its affiliates.
34
+ *
35
+ * This source code is licensed under the MIT license found in the
36
+ * LICENSE file in the root directory of this source tree.
37
+ */
38
+
39
+
40
+
41
+ if (process.env.NODE_ENV !== "production") {
42
+ (function() {
43
+
44
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
45
+ // nor polyfill, then a plain number is used for performance.
46
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
47
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
48
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
49
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
50
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
51
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
52
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
53
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
54
+ // (unstable) APIs that have been removed. Can we remove the symbols?
55
+
56
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
57
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
58
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
59
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
60
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
61
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
62
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
63
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
64
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
65
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
66
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
67
+
68
+ function isValidElementType(type) {
69
+ return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
70
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (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 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
71
+ }
72
+
73
+ function typeOf(object) {
74
+ if (typeof object === 'object' && object !== null) {
75
+ var $$typeof = object.$$typeof;
76
+
77
+ switch ($$typeof) {
78
+ case REACT_ELEMENT_TYPE:
79
+ var type = object.type;
80
+
81
+ switch (type) {
82
+ case REACT_ASYNC_MODE_TYPE:
83
+ case REACT_CONCURRENT_MODE_TYPE:
84
+ case REACT_FRAGMENT_TYPE:
85
+ case REACT_PROFILER_TYPE:
86
+ case REACT_STRICT_MODE_TYPE:
87
+ case REACT_SUSPENSE_TYPE:
88
+ return type;
89
+
90
+ default:
91
+ var $$typeofType = type && type.$$typeof;
92
+
93
+ switch ($$typeofType) {
94
+ case REACT_CONTEXT_TYPE:
95
+ case REACT_FORWARD_REF_TYPE:
96
+ case REACT_LAZY_TYPE:
97
+ case REACT_MEMO_TYPE:
98
+ case REACT_PROVIDER_TYPE:
99
+ return $$typeofType;
100
+
101
+ default:
102
+ return $$typeof;
103
+ }
104
+
105
+ }
106
+
107
+ case REACT_PORTAL_TYPE:
108
+ return $$typeof;
109
+ }
110
+ }
111
+
112
+ return undefined;
113
+ } // AsyncMode is deprecated along with isAsyncMode
114
+
115
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
116
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
117
+ var ContextConsumer = REACT_CONTEXT_TYPE;
118
+ var ContextProvider = REACT_PROVIDER_TYPE;
119
+ var Element = REACT_ELEMENT_TYPE;
120
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
121
+ var Fragment = REACT_FRAGMENT_TYPE;
122
+ var Lazy = REACT_LAZY_TYPE;
123
+ var Memo = REACT_MEMO_TYPE;
124
+ var Portal = REACT_PORTAL_TYPE;
125
+ var Profiler = REACT_PROFILER_TYPE;
126
+ var StrictMode = REACT_STRICT_MODE_TYPE;
127
+ var Suspense = REACT_SUSPENSE_TYPE;
128
+ var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
129
+
130
+ function isAsyncMode(object) {
131
+ {
132
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
133
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
134
+
135
+ console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
136
+ }
137
+ }
138
+
139
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
140
+ }
141
+ function isConcurrentMode(object) {
142
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
143
+ }
144
+ function isContextConsumer(object) {
145
+ return typeOf(object) === REACT_CONTEXT_TYPE;
146
+ }
147
+ function isContextProvider(object) {
148
+ return typeOf(object) === REACT_PROVIDER_TYPE;
149
+ }
150
+ function isElement(object) {
151
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
152
+ }
153
+ function isForwardRef(object) {
154
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
155
+ }
156
+ function isFragment(object) {
157
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
158
+ }
159
+ function isLazy(object) {
160
+ return typeOf(object) === REACT_LAZY_TYPE;
161
+ }
162
+ function isMemo(object) {
163
+ return typeOf(object) === REACT_MEMO_TYPE;
164
+ }
165
+ function isPortal(object) {
166
+ return typeOf(object) === REACT_PORTAL_TYPE;
167
+ }
168
+ function isProfiler(object) {
169
+ return typeOf(object) === REACT_PROFILER_TYPE;
170
+ }
171
+ function isStrictMode(object) {
172
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
173
+ }
174
+ function isSuspense(object) {
175
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
176
+ }
177
+
178
+ reactIs_development.AsyncMode = AsyncMode;
179
+ reactIs_development.ConcurrentMode = ConcurrentMode;
180
+ reactIs_development.ContextConsumer = ContextConsumer;
181
+ reactIs_development.ContextProvider = ContextProvider;
182
+ reactIs_development.Element = Element;
183
+ reactIs_development.ForwardRef = ForwardRef;
184
+ reactIs_development.Fragment = Fragment;
185
+ reactIs_development.Lazy = Lazy;
186
+ reactIs_development.Memo = Memo;
187
+ reactIs_development.Portal = Portal;
188
+ reactIs_development.Profiler = Profiler;
189
+ reactIs_development.StrictMode = StrictMode;
190
+ reactIs_development.Suspense = Suspense;
191
+ reactIs_development.isAsyncMode = isAsyncMode;
192
+ reactIs_development.isConcurrentMode = isConcurrentMode;
193
+ reactIs_development.isContextConsumer = isContextConsumer;
194
+ reactIs_development.isContextProvider = isContextProvider;
195
+ reactIs_development.isElement = isElement;
196
+ reactIs_development.isForwardRef = isForwardRef;
197
+ reactIs_development.isFragment = isFragment;
198
+ reactIs_development.isLazy = isLazy;
199
+ reactIs_development.isMemo = isMemo;
200
+ reactIs_development.isPortal = isPortal;
201
+ reactIs_development.isProfiler = isProfiler;
202
+ reactIs_development.isStrictMode = isStrictMode;
203
+ reactIs_development.isSuspense = isSuspense;
204
+ reactIs_development.isValidElementType = isValidElementType;
205
+ reactIs_development.typeOf = typeOf;
206
+ })();
207
+ }
208
+
209
+ if (process.env.NODE_ENV === 'production') {
210
+ reactIs.exports = reactIs_production_min;
211
+ } else {
212
+ reactIs.exports = reactIs_development;
213
+ }
214
+
215
+ /*
216
+ object-assign
217
+ (c) Sindre Sorhus
218
+ @license MIT
219
+ */
220
+ /* eslint-disable no-unused-vars */
221
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
222
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
223
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
224
+
225
+ function toObject(val) {
226
+ if (val === null || val === undefined) {
227
+ throw new TypeError('Object.assign cannot be called with null or undefined');
228
+ }
229
+
230
+ return Object(val);
231
+ }
232
+
233
+ function shouldUseNative() {
234
+ try {
235
+ if (!Object.assign) {
236
+ return false;
237
+ }
238
+
239
+ // Detect buggy property enumeration order in older V8 versions.
240
+
241
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
242
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
243
+ test1[5] = 'de';
244
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
245
+ return false;
246
+ }
247
+
248
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
249
+ var test2 = {};
250
+ for (var i = 0; i < 10; i++) {
251
+ test2['_' + String.fromCharCode(i)] = i;
252
+ }
253
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
254
+ return test2[n];
255
+ });
256
+ if (order2.join('') !== '0123456789') {
257
+ return false;
258
+ }
259
+
260
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
261
+ var test3 = {};
262
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
263
+ test3[letter] = letter;
264
+ });
265
+ if (Object.keys(Object.assign({}, test3)).join('') !==
266
+ 'abcdefghijklmnopqrst') {
267
+ return false;
268
+ }
269
+
270
+ return true;
271
+ } catch (err) {
272
+ // We don't expect any of the above to throw, but better to be safe.
273
+ return false;
274
+ }
275
+ }
276
+
277
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
278
+ var from;
279
+ var to = toObject(target);
280
+ var symbols;
281
+
282
+ for (var s = 1; s < arguments.length; s++) {
283
+ from = Object(arguments[s]);
284
+
285
+ for (var key in from) {
286
+ if (hasOwnProperty.call(from, key)) {
287
+ to[key] = from[key];
288
+ }
289
+ }
290
+
291
+ if (getOwnPropertySymbols) {
292
+ symbols = getOwnPropertySymbols(from);
293
+ for (var i = 0; i < symbols.length; i++) {
294
+ if (propIsEnumerable.call(from, symbols[i])) {
295
+ to[symbols[i]] = from[symbols[i]];
296
+ }
297
+ }
298
+ }
299
+ }
300
+
301
+ return to;
302
+ };
303
+
304
+ /**
305
+ * Copyright (c) 2013-present, Facebook, Inc.
306
+ *
307
+ * This source code is licensed under the MIT license found in the
308
+ * LICENSE file in the root directory of this source tree.
309
+ */
310
+
311
+ var ReactPropTypesSecret$3 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
312
+
313
+ var ReactPropTypesSecret_1 = ReactPropTypesSecret$3;
314
+
315
+ var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
316
+
317
+ /**
318
+ * Copyright (c) 2013-present, Facebook, Inc.
319
+ *
320
+ * This source code is licensed under the MIT license found in the
321
+ * LICENSE file in the root directory of this source tree.
322
+ */
323
+
324
+ var printWarning$1 = function() {};
325
+
326
+ if (process.env.NODE_ENV !== 'production') {
327
+ var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
328
+ var loggedTypeFailures = {};
329
+ var has$1 = has$2;
330
+
331
+ printWarning$1 = function(text) {
332
+ var message = 'Warning: ' + text;
333
+ if (typeof console !== 'undefined') {
334
+ console.error(message);
335
+ }
336
+ try {
337
+ // --- Welcome to debugging React ---
338
+ // This error was thrown as a convenience so that you can use this stack
339
+ // to find the callsite that caused this warning to fire.
340
+ throw new Error(message);
341
+ } catch (x) { /**/ }
342
+ };
343
+ }
344
+
345
+ /**
346
+ * Assert that the values match with the type specs.
347
+ * Error messages are memorized and will only be shown once.
348
+ *
349
+ * @param {object} typeSpecs Map of name to a ReactPropType
350
+ * @param {object} values Runtime values that need to be type-checked
351
+ * @param {string} location e.g. "prop", "context", "child context"
352
+ * @param {string} componentName Name of the component for error messages.
353
+ * @param {?Function} getStack Returns the component stack.
354
+ * @private
355
+ */
356
+ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
357
+ if (process.env.NODE_ENV !== 'production') {
358
+ for (var typeSpecName in typeSpecs) {
359
+ if (has$1(typeSpecs, typeSpecName)) {
360
+ var error;
361
+ // Prop type validation may throw. In case they do, we don't want to
362
+ // fail the render phase where it didn't fail before. So we log it.
363
+ // After these have been cleaned up, we'll let them throw.
364
+ try {
365
+ // This is intentionally an invariant that gets caught. It's the same
366
+ // behavior as without this statement except with a better message.
367
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
368
+ var err = Error(
369
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
370
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
371
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
372
+ );
373
+ err.name = 'Invariant Violation';
374
+ throw err;
375
+ }
376
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$2);
377
+ } catch (ex) {
378
+ error = ex;
379
+ }
380
+ if (error && !(error instanceof Error)) {
381
+ printWarning$1(
382
+ (componentName || 'React class') + ': type specification of ' +
383
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
384
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
385
+ 'You may have forgotten to pass an argument to the type checker ' +
386
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
387
+ 'shape all require an argument).'
388
+ );
389
+ }
390
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
391
+ // Only monitor this failure once because there tends to be a lot of the
392
+ // same error.
393
+ loggedTypeFailures[error.message] = true;
394
+
395
+ var stack = getStack ? getStack() : '';
396
+
397
+ printWarning$1(
398
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
399
+ );
400
+ }
401
+ }
402
+ }
403
+ }
404
+ }
405
+
406
+ /**
407
+ * Resets warning cache when testing.
408
+ *
409
+ * @private
410
+ */
411
+ checkPropTypes$1.resetWarningCache = function() {
412
+ if (process.env.NODE_ENV !== 'production') {
413
+ loggedTypeFailures = {};
414
+ }
415
+ };
416
+
417
+ var checkPropTypes_1 = checkPropTypes$1;
418
+
419
+ /**
420
+ * Copyright (c) 2013-present, Facebook, Inc.
421
+ *
422
+ * This source code is licensed under the MIT license found in the
423
+ * LICENSE file in the root directory of this source tree.
424
+ */
425
+
426
+ var ReactIs$1 = reactIs.exports;
427
+ var assign = objectAssign;
428
+
429
+ var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
430
+ var has = has$2;
431
+ var checkPropTypes = checkPropTypes_1;
432
+
433
+ var printWarning = function() {};
434
+
435
+ if (process.env.NODE_ENV !== 'production') {
436
+ printWarning = function(text) {
437
+ var message = 'Warning: ' + text;
438
+ if (typeof console !== 'undefined') {
439
+ console.error(message);
440
+ }
441
+ try {
442
+ // --- Welcome to debugging React ---
443
+ // This error was thrown as a convenience so that you can use this stack
444
+ // to find the callsite that caused this warning to fire.
445
+ throw new Error(message);
446
+ } catch (x) {}
447
+ };
448
+ }
449
+
450
+ function emptyFunctionThatReturnsNull() {
451
+ return null;
452
+ }
453
+
454
+ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
455
+ /* global Symbol */
456
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
457
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
458
+
459
+ /**
460
+ * Returns the iterator method function contained on the iterable object.
461
+ *
462
+ * Be sure to invoke the function with the iterable as context:
463
+ *
464
+ * var iteratorFn = getIteratorFn(myIterable);
465
+ * if (iteratorFn) {
466
+ * var iterator = iteratorFn.call(myIterable);
467
+ * ...
468
+ * }
469
+ *
470
+ * @param {?object} maybeIterable
471
+ * @return {?function}
472
+ */
473
+ function getIteratorFn(maybeIterable) {
474
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
475
+ if (typeof iteratorFn === 'function') {
476
+ return iteratorFn;
477
+ }
478
+ }
479
+
480
+ /**
481
+ * Collection of methods that allow declaration and validation of props that are
482
+ * supplied to React components. Example usage:
483
+ *
484
+ * var Props = require('ReactPropTypes');
485
+ * var MyArticle = React.createClass({
486
+ * propTypes: {
487
+ * // An optional string prop named "description".
488
+ * description: Props.string,
489
+ *
490
+ * // A required enum prop named "category".
491
+ * category: Props.oneOf(['News','Photos']).isRequired,
492
+ *
493
+ * // A prop named "dialog" that requires an instance of Dialog.
494
+ * dialog: Props.instanceOf(Dialog).isRequired
495
+ * },
496
+ * render: function() { ... }
497
+ * });
498
+ *
499
+ * A more formal specification of how these methods are used:
500
+ *
501
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
502
+ * decl := ReactPropTypes.{type}(.isRequired)?
503
+ *
504
+ * Each and every declaration produces a function with the same signature. This
505
+ * allows the creation of custom validation functions. For example:
506
+ *
507
+ * var MyLink = React.createClass({
508
+ * propTypes: {
509
+ * // An optional string or URI prop named "href".
510
+ * href: function(props, propName, componentName) {
511
+ * var propValue = props[propName];
512
+ * if (propValue != null && typeof propValue !== 'string' &&
513
+ * !(propValue instanceof URI)) {
514
+ * return new Error(
515
+ * 'Expected a string or an URI for ' + propName + ' in ' +
516
+ * componentName
517
+ * );
518
+ * }
519
+ * }
520
+ * },
521
+ * render: function() {...}
522
+ * });
523
+ *
524
+ * @internal
525
+ */
526
+
527
+ var ANONYMOUS = '<<anonymous>>';
528
+
529
+ // Important!
530
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
531
+ var ReactPropTypes = {
532
+ array: createPrimitiveTypeChecker('array'),
533
+ bigint: createPrimitiveTypeChecker('bigint'),
534
+ bool: createPrimitiveTypeChecker('boolean'),
535
+ func: createPrimitiveTypeChecker('function'),
536
+ number: createPrimitiveTypeChecker('number'),
537
+ object: createPrimitiveTypeChecker('object'),
538
+ string: createPrimitiveTypeChecker('string'),
539
+ symbol: createPrimitiveTypeChecker('symbol'),
540
+
541
+ any: createAnyTypeChecker(),
542
+ arrayOf: createArrayOfTypeChecker,
543
+ element: createElementTypeChecker(),
544
+ elementType: createElementTypeTypeChecker(),
545
+ instanceOf: createInstanceTypeChecker,
546
+ node: createNodeChecker(),
547
+ objectOf: createObjectOfTypeChecker,
548
+ oneOf: createEnumTypeChecker,
549
+ oneOfType: createUnionTypeChecker,
550
+ shape: createShapeTypeChecker,
551
+ exact: createStrictShapeTypeChecker,
552
+ };
553
+
554
+ /**
555
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
556
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
557
+ */
558
+ /*eslint-disable no-self-compare*/
559
+ function is(x, y) {
560
+ // SameValue algorithm
561
+ if (x === y) {
562
+ // Steps 1-5, 7-10
563
+ // Steps 6.b-6.e: +0 != -0
564
+ return x !== 0 || 1 / x === 1 / y;
565
+ } else {
566
+ // Step 6.a: NaN == NaN
567
+ return x !== x && y !== y;
568
+ }
569
+ }
570
+ /*eslint-enable no-self-compare*/
571
+
572
+ /**
573
+ * We use an Error-like object for backward compatibility as people may call
574
+ * PropTypes directly and inspect their output. However, we don't use real
575
+ * Errors anymore. We don't inspect their stack anyway, and creating them
576
+ * is prohibitively expensive if they are created too often, such as what
577
+ * happens in oneOfType() for any type before the one that matched.
578
+ */
579
+ function PropTypeError(message, data) {
580
+ this.message = message;
581
+ this.data = data && typeof data === 'object' ? data: {};
582
+ this.stack = '';
583
+ }
584
+ // Make `instanceof Error` still work for returned errors.
585
+ PropTypeError.prototype = Error.prototype;
586
+
587
+ function createChainableTypeChecker(validate) {
588
+ if (process.env.NODE_ENV !== 'production') {
589
+ var manualPropTypeCallCache = {};
590
+ var manualPropTypeWarningCount = 0;
591
+ }
592
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
593
+ componentName = componentName || ANONYMOUS;
594
+ propFullName = propFullName || propName;
595
+
596
+ if (secret !== ReactPropTypesSecret$1) {
597
+ if (throwOnDirectAccess) {
598
+ // New behavior only for users of `prop-types` package
599
+ var err = new Error(
600
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
601
+ 'Use `PropTypes.checkPropTypes()` to call them. ' +
602
+ 'Read more at http://fb.me/use-check-prop-types'
603
+ );
604
+ err.name = 'Invariant Violation';
605
+ throw err;
606
+ } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
607
+ // Old behavior for people using React.PropTypes
608
+ var cacheKey = componentName + ':' + propName;
609
+ if (
610
+ !manualPropTypeCallCache[cacheKey] &&
611
+ // Avoid spamming the console because they are often not actionable except for lib authors
612
+ manualPropTypeWarningCount < 3
613
+ ) {
614
+ printWarning(
615
+ 'You are manually calling a React.PropTypes validation ' +
616
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
617
+ 'and will throw in the standalone `prop-types` package. ' +
618
+ 'You may be seeing this warning due to a third-party PropTypes ' +
619
+ 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
620
+ );
621
+ manualPropTypeCallCache[cacheKey] = true;
622
+ manualPropTypeWarningCount++;
623
+ }
624
+ }
625
+ }
626
+ if (props[propName] == null) {
627
+ if (isRequired) {
628
+ if (props[propName] === null) {
629
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
630
+ }
631
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
632
+ }
633
+ return null;
634
+ } else {
635
+ return validate(props, propName, componentName, location, propFullName);
636
+ }
637
+ }
638
+
639
+ var chainedCheckType = checkType.bind(null, false);
640
+ chainedCheckType.isRequired = checkType.bind(null, true);
641
+
642
+ return chainedCheckType;
643
+ }
644
+
645
+ function createPrimitiveTypeChecker(expectedType) {
646
+ function validate(props, propName, componentName, location, propFullName, secret) {
647
+ var propValue = props[propName];
648
+ var propType = getPropType(propValue);
649
+ if (propType !== expectedType) {
650
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
651
+ // check, but we can offer a more precise error message here rather than
652
+ // 'of type `object`'.
653
+ var preciseType = getPreciseType(propValue);
654
+
655
+ return new PropTypeError(
656
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
657
+ {expectedType: expectedType}
658
+ );
659
+ }
660
+ return null;
661
+ }
662
+ return createChainableTypeChecker(validate);
663
+ }
664
+
665
+ function createAnyTypeChecker() {
666
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
667
+ }
668
+
669
+ function createArrayOfTypeChecker(typeChecker) {
670
+ function validate(props, propName, componentName, location, propFullName) {
671
+ if (typeof typeChecker !== 'function') {
672
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
673
+ }
674
+ var propValue = props[propName];
675
+ if (!Array.isArray(propValue)) {
676
+ var propType = getPropType(propValue);
677
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
678
+ }
679
+ for (var i = 0; i < propValue.length; i++) {
680
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret$1);
681
+ if (error instanceof Error) {
682
+ return error;
683
+ }
684
+ }
685
+ return null;
686
+ }
687
+ return createChainableTypeChecker(validate);
688
+ }
689
+
690
+ function createElementTypeChecker() {
691
+ function validate(props, propName, componentName, location, propFullName) {
692
+ var propValue = props[propName];
693
+ if (!isValidElement(propValue)) {
694
+ var propType = getPropType(propValue);
695
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
696
+ }
697
+ return null;
698
+ }
699
+ return createChainableTypeChecker(validate);
700
+ }
701
+
702
+ function createElementTypeTypeChecker() {
703
+ function validate(props, propName, componentName, location, propFullName) {
704
+ var propValue = props[propName];
705
+ if (!ReactIs$1.isValidElementType(propValue)) {
706
+ var propType = getPropType(propValue);
707
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
708
+ }
709
+ return null;
710
+ }
711
+ return createChainableTypeChecker(validate);
712
+ }
713
+
714
+ function createInstanceTypeChecker(expectedClass) {
715
+ function validate(props, propName, componentName, location, propFullName) {
716
+ if (!(props[propName] instanceof expectedClass)) {
717
+ var expectedClassName = expectedClass.name || ANONYMOUS;
718
+ var actualClassName = getClassName(props[propName]);
719
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
720
+ }
721
+ return null;
722
+ }
723
+ return createChainableTypeChecker(validate);
724
+ }
725
+
726
+ function createEnumTypeChecker(expectedValues) {
727
+ if (!Array.isArray(expectedValues)) {
728
+ if (process.env.NODE_ENV !== 'production') {
729
+ if (arguments.length > 1) {
730
+ printWarning(
731
+ 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
732
+ 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
733
+ );
734
+ } else {
735
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
736
+ }
737
+ }
738
+ return emptyFunctionThatReturnsNull;
739
+ }
740
+
741
+ function validate(props, propName, componentName, location, propFullName) {
742
+ var propValue = props[propName];
743
+ for (var i = 0; i < expectedValues.length; i++) {
744
+ if (is(propValue, expectedValues[i])) {
745
+ return null;
746
+ }
747
+ }
748
+
749
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
750
+ var type = getPreciseType(value);
751
+ if (type === 'symbol') {
752
+ return String(value);
753
+ }
754
+ return value;
755
+ });
756
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
757
+ }
758
+ return createChainableTypeChecker(validate);
759
+ }
760
+
761
+ function createObjectOfTypeChecker(typeChecker) {
762
+ function validate(props, propName, componentName, location, propFullName) {
763
+ if (typeof typeChecker !== 'function') {
764
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
765
+ }
766
+ var propValue = props[propName];
767
+ var propType = getPropType(propValue);
768
+ if (propType !== 'object') {
769
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
770
+ }
771
+ for (var key in propValue) {
772
+ if (has(propValue, key)) {
773
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
774
+ if (error instanceof Error) {
775
+ return error;
776
+ }
777
+ }
778
+ }
779
+ return null;
780
+ }
781
+ return createChainableTypeChecker(validate);
782
+ }
783
+
784
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
785
+ if (!Array.isArray(arrayOfTypeCheckers)) {
786
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
787
+ return emptyFunctionThatReturnsNull;
788
+ }
789
+
790
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
791
+ var checker = arrayOfTypeCheckers[i];
792
+ if (typeof checker !== 'function') {
793
+ printWarning(
794
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
795
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
796
+ );
797
+ return emptyFunctionThatReturnsNull;
798
+ }
799
+ }
800
+
801
+ function validate(props, propName, componentName, location, propFullName) {
802
+ var expectedTypes = [];
803
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
804
+ var checker = arrayOfTypeCheckers[i];
805
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1);
806
+ if (checkerResult == null) {
807
+ return null;
808
+ }
809
+ if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
810
+ expectedTypes.push(checkerResult.data.expectedType);
811
+ }
812
+ }
813
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
814
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
815
+ }
816
+ return createChainableTypeChecker(validate);
817
+ }
818
+
819
+ function createNodeChecker() {
820
+ function validate(props, propName, componentName, location, propFullName) {
821
+ if (!isNode(props[propName])) {
822
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
823
+ }
824
+ return null;
825
+ }
826
+ return createChainableTypeChecker(validate);
827
+ }
828
+
829
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
830
+ return new PropTypeError(
831
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
832
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
833
+ );
834
+ }
835
+
836
+ function createShapeTypeChecker(shapeTypes) {
837
+ function validate(props, propName, componentName, location, propFullName) {
838
+ var propValue = props[propName];
839
+ var propType = getPropType(propValue);
840
+ if (propType !== 'object') {
841
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
842
+ }
843
+ for (var key in shapeTypes) {
844
+ var checker = shapeTypes[key];
845
+ if (typeof checker !== 'function') {
846
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
847
+ }
848
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
849
+ if (error) {
850
+ return error;
851
+ }
852
+ }
853
+ return null;
854
+ }
855
+ return createChainableTypeChecker(validate);
856
+ }
857
+
858
+ function createStrictShapeTypeChecker(shapeTypes) {
859
+ function validate(props, propName, componentName, location, propFullName) {
860
+ var propValue = props[propName];
861
+ var propType = getPropType(propValue);
862
+ if (propType !== 'object') {
863
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
864
+ }
865
+ // We need to check all keys in case some are required but missing from props.
866
+ var allKeys = assign({}, props[propName], shapeTypes);
867
+ for (var key in allKeys) {
868
+ var checker = shapeTypes[key];
869
+ if (has(shapeTypes, key) && typeof checker !== 'function') {
870
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
871
+ }
872
+ if (!checker) {
873
+ return new PropTypeError(
874
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
875
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
876
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
877
+ );
878
+ }
879
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
880
+ if (error) {
881
+ return error;
882
+ }
883
+ }
884
+ return null;
885
+ }
886
+
887
+ return createChainableTypeChecker(validate);
888
+ }
889
+
890
+ function isNode(propValue) {
891
+ switch (typeof propValue) {
892
+ case 'number':
893
+ case 'string':
894
+ case 'undefined':
895
+ return true;
896
+ case 'boolean':
897
+ return !propValue;
898
+ case 'object':
899
+ if (Array.isArray(propValue)) {
900
+ return propValue.every(isNode);
901
+ }
902
+ if (propValue === null || isValidElement(propValue)) {
903
+ return true;
904
+ }
905
+
906
+ var iteratorFn = getIteratorFn(propValue);
907
+ if (iteratorFn) {
908
+ var iterator = iteratorFn.call(propValue);
909
+ var step;
910
+ if (iteratorFn !== propValue.entries) {
911
+ while (!(step = iterator.next()).done) {
912
+ if (!isNode(step.value)) {
913
+ return false;
914
+ }
915
+ }
916
+ } else {
917
+ // Iterator will provide entry [k,v] tuples rather than values.
918
+ while (!(step = iterator.next()).done) {
919
+ var entry = step.value;
920
+ if (entry) {
921
+ if (!isNode(entry[1])) {
922
+ return false;
923
+ }
924
+ }
925
+ }
926
+ }
927
+ } else {
928
+ return false;
929
+ }
930
+
931
+ return true;
932
+ default:
933
+ return false;
934
+ }
935
+ }
936
+
937
+ function isSymbol(propType, propValue) {
938
+ // Native Symbol.
939
+ if (propType === 'symbol') {
940
+ return true;
941
+ }
942
+
943
+ // falsy value can't be a Symbol
944
+ if (!propValue) {
945
+ return false;
946
+ }
947
+
948
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
949
+ if (propValue['@@toStringTag'] === 'Symbol') {
950
+ return true;
951
+ }
952
+
953
+ // Fallback for non-spec compliant Symbols which are polyfilled.
954
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
955
+ return true;
956
+ }
957
+
958
+ return false;
959
+ }
960
+
961
+ // Equivalent of `typeof` but with special handling for array and regexp.
962
+ function getPropType(propValue) {
963
+ var propType = typeof propValue;
964
+ if (Array.isArray(propValue)) {
965
+ return 'array';
966
+ }
967
+ if (propValue instanceof RegExp) {
968
+ // Old webkits (at least until Android 4.0) return 'function' rather than
969
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
970
+ // passes PropTypes.object.
971
+ return 'object';
972
+ }
973
+ if (isSymbol(propType, propValue)) {
974
+ return 'symbol';
975
+ }
976
+ return propType;
977
+ }
978
+
979
+ // This handles more types than `getPropType`. Only used for error messages.
980
+ // See `createPrimitiveTypeChecker`.
981
+ function getPreciseType(propValue) {
982
+ if (typeof propValue === 'undefined' || propValue === null) {
983
+ return '' + propValue;
984
+ }
985
+ var propType = getPropType(propValue);
986
+ if (propType === 'object') {
987
+ if (propValue instanceof Date) {
988
+ return 'date';
989
+ } else if (propValue instanceof RegExp) {
990
+ return 'regexp';
991
+ }
992
+ }
993
+ return propType;
994
+ }
995
+
996
+ // Returns a string that is postfixed to a warning about an invalid type.
997
+ // For example, "undefined" or "of type array"
998
+ function getPostfixForTypeWarning(value) {
999
+ var type = getPreciseType(value);
1000
+ switch (type) {
1001
+ case 'array':
1002
+ case 'object':
1003
+ return 'an ' + type;
1004
+ case 'boolean':
1005
+ case 'date':
1006
+ case 'regexp':
1007
+ return 'a ' + type;
1008
+ default:
1009
+ return type;
1010
+ }
1011
+ }
1012
+
1013
+ // Returns class name of the object, if any.
1014
+ function getClassName(propValue) {
1015
+ if (!propValue.constructor || !propValue.constructor.name) {
1016
+ return ANONYMOUS;
1017
+ }
1018
+ return propValue.constructor.name;
1019
+ }
1020
+
1021
+ ReactPropTypes.checkPropTypes = checkPropTypes;
1022
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1023
+ ReactPropTypes.PropTypes = ReactPropTypes;
1024
+
1025
+ return ReactPropTypes;
1026
+ };
1027
+
1028
+ /**
1029
+ * Copyright (c) 2013-present, Facebook, Inc.
1030
+ *
1031
+ * This source code is licensed under the MIT license found in the
1032
+ * LICENSE file in the root directory of this source tree.
1033
+ */
1034
+
1035
+ var ReactPropTypesSecret = ReactPropTypesSecret_1;
1036
+
1037
+ function emptyFunction() {}
1038
+ function emptyFunctionWithReset() {}
1039
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
1040
+
1041
+ var factoryWithThrowingShims = function() {
1042
+ function shim(props, propName, componentName, location, propFullName, secret) {
1043
+ if (secret === ReactPropTypesSecret) {
1044
+ // It is still safe when called from React.
1045
+ return;
1046
+ }
1047
+ var err = new Error(
1048
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1049
+ 'Use PropTypes.checkPropTypes() to call them. ' +
1050
+ 'Read more at http://fb.me/use-check-prop-types'
1051
+ );
1052
+ err.name = 'Invariant Violation';
1053
+ throw err;
1054
+ } shim.isRequired = shim;
1055
+ function getShim() {
1056
+ return shim;
1057
+ } // Important!
1058
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1059
+ var ReactPropTypes = {
1060
+ array: shim,
1061
+ bigint: shim,
1062
+ bool: shim,
1063
+ func: shim,
1064
+ number: shim,
1065
+ object: shim,
1066
+ string: shim,
1067
+ symbol: shim,
1068
+
1069
+ any: shim,
1070
+ arrayOf: getShim,
1071
+ element: shim,
1072
+ elementType: shim,
1073
+ instanceOf: getShim,
1074
+ node: shim,
1075
+ objectOf: getShim,
1076
+ oneOf: getShim,
1077
+ oneOfType: getShim,
1078
+ shape: getShim,
1079
+ exact: getShim,
1080
+
1081
+ checkPropTypes: emptyFunctionWithReset,
1082
+ resetWarningCache: emptyFunction
1083
+ };
1084
+
1085
+ ReactPropTypes.PropTypes = ReactPropTypes;
1086
+
1087
+ return ReactPropTypes;
1088
+ };
1089
+
1090
+ /**
1091
+ * Copyright (c) 2013-present, Facebook, Inc.
1092
+ *
1093
+ * This source code is licensed under the MIT license found in the
1094
+ * LICENSE file in the root directory of this source tree.
1095
+ */
1096
+
1097
+ if (process.env.NODE_ENV !== 'production') {
1098
+ var ReactIs = reactIs.exports;
1099
+
1100
+ // By explicitly using `prop-types` you are opting into new development behavior.
1101
+ // http://fb.me/prop-types-in-prod
1102
+ var throwOnDirectAccess = true;
1103
+ propTypes.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
1104
+ } else {
1105
+ // By explicitly using `prop-types` you are opting into new production behavior.
1106
+ // http://fb.me/prop-types-in-prod
1107
+ propTypes.exports = factoryWithThrowingShims();
1108
+ }
1109
+
1110
+ var PropTypes = propTypes.exports;
1111
+
1112
+ class Main extends React.Component {
1113
+ render() {
1114
+ const {
1115
+ model
1116
+ } = this.props;
1117
+ const {
1118
+ extraCSSRules
1119
+ } = model;
1120
+ return /*#__PURE__*/React.createElement(UiLayout, {
1121
+ extraCSSRules: extraCSSRules
1122
+ }, model.prompt && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, "Boilerplate Item"), /*#__PURE__*/React.createElement(PreviewPrompt, {
1123
+ prompt: model.prompt
1124
+ })));
1125
+ }
1126
+
1127
+ }
1128
+ Main.propTypes = {
1129
+ model: PropTypes.object,
1130
+ session: PropTypes.object,
1131
+ onSessionChange: PropTypes.func.isRequired
1132
+ };
1133
+ Main.defaultProps = {};
1134
+
1135
+ class BoilerplateItemType extends HTMLElement {
1136
+ set model(m) {
1137
+ this._model = m;
1138
+ this.render();
1139
+ this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this.isSessionComplete(), this._model !== undefined));
1140
+ }
1141
+
1142
+ get model() {
1143
+ return this._model;
1144
+ }
1145
+
1146
+ set session(s) {
1147
+ this._session = s;
1148
+ this.render();
1149
+ }
1150
+
1151
+ get session() {
1152
+ return this._session;
1153
+ }
1154
+
1155
+ isSessionComplete() {
1156
+ // a method to check if student answered the question
1157
+ return true;
1158
+ }
1159
+
1160
+ onSessionChange(session) {
1161
+ // you can add an extra step here to validate session
1162
+ this._session = session;
1163
+ this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isSessionComplete()));
1164
+ }
1165
+
1166
+ connectedCallback() {
1167
+ this.render();
1168
+ }
1169
+
1170
+ render() {
1171
+ if (this._model && this._session) {
1172
+ const el = /*#__PURE__*/React.createElement(Main, {
1173
+ model: this._model,
1174
+ session: this._session,
1175
+ onSessionChange: this.onSessionChange.bind(this)
1176
+ });
1177
+ ReactDOM.render(el, this, () => {
1178
+ renderMath(this);
1179
+ });
1180
+ }
1181
+ }
1182
+
1183
+ }
1184
+
1185
+ export { BoilerplateItemType as default };
1186
+ //# sourceMappingURL=element.js.map