@financial-times/n-myft-ui 26.1.0 → 27.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/.circleci/config.yml +46 -34
  2. package/.nvmrc +1 -1
  3. package/Makefile +0 -1
  4. package/README.md +2 -48
  5. package/build-state/npm-shrinkwrap.json +10147 -20187
  6. package/components/collections/collections.html +85 -0
  7. package/components/concept-list/concept-list.html +31 -0
  8. package/components/csrf-token/input.html +5 -0
  9. package/components/follow-button/follow-button.html +79 -0
  10. package/components/instant-alert/instant-alert.html +47 -0
  11. package/components/pin-button/pin-button.html +20 -0
  12. package/components/save-for-later/save-for-later.html +67 -0
  13. package/components/unread-articles-indicator/date-fns.js +6 -6
  14. package/demos/app.js +3 -26
  15. package/demos/templates/demo.html +11 -10
  16. package/package.json +16 -30
  17. package/components/collections/collections.jsx +0 -68
  18. package/components/collections/collections.test.js +0 -83
  19. package/components/concept-list/concept-list.jsx +0 -69
  20. package/components/concept-list/concept-list.test.js +0 -116
  21. package/components/csrf-token/input.jsx +0 -20
  22. package/components/csrf-token/input.test.js +0 -23
  23. package/components/follow-button/follow-button.jsx +0 -176
  24. package/components/follow-button/follow-button.test.js +0 -40
  25. package/components/index.js +0 -17
  26. package/components/instant-alert/instant-alert.jsx +0 -73
  27. package/components/instant-alert/instant-alert.test.js +0 -86
  28. package/components/pin-button/pin-button.jsx +0 -40
  29. package/components/pin-button/pin-button.test.js +0 -57
  30. package/components/save-for-later/save-for-later.jsx +0 -101
  31. package/components/save-for-later/save-for-later.test.js +0 -59
  32. package/demos/templates/demo-layout.html +0 -25
  33. package/demos/templates/demo.jsx +0 -125
  34. package/dist/bundles/bundle.js +0 -3232
  35. package/jest.config.js +0 -8
  36. package/jsx-migration.md +0 -16
  37. package/webpack.config.js +0 -34
@@ -1,3232 +0,0 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if(typeof define === 'function' && define.amd)
5
- define([], factory);
6
- else if(typeof exports === 'object')
7
- exports["@financial-times/n-myft-ui"] = factory();
8
- else
9
- root["@financial-times/n-myft-ui"] = factory();
10
- })(typeof self !== 'undefined' ? self : this, function() {
11
- return /******/ (function(modules) { // webpackBootstrap
12
- /******/ // The module cache
13
- /******/ var installedModules = {};
14
- /******/
15
- /******/ // The require function
16
- /******/ function __webpack_require__(moduleId) {
17
- /******/
18
- /******/ // Check if module is in cache
19
- /******/ if(installedModules[moduleId]) {
20
- /******/ return installedModules[moduleId].exports;
21
- /******/ }
22
- /******/ // Create a new module (and put it into the cache)
23
- /******/ var module = installedModules[moduleId] = {
24
- /******/ i: moduleId,
25
- /******/ l: false,
26
- /******/ exports: {}
27
- /******/ };
28
- /******/
29
- /******/ // Execute the module function
30
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
- /******/
32
- /******/ // Flag the module as loaded
33
- /******/ module.l = true;
34
- /******/
35
- /******/ // Return the exports of the module
36
- /******/ return module.exports;
37
- /******/ }
38
- /******/
39
- /******/
40
- /******/ // expose the modules object (__webpack_modules__)
41
- /******/ __webpack_require__.m = modules;
42
- /******/
43
- /******/ // expose the module cache
44
- /******/ __webpack_require__.c = installedModules;
45
- /******/
46
- /******/ // define getter function for harmony exports
47
- /******/ __webpack_require__.d = function(exports, name, getter) {
48
- /******/ if(!__webpack_require__.o(exports, name)) {
49
- /******/ Object.defineProperty(exports, name, {
50
- /******/ configurable: false,
51
- /******/ enumerable: true,
52
- /******/ get: getter
53
- /******/ });
54
- /******/ }
55
- /******/ };
56
- /******/
57
- /******/ // getDefaultExport function for compatibility with non-harmony modules
58
- /******/ __webpack_require__.n = function(module) {
59
- /******/ var getter = module && module.__esModule ?
60
- /******/ function getDefault() { return module['default']; } :
61
- /******/ function getModuleExports() { return module; };
62
- /******/ __webpack_require__.d(getter, 'a', getter);
63
- /******/ return getter;
64
- /******/ };
65
- /******/
66
- /******/ // Object.prototype.hasOwnProperty.call
67
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
68
- /******/
69
- /******/ // __webpack_public_path__
70
- /******/ __webpack_require__.p = "";
71
- /******/
72
- /******/ // Load entry module and return exports
73
- /******/ return __webpack_require__(__webpack_require__.s = 4);
74
- /******/ })
75
- /************************************************************************/
76
- /******/ ([
77
- /* 0 */
78
- /***/ (function(module, exports, __webpack_require__) {
79
-
80
- "use strict";
81
-
82
-
83
- if (process.env.NODE_ENV === 'production') {
84
- module.exports = __webpack_require__(5);
85
- } else {
86
- module.exports = __webpack_require__(6);
87
- }
88
-
89
-
90
- /***/ }),
91
- /* 1 */
92
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
93
-
94
- "use strict";
95
- /* harmony export (immutable) */ __webpack_exports__["a"] = CsrfToken;
96
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
97
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
98
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
99
-
100
-
101
-
102
- function CsrfToken({ cacheablePersonalisedUrl, csrfToken }) {
103
-
104
- let inputProps = {};
105
-
106
- if (cacheablePersonalisedUrl) {
107
- inputProps.value = csrfToken;
108
- }
109
-
110
- return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement("input", _extends({
111
- "data-myft-csrf-token": true
112
- }, inputProps, {
113
- type: "hidden",
114
- name: "token"
115
- }));
116
- }
117
-
118
- /***/ }),
119
- /* 2 */
120
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
121
-
122
- "use strict";
123
- /* harmony export (immutable) */ __webpack_exports__["a"] = FollowButton;
124
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
125
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
126
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__csrf_token_input__ = __webpack_require__(1);
127
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
128
-
129
-
130
-
131
-
132
- function generateFormProps(props) {
133
- let generatedProps = {};
134
-
135
- const {
136
- collectionName,
137
- followPlusDigestEmail,
138
- conceptId,
139
- setFollowButtonStateToSelected,
140
- cacheablePersonalisedUrl
141
- } = props;
142
-
143
- if (collectionName) {
144
- generatedProps['data-myft-tracking'] = `collectionName=${collectionName}`;
145
- }
146
-
147
- if (followPlusDigestEmail) {
148
- generatedProps['action'] = `/__myft/api/core/follow-plus-digest-email/${conceptId}?method=put`;
149
- generatedProps['data-myft-ui-variant'] = 'followPlusDigestEmail';
150
- } else {
151
- if (setFollowButtonStateToSelected && cacheablePersonalisedUrl) {
152
- generatedProps['action'] = `/myft/remove/${conceptId}`;
153
- generatedProps['data-js-action'] = `/__myft/api/core/followed/concept/${conceptId}?method=delete`;
154
- } else {
155
- generatedProps['action'] = `/myft/add/${conceptId}`;
156
- generatedProps['data-js-action'] = `/__myft/api/core/followed/concept/${conceptId}?method=put`;
157
- }
158
- }
159
-
160
- return generatedProps;
161
- }
162
-
163
- function generateButtonProps(props) {
164
-
165
- const {
166
- cacheablePersonalisedUrl,
167
- setFollowButtonStateToSelected,
168
- name,
169
- buttonText,
170
- variant,
171
- conceptId,
172
- alternateText,
173
- followPlusDigestEmail
174
- } = props;
175
-
176
- let generatedProps = {
177
- 'data-concept-id': conceptId,
178
- 'n-myft-follow-button': 'true',
179
- 'data-trackable': 'follow',
180
- type: 'submit'
181
- };
182
-
183
- if (cacheablePersonalisedUrl && setFollowButtonStateToSelected) {
184
- generatedProps['aria-label'] = `Remove ${name} from myFT`;
185
- generatedProps['title'] = `Remove ${name} from myFT`;
186
- generatedProps['data-alternate-label'] = `Add ${name} to myFT`;
187
- generatedProps['aria-pressed'] = true;
188
-
189
- if (alternateText) {
190
- generatedProps['data-alternate-text'] = alternateText;
191
- } else {
192
- if (buttonText) {
193
- generatedProps['data-alternate-text'] = buttonText;
194
- } else {
195
- generatedProps['data-alternate-text'] = 'Add to myFT';
196
- }
197
- }
198
- } else {
199
- generatedProps['aria-pressed'] = false;
200
- generatedProps['aria-label'] = `Add ${name} to myFT`;
201
- generatedProps['title'] = `Add ${name} to myFT`;
202
- generatedProps['data-alternate-label'] = `Remove ${name} from myFT`;
203
- if (alternateText) {
204
- generatedProps['data-alternate-text'] = alternateText;
205
- } else {
206
- if (buttonText) {
207
- generatedProps['data-alternate-text'] = buttonText;
208
- } else {
209
- generatedProps['data-alternate-text'] = 'Added';
210
- }
211
- }
212
- }
213
-
214
- if (variant) {
215
- generatedProps[`n-myft-follow-button--${variant}`] = 'true';
216
- }
217
-
218
- if (followPlusDigestEmail) {
219
- generatedProps['data-trackable-context-messaging'] = 'add-to-myft-plus-digest-button';
220
- }
221
-
222
- return generatedProps;
223
- }
224
-
225
- function getButtonText(props) {
226
-
227
- const {
228
- buttonText,
229
- setFollowButtonStateToSelected,
230
- cacheablePersonalisedUrl
231
- } = props;
232
- let outputText;
233
-
234
- if (buttonText) {
235
- outputText = buttonText;
236
- } else {
237
- if (setFollowButtonStateToSelected && cacheablePersonalisedUrl) {
238
- outputText = 'Added';
239
- } else {
240
- outputText = 'Add to myFT';
241
- }
242
- }
243
-
244
- return outputText;
245
- }
246
-
247
- /**
248
- *
249
- * @param {Object} props
250
- * @param {string} props.name
251
- * @param {Object} props.flags
252
- * @param {string} props.extraClasses
253
- * @param {string} props.conceptId
254
- * @param {string} props.variant
255
- * @param {string} props.buttonText
256
- * @param {*} props.setFollowButtonStateToSelected
257
- * @param {string} props.cacheablePersonalisedUrl
258
- * @param {string} props.alternateText
259
- * @param {*} props.followPlusDigestEmail
260
- * @param {string} props.collectionName
261
- */
262
- function FollowButton(props) {
263
-
264
- const {
265
- name,
266
- flags,
267
- extraClasses,
268
- conceptId,
269
- variant,
270
- csrfToken,
271
- cacheablePersonalisedUrl
272
- } = props;
273
-
274
- const formProps = generateFormProps(props);
275
- const buttonProps = generateButtonProps(props);
276
-
277
- const getVariantClass = variant => variant ? `n-myft-follow-button--${variant}` : '';
278
-
279
- return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
280
- __WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
281
- null,
282
- flags.myFtApiWrite && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
283
- 'form',
284
- _extends({
285
- className: `n-myft-ui n-myft-ui--follow ${extraClasses || ''}`,
286
- method: 'GET',
287
- 'data-myft-ui': 'follow',
288
- 'data-concept-id': conceptId
289
- }, formProps),
290
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1__csrf_token_input__["a" /* default */], { cacheablePersonalisedUrl: cacheablePersonalisedUrl, csrfToken: csrfToken }),
291
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div', {
292
- className: 'n-myft-ui__announcement o-normalise-visually-hidden',
293
- 'aria-live': 'assertive',
294
- 'data-pressed-text': `Now following ${name}.`,
295
- 'data-unpressed-text': `No longer following ${name}.`
296
- }),
297
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
298
- 'button',
299
- _extends({}, buttonProps, {
300
- className: [`n-myft-follow-button ${getVariantClass(variant)}`] }),
301
- getButtonText(props)
302
- )
303
- )
304
- );
305
- }
306
-
307
- /***/ }),
308
- /* 3 */
309
- /***/ (function(module, exports, __webpack_require__) {
310
-
311
- "use strict";
312
- /*
313
- object-assign
314
- (c) Sindre Sorhus
315
- @license MIT
316
- */
317
-
318
-
319
- /* eslint-disable no-unused-vars */
320
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
321
- var hasOwnProperty = Object.prototype.hasOwnProperty;
322
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
323
-
324
- function toObject(val) {
325
- if (val === null || val === undefined) {
326
- throw new TypeError('Object.assign cannot be called with null or undefined');
327
- }
328
-
329
- return Object(val);
330
- }
331
-
332
- function shouldUseNative() {
333
- try {
334
- if (!Object.assign) {
335
- return false;
336
- }
337
-
338
- // Detect buggy property enumeration order in older V8 versions.
339
-
340
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
341
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
342
- test1[5] = 'de';
343
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
344
- return false;
345
- }
346
-
347
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
348
- var test2 = {};
349
- for (var i = 0; i < 10; i++) {
350
- test2['_' + String.fromCharCode(i)] = i;
351
- }
352
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
353
- return test2[n];
354
- });
355
- if (order2.join('') !== '0123456789') {
356
- return false;
357
- }
358
-
359
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
360
- var test3 = {};
361
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
362
- test3[letter] = letter;
363
- });
364
- if (Object.keys(Object.assign({}, test3)).join('') !==
365
- 'abcdefghijklmnopqrst') {
366
- return false;
367
- }
368
-
369
- return true;
370
- } catch (err) {
371
- // We don't expect any of the above to throw, but better to be safe.
372
- return false;
373
- }
374
- }
375
-
376
- module.exports = shouldUseNative() ? Object.assign : function (target, source) {
377
- var from;
378
- var to = toObject(target);
379
- var symbols;
380
-
381
- for (var s = 1; s < arguments.length; s++) {
382
- from = Object(arguments[s]);
383
-
384
- for (var key in from) {
385
- if (hasOwnProperty.call(from, key)) {
386
- to[key] = from[key];
387
- }
388
- }
389
-
390
- if (getOwnPropertySymbols) {
391
- symbols = getOwnPropertySymbols(from);
392
- for (var i = 0; i < symbols.length; i++) {
393
- if (propIsEnumerable.call(from, symbols[i])) {
394
- to[symbols[i]] = from[symbols[i]];
395
- }
396
- }
397
- }
398
- }
399
-
400
- return to;
401
- };
402
-
403
-
404
- /***/ }),
405
- /* 4 */
406
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
407
-
408
- "use strict";
409
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
410
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__csrf_token_input__ = __webpack_require__(1);
411
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__follow_button_follow_button__ = __webpack_require__(2);
412
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__concept_list_concept_list__ = __webpack_require__(7);
413
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collections_collections__ = __webpack_require__(8);
414
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__save_for_later_save_for_later__ = __webpack_require__(9);
415
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__pin_button_pin_button__ = __webpack_require__(10);
416
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__instant_alert_instant_alert__ = __webpack_require__(11);
417
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "CsrfToken", function() { return __WEBPACK_IMPORTED_MODULE_0__csrf_token_input__["a"]; });
418
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "FollowButton", function() { return __WEBPACK_IMPORTED_MODULE_1__follow_button_follow_button__["a"]; });
419
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ConceptList", function() { return __WEBPACK_IMPORTED_MODULE_2__concept_list_concept_list__["a"]; });
420
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Collections", function() { return __WEBPACK_IMPORTED_MODULE_3__collections_collections__["a"]; });
421
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "SaveForLater", function() { return __WEBPACK_IMPORTED_MODULE_4__save_for_later_save_for_later__["a"]; });
422
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "PinButton", function() { return __WEBPACK_IMPORTED_MODULE_5__pin_button_pin_button__["a"]; });
423
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "InstantAlert", function() { return __WEBPACK_IMPORTED_MODULE_6__instant_alert_instant_alert__["a"]; });
424
-
425
-
426
-
427
-
428
-
429
-
430
-
431
-
432
-
433
-
434
- /***/ }),
435
- /* 5 */
436
- /***/ (function(module, exports, __webpack_require__) {
437
-
438
- "use strict";
439
- /** @license React v17.0.2
440
- * react.production.min.js
441
- *
442
- * Copyright (c) Facebook, Inc. and its affiliates.
443
- *
444
- * This source code is licensed under the MIT license found in the
445
- * LICENSE file in the root directory of this source tree.
446
- */
447
- var l=__webpack_require__(3),n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116;
448
- if("function"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w("react.element");p=w("react.portal");exports.Fragment=w("react.fragment");exports.StrictMode=w("react.strict_mode");exports.Profiler=w("react.profiler");q=w("react.provider");r=w("react.context");t=w("react.forward_ref");exports.Suspense=w("react.suspense");u=w("react.memo");v=w("react.lazy")}var x="function"===typeof Symbol&&Symbol.iterator;
449
- function y(a){if(null===a||"object"!==typeof a)return null;a=x&&a[x]||a["@@iterator"];return"function"===typeof a?a:null}function z(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}
450
- var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B={};function C(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A}C.prototype.isReactComponent={};C.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error(z(85));this.updater.enqueueSetState(this,a,b,"setState")};C.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};
451
- function D(){}D.prototype=C.prototype;function E(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A}var F=E.prototype=new D;F.constructor=E;l(F,C.prototype);F.isPureReactComponent=!0;var G={current:null},H=Object.prototype.hasOwnProperty,I={key:!0,ref:!0,__self:!0,__source:!0};
452
- function J(a,b,c){var e,d={},k=null,h=null;if(null!=b)for(e in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)H.call(b,e)&&!I.hasOwnProperty(e)&&(d[e]=b[e]);var g=arguments.length-2;if(1===g)d.children=c;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];d.children=f}if(a&&a.defaultProps)for(e in g=a.defaultProps,g)void 0===d[e]&&(d[e]=g[e]);return{$$typeof:n,type:a,key:k,ref:h,props:d,_owner:G.current}}
453
- function K(a,b){return{$$typeof:n,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function L(a){return"object"===typeof a&&null!==a&&a.$$typeof===n}function escape(a){var b={"=":"=0",":":"=2"};return"$"+a.replace(/[=:]/g,function(a){return b[a]})}var M=/\/+/g;function N(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)}
454
- function O(a,b,c,e,d){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case "string":case "number":h=!0;break;case "object":switch(a.$$typeof){case n:case p:h=!0}}if(h)return h=a,d=d(h),a=""===e?"."+N(h,0):e,Array.isArray(d)?(c="",null!=a&&(c=a.replace(M,"$&/")+"/"),O(d,b,c,"",function(a){return a})):null!=d&&(L(d)&&(d=K(d,c+(!d.key||h&&h.key===d.key?"":(""+d.key).replace(M,"$&/")+"/")+a)),b.push(d)),1;h=0;e=""===e?".":e+":";if(Array.isArray(a))for(var g=
455
- 0;g<a.length;g++){k=a[g];var f=e+N(k,g);h+=O(k,b,c,f,d)}else if(f=y(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=e+N(k,g++),h+=O(k,b,c,f,d);else if("object"===k)throw b=""+a,Error(z(31,"[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b));return h}function P(a,b,c){if(null==a)return a;var e=[],d=0;O(a,e,"","",function(a){return b.call(c,a,d++)});return e}
456
- function Q(a){if(-1===a._status){var b=a._result;b=b();a._status=0;a._result=b;b.then(function(b){0===a._status&&(b=b.default,a._status=1,a._result=b)},function(b){0===a._status&&(a._status=2,a._result=b)})}if(1===a._status)return a._result;throw a._result;}var R={current:null};function S(){var a=R.current;if(null===a)throw Error(z(321));return a}var T={ReactCurrentDispatcher:R,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:G,IsSomeRendererActing:{current:!1},assign:l};
457
- exports.Children={map:P,forEach:function(a,b,c){P(a,function(){b.apply(this,arguments)},c)},count:function(a){var b=0;P(a,function(){b++});return b},toArray:function(a){return P(a,function(a){return a})||[]},only:function(a){if(!L(a))throw Error(z(143));return a}};exports.Component=C;exports.PureComponent=E;exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T;
458
- exports.cloneElement=function(a,b,c){if(null===a||void 0===a)throw Error(z(267,a));var e=l({},a.props),d=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=G.current);void 0!==b.key&&(d=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)H.call(b,f)&&!I.hasOwnProperty(f)&&(e[f]=void 0===b[f]&&void 0!==g?g[f]:b[f])}var f=arguments.length-2;if(1===f)e.children=c;else if(1<f){g=Array(f);for(var m=0;m<f;m++)g[m]=arguments[m+2];e.children=g}return{$$typeof:n,type:a.type,
459
- key:d,ref:k,props:e,_owner:h}};exports.createContext=function(a,b){void 0===b&&(b=null);a={$$typeof:r,_calculateChangedBits:b,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:q,_context:a};return a.Consumer=a};exports.createElement=J;exports.createFactory=function(a){var b=J.bind(null,a);b.type=a;return b};exports.createRef=function(){return{current:null}};exports.forwardRef=function(a){return{$$typeof:t,render:a}};exports.isValidElement=L;
460
- exports.lazy=function(a){return{$$typeof:v,_payload:{_status:-1,_result:a},_init:Q}};exports.memo=function(a,b){return{$$typeof:u,type:a,compare:void 0===b?null:b}};exports.useCallback=function(a,b){return S().useCallback(a,b)};exports.useContext=function(a,b){return S().useContext(a,b)};exports.useDebugValue=function(){};exports.useEffect=function(a,b){return S().useEffect(a,b)};exports.useImperativeHandle=function(a,b,c){return S().useImperativeHandle(a,b,c)};
461
- exports.useLayoutEffect=function(a,b){return S().useLayoutEffect(a,b)};exports.useMemo=function(a,b){return S().useMemo(a,b)};exports.useReducer=function(a,b,c){return S().useReducer(a,b,c)};exports.useRef=function(a){return S().useRef(a)};exports.useState=function(a){return S().useState(a)};exports.version="17.0.2";
462
-
463
-
464
- /***/ }),
465
- /* 6 */
466
- /***/ (function(module, exports, __webpack_require__) {
467
-
468
- "use strict";
469
- /** @license React v17.0.2
470
- * react.development.js
471
- *
472
- * Copyright (c) Facebook, Inc. and its affiliates.
473
- *
474
- * This source code is licensed under the MIT license found in the
475
- * LICENSE file in the root directory of this source tree.
476
- */
477
-
478
-
479
-
480
- if (process.env.NODE_ENV !== "production") {
481
- (function() {
482
- 'use strict';
483
-
484
- var _assign = __webpack_require__(3);
485
-
486
- // TODO: this is special because it gets imported during build.
487
- var ReactVersion = '17.0.2';
488
-
489
- // ATTENTION
490
- // When adding new symbols to this file,
491
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
492
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
493
- // nor polyfill, then a plain number is used for performance.
494
- var REACT_ELEMENT_TYPE = 0xeac7;
495
- var REACT_PORTAL_TYPE = 0xeaca;
496
- exports.Fragment = 0xeacb;
497
- exports.StrictMode = 0xeacc;
498
- exports.Profiler = 0xead2;
499
- var REACT_PROVIDER_TYPE = 0xeacd;
500
- var REACT_CONTEXT_TYPE = 0xeace;
501
- var REACT_FORWARD_REF_TYPE = 0xead0;
502
- exports.Suspense = 0xead1;
503
- var REACT_SUSPENSE_LIST_TYPE = 0xead8;
504
- var REACT_MEMO_TYPE = 0xead3;
505
- var REACT_LAZY_TYPE = 0xead4;
506
- var REACT_BLOCK_TYPE = 0xead9;
507
- var REACT_SERVER_BLOCK_TYPE = 0xeada;
508
- var REACT_FUNDAMENTAL_TYPE = 0xead5;
509
- var REACT_SCOPE_TYPE = 0xead7;
510
- var REACT_OPAQUE_ID_TYPE = 0xeae0;
511
- var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
512
- var REACT_OFFSCREEN_TYPE = 0xeae2;
513
- var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
514
-
515
- if (typeof Symbol === 'function' && Symbol.for) {
516
- var symbolFor = Symbol.for;
517
- REACT_ELEMENT_TYPE = symbolFor('react.element');
518
- REACT_PORTAL_TYPE = symbolFor('react.portal');
519
- exports.Fragment = symbolFor('react.fragment');
520
- exports.StrictMode = symbolFor('react.strict_mode');
521
- exports.Profiler = symbolFor('react.profiler');
522
- REACT_PROVIDER_TYPE = symbolFor('react.provider');
523
- REACT_CONTEXT_TYPE = symbolFor('react.context');
524
- REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
525
- exports.Suspense = symbolFor('react.suspense');
526
- REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
527
- REACT_MEMO_TYPE = symbolFor('react.memo');
528
- REACT_LAZY_TYPE = symbolFor('react.lazy');
529
- REACT_BLOCK_TYPE = symbolFor('react.block');
530
- REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
531
- REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
532
- REACT_SCOPE_TYPE = symbolFor('react.scope');
533
- REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
534
- REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
535
- REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
536
- REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
537
- }
538
-
539
- var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
540
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
541
- function getIteratorFn(maybeIterable) {
542
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
543
- return null;
544
- }
545
-
546
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
547
-
548
- if (typeof maybeIterator === 'function') {
549
- return maybeIterator;
550
- }
551
-
552
- return null;
553
- }
554
-
555
- /**
556
- * Keeps track of the current dispatcher.
557
- */
558
- var ReactCurrentDispatcher = {
559
- /**
560
- * @internal
561
- * @type {ReactComponent}
562
- */
563
- current: null
564
- };
565
-
566
- /**
567
- * Keeps track of the current batch's configuration such as how long an update
568
- * should suspend for if it needs to.
569
- */
570
- var ReactCurrentBatchConfig = {
571
- transition: 0
572
- };
573
-
574
- /**
575
- * Keeps track of the current owner.
576
- *
577
- * The current owner is the component who should own any components that are
578
- * currently being constructed.
579
- */
580
- var ReactCurrentOwner = {
581
- /**
582
- * @internal
583
- * @type {ReactComponent}
584
- */
585
- current: null
586
- };
587
-
588
- var ReactDebugCurrentFrame = {};
589
- var currentExtraStackFrame = null;
590
- function setExtraStackFrame(stack) {
591
- {
592
- currentExtraStackFrame = stack;
593
- }
594
- }
595
-
596
- {
597
- ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
598
- {
599
- currentExtraStackFrame = stack;
600
- }
601
- }; // Stack implementation injected by the current renderer.
602
-
603
-
604
- ReactDebugCurrentFrame.getCurrentStack = null;
605
-
606
- ReactDebugCurrentFrame.getStackAddendum = function () {
607
- var stack = ''; // Add an extra top frame while an element is being validated
608
-
609
- if (currentExtraStackFrame) {
610
- stack += currentExtraStackFrame;
611
- } // Delegate to the injected renderer-specific implementation
612
-
613
-
614
- var impl = ReactDebugCurrentFrame.getCurrentStack;
615
-
616
- if (impl) {
617
- stack += impl() || '';
618
- }
619
-
620
- return stack;
621
- };
622
- }
623
-
624
- /**
625
- * Used by act() to track whether you're inside an act() scope.
626
- */
627
- var IsSomeRendererActing = {
628
- current: false
629
- };
630
-
631
- var ReactSharedInternals = {
632
- ReactCurrentDispatcher: ReactCurrentDispatcher,
633
- ReactCurrentBatchConfig: ReactCurrentBatchConfig,
634
- ReactCurrentOwner: ReactCurrentOwner,
635
- IsSomeRendererActing: IsSomeRendererActing,
636
- // Used by renderers to avoid bundling object-assign twice in UMD bundles:
637
- assign: _assign
638
- };
639
-
640
- {
641
- ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
642
- }
643
-
644
- // by calls to these methods by a Babel plugin.
645
- //
646
- // In PROD (or in packages without access to React internals),
647
- // they are left as they are instead.
648
-
649
- function warn(format) {
650
- {
651
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
652
- args[_key - 1] = arguments[_key];
653
- }
654
-
655
- printWarning('warn', format, args);
656
- }
657
- }
658
- function error(format) {
659
- {
660
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
661
- args[_key2 - 1] = arguments[_key2];
662
- }
663
-
664
- printWarning('error', format, args);
665
- }
666
- }
667
-
668
- function printWarning(level, format, args) {
669
- // When changing this logic, you might want to also
670
- // update consoleWithStackDev.www.js as well.
671
- {
672
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
673
- var stack = ReactDebugCurrentFrame.getStackAddendum();
674
-
675
- if (stack !== '') {
676
- format += '%s';
677
- args = args.concat([stack]);
678
- }
679
-
680
- var argsWithFormat = args.map(function (item) {
681
- return '' + item;
682
- }); // Careful: RN currently depends on this prefix
683
-
684
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
685
- // breaks IE9: https://github.com/facebook/react/issues/13610
686
- // eslint-disable-next-line react-internal/no-production-logging
687
-
688
- Function.prototype.apply.call(console[level], console, argsWithFormat);
689
- }
690
- }
691
-
692
- var didWarnStateUpdateForUnmountedComponent = {};
693
-
694
- function warnNoop(publicInstance, callerName) {
695
- {
696
- var _constructor = publicInstance.constructor;
697
- var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
698
- var warningKey = componentName + "." + callerName;
699
-
700
- if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
701
- return;
702
- }
703
-
704
- error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
705
-
706
- didWarnStateUpdateForUnmountedComponent[warningKey] = true;
707
- }
708
- }
709
- /**
710
- * This is the abstract API for an update queue.
711
- */
712
-
713
-
714
- var ReactNoopUpdateQueue = {
715
- /**
716
- * Checks whether or not this composite component is mounted.
717
- * @param {ReactClass} publicInstance The instance we want to test.
718
- * @return {boolean} True if mounted, false otherwise.
719
- * @protected
720
- * @final
721
- */
722
- isMounted: function (publicInstance) {
723
- return false;
724
- },
725
-
726
- /**
727
- * Forces an update. This should only be invoked when it is known with
728
- * certainty that we are **not** in a DOM transaction.
729
- *
730
- * You may want to call this when you know that some deeper aspect of the
731
- * component's state has changed but `setState` was not called.
732
- *
733
- * This will not invoke `shouldComponentUpdate`, but it will invoke
734
- * `componentWillUpdate` and `componentDidUpdate`.
735
- *
736
- * @param {ReactClass} publicInstance The instance that should rerender.
737
- * @param {?function} callback Called after component is updated.
738
- * @param {?string} callerName name of the calling function in the public API.
739
- * @internal
740
- */
741
- enqueueForceUpdate: function (publicInstance, callback, callerName) {
742
- warnNoop(publicInstance, 'forceUpdate');
743
- },
744
-
745
- /**
746
- * Replaces all of the state. Always use this or `setState` to mutate state.
747
- * You should treat `this.state` as immutable.
748
- *
749
- * There is no guarantee that `this.state` will be immediately updated, so
750
- * accessing `this.state` after calling this method may return the old value.
751
- *
752
- * @param {ReactClass} publicInstance The instance that should rerender.
753
- * @param {object} completeState Next state.
754
- * @param {?function} callback Called after component is updated.
755
- * @param {?string} callerName name of the calling function in the public API.
756
- * @internal
757
- */
758
- enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
759
- warnNoop(publicInstance, 'replaceState');
760
- },
761
-
762
- /**
763
- * Sets a subset of the state. This only exists because _pendingState is
764
- * internal. This provides a merging strategy that is not available to deep
765
- * properties which is confusing. TODO: Expose pendingState or don't use it
766
- * during the merge.
767
- *
768
- * @param {ReactClass} publicInstance The instance that should rerender.
769
- * @param {object} partialState Next partial state to be merged with state.
770
- * @param {?function} callback Called after component is updated.
771
- * @param {?string} Name of the calling function in the public API.
772
- * @internal
773
- */
774
- enqueueSetState: function (publicInstance, partialState, callback, callerName) {
775
- warnNoop(publicInstance, 'setState');
776
- }
777
- };
778
-
779
- var emptyObject = {};
780
-
781
- {
782
- Object.freeze(emptyObject);
783
- }
784
- /**
785
- * Base class helpers for the updating state of a component.
786
- */
787
-
788
-
789
- function Component(props, context, updater) {
790
- this.props = props;
791
- this.context = context; // If a component has string refs, we will assign a different object later.
792
-
793
- this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
794
- // renderer.
795
-
796
- this.updater = updater || ReactNoopUpdateQueue;
797
- }
798
-
799
- Component.prototype.isReactComponent = {};
800
- /**
801
- * Sets a subset of the state. Always use this to mutate
802
- * state. You should treat `this.state` as immutable.
803
- *
804
- * There is no guarantee that `this.state` will be immediately updated, so
805
- * accessing `this.state` after calling this method may return the old value.
806
- *
807
- * There is no guarantee that calls to `setState` will run synchronously,
808
- * as they may eventually be batched together. You can provide an optional
809
- * callback that will be executed when the call to setState is actually
810
- * completed.
811
- *
812
- * When a function is provided to setState, it will be called at some point in
813
- * the future (not synchronously). It will be called with the up to date
814
- * component arguments (state, props, context). These values can be different
815
- * from this.* because your function may be called after receiveProps but before
816
- * shouldComponentUpdate, and this new state, props, and context will not yet be
817
- * assigned to this.
818
- *
819
- * @param {object|function} partialState Next partial state or function to
820
- * produce next partial state to be merged with current state.
821
- * @param {?function} callback Called after state is updated.
822
- * @final
823
- * @protected
824
- */
825
-
826
- Component.prototype.setState = function (partialState, callback) {
827
- if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
828
- {
829
- throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
830
- }
831
- }
832
-
833
- this.updater.enqueueSetState(this, partialState, callback, 'setState');
834
- };
835
- /**
836
- * Forces an update. This should only be invoked when it is known with
837
- * certainty that we are **not** in a DOM transaction.
838
- *
839
- * You may want to call this when you know that some deeper aspect of the
840
- * component's state has changed but `setState` was not called.
841
- *
842
- * This will not invoke `shouldComponentUpdate`, but it will invoke
843
- * `componentWillUpdate` and `componentDidUpdate`.
844
- *
845
- * @param {?function} callback Called after update is complete.
846
- * @final
847
- * @protected
848
- */
849
-
850
-
851
- Component.prototype.forceUpdate = function (callback) {
852
- this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
853
- };
854
- /**
855
- * Deprecated APIs. These APIs used to exist on classic React classes but since
856
- * we would like to deprecate them, we're not going to move them over to this
857
- * modern base class. Instead, we define a getter that warns if it's accessed.
858
- */
859
-
860
-
861
- {
862
- var deprecatedAPIs = {
863
- isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
864
- replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
865
- };
866
-
867
- var defineDeprecationWarning = function (methodName, info) {
868
- Object.defineProperty(Component.prototype, methodName, {
869
- get: function () {
870
- warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
871
-
872
- return undefined;
873
- }
874
- });
875
- };
876
-
877
- for (var fnName in deprecatedAPIs) {
878
- if (deprecatedAPIs.hasOwnProperty(fnName)) {
879
- defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
880
- }
881
- }
882
- }
883
-
884
- function ComponentDummy() {}
885
-
886
- ComponentDummy.prototype = Component.prototype;
887
- /**
888
- * Convenience component with default shallow equality check for sCU.
889
- */
890
-
891
- function PureComponent(props, context, updater) {
892
- this.props = props;
893
- this.context = context; // If a component has string refs, we will assign a different object later.
894
-
895
- this.refs = emptyObject;
896
- this.updater = updater || ReactNoopUpdateQueue;
897
- }
898
-
899
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
900
- pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
901
-
902
- _assign(pureComponentPrototype, Component.prototype);
903
-
904
- pureComponentPrototype.isPureReactComponent = true;
905
-
906
- // an immutable object with a single mutable value
907
- function createRef() {
908
- var refObject = {
909
- current: null
910
- };
911
-
912
- {
913
- Object.seal(refObject);
914
- }
915
-
916
- return refObject;
917
- }
918
-
919
- function getWrappedName(outerType, innerType, wrapperName) {
920
- var functionName = innerType.displayName || innerType.name || '';
921
- return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
922
- }
923
-
924
- function getContextName(type) {
925
- return type.displayName || 'Context';
926
- }
927
-
928
- function getComponentName(type) {
929
- if (type == null) {
930
- // Host root, text node or just invalid type.
931
- return null;
932
- }
933
-
934
- {
935
- if (typeof type.tag === 'number') {
936
- error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
937
- }
938
- }
939
-
940
- if (typeof type === 'function') {
941
- return type.displayName || type.name || null;
942
- }
943
-
944
- if (typeof type === 'string') {
945
- return type;
946
- }
947
-
948
- switch (type) {
949
- case exports.Fragment:
950
- return 'Fragment';
951
-
952
- case REACT_PORTAL_TYPE:
953
- return 'Portal';
954
-
955
- case exports.Profiler:
956
- return 'Profiler';
957
-
958
- case exports.StrictMode:
959
- return 'StrictMode';
960
-
961
- case exports.Suspense:
962
- return 'Suspense';
963
-
964
- case REACT_SUSPENSE_LIST_TYPE:
965
- return 'SuspenseList';
966
- }
967
-
968
- if (typeof type === 'object') {
969
- switch (type.$$typeof) {
970
- case REACT_CONTEXT_TYPE:
971
- var context = type;
972
- return getContextName(context) + '.Consumer';
973
-
974
- case REACT_PROVIDER_TYPE:
975
- var provider = type;
976
- return getContextName(provider._context) + '.Provider';
977
-
978
- case REACT_FORWARD_REF_TYPE:
979
- return getWrappedName(type, type.render, 'ForwardRef');
980
-
981
- case REACT_MEMO_TYPE:
982
- return getComponentName(type.type);
983
-
984
- case REACT_BLOCK_TYPE:
985
- return getComponentName(type._render);
986
-
987
- case REACT_LAZY_TYPE:
988
- {
989
- var lazyComponent = type;
990
- var payload = lazyComponent._payload;
991
- var init = lazyComponent._init;
992
-
993
- try {
994
- return getComponentName(init(payload));
995
- } catch (x) {
996
- return null;
997
- }
998
- }
999
- }
1000
- }
1001
-
1002
- return null;
1003
- }
1004
-
1005
- var hasOwnProperty = Object.prototype.hasOwnProperty;
1006
- var RESERVED_PROPS = {
1007
- key: true,
1008
- ref: true,
1009
- __self: true,
1010
- __source: true
1011
- };
1012
- var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
1013
-
1014
- {
1015
- didWarnAboutStringRefs = {};
1016
- }
1017
-
1018
- function hasValidRef(config) {
1019
- {
1020
- if (hasOwnProperty.call(config, 'ref')) {
1021
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
1022
-
1023
- if (getter && getter.isReactWarning) {
1024
- return false;
1025
- }
1026
- }
1027
- }
1028
-
1029
- return config.ref !== undefined;
1030
- }
1031
-
1032
- function hasValidKey(config) {
1033
- {
1034
- if (hasOwnProperty.call(config, 'key')) {
1035
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
1036
-
1037
- if (getter && getter.isReactWarning) {
1038
- return false;
1039
- }
1040
- }
1041
- }
1042
-
1043
- return config.key !== undefined;
1044
- }
1045
-
1046
- function defineKeyPropWarningGetter(props, displayName) {
1047
- var warnAboutAccessingKey = function () {
1048
- {
1049
- if (!specialPropKeyWarningShown) {
1050
- specialPropKeyWarningShown = true;
1051
-
1052
- 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);
1053
- }
1054
- }
1055
- };
1056
-
1057
- warnAboutAccessingKey.isReactWarning = true;
1058
- Object.defineProperty(props, 'key', {
1059
- get: warnAboutAccessingKey,
1060
- configurable: true
1061
- });
1062
- }
1063
-
1064
- function defineRefPropWarningGetter(props, displayName) {
1065
- var warnAboutAccessingRef = function () {
1066
- {
1067
- if (!specialPropRefWarningShown) {
1068
- specialPropRefWarningShown = true;
1069
-
1070
- 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);
1071
- }
1072
- }
1073
- };
1074
-
1075
- warnAboutAccessingRef.isReactWarning = true;
1076
- Object.defineProperty(props, 'ref', {
1077
- get: warnAboutAccessingRef,
1078
- configurable: true
1079
- });
1080
- }
1081
-
1082
- function warnIfStringRefCannotBeAutoConverted(config) {
1083
- {
1084
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
1085
- var componentName = getComponentName(ReactCurrentOwner.current.type);
1086
-
1087
- if (!didWarnAboutStringRefs[componentName]) {
1088
- error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
1089
-
1090
- didWarnAboutStringRefs[componentName] = true;
1091
- }
1092
- }
1093
- }
1094
- }
1095
- /**
1096
- * Factory method to create a new React element. This no longer adheres to
1097
- * the class pattern, so do not use new to call it. Also, instanceof check
1098
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
1099
- * if something is a React Element.
1100
- *
1101
- * @param {*} type
1102
- * @param {*} props
1103
- * @param {*} key
1104
- * @param {string|object} ref
1105
- * @param {*} owner
1106
- * @param {*} self A *temporary* helper to detect places where `this` is
1107
- * different from the `owner` when React.createElement is called, so that we
1108
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
1109
- * functions, and as long as `this` and owner are the same, there will be no
1110
- * change in behavior.
1111
- * @param {*} source An annotation object (added by a transpiler or otherwise)
1112
- * indicating filename, line number, and/or other information.
1113
- * @internal
1114
- */
1115
-
1116
-
1117
- var ReactElement = function (type, key, ref, self, source, owner, props) {
1118
- var element = {
1119
- // This tag allows us to uniquely identify this as a React Element
1120
- $$typeof: REACT_ELEMENT_TYPE,
1121
- // Built-in properties that belong on the element
1122
- type: type,
1123
- key: key,
1124
- ref: ref,
1125
- props: props,
1126
- // Record the component responsible for creating this element.
1127
- _owner: owner
1128
- };
1129
-
1130
- {
1131
- // The validation flag is currently mutative. We put it on
1132
- // an external backing store so that we can freeze the whole object.
1133
- // This can be replaced with a WeakMap once they are implemented in
1134
- // commonly used development environments.
1135
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
1136
- // the validation flag non-enumerable (where possible, which should
1137
- // include every environment we run tests in), so the test framework
1138
- // ignores it.
1139
-
1140
- Object.defineProperty(element._store, 'validated', {
1141
- configurable: false,
1142
- enumerable: false,
1143
- writable: true,
1144
- value: false
1145
- }); // self and source are DEV only properties.
1146
-
1147
- Object.defineProperty(element, '_self', {
1148
- configurable: false,
1149
- enumerable: false,
1150
- writable: false,
1151
- value: self
1152
- }); // Two elements created in two different places should be considered
1153
- // equal for testing purposes and therefore we hide it from enumeration.
1154
-
1155
- Object.defineProperty(element, '_source', {
1156
- configurable: false,
1157
- enumerable: false,
1158
- writable: false,
1159
- value: source
1160
- });
1161
-
1162
- if (Object.freeze) {
1163
- Object.freeze(element.props);
1164
- Object.freeze(element);
1165
- }
1166
- }
1167
-
1168
- return element;
1169
- };
1170
- /**
1171
- * Create and return a new ReactElement of the given type.
1172
- * See https://reactjs.org/docs/react-api.html#createelement
1173
- */
1174
-
1175
- function createElement(type, config, children) {
1176
- var propName; // Reserved names are extracted
1177
-
1178
- var props = {};
1179
- var key = null;
1180
- var ref = null;
1181
- var self = null;
1182
- var source = null;
1183
-
1184
- if (config != null) {
1185
- if (hasValidRef(config)) {
1186
- ref = config.ref;
1187
-
1188
- {
1189
- warnIfStringRefCannotBeAutoConverted(config);
1190
- }
1191
- }
1192
-
1193
- if (hasValidKey(config)) {
1194
- key = '' + config.key;
1195
- }
1196
-
1197
- self = config.__self === undefined ? null : config.__self;
1198
- source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
1199
-
1200
- for (propName in config) {
1201
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1202
- props[propName] = config[propName];
1203
- }
1204
- }
1205
- } // Children can be more than one argument, and those are transferred onto
1206
- // the newly allocated props object.
1207
-
1208
-
1209
- var childrenLength = arguments.length - 2;
1210
-
1211
- if (childrenLength === 1) {
1212
- props.children = children;
1213
- } else if (childrenLength > 1) {
1214
- var childArray = Array(childrenLength);
1215
-
1216
- for (var i = 0; i < childrenLength; i++) {
1217
- childArray[i] = arguments[i + 2];
1218
- }
1219
-
1220
- {
1221
- if (Object.freeze) {
1222
- Object.freeze(childArray);
1223
- }
1224
- }
1225
-
1226
- props.children = childArray;
1227
- } // Resolve default props
1228
-
1229
-
1230
- if (type && type.defaultProps) {
1231
- var defaultProps = type.defaultProps;
1232
-
1233
- for (propName in defaultProps) {
1234
- if (props[propName] === undefined) {
1235
- props[propName] = defaultProps[propName];
1236
- }
1237
- }
1238
- }
1239
-
1240
- {
1241
- if (key || ref) {
1242
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1243
-
1244
- if (key) {
1245
- defineKeyPropWarningGetter(props, displayName);
1246
- }
1247
-
1248
- if (ref) {
1249
- defineRefPropWarningGetter(props, displayName);
1250
- }
1251
- }
1252
- }
1253
-
1254
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1255
- }
1256
- function cloneAndReplaceKey(oldElement, newKey) {
1257
- var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
1258
- return newElement;
1259
- }
1260
- /**
1261
- * Clone and return a new ReactElement using element as the starting point.
1262
- * See https://reactjs.org/docs/react-api.html#cloneelement
1263
- */
1264
-
1265
- function cloneElement(element, config, children) {
1266
- if (!!(element === null || element === undefined)) {
1267
- {
1268
- throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
1269
- }
1270
- }
1271
-
1272
- var propName; // Original props are copied
1273
-
1274
- var props = _assign({}, element.props); // Reserved names are extracted
1275
-
1276
-
1277
- var key = element.key;
1278
- var ref = element.ref; // Self is preserved since the owner is preserved.
1279
-
1280
- var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
1281
- // transpiler, and the original source is probably a better indicator of the
1282
- // true owner.
1283
-
1284
- var source = element._source; // Owner will be preserved, unless ref is overridden
1285
-
1286
- var owner = element._owner;
1287
-
1288
- if (config != null) {
1289
- if (hasValidRef(config)) {
1290
- // Silently steal the ref from the parent.
1291
- ref = config.ref;
1292
- owner = ReactCurrentOwner.current;
1293
- }
1294
-
1295
- if (hasValidKey(config)) {
1296
- key = '' + config.key;
1297
- } // Remaining properties override existing props
1298
-
1299
-
1300
- var defaultProps;
1301
-
1302
- if (element.type && element.type.defaultProps) {
1303
- defaultProps = element.type.defaultProps;
1304
- }
1305
-
1306
- for (propName in config) {
1307
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1308
- if (config[propName] === undefined && defaultProps !== undefined) {
1309
- // Resolve default props
1310
- props[propName] = defaultProps[propName];
1311
- } else {
1312
- props[propName] = config[propName];
1313
- }
1314
- }
1315
- }
1316
- } // Children can be more than one argument, and those are transferred onto
1317
- // the newly allocated props object.
1318
-
1319
-
1320
- var childrenLength = arguments.length - 2;
1321
-
1322
- if (childrenLength === 1) {
1323
- props.children = children;
1324
- } else if (childrenLength > 1) {
1325
- var childArray = Array(childrenLength);
1326
-
1327
- for (var i = 0; i < childrenLength; i++) {
1328
- childArray[i] = arguments[i + 2];
1329
- }
1330
-
1331
- props.children = childArray;
1332
- }
1333
-
1334
- return ReactElement(element.type, key, ref, self, source, owner, props);
1335
- }
1336
- /**
1337
- * Verifies the object is a ReactElement.
1338
- * See https://reactjs.org/docs/react-api.html#isvalidelement
1339
- * @param {?object} object
1340
- * @return {boolean} True if `object` is a ReactElement.
1341
- * @final
1342
- */
1343
-
1344
- function isValidElement(object) {
1345
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1346
- }
1347
-
1348
- var SEPARATOR = '.';
1349
- var SUBSEPARATOR = ':';
1350
- /**
1351
- * Escape and wrap key so it is safe to use as a reactid
1352
- *
1353
- * @param {string} key to be escaped.
1354
- * @return {string} the escaped key.
1355
- */
1356
-
1357
- function escape(key) {
1358
- var escapeRegex = /[=:]/g;
1359
- var escaperLookup = {
1360
- '=': '=0',
1361
- ':': '=2'
1362
- };
1363
- var escapedString = key.replace(escapeRegex, function (match) {
1364
- return escaperLookup[match];
1365
- });
1366
- return '$' + escapedString;
1367
- }
1368
- /**
1369
- * TODO: Test that a single child and an array with one item have the same key
1370
- * pattern.
1371
- */
1372
-
1373
-
1374
- var didWarnAboutMaps = false;
1375
- var userProvidedKeyEscapeRegex = /\/+/g;
1376
-
1377
- function escapeUserProvidedKey(text) {
1378
- return text.replace(userProvidedKeyEscapeRegex, '$&/');
1379
- }
1380
- /**
1381
- * Generate a key string that identifies a element within a set.
1382
- *
1383
- * @param {*} element A element that could contain a manual key.
1384
- * @param {number} index Index that is used if a manual key is not provided.
1385
- * @return {string}
1386
- */
1387
-
1388
-
1389
- function getElementKey(element, index) {
1390
- // Do some typechecking here since we call this blindly. We want to ensure
1391
- // that we don't block potential future ES APIs.
1392
- if (typeof element === 'object' && element !== null && element.key != null) {
1393
- // Explicit key
1394
- return escape('' + element.key);
1395
- } // Implicit key determined by the index in the set
1396
-
1397
-
1398
- return index.toString(36);
1399
- }
1400
-
1401
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
1402
- var type = typeof children;
1403
-
1404
- if (type === 'undefined' || type === 'boolean') {
1405
- // All of the above are perceived as null.
1406
- children = null;
1407
- }
1408
-
1409
- var invokeCallback = false;
1410
-
1411
- if (children === null) {
1412
- invokeCallback = true;
1413
- } else {
1414
- switch (type) {
1415
- case 'string':
1416
- case 'number':
1417
- invokeCallback = true;
1418
- break;
1419
-
1420
- case 'object':
1421
- switch (children.$$typeof) {
1422
- case REACT_ELEMENT_TYPE:
1423
- case REACT_PORTAL_TYPE:
1424
- invokeCallback = true;
1425
- }
1426
-
1427
- }
1428
- }
1429
-
1430
- if (invokeCallback) {
1431
- var _child = children;
1432
- var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
1433
- // so that it's consistent if the number of children grows:
1434
-
1435
- var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
1436
-
1437
- if (Array.isArray(mappedChild)) {
1438
- var escapedChildKey = '';
1439
-
1440
- if (childKey != null) {
1441
- escapedChildKey = escapeUserProvidedKey(childKey) + '/';
1442
- }
1443
-
1444
- mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
1445
- return c;
1446
- });
1447
- } else if (mappedChild != null) {
1448
- if (isValidElement(mappedChild)) {
1449
- mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
1450
- // traverseAllChildren used to do for objects as children
1451
- escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
1452
- mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
1453
- escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
1454
- }
1455
-
1456
- array.push(mappedChild);
1457
- }
1458
-
1459
- return 1;
1460
- }
1461
-
1462
- var child;
1463
- var nextName;
1464
- var subtreeCount = 0; // Count of children found in the current subtree.
1465
-
1466
- var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1467
-
1468
- if (Array.isArray(children)) {
1469
- for (var i = 0; i < children.length; i++) {
1470
- child = children[i];
1471
- nextName = nextNamePrefix + getElementKey(child, i);
1472
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1473
- }
1474
- } else {
1475
- var iteratorFn = getIteratorFn(children);
1476
-
1477
- if (typeof iteratorFn === 'function') {
1478
- var iterableChildren = children;
1479
-
1480
- {
1481
- // Warn about using Maps as children
1482
- if (iteratorFn === iterableChildren.entries) {
1483
- if (!didWarnAboutMaps) {
1484
- warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
1485
- }
1486
-
1487
- didWarnAboutMaps = true;
1488
- }
1489
- }
1490
-
1491
- var iterator = iteratorFn.call(iterableChildren);
1492
- var step;
1493
- var ii = 0;
1494
-
1495
- while (!(step = iterator.next()).done) {
1496
- child = step.value;
1497
- nextName = nextNamePrefix + getElementKey(child, ii++);
1498
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1499
- }
1500
- } else if (type === 'object') {
1501
- var childrenString = '' + children;
1502
-
1503
- {
1504
- {
1505
- throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead." );
1506
- }
1507
- }
1508
- }
1509
- }
1510
-
1511
- return subtreeCount;
1512
- }
1513
-
1514
- /**
1515
- * Maps children that are typically specified as `props.children`.
1516
- *
1517
- * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1518
- *
1519
- * The provided mapFunction(child, index) will be called for each
1520
- * leaf child.
1521
- *
1522
- * @param {?*} children Children tree container.
1523
- * @param {function(*, int)} func The map function.
1524
- * @param {*} context Context for mapFunction.
1525
- * @return {object} Object containing the ordered map of results.
1526
- */
1527
- function mapChildren(children, func, context) {
1528
- if (children == null) {
1529
- return children;
1530
- }
1531
-
1532
- var result = [];
1533
- var count = 0;
1534
- mapIntoArray(children, result, '', '', function (child) {
1535
- return func.call(context, child, count++);
1536
- });
1537
- return result;
1538
- }
1539
- /**
1540
- * Count the number of children that are typically specified as
1541
- * `props.children`.
1542
- *
1543
- * See https://reactjs.org/docs/react-api.html#reactchildrencount
1544
- *
1545
- * @param {?*} children Children tree container.
1546
- * @return {number} The number of children.
1547
- */
1548
-
1549
-
1550
- function countChildren(children) {
1551
- var n = 0;
1552
- mapChildren(children, function () {
1553
- n++; // Don't return anything
1554
- });
1555
- return n;
1556
- }
1557
-
1558
- /**
1559
- * Iterates through children that are typically specified as `props.children`.
1560
- *
1561
- * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1562
- *
1563
- * The provided forEachFunc(child, index) will be called for each
1564
- * leaf child.
1565
- *
1566
- * @param {?*} children Children tree container.
1567
- * @param {function(*, int)} forEachFunc
1568
- * @param {*} forEachContext Context for forEachContext.
1569
- */
1570
- function forEachChildren(children, forEachFunc, forEachContext) {
1571
- mapChildren(children, function () {
1572
- forEachFunc.apply(this, arguments); // Don't return anything.
1573
- }, forEachContext);
1574
- }
1575
- /**
1576
- * Flatten a children object (typically specified as `props.children`) and
1577
- * return an array with appropriately re-keyed children.
1578
- *
1579
- * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1580
- */
1581
-
1582
-
1583
- function toArray(children) {
1584
- return mapChildren(children, function (child) {
1585
- return child;
1586
- }) || [];
1587
- }
1588
- /**
1589
- * Returns the first child in a collection of children and verifies that there
1590
- * is only one child in the collection.
1591
- *
1592
- * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1593
- *
1594
- * The current implementation of this function assumes that a single child gets
1595
- * passed without a wrapper, but the purpose of this helper function is to
1596
- * abstract away the particular structure of children.
1597
- *
1598
- * @param {?object} children Child collection structure.
1599
- * @return {ReactElement} The first and only `ReactElement` contained in the
1600
- * structure.
1601
- */
1602
-
1603
-
1604
- function onlyChild(children) {
1605
- if (!isValidElement(children)) {
1606
- {
1607
- throw Error( "React.Children.only expected to receive a single React element child." );
1608
- }
1609
- }
1610
-
1611
- return children;
1612
- }
1613
-
1614
- function createContext(defaultValue, calculateChangedBits) {
1615
- if (calculateChangedBits === undefined) {
1616
- calculateChangedBits = null;
1617
- } else {
1618
- {
1619
- if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
1620
- error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
1621
- }
1622
- }
1623
- }
1624
-
1625
- var context = {
1626
- $$typeof: REACT_CONTEXT_TYPE,
1627
- _calculateChangedBits: calculateChangedBits,
1628
- // As a workaround to support multiple concurrent renderers, we categorize
1629
- // some renderers as primary and others as secondary. We only expect
1630
- // there to be two concurrent renderers at most: React Native (primary) and
1631
- // Fabric (secondary); React DOM (primary) and React ART (secondary).
1632
- // Secondary renderers store their context values on separate fields.
1633
- _currentValue: defaultValue,
1634
- _currentValue2: defaultValue,
1635
- // Used to track how many concurrent renderers this context currently
1636
- // supports within in a single renderer. Such as parallel server rendering.
1637
- _threadCount: 0,
1638
- // These are circular
1639
- Provider: null,
1640
- Consumer: null
1641
- };
1642
- context.Provider = {
1643
- $$typeof: REACT_PROVIDER_TYPE,
1644
- _context: context
1645
- };
1646
- var hasWarnedAboutUsingNestedContextConsumers = false;
1647
- var hasWarnedAboutUsingConsumerProvider = false;
1648
- var hasWarnedAboutDisplayNameOnConsumer = false;
1649
-
1650
- {
1651
- // A separate object, but proxies back to the original context object for
1652
- // backwards compatibility. It has a different $$typeof, so we can properly
1653
- // warn for the incorrect usage of Context as a Consumer.
1654
- var Consumer = {
1655
- $$typeof: REACT_CONTEXT_TYPE,
1656
- _context: context,
1657
- _calculateChangedBits: context._calculateChangedBits
1658
- }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1659
-
1660
- Object.defineProperties(Consumer, {
1661
- Provider: {
1662
- get: function () {
1663
- if (!hasWarnedAboutUsingConsumerProvider) {
1664
- hasWarnedAboutUsingConsumerProvider = true;
1665
-
1666
- error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
1667
- }
1668
-
1669
- return context.Provider;
1670
- },
1671
- set: function (_Provider) {
1672
- context.Provider = _Provider;
1673
- }
1674
- },
1675
- _currentValue: {
1676
- get: function () {
1677
- return context._currentValue;
1678
- },
1679
- set: function (_currentValue) {
1680
- context._currentValue = _currentValue;
1681
- }
1682
- },
1683
- _currentValue2: {
1684
- get: function () {
1685
- return context._currentValue2;
1686
- },
1687
- set: function (_currentValue2) {
1688
- context._currentValue2 = _currentValue2;
1689
- }
1690
- },
1691
- _threadCount: {
1692
- get: function () {
1693
- return context._threadCount;
1694
- },
1695
- set: function (_threadCount) {
1696
- context._threadCount = _threadCount;
1697
- }
1698
- },
1699
- Consumer: {
1700
- get: function () {
1701
- if (!hasWarnedAboutUsingNestedContextConsumers) {
1702
- hasWarnedAboutUsingNestedContextConsumers = true;
1703
-
1704
- error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
1705
- }
1706
-
1707
- return context.Consumer;
1708
- }
1709
- },
1710
- displayName: {
1711
- get: function () {
1712
- return context.displayName;
1713
- },
1714
- set: function (displayName) {
1715
- if (!hasWarnedAboutDisplayNameOnConsumer) {
1716
- warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
1717
-
1718
- hasWarnedAboutDisplayNameOnConsumer = true;
1719
- }
1720
- }
1721
- }
1722
- }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1723
-
1724
- context.Consumer = Consumer;
1725
- }
1726
-
1727
- {
1728
- context._currentRenderer = null;
1729
- context._currentRenderer2 = null;
1730
- }
1731
-
1732
- return context;
1733
- }
1734
-
1735
- var Uninitialized = -1;
1736
- var Pending = 0;
1737
- var Resolved = 1;
1738
- var Rejected = 2;
1739
-
1740
- function lazyInitializer(payload) {
1741
- if (payload._status === Uninitialized) {
1742
- var ctor = payload._result;
1743
- var thenable = ctor(); // Transition to the next state.
1744
-
1745
- var pending = payload;
1746
- pending._status = Pending;
1747
- pending._result = thenable;
1748
- thenable.then(function (moduleObject) {
1749
- if (payload._status === Pending) {
1750
- var defaultExport = moduleObject.default;
1751
-
1752
- {
1753
- if (defaultExport === undefined) {
1754
- error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
1755
- 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
1756
- }
1757
- } // Transition to the next state.
1758
-
1759
-
1760
- var resolved = payload;
1761
- resolved._status = Resolved;
1762
- resolved._result = defaultExport;
1763
- }
1764
- }, function (error) {
1765
- if (payload._status === Pending) {
1766
- // Transition to the next state.
1767
- var rejected = payload;
1768
- rejected._status = Rejected;
1769
- rejected._result = error;
1770
- }
1771
- });
1772
- }
1773
-
1774
- if (payload._status === Resolved) {
1775
- return payload._result;
1776
- } else {
1777
- throw payload._result;
1778
- }
1779
- }
1780
-
1781
- function lazy(ctor) {
1782
- var payload = {
1783
- // We use these fields to store the result.
1784
- _status: -1,
1785
- _result: ctor
1786
- };
1787
- var lazyType = {
1788
- $$typeof: REACT_LAZY_TYPE,
1789
- _payload: payload,
1790
- _init: lazyInitializer
1791
- };
1792
-
1793
- {
1794
- // In production, this would just set it on the object.
1795
- var defaultProps;
1796
- var propTypes; // $FlowFixMe
1797
-
1798
- Object.defineProperties(lazyType, {
1799
- defaultProps: {
1800
- configurable: true,
1801
- get: function () {
1802
- return defaultProps;
1803
- },
1804
- set: function (newDefaultProps) {
1805
- error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1806
-
1807
- defaultProps = newDefaultProps; // Match production behavior more closely:
1808
- // $FlowFixMe
1809
-
1810
- Object.defineProperty(lazyType, 'defaultProps', {
1811
- enumerable: true
1812
- });
1813
- }
1814
- },
1815
- propTypes: {
1816
- configurable: true,
1817
- get: function () {
1818
- return propTypes;
1819
- },
1820
- set: function (newPropTypes) {
1821
- error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1822
-
1823
- propTypes = newPropTypes; // Match production behavior more closely:
1824
- // $FlowFixMe
1825
-
1826
- Object.defineProperty(lazyType, 'propTypes', {
1827
- enumerable: true
1828
- });
1829
- }
1830
- }
1831
- });
1832
- }
1833
-
1834
- return lazyType;
1835
- }
1836
-
1837
- function forwardRef(render) {
1838
- {
1839
- if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1840
- error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1841
- } else if (typeof render !== 'function') {
1842
- error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1843
- } else {
1844
- if (render.length !== 0 && render.length !== 2) {
1845
- error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
1846
- }
1847
- }
1848
-
1849
- if (render != null) {
1850
- if (render.defaultProps != null || render.propTypes != null) {
1851
- error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
1852
- }
1853
- }
1854
- }
1855
-
1856
- var elementType = {
1857
- $$typeof: REACT_FORWARD_REF_TYPE,
1858
- render: render
1859
- };
1860
-
1861
- {
1862
- var ownName;
1863
- Object.defineProperty(elementType, 'displayName', {
1864
- enumerable: false,
1865
- configurable: true,
1866
- get: function () {
1867
- return ownName;
1868
- },
1869
- set: function (name) {
1870
- ownName = name;
1871
-
1872
- if (render.displayName == null) {
1873
- render.displayName = name;
1874
- }
1875
- }
1876
- });
1877
- }
1878
-
1879
- return elementType;
1880
- }
1881
-
1882
- // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1883
-
1884
- var enableScopeAPI = false; // Experimental Create Event Handle API.
1885
-
1886
- function isValidElementType(type) {
1887
- if (typeof type === 'string' || typeof type === 'function') {
1888
- return true;
1889
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1890
-
1891
-
1892
- if (type === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
1893
- return true;
1894
- }
1895
-
1896
- if (typeof type === 'object' && type !== null) {
1897
- 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 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
1898
- return true;
1899
- }
1900
- }
1901
-
1902
- return false;
1903
- }
1904
-
1905
- function memo(type, compare) {
1906
- {
1907
- if (!isValidElementType(type)) {
1908
- error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1909
- }
1910
- }
1911
-
1912
- var elementType = {
1913
- $$typeof: REACT_MEMO_TYPE,
1914
- type: type,
1915
- compare: compare === undefined ? null : compare
1916
- };
1917
-
1918
- {
1919
- var ownName;
1920
- Object.defineProperty(elementType, 'displayName', {
1921
- enumerable: false,
1922
- configurable: true,
1923
- get: function () {
1924
- return ownName;
1925
- },
1926
- set: function (name) {
1927
- ownName = name;
1928
-
1929
- if (type.displayName == null) {
1930
- type.displayName = name;
1931
- }
1932
- }
1933
- });
1934
- }
1935
-
1936
- return elementType;
1937
- }
1938
-
1939
- function resolveDispatcher() {
1940
- var dispatcher = ReactCurrentDispatcher.current;
1941
-
1942
- if (!(dispatcher !== null)) {
1943
- {
1944
- throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." );
1945
- }
1946
- }
1947
-
1948
- return dispatcher;
1949
- }
1950
-
1951
- function useContext(Context, unstable_observedBits) {
1952
- var dispatcher = resolveDispatcher();
1953
-
1954
- {
1955
- if (unstable_observedBits !== undefined) {
1956
- error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://reactjs.org/link/rules-of-hooks' : '');
1957
- } // TODO: add a more generic warning for invalid values.
1958
-
1959
-
1960
- if (Context._context !== undefined) {
1961
- var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
1962
- // and nobody should be using this in existing code.
1963
-
1964
- if (realContext.Consumer === Context) {
1965
- error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
1966
- } else if (realContext.Provider === Context) {
1967
- error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1968
- }
1969
- }
1970
- }
1971
-
1972
- return dispatcher.useContext(Context, unstable_observedBits);
1973
- }
1974
- function useState(initialState) {
1975
- var dispatcher = resolveDispatcher();
1976
- return dispatcher.useState(initialState);
1977
- }
1978
- function useReducer(reducer, initialArg, init) {
1979
- var dispatcher = resolveDispatcher();
1980
- return dispatcher.useReducer(reducer, initialArg, init);
1981
- }
1982
- function useRef(initialValue) {
1983
- var dispatcher = resolveDispatcher();
1984
- return dispatcher.useRef(initialValue);
1985
- }
1986
- function useEffect(create, deps) {
1987
- var dispatcher = resolveDispatcher();
1988
- return dispatcher.useEffect(create, deps);
1989
- }
1990
- function useLayoutEffect(create, deps) {
1991
- var dispatcher = resolveDispatcher();
1992
- return dispatcher.useLayoutEffect(create, deps);
1993
- }
1994
- function useCallback(callback, deps) {
1995
- var dispatcher = resolveDispatcher();
1996
- return dispatcher.useCallback(callback, deps);
1997
- }
1998
- function useMemo(create, deps) {
1999
- var dispatcher = resolveDispatcher();
2000
- return dispatcher.useMemo(create, deps);
2001
- }
2002
- function useImperativeHandle(ref, create, deps) {
2003
- var dispatcher = resolveDispatcher();
2004
- return dispatcher.useImperativeHandle(ref, create, deps);
2005
- }
2006
- function useDebugValue(value, formatterFn) {
2007
- {
2008
- var dispatcher = resolveDispatcher();
2009
- return dispatcher.useDebugValue(value, formatterFn);
2010
- }
2011
- }
2012
-
2013
- // Helpers to patch console.logs to avoid logging during side-effect free
2014
- // replaying on render function. This currently only patches the object
2015
- // lazily which won't cover if the log function was extracted eagerly.
2016
- // We could also eagerly patch the method.
2017
- var disabledDepth = 0;
2018
- var prevLog;
2019
- var prevInfo;
2020
- var prevWarn;
2021
- var prevError;
2022
- var prevGroup;
2023
- var prevGroupCollapsed;
2024
- var prevGroupEnd;
2025
-
2026
- function disabledLog() {}
2027
-
2028
- disabledLog.__reactDisabledLog = true;
2029
- function disableLogs() {
2030
- {
2031
- if (disabledDepth === 0) {
2032
- /* eslint-disable react-internal/no-production-logging */
2033
- prevLog = console.log;
2034
- prevInfo = console.info;
2035
- prevWarn = console.warn;
2036
- prevError = console.error;
2037
- prevGroup = console.group;
2038
- prevGroupCollapsed = console.groupCollapsed;
2039
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
2040
-
2041
- var props = {
2042
- configurable: true,
2043
- enumerable: true,
2044
- value: disabledLog,
2045
- writable: true
2046
- }; // $FlowFixMe Flow thinks console is immutable.
2047
-
2048
- Object.defineProperties(console, {
2049
- info: props,
2050
- log: props,
2051
- warn: props,
2052
- error: props,
2053
- group: props,
2054
- groupCollapsed: props,
2055
- groupEnd: props
2056
- });
2057
- /* eslint-enable react-internal/no-production-logging */
2058
- }
2059
-
2060
- disabledDepth++;
2061
- }
2062
- }
2063
- function reenableLogs() {
2064
- {
2065
- disabledDepth--;
2066
-
2067
- if (disabledDepth === 0) {
2068
- /* eslint-disable react-internal/no-production-logging */
2069
- var props = {
2070
- configurable: true,
2071
- enumerable: true,
2072
- writable: true
2073
- }; // $FlowFixMe Flow thinks console is immutable.
2074
-
2075
- Object.defineProperties(console, {
2076
- log: _assign({}, props, {
2077
- value: prevLog
2078
- }),
2079
- info: _assign({}, props, {
2080
- value: prevInfo
2081
- }),
2082
- warn: _assign({}, props, {
2083
- value: prevWarn
2084
- }),
2085
- error: _assign({}, props, {
2086
- value: prevError
2087
- }),
2088
- group: _assign({}, props, {
2089
- value: prevGroup
2090
- }),
2091
- groupCollapsed: _assign({}, props, {
2092
- value: prevGroupCollapsed
2093
- }),
2094
- groupEnd: _assign({}, props, {
2095
- value: prevGroupEnd
2096
- })
2097
- });
2098
- /* eslint-enable react-internal/no-production-logging */
2099
- }
2100
-
2101
- if (disabledDepth < 0) {
2102
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
2103
- }
2104
- }
2105
- }
2106
-
2107
- var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
2108
- var prefix;
2109
- function describeBuiltInComponentFrame(name, source, ownerFn) {
2110
- {
2111
- if (prefix === undefined) {
2112
- // Extract the VM specific prefix used by each line.
2113
- try {
2114
- throw Error();
2115
- } catch (x) {
2116
- var match = x.stack.trim().match(/\n( *(at )?)/);
2117
- prefix = match && match[1] || '';
2118
- }
2119
- } // We use the prefix to ensure our stacks line up with native stack frames.
2120
-
2121
-
2122
- return '\n' + prefix + name;
2123
- }
2124
- }
2125
- var reentry = false;
2126
- var componentFrameCache;
2127
-
2128
- {
2129
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
2130
- componentFrameCache = new PossiblyWeakMap();
2131
- }
2132
-
2133
- function describeNativeComponentFrame(fn, construct) {
2134
- // If something asked for a stack inside a fake render, it should get ignored.
2135
- if (!fn || reentry) {
2136
- return '';
2137
- }
2138
-
2139
- {
2140
- var frame = componentFrameCache.get(fn);
2141
-
2142
- if (frame !== undefined) {
2143
- return frame;
2144
- }
2145
- }
2146
-
2147
- var control;
2148
- reentry = true;
2149
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
2150
-
2151
- Error.prepareStackTrace = undefined;
2152
- var previousDispatcher;
2153
-
2154
- {
2155
- previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
2156
- // for warnings.
2157
-
2158
- ReactCurrentDispatcher$1.current = null;
2159
- disableLogs();
2160
- }
2161
-
2162
- try {
2163
- // This should throw.
2164
- if (construct) {
2165
- // Something should be setting the props in the constructor.
2166
- var Fake = function () {
2167
- throw Error();
2168
- }; // $FlowFixMe
2169
-
2170
-
2171
- Object.defineProperty(Fake.prototype, 'props', {
2172
- set: function () {
2173
- // We use a throwing setter instead of frozen or non-writable props
2174
- // because that won't throw in a non-strict mode function.
2175
- throw Error();
2176
- }
2177
- });
2178
-
2179
- if (typeof Reflect === 'object' && Reflect.construct) {
2180
- // We construct a different control for this case to include any extra
2181
- // frames added by the construct call.
2182
- try {
2183
- Reflect.construct(Fake, []);
2184
- } catch (x) {
2185
- control = x;
2186
- }
2187
-
2188
- Reflect.construct(fn, [], Fake);
2189
- } else {
2190
- try {
2191
- Fake.call();
2192
- } catch (x) {
2193
- control = x;
2194
- }
2195
-
2196
- fn.call(Fake.prototype);
2197
- }
2198
- } else {
2199
- try {
2200
- throw Error();
2201
- } catch (x) {
2202
- control = x;
2203
- }
2204
-
2205
- fn();
2206
- }
2207
- } catch (sample) {
2208
- // This is inlined manually because closure doesn't do it for us.
2209
- if (sample && control && typeof sample.stack === 'string') {
2210
- // This extracts the first frame from the sample that isn't also in the control.
2211
- // Skipping one frame that we assume is the frame that calls the two.
2212
- var sampleLines = sample.stack.split('\n');
2213
- var controlLines = control.stack.split('\n');
2214
- var s = sampleLines.length - 1;
2215
- var c = controlLines.length - 1;
2216
-
2217
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
2218
- // We expect at least one stack frame to be shared.
2219
- // Typically this will be the root most one. However, stack frames may be
2220
- // cut off due to maximum stack limits. In this case, one maybe cut off
2221
- // earlier than the other. We assume that the sample is longer or the same
2222
- // and there for cut off earlier. So we should find the root most frame in
2223
- // the sample somewhere in the control.
2224
- c--;
2225
- }
2226
-
2227
- for (; s >= 1 && c >= 0; s--, c--) {
2228
- // Next we find the first one that isn't the same which should be the
2229
- // frame that called our sample function and the control.
2230
- if (sampleLines[s] !== controlLines[c]) {
2231
- // In V8, the first line is describing the message but other VMs don't.
2232
- // If we're about to return the first line, and the control is also on the same
2233
- // line, that's a pretty good indicator that our sample threw at same line as
2234
- // the control. I.e. before we entered the sample frame. So we ignore this result.
2235
- // This can happen if you passed a class to function component, or non-function.
2236
- if (s !== 1 || c !== 1) {
2237
- do {
2238
- s--;
2239
- c--; // We may still have similar intermediate frames from the construct call.
2240
- // The next one that isn't the same should be our match though.
2241
-
2242
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
2243
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
2244
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
2245
-
2246
- {
2247
- if (typeof fn === 'function') {
2248
- componentFrameCache.set(fn, _frame);
2249
- }
2250
- } // Return the line we found.
2251
-
2252
-
2253
- return _frame;
2254
- }
2255
- } while (s >= 1 && c >= 0);
2256
- }
2257
-
2258
- break;
2259
- }
2260
- }
2261
- }
2262
- } finally {
2263
- reentry = false;
2264
-
2265
- {
2266
- ReactCurrentDispatcher$1.current = previousDispatcher;
2267
- reenableLogs();
2268
- }
2269
-
2270
- Error.prepareStackTrace = previousPrepareStackTrace;
2271
- } // Fallback to just using the name if we couldn't make it throw.
2272
-
2273
-
2274
- var name = fn ? fn.displayName || fn.name : '';
2275
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
2276
-
2277
- {
2278
- if (typeof fn === 'function') {
2279
- componentFrameCache.set(fn, syntheticFrame);
2280
- }
2281
- }
2282
-
2283
- return syntheticFrame;
2284
- }
2285
- function describeFunctionComponentFrame(fn, source, ownerFn) {
2286
- {
2287
- return describeNativeComponentFrame(fn, false);
2288
- }
2289
- }
2290
-
2291
- function shouldConstruct(Component) {
2292
- var prototype = Component.prototype;
2293
- return !!(prototype && prototype.isReactComponent);
2294
- }
2295
-
2296
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
2297
-
2298
- if (type == null) {
2299
- return '';
2300
- }
2301
-
2302
- if (typeof type === 'function') {
2303
- {
2304
- return describeNativeComponentFrame(type, shouldConstruct(type));
2305
- }
2306
- }
2307
-
2308
- if (typeof type === 'string') {
2309
- return describeBuiltInComponentFrame(type);
2310
- }
2311
-
2312
- switch (type) {
2313
- case exports.Suspense:
2314
- return describeBuiltInComponentFrame('Suspense');
2315
-
2316
- case REACT_SUSPENSE_LIST_TYPE:
2317
- return describeBuiltInComponentFrame('SuspenseList');
2318
- }
2319
-
2320
- if (typeof type === 'object') {
2321
- switch (type.$$typeof) {
2322
- case REACT_FORWARD_REF_TYPE:
2323
- return describeFunctionComponentFrame(type.render);
2324
-
2325
- case REACT_MEMO_TYPE:
2326
- // Memo may contain any component type so we recursively resolve it.
2327
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
2328
-
2329
- case REACT_BLOCK_TYPE:
2330
- return describeFunctionComponentFrame(type._render);
2331
-
2332
- case REACT_LAZY_TYPE:
2333
- {
2334
- var lazyComponent = type;
2335
- var payload = lazyComponent._payload;
2336
- var init = lazyComponent._init;
2337
-
2338
- try {
2339
- // Lazy may contain any component type so we recursively resolve it.
2340
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
2341
- } catch (x) {}
2342
- }
2343
- }
2344
- }
2345
-
2346
- return '';
2347
- }
2348
-
2349
- var loggedTypeFailures = {};
2350
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
2351
-
2352
- function setCurrentlyValidatingElement(element) {
2353
- {
2354
- if (element) {
2355
- var owner = element._owner;
2356
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2357
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
2358
- } else {
2359
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
2360
- }
2361
- }
2362
- }
2363
-
2364
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
2365
- {
2366
- // $FlowFixMe This is okay but Flow doesn't know it.
2367
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
2368
-
2369
- for (var typeSpecName in typeSpecs) {
2370
- if (has(typeSpecs, typeSpecName)) {
2371
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
2372
- // fail the render phase where it didn't fail before. So we log it.
2373
- // After these have been cleaned up, we'll let them throw.
2374
-
2375
- try {
2376
- // This is intentionally an invariant that gets caught. It's the same
2377
- // behavior as without this statement except with a better message.
2378
- if (typeof typeSpecs[typeSpecName] !== 'function') {
2379
- 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`.');
2380
- err.name = 'Invariant Violation';
2381
- throw err;
2382
- }
2383
-
2384
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
2385
- } catch (ex) {
2386
- error$1 = ex;
2387
- }
2388
-
2389
- if (error$1 && !(error$1 instanceof Error)) {
2390
- setCurrentlyValidatingElement(element);
2391
-
2392
- 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);
2393
-
2394
- setCurrentlyValidatingElement(null);
2395
- }
2396
-
2397
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
2398
- // Only monitor this failure once because there tends to be a lot of the
2399
- // same error.
2400
- loggedTypeFailures[error$1.message] = true;
2401
- setCurrentlyValidatingElement(element);
2402
-
2403
- error('Failed %s type: %s', location, error$1.message);
2404
-
2405
- setCurrentlyValidatingElement(null);
2406
- }
2407
- }
2408
- }
2409
- }
2410
- }
2411
-
2412
- function setCurrentlyValidatingElement$1(element) {
2413
- {
2414
- if (element) {
2415
- var owner = element._owner;
2416
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2417
- setExtraStackFrame(stack);
2418
- } else {
2419
- setExtraStackFrame(null);
2420
- }
2421
- }
2422
- }
2423
-
2424
- var propTypesMisspellWarningShown;
2425
-
2426
- {
2427
- propTypesMisspellWarningShown = false;
2428
- }
2429
-
2430
- function getDeclarationErrorAddendum() {
2431
- if (ReactCurrentOwner.current) {
2432
- var name = getComponentName(ReactCurrentOwner.current.type);
2433
-
2434
- if (name) {
2435
- return '\n\nCheck the render method of `' + name + '`.';
2436
- }
2437
- }
2438
-
2439
- return '';
2440
- }
2441
-
2442
- function getSourceInfoErrorAddendum(source) {
2443
- if (source !== undefined) {
2444
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
2445
- var lineNumber = source.lineNumber;
2446
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
2447
- }
2448
-
2449
- return '';
2450
- }
2451
-
2452
- function getSourceInfoErrorAddendumForProps(elementProps) {
2453
- if (elementProps !== null && elementProps !== undefined) {
2454
- return getSourceInfoErrorAddendum(elementProps.__source);
2455
- }
2456
-
2457
- return '';
2458
- }
2459
- /**
2460
- * Warn if there's no key explicitly set on dynamic arrays of children or
2461
- * object keys are not valid. This allows us to keep track of children between
2462
- * updates.
2463
- */
2464
-
2465
-
2466
- var ownerHasKeyUseWarning = {};
2467
-
2468
- function getCurrentComponentErrorInfo(parentType) {
2469
- var info = getDeclarationErrorAddendum();
2470
-
2471
- if (!info) {
2472
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
2473
-
2474
- if (parentName) {
2475
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
2476
- }
2477
- }
2478
-
2479
- return info;
2480
- }
2481
- /**
2482
- * Warn if the element doesn't have an explicit key assigned to it.
2483
- * This element is in an array. The array could grow and shrink or be
2484
- * reordered. All children that haven't already been validated are required to
2485
- * have a "key" property assigned to it. Error statuses are cached so a warning
2486
- * will only be shown once.
2487
- *
2488
- * @internal
2489
- * @param {ReactElement} element Element that requires a key.
2490
- * @param {*} parentType element's parent's type.
2491
- */
2492
-
2493
-
2494
- function validateExplicitKey(element, parentType) {
2495
- if (!element._store || element._store.validated || element.key != null) {
2496
- return;
2497
- }
2498
-
2499
- element._store.validated = true;
2500
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2501
-
2502
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2503
- return;
2504
- }
2505
-
2506
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
2507
- // property, it may be the creator of the child that's responsible for
2508
- // assigning it a key.
2509
-
2510
- var childOwner = '';
2511
-
2512
- if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
2513
- // Give the component that originally created this child.
2514
- childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
2515
- }
2516
-
2517
- {
2518
- setCurrentlyValidatingElement$1(element);
2519
-
2520
- 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);
2521
-
2522
- setCurrentlyValidatingElement$1(null);
2523
- }
2524
- }
2525
- /**
2526
- * Ensure that every element either is passed in a static location, in an
2527
- * array with an explicit keys property defined, or in an object literal
2528
- * with valid key property.
2529
- *
2530
- * @internal
2531
- * @param {ReactNode} node Statically passed child of any type.
2532
- * @param {*} parentType node's parent's type.
2533
- */
2534
-
2535
-
2536
- function validateChildKeys(node, parentType) {
2537
- if (typeof node !== 'object') {
2538
- return;
2539
- }
2540
-
2541
- if (Array.isArray(node)) {
2542
- for (var i = 0; i < node.length; i++) {
2543
- var child = node[i];
2544
-
2545
- if (isValidElement(child)) {
2546
- validateExplicitKey(child, parentType);
2547
- }
2548
- }
2549
- } else if (isValidElement(node)) {
2550
- // This element was passed in a valid location.
2551
- if (node._store) {
2552
- node._store.validated = true;
2553
- }
2554
- } else if (node) {
2555
- var iteratorFn = getIteratorFn(node);
2556
-
2557
- if (typeof iteratorFn === 'function') {
2558
- // Entry iterators used to provide implicit keys,
2559
- // but now we print a separate warning for them later.
2560
- if (iteratorFn !== node.entries) {
2561
- var iterator = iteratorFn.call(node);
2562
- var step;
2563
-
2564
- while (!(step = iterator.next()).done) {
2565
- if (isValidElement(step.value)) {
2566
- validateExplicitKey(step.value, parentType);
2567
- }
2568
- }
2569
- }
2570
- }
2571
- }
2572
- }
2573
- /**
2574
- * Given an element, validate that its props follow the propTypes definition,
2575
- * provided by the type.
2576
- *
2577
- * @param {ReactElement} element
2578
- */
2579
-
2580
-
2581
- function validatePropTypes(element) {
2582
- {
2583
- var type = element.type;
2584
-
2585
- if (type === null || type === undefined || typeof type === 'string') {
2586
- return;
2587
- }
2588
-
2589
- var propTypes;
2590
-
2591
- if (typeof type === 'function') {
2592
- propTypes = type.propTypes;
2593
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2594
- // Inner props are checked in the reconciler.
2595
- type.$$typeof === REACT_MEMO_TYPE)) {
2596
- propTypes = type.propTypes;
2597
- } else {
2598
- return;
2599
- }
2600
-
2601
- if (propTypes) {
2602
- // Intentionally inside to avoid triggering lazy initializers:
2603
- var name = getComponentName(type);
2604
- checkPropTypes(propTypes, element.props, 'prop', name, element);
2605
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2606
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
2607
-
2608
- var _name = getComponentName(type);
2609
-
2610
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
2611
- }
2612
-
2613
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
2614
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
2615
- }
2616
- }
2617
- }
2618
- /**
2619
- * Given a fragment, validate that it can only be provided with fragment props
2620
- * @param {ReactElement} fragment
2621
- */
2622
-
2623
-
2624
- function validateFragmentProps(fragment) {
2625
- {
2626
- var keys = Object.keys(fragment.props);
2627
-
2628
- for (var i = 0; i < keys.length; i++) {
2629
- var key = keys[i];
2630
-
2631
- if (key !== 'children' && key !== 'key') {
2632
- setCurrentlyValidatingElement$1(fragment);
2633
-
2634
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2635
-
2636
- setCurrentlyValidatingElement$1(null);
2637
- break;
2638
- }
2639
- }
2640
-
2641
- if (fragment.ref !== null) {
2642
- setCurrentlyValidatingElement$1(fragment);
2643
-
2644
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
2645
-
2646
- setCurrentlyValidatingElement$1(null);
2647
- }
2648
- }
2649
- }
2650
- function createElementWithValidation(type, props, children) {
2651
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2652
- // succeed and there will likely be errors in render.
2653
-
2654
- if (!validType) {
2655
- var info = '';
2656
-
2657
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2658
- 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.";
2659
- }
2660
-
2661
- var sourceInfo = getSourceInfoErrorAddendumForProps(props);
2662
-
2663
- if (sourceInfo) {
2664
- info += sourceInfo;
2665
- } else {
2666
- info += getDeclarationErrorAddendum();
2667
- }
2668
-
2669
- var typeString;
2670
-
2671
- if (type === null) {
2672
- typeString = 'null';
2673
- } else if (Array.isArray(type)) {
2674
- typeString = 'array';
2675
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2676
- typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
2677
- info = ' Did you accidentally export a JSX literal instead of a component?';
2678
- } else {
2679
- typeString = typeof type;
2680
- }
2681
-
2682
- {
2683
- error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
2684
- }
2685
- }
2686
-
2687
- var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
2688
- // TODO: Drop this when these are no longer allowed as the type argument.
2689
-
2690
- if (element == null) {
2691
- return element;
2692
- } // Skip key warning if the type isn't valid since our key validation logic
2693
- // doesn't expect a non-string/function type and can throw confusing errors.
2694
- // We don't want exception behavior to differ between dev and prod.
2695
- // (Rendering will throw with a helpful message and as soon as the type is
2696
- // fixed, the key warnings will appear.)
2697
-
2698
-
2699
- if (validType) {
2700
- for (var i = 2; i < arguments.length; i++) {
2701
- validateChildKeys(arguments[i], type);
2702
- }
2703
- }
2704
-
2705
- if (type === exports.Fragment) {
2706
- validateFragmentProps(element);
2707
- } else {
2708
- validatePropTypes(element);
2709
- }
2710
-
2711
- return element;
2712
- }
2713
- var didWarnAboutDeprecatedCreateFactory = false;
2714
- function createFactoryWithValidation(type) {
2715
- var validatedFactory = createElementWithValidation.bind(null, type);
2716
- validatedFactory.type = type;
2717
-
2718
- {
2719
- if (!didWarnAboutDeprecatedCreateFactory) {
2720
- didWarnAboutDeprecatedCreateFactory = true;
2721
-
2722
- warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
2723
- } // Legacy hook: remove it
2724
-
2725
-
2726
- Object.defineProperty(validatedFactory, 'type', {
2727
- enumerable: false,
2728
- get: function () {
2729
- warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2730
-
2731
- Object.defineProperty(this, 'type', {
2732
- value: type
2733
- });
2734
- return type;
2735
- }
2736
- });
2737
- }
2738
-
2739
- return validatedFactory;
2740
- }
2741
- function cloneElementWithValidation(element, props, children) {
2742
- var newElement = cloneElement.apply(this, arguments);
2743
-
2744
- for (var i = 2; i < arguments.length; i++) {
2745
- validateChildKeys(arguments[i], newElement.type);
2746
- }
2747
-
2748
- validatePropTypes(newElement);
2749
- return newElement;
2750
- }
2751
-
2752
- {
2753
-
2754
- try {
2755
- var frozenObject = Object.freeze({});
2756
- /* eslint-disable no-new */
2757
-
2758
- new Map([[frozenObject, null]]);
2759
- new Set([frozenObject]);
2760
- /* eslint-enable no-new */
2761
- } catch (e) {
2762
- }
2763
- }
2764
-
2765
- var createElement$1 = createElementWithValidation ;
2766
- var cloneElement$1 = cloneElementWithValidation ;
2767
- var createFactory = createFactoryWithValidation ;
2768
- var Children = {
2769
- map: mapChildren,
2770
- forEach: forEachChildren,
2771
- count: countChildren,
2772
- toArray: toArray,
2773
- only: onlyChild
2774
- };
2775
-
2776
- exports.Children = Children;
2777
- exports.Component = Component;
2778
- exports.PureComponent = PureComponent;
2779
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2780
- exports.cloneElement = cloneElement$1;
2781
- exports.createContext = createContext;
2782
- exports.createElement = createElement$1;
2783
- exports.createFactory = createFactory;
2784
- exports.createRef = createRef;
2785
- exports.forwardRef = forwardRef;
2786
- exports.isValidElement = isValidElement;
2787
- exports.lazy = lazy;
2788
- exports.memo = memo;
2789
- exports.useCallback = useCallback;
2790
- exports.useContext = useContext;
2791
- exports.useDebugValue = useDebugValue;
2792
- exports.useEffect = useEffect;
2793
- exports.useImperativeHandle = useImperativeHandle;
2794
- exports.useLayoutEffect = useLayoutEffect;
2795
- exports.useMemo = useMemo;
2796
- exports.useReducer = useReducer;
2797
- exports.useRef = useRef;
2798
- exports.useState = useState;
2799
- exports.version = ReactVersion;
2800
- })();
2801
- }
2802
-
2803
-
2804
- /***/ }),
2805
- /* 7 */
2806
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2807
-
2808
- "use strict";
2809
- /* harmony export (immutable) */ __webpack_exports__["a"] = ConceptList;
2810
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
2811
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
2812
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__follow_button_follow_button__ = __webpack_require__(2);
2813
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2814
-
2815
-
2816
-
2817
-
2818
- function ConceptList({ flags, concepts, contentType, conceptListTitle, trackable, csrfToken, cacheablePersonalisedUrl }) {
2819
-
2820
- const {
2821
- myFtApi,
2822
- myFtApiWrite
2823
- } = flags;
2824
-
2825
- const generateTrackableProps = (primary, secondary) => {
2826
- return {
2827
- 'data-trackable': primary ? primary : secondary
2828
- };
2829
- };
2830
-
2831
- const shouldDisplay = () => {
2832
- if (myFtApi && myFtApiWrite && Array.isArray(concepts) && concepts.length) {
2833
- return true;
2834
- }
2835
-
2836
- return false;
2837
- };
2838
-
2839
- return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2840
- __WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
2841
- null,
2842
- shouldDisplay() && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2843
- 'div',
2844
- _extends({
2845
- className: 'concept-list'
2846
- }, generateTrackableProps(trackable, 'concept-list')),
2847
- (contentType || conceptListTitle) && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2848
- 'h2',
2849
- { className: 'concept-list__title' },
2850
- conceptListTitle ? conceptListTitle : `Follow the topics in this ${contentType}`
2851
- ),
2852
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2853
- 'ul',
2854
- { className: 'concept-list__list' },
2855
- concepts.map((concept, index) => {
2856
- const {
2857
- relativeUrl,
2858
- url,
2859
- conceptTrackable,
2860
- prefLabel,
2861
- id
2862
- } = concept;
2863
- return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2864
- 'li',
2865
- { key: index, className: 'concept-list__list-item' },
2866
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2867
- 'a',
2868
- _extends({
2869
- href: relativeUrl || url
2870
- }, generateTrackableProps(conceptTrackable, 'concept'), {
2871
- className: 'concept-list__concept' }),
2872
- prefLabel
2873
- ),
2874
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1__follow_button_follow_button__["a" /* default */], { csrfToken: csrfToken, cacheablePersonalisedUrl: cacheablePersonalisedUrl, conceptId: id, name: prefLabel, flags: flags })
2875
- );
2876
- })
2877
- )
2878
- )
2879
- );
2880
- }
2881
-
2882
- /***/ }),
2883
- /* 8 */
2884
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2885
-
2886
- "use strict";
2887
- /* harmony export (immutable) */ __webpack_exports__["a"] = Collections;
2888
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
2889
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
2890
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__csrf_token_input__ = __webpack_require__(1);
2891
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__follow_button_follow_button__ = __webpack_require__(2);
2892
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2893
-
2894
-
2895
-
2896
-
2897
-
2898
- function Collections({ title, liteStyle, flags, collectionName, trackable, concepts = [], csrfToken, cacheablePersonalisedUrl }) {
2899
- const getLiteStyleModifier = () => liteStyle ? 'lite' : 'regular';
2900
- let formProps = {
2901
- method: 'POST',
2902
- action: '#',
2903
- 'data-myft-ui': 'follow',
2904
- 'data-concept-id': concepts.map(concept => concept.id).join(',')
2905
- };
2906
-
2907
- if (collectionName) {
2908
- formProps['data-myft-tracking'] = collectionName;
2909
- }
2910
-
2911
- return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2912
- 'section',
2913
- {
2914
- className: `collection collection--${getLiteStyleModifier()}`,
2915
- 'data-trackable': trackable ? trackable : 'collection' },
2916
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2917
- 'header',
2918
- { className: `collection__header collection__header--${getLiteStyleModifier()}` },
2919
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2920
- 'h2',
2921
- { className: `collection__title collection__title--${getLiteStyleModifier()}` },
2922
- title
2923
- )
2924
- ),
2925
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2926
- 'ul',
2927
- { className: 'collection__concepts' },
2928
- concepts && concepts.map((concept, index) => __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2929
- 'li',
2930
- { className: 'collection__concept', key: index },
2931
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_2__follow_button_follow_button__["a" /* default */], { cacheablePersonalisedUrl: cacheablePersonalisedUrl, csrfToken: csrfToken, variant: liteStyle ? 'primary' : 'inverse', buttonText: concept.name, flags: flags, collectionName: collectionName })
2932
- ))
2933
- ),
2934
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2935
- 'div',
2936
- { className: 'collection__meta' },
2937
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2938
- 'form',
2939
- _extends({}, formProps, {
2940
- className: 'n-myft-ui n-myft-ui--follow n-ui-hide-core collection-follow-all' }),
2941
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', {
2942
- type: 'hidden',
2943
- name: 'directType',
2944
- value: concepts.map(concept => concept.directType).join(',')
2945
- }),
2946
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1__csrf_token_input__["a" /* default */], { csrfToken: csrfToken, cacheablePersonalisedUrl: cacheablePersonalisedUrl }),
2947
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', {
2948
- type: 'hidden',
2949
- name: 'name',
2950
- value: concepts.map(concept => concept.name).join(',')
2951
- }),
2952
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2953
- 'button',
2954
- {
2955
- type: 'submit',
2956
- 'aria-pressed': 'false',
2957
- className: `collection-follow-all__button collection-follow-all__button--${getLiteStyleModifier()}`,
2958
- 'data-trackable': 'follow all',
2959
- 'data-concept-id': concepts.map(concept => concept.id).join(','),
2960
- 'aria-label': `Add all topics in the ${title} collection to my F T`,
2961
- 'data-alternate-label': `Remove all topics in the ${title} collection from my F T`,
2962
- 'data-alternate-text': 'Added',
2963
- title: `Add all topics in the ${title} collection to my F T` },
2964
- 'Add all to myFT'
2965
- )
2966
- )
2967
- )
2968
- );
2969
- }
2970
-
2971
- /***/ }),
2972
- /* 9 */
2973
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2974
-
2975
- "use strict";
2976
- /* harmony export (immutable) */ __webpack_exports__["a"] = SaveForLater;
2977
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
2978
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
2979
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__csrf_token_input__ = __webpack_require__(1);
2980
-
2981
-
2982
-
2983
- const ButtonContent = ({ saveButtonWithIcon, buttonText, isSaved, appIsStreamPage }) => {
2984
-
2985
- const DefaultButtonText = () => {
2986
- if (appIsStreamPage !== true) {
2987
- return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2988
- __WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
2989
- null,
2990
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2991
- 'span',
2992
- { className: 'save-button-longer-copy', 'data-variant-label': true },
2993
- isSaved ? 'Saved ' : 'Save '
2994
- ),
2995
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
2996
- 'span',
2997
- { className: 'n-myft-ui__button--viewport-large', 'aria-hidden': 'true' },
2998
- 'to myFT'
2999
- )
3000
- );
3001
- }
3002
-
3003
- return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3004
- 'span',
3005
- null,
3006
- isSaved ? 'Saved' : 'Save'
3007
- );
3008
- };
3009
-
3010
- return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3011
- __WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
3012
- null,
3013
- saveButtonWithIcon && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3014
- 'span',
3015
- { className: 'save-button-with-icon-copy', 'data-variant-label': true },
3016
- buttonText && buttonText,
3017
- !buttonText && (isSaved ? 'Saved' : 'Save')
3018
- ),
3019
- !saveButtonWithIcon && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3020
- __WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
3021
- null,
3022
- buttonText && buttonText,
3023
- !buttonText && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(DefaultButtonText, null)
3024
- )
3025
- );
3026
- };
3027
- function SaveForLater({ flags, contentId, title, variant, trackableId, isSaved, appIsStreamPage, alternateText, saveButtonWithIcon, buttonText, csrfToken, cacheablePersonalisedUrl }) {
3028
-
3029
- const { myFtApiWrite } = flags;
3030
-
3031
- const generateSubmitButtonProps = () => {
3032
- let props = {
3033
- type: 'submit',
3034
- 'data-trackable': trackableId ? trackableId : 'save-for-later',
3035
- 'data-text-variant': appIsStreamPage !== true ? 'save-button-with-icon-copy' : 'save-button-longer-copy',
3036
- 'data-content-id': contentId,
3037
- className: saveButtonWithIcon ? 'n-myft-ui__save-button-with-icon' : `n-myft-ui__button ${variant ? `n-myft-ui__button--${variant}` : ''}`
3038
- };
3039
-
3040
- if (isSaved) {
3041
- let titleText = `${title ? `${title} is` : ''} saved to myFT`;
3042
- props['title'] = title;
3043
- props['aria-label'] = titleText;
3044
- props['data-alternate-label'] = title ? `Save ${title} to myFT for later` : 'Save this article to myFT for later';
3045
- props['aria-pressed'] = true;
3046
- } else {
3047
- let titleText = title ? `Save ${title} to myFT for later` : 'Save this article to myFT for later';
3048
- props['title'] = titleText;
3049
- props['aria-label'] = titleText;
3050
- props['data-alternate-label'] = `${title ? `${title} is` : ''} saved to myFT`;
3051
- props['aria-pressed'] = false;
3052
- }
3053
-
3054
- if (alternateText) {
3055
- props['data-alternate-text'] = alternateText;
3056
- } else if (isSaved) {
3057
- props['data-alternate-text'] = 'Save ';
3058
- } else {
3059
- props['data-alternate-text'] = 'Saved ';
3060
- }
3061
-
3062
- return props;
3063
- };
3064
-
3065
- return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3066
- __WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
3067
- null,
3068
- myFtApiWrite && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3069
- 'form',
3070
- { className: 'n-myft-ui n-myft-ui--save', method: 'GET',
3071
- 'data-content-id': contentId,
3072
- 'data-myft-ui': 'saved',
3073
- action: `/myft/save/${contentId}`,
3074
- 'data-js-action': `/__myft/api/core/saved/content/${contentId}?method=put` },
3075
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1__csrf_token_input__["a" /* default */], { csrfToken: csrfToken, cacheablePersonalisedUrl: cacheablePersonalisedUrl }),
3076
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div', {
3077
- className: 'n-myft-ui__announcement o-normalise-visually-hidden',
3078
- 'aria-live': 'assertive',
3079
- 'data-pressed-text': 'Article saved in My FT.',
3080
- 'data-unpressed-text': 'Removed article from My FT.'
3081
- }),
3082
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3083
- 'button',
3084
- generateSubmitButtonProps(),
3085
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(ButtonContent, { buttonText: buttonText, saveButtonWithIcon: saveButtonWithIcon, isSaved: isSaved, appIsStreamPage: appIsStreamPage })
3086
- )
3087
- )
3088
- );
3089
- }
3090
-
3091
- /***/ }),
3092
- /* 10 */
3093
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3094
-
3095
- "use strict";
3096
- /* harmony export (immutable) */ __webpack_exports__["a"] = PinButton;
3097
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
3098
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
3099
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__csrf_token_input__ = __webpack_require__(1);
3100
-
3101
-
3102
- function PinButton({ showPrioritiseButton, id, name, directType, prioritised, csrfToken, cacheablePersonalisedUrl }) {
3103
-
3104
- const getAction = () => `/__myft/api/core/prioritised/concept/${id}?method=${prioritised ? 'delete' : 'put'}`;
3105
-
3106
- if (!showPrioritiseButton) {
3107
- return null;
3108
- }
3109
-
3110
- return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3111
- __WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
3112
- null,
3113
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('span', { className: 'myft-pin-divider' }),
3114
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3115
- 'div',
3116
- { className: 'myft-pin-button-wrapper' },
3117
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3118
- 'form',
3119
- { method: 'post', action: getAction(), 'data-myft-prioritise': true },
3120
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1__csrf_token_input__["a" /* default */], { csrfToken: csrfToken, cacheablePersonalisedUrl: cacheablePersonalisedUrl }),
3121
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', { type: 'hidden', value: name, name: 'name' }),
3122
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', { type: 'hidden', value: directType || 'http://www.ft.com/ontology/concept/Concept', name: 'directType' }),
3123
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div', {
3124
- className: 'n-myft-ui__announcement o-normalise-visually-hidden',
3125
- 'aria-live': 'assertive',
3126
- 'data-pressed-text': `${name} pinned in myFT.`,
3127
- 'data-unpressed-text': `Unpinned ${name} from myFT.`
3128
- }),
3129
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('button', { id: `myft-pin-button__${id}`,
3130
- className: 'myft-pin-button',
3131
- 'data-prioritise-button': true,
3132
- 'data-trackable': 'prioritised',
3133
- 'data-concept-id': id,
3134
- 'data-prioritised': prioritised ? true : false,
3135
- 'aria-label': `${prioritised ? 'Unpin' : 'Pin'} ${name} ${prioritised ? 'from' : 'in'} my F T`,
3136
- 'aria-pressed': prioritised ? true : false,
3137
- title: `${prioritised ? 'Unpin' : 'Pin'} ${name}` })
3138
- )
3139
- )
3140
- );
3141
- }
3142
-
3143
- /***/ }),
3144
- /* 11 */
3145
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3146
-
3147
- "use strict";
3148
- /* harmony export (immutable) */ __webpack_exports__["a"] = InstantAlert;
3149
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
3150
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
3151
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__csrf_token_input__ = __webpack_require__(1);
3152
-
3153
-
3154
-
3155
- /**
3156
- *
3157
- * @param {Object} props
3158
- * @param {string} props.name
3159
- * @param {Object} props.flags
3160
- * @param {booelan} props.hideButtonText
3161
- * @param {string} props.conceptId
3162
- * @param {string} props.name
3163
- * @param {string} props.extraClasses
3164
- * @param {boolean} props.directType
3165
- * @param {string} props.cacheablePersonalisedUrl
3166
- * @param {string} props.hasInstantAlert
3167
- * @param {string} props.buttonText
3168
- * @param {string} props.alternateText
3169
- * @param {string} props.variant
3170
- * @param {string} props.size
3171
- */
3172
- function InstantAlert(props) {
3173
-
3174
- const {
3175
- hasInstantAlert,
3176
- cacheablePersonalisedUrl,
3177
- name,
3178
- alternateText,
3179
- buttonText,
3180
- conceptId,
3181
- variant,
3182
- size,
3183
- flags,
3184
- hideButtonText,
3185
- directType,
3186
- extraClasses
3187
- } = props;
3188
-
3189
- const generateButtonProps = () => {
3190
-
3191
- let buttonProps = {
3192
- 'aria-pressed': `${Boolean(hasInstantAlert) && Boolean(cacheablePersonalisedUrl)}`,
3193
- 'aria-label': `Get instant alerts for ${name}`,
3194
- 'data-alternate-label': `Stop instant alerts for ${name}`,
3195
- 'data-alternate-text': alternateText ? alternateText : buttonText ? buttonText : 'Instant alerts',
3196
- 'data-concept-id': conceptId, // duplicated here for tracking
3197
- 'data-trackable': 'instant',
3198
- title: `Get instant alerts for ${name}`,
3199
- value: hasInstantAlert ? false : true,
3200
- type: 'submit',
3201
- name: '_rel.instant',
3202
- className: `n-myft-ui__button n-myft-ui__button--instant n-myft-ui__button--instant-light${variant ? ` n-myft-ui__button--${variant}` : ''}${size ? ` n-myft-ui__button--${size}` : ''}`
3203
- };
3204
- return buttonProps;
3205
- };
3206
-
3207
- return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3208
- __WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
3209
- null,
3210
- flags.myFtApiWrite && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3211
- 'form',
3212
- { className: `n-myft-ui n-myft-ui--instant${hideButtonText ? ' n-myft-ui--instant--hide-text' : ''}${extraClasses ? ` ${extraClasses}` : ''}`,
3213
- method: 'GET',
3214
- 'data-myft-ui': 'instant',
3215
- 'data-concept-id': conceptId,
3216
- action: `/myft/add/${conceptId}?instant=true`,
3217
- 'data-js-action': `/__myft/api/core/followed/concept/${conceptId}?method=put` },
3218
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1__csrf_token_input__["a" /* default */], null),
3219
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', { type: 'hidden', value: name, name: 'name' }),
3220
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', { type: 'hidden', value: directType || 'http://www.ft.com/ontology/concept/Concept', name: 'directType' }),
3221
- __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
3222
- 'button',
3223
- generateButtonProps(),
3224
- buttonText ? buttonText : 'Instant alerts'
3225
- )
3226
- )
3227
- );
3228
- }
3229
-
3230
- /***/ })
3231
- /******/ ]);
3232
- });