pallote-react 0.5.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js ADDED
@@ -0,0 +1,3615 @@
1
+ import * as React from 'react';
2
+ import React__default, { useState, useEffect, useRef, createContext, useContext } from 'react';
3
+ import classnames from 'classnames';
4
+ import PropTypes from 'prop-types';
5
+ import { createPortal } from 'react-dom';
6
+ import { X, CalendarBlank, Clock, CaretUpDown, ArrowSquareOut, CaretDoubleLeft, CaretLeft, CaretRight, CaretDoubleRight } from '@phosphor-icons/react';
7
+ import SyntaxHighlighter from 'react-syntax-highlighter';
8
+
9
+ const Color = ({
10
+ fill,
11
+ stroke,
12
+ customFill,
13
+ customStroke,
14
+ className,
15
+ children,
16
+ ...props
17
+ }) => {
18
+ const style = {
19
+ ...(customFill ? {
20
+ backgroundColor: customFill
21
+ } : {}),
22
+ ...(customStroke ? {
23
+ border: `1px solid ${customStroke}`
24
+ } : {})
25
+ };
26
+ const childClassName = classnames(children.props.className, className, {
27
+ [`fill-${fill}`]: fill,
28
+ [`stroke-${stroke}`]: stroke
29
+ });
30
+ return /*#__PURE__*/React__default.cloneElement(children, {
31
+ className: childClassName,
32
+ style: {
33
+ ...children.props.style,
34
+ ...style
35
+ },
36
+ ...props
37
+ });
38
+ };
39
+ Color.propTypes = {
40
+ fill: PropTypes.oneOf(['main', 'contrast', 'grey90', 'grey80', 'grey70', 'grey60', 'grey50', 'grey40', 'grey30', 'grey20', 'grey10', 'grey5', 'default', 'paper', 'primary', 'secondary', 'success', 'info', 'warning', 'error']),
41
+ stroke: PropTypes.oneOf(['main', 'contrast', 'grey90', 'grey80', 'grey70', 'grey60', 'grey50', 'grey40', 'grey30', 'grey20', 'grey10', 'grey5', 'default', 'paper', 'primary', 'secondary', 'success', 'info', 'warning', 'error']),
42
+ customFill: PropTypes.string,
43
+ customStroke: PropTypes.string,
44
+ className: PropTypes.node,
45
+ children: PropTypes.node
46
+ };
47
+
48
+ const viewportSizes = {
49
+ 'mobile-sm': 375,
50
+ 'mobile': 576,
51
+ 'tablet': 768,
52
+ 'laptop': 1024,
53
+ 'desktop': 1280
54
+ };
55
+ const Display = ({
56
+ show,
57
+ hide,
58
+ children
59
+ }) => {
60
+ const [isDisplayed, setDisplayed] = useState(false);
61
+ const updateMedia = () => {
62
+ if (show === 'touch') {
63
+ setDisplayed(navigator.maxTouchPoints > 0);
64
+ } else if (hide === 'touch') {
65
+ setDisplayed(navigator.maxTouchPoints === 0);
66
+ } else {
67
+ const viewportValue = viewportSizes[show || hide];
68
+ if (show) {
69
+ setDisplayed(window.innerWidth <= viewportValue);
70
+ } else if (hide) {
71
+ setDisplayed(window.innerWidth > viewportValue);
72
+ }
73
+ }
74
+ };
75
+ useEffect(() => {
76
+ updateMedia();
77
+ window.addEventListener('resize', updateMedia);
78
+ return () => window.removeEventListener('resize', updateMedia);
79
+ }, [show, hide]);
80
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isDisplayed ? children : null);
81
+ };
82
+ Display.propTypes = {
83
+ show: PropTypes.oneOf(['mobile-sm', 'mobile', 'tablet', 'laptop', 'desktop', 'touch']),
84
+ hide: PropTypes.oneOf(['mobile-sm', 'mobile', 'tablet', 'laptop', 'desktop', 'touch']),
85
+ children: PropTypes.node
86
+ };
87
+
88
+ function _extends() {
89
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
90
+ for (var e = 1; e < arguments.length; e++) {
91
+ var t = arguments[e];
92
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
93
+ }
94
+ return n;
95
+ }, _extends.apply(null, arguments);
96
+ }
97
+
98
+ const Grid = ({
99
+ item,
100
+ wrap,
101
+ direction,
102
+ justify,
103
+ items,
104
+ self,
105
+ gap,
106
+ col,
107
+ colxs,
108
+ colsm,
109
+ colmd,
110
+ collg,
111
+ colxl,
112
+ className,
113
+ children,
114
+ ...props
115
+ }) => {
116
+ return /*#__PURE__*/React__default.createElement("div", _extends({
117
+ className: classnames('flex', {
118
+ 'flex-wrap': wrap,
119
+ [`direction-${direction}`]: direction,
120
+ [`justify-${justify}`]: justify,
121
+ [`items-${items}`]: items,
122
+ [`slef-${self}`]: self,
123
+ [`col-${col}`]: col,
124
+ [`col-xs-${colxs}`]: colxs,
125
+ [`col-sm-${colsm}`]: colsm,
126
+ [`col-md-${colmd}`]: colmd,
127
+ [`col-lg-${collg}`]: collg,
128
+ [`col-xl-${colxl}`]: colxl,
129
+ [`gap-${gap}`]: gap
130
+ }, className)
131
+ }, props), children);
132
+ };
133
+ Grid.propTypes = {
134
+ item: PropTypes.bool,
135
+ wrap: PropTypes.bool,
136
+ direction: PropTypes.oneOf(['column', 'columnReverse', 'row', 'rowReverse']),
137
+ justify: PropTypes.oneOf(['center', 'end', 'start', 'spaceAround', 'spaceBetween', 'spaceEvenly']),
138
+ items: PropTypes.oneOf(['stretch', 'center', 'end', 'start', 'baseline']),
139
+ self: PropTypes.oneOf(['stretch', 'center', 'end', 'start', 'baseline']),
140
+ col: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
141
+ colxs: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
142
+ colsm: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
143
+ colmd: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
144
+ collg: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
145
+ colxl: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
146
+ gap: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
147
+ className: PropTypes.node,
148
+ children: PropTypes.node
149
+ };
150
+
151
+ const Text = ({
152
+ variant,
153
+ align,
154
+ weight,
155
+ transform,
156
+ italic,
157
+ underline,
158
+ strikeThrough,
159
+ code,
160
+ color,
161
+ component,
162
+ className,
163
+ children,
164
+ ...props
165
+ }) => {
166
+ const Component = component || 'p';
167
+ return /*#__PURE__*/React__default.createElement(Component, _extends({
168
+ className: classnames([{
169
+ [`${variant}`]: variant,
170
+ [`text-${align}`]: align,
171
+ [`text-${weight}`]: weight,
172
+ [`text-${transform}`]: transform,
173
+ [`text-${color}`]: color,
174
+ 'text-italic': italic,
175
+ 'text-underline': underline,
176
+ 'text-strikeThrough': strikeThrough,
177
+ 'text-code': code
178
+ }, className])
179
+ }, props), children);
180
+ };
181
+ Text.propTypes = {
182
+ variant: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle', 'body', 'caption', 'overline']),
183
+ align: PropTypes.oneOf(['left', 'center', 'right', 'justify']),
184
+ weight: PropTypes.oneOf(['regular', 'bold']),
185
+ transform: PropTypes.oneOf(['none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit']),
186
+ italic: PropTypes.bool,
187
+ underline: PropTypes.bool,
188
+ strikeThrough: PropTypes.bool,
189
+ code: PropTypes.bool,
190
+ color: PropTypes.oneOf(['default', 'alt', 'disabled', 'contrast', 'contrastAlt', 'contrastDisabled', 'primary', 'secondary', 'success', 'info', 'warning', 'error']),
191
+ component: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span', 'label', 'legend']),
192
+ className: PropTypes.node,
193
+ children: PropTypes.node
194
+ };
195
+
196
+ const Alert = ({
197
+ color = 'success',
198
+ variant = 'toast',
199
+ title,
200
+ subtitle,
201
+ dense,
202
+ noIcon,
203
+ show,
204
+ onClose,
205
+ className,
206
+ ...props
207
+ }) => {
208
+ const [shouldRender, setRender] = useState(show);
209
+ const [container] = useState(() => {
210
+ let el = document.getElementById('alerts');
211
+ if (!el) {
212
+ el = document.createElement('div');
213
+ el.id = 'alerts';
214
+ document.body.appendChild(el);
215
+ }
216
+ return el;
217
+ });
218
+ useEffect(() => {
219
+ if (show) setRender(true);
220
+ }, [show]);
221
+ const onAnimationEnd = () => {
222
+ if (!show) setRender(false);
223
+ };
224
+ let alert = /*#__PURE__*/React__default.createElement("div", _extends({
225
+ className: classnames(['alert', {
226
+ [`alert-${color}`]: color,
227
+ [`alert-${variant}`]: variant,
228
+ 'alert-slideIn': show,
229
+ 'alert-slideOut': !show,
230
+ 'alert-dense': dense,
231
+ 'alert-noIcon': noIcon
232
+ }, className]),
233
+ onAnimationEnd: onAnimationEnd
234
+ }, props), /*#__PURE__*/React__default.createElement("div", {
235
+ className: classnames('alert_content')
236
+ }, title ? /*#__PURE__*/React__default.createElement(Text, {
237
+ className: classnames('alert_title'),
238
+ variant: dense ? 'caption' : 'body',
239
+ weight: "bold"
240
+ }, title) : null, subtitle ? /*#__PURE__*/React__default.createElement(Text, {
241
+ variant: dense ? 'overline' : 'caption',
242
+ className: classnames('alert_subtitle')
243
+ }, subtitle) : null), onClose ? /*#__PURE__*/React__default.createElement(X, {
244
+ className: classnames('alert_close'),
245
+ onClick: onClose,
246
+ size: dense ? 14 : 16
247
+ }) : null);
248
+ if (variant === 'notice') {
249
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, alert);
250
+ } else {
251
+ return /*#__PURE__*/createPortal(shouldRender && alert, container);
252
+ }
253
+ };
254
+ Alert.propTypes = {
255
+ color: PropTypes.oneOf(['success', 'info', 'warning', 'error']),
256
+ variant: PropTypes.oneOf(['bar', 'toast', 'notice']),
257
+ title: PropTypes.string.isRequired,
258
+ subtitle: PropTypes.string,
259
+ dense: PropTypes.bool,
260
+ noIcon: PropTypes.bool,
261
+ show: PropTypes.bool,
262
+ onClose: PropTypes.func,
263
+ className: PropTypes.node
264
+ };
265
+
266
+ const Breadcrumbs = ({
267
+ items,
268
+ separator = "slash",
269
+ className
270
+ }) => /*#__PURE__*/React__default.createElement("nav", {
271
+ "aria-label": "breadcrumbs",
272
+ className: classnames(['breadcrumbs', {
273
+ [`breadcrumbs-${separator}`]: separator
274
+ }, className])
275
+ }, /*#__PURE__*/React__default.createElement("ol", null, items.map((item, index) => /*#__PURE__*/React__default.createElement("li", {
276
+ key: index,
277
+ className: "breadcrumbs_item"
278
+ }, index === items.length - 1 ? /*#__PURE__*/React__default.createElement("p", {
279
+ "aria-current": "page"
280
+ }, item.label) : /*#__PURE__*/React__default.createElement("a", {
281
+ href: item.href
282
+ }, item.label)))));
283
+ Breadcrumbs.propTypes = {
284
+ items: PropTypes.array.isRequired,
285
+ separator: PropTypes.oneOf(['slash', 'arrow']),
286
+ className: PropTypes.node
287
+ };
288
+
289
+ const Button = /*#__PURE__*/React__default.forwardRef(({
290
+ component = 'button',
291
+ kind,
292
+ variant = 'fill',
293
+ size = 'md',
294
+ color = 'primary',
295
+ fullWidth,
296
+ disabled,
297
+ iconLeft,
298
+ iconRight,
299
+ className,
300
+ children = 'button',
301
+ ...props
302
+ }, ref) => {
303
+ const Component = component || 'button';
304
+ let content;
305
+ if (kind === 'icon') {
306
+ content = children;
307
+ } else {
308
+ content = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, iconLeft && iconLeft, children, iconRight && iconRight);
309
+ }
310
+ return /*#__PURE__*/React__default.createElement(Component, _extends({
311
+ className: classnames(['button', {
312
+ [`button-${size}`]: size,
313
+ [`button-${color}`]: color,
314
+ [`button-${kind}`]: kind,
315
+ [`button-${variant}`]: variant,
316
+ 'button-fullWidth': fullWidth,
317
+ 'button-disabled': disabled
318
+ }, className]),
319
+ ref: ref,
320
+ disabled: Component === 'button' ? disabled : undefined
321
+ }, props), content);
322
+ });
323
+ Button.displayName = 'Button';
324
+ Button.propTypes = {
325
+ component: PropTypes.oneOfType([PropTypes.oneOf(['button', 'a']), PropTypes.elementType]),
326
+ kind: PropTypes.oneOf(['text', 'icon']),
327
+ variant: PropTypes.oneOf(['fill', 'stroke', 'transparent']),
328
+ size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
329
+ color: PropTypes.oneOf(['primary', 'secondary', 'grey', 'success', 'info', 'warning', 'error', 'main', 'contrast']),
330
+ fullWidth: PropTypes.bool,
331
+ disabled: PropTypes.bool,
332
+ iconLeft: PropTypes.node,
333
+ iconRight: PropTypes.node,
334
+ className: PropTypes.node,
335
+ children: PropTypes.node.isRequired
336
+ };
337
+
338
+ const Buttons = ({
339
+ direction = 'landscape',
340
+ fullWidth,
341
+ wide,
342
+ className,
343
+ children,
344
+ ...props
345
+ }) => {
346
+ return /*#__PURE__*/React__default.createElement("div", _extends({
347
+ className: classnames(['buttons', {
348
+ [`buttons-${direction}`]: direction,
349
+ 'buttons-fullWidth': fullWidth,
350
+ 'buttons-wide': wide
351
+ }, className])
352
+ }, props), children);
353
+ };
354
+ Buttons.propTypes = {
355
+ direction: PropTypes.oneOf(['landscape', 'portrait']),
356
+ fullWidth: PropTypes.bool,
357
+ wide: PropTypes.bool,
358
+ className: PropTypes.node,
359
+ children: PropTypes.node.isRequired
360
+ };
361
+
362
+ const Card = ({
363
+ size = 'md',
364
+ fill = 'paper',
365
+ direction = 'portrait',
366
+ align = 'left',
367
+ hasShadow = false,
368
+ transparent = false,
369
+ className,
370
+ children,
371
+ ...props
372
+ }) => {
373
+ return /*#__PURE__*/React__default.createElement(Color, {
374
+ fill: transparent ? null : fill
375
+ }, /*#__PURE__*/React__default.createElement("div", _extends({
376
+ className: classnames(['card', {
377
+ [`card-${size}`]: size,
378
+ [`card-${direction}`]: direction,
379
+ [`card-${align}`]: align,
380
+ 'card-hasShadow': hasShadow,
381
+ 'card-transparent': transparent
382
+ }, className])
383
+ }, props), children));
384
+ };
385
+ Card.propTypes = {
386
+ size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
387
+ fill: PropTypes.oneOf(['default', 'paper', 'primary', 'secondary', 'success', 'info', 'warning', 'error']),
388
+ direction: PropTypes.oneOf(['portrait', 'landscape']),
389
+ align: PropTypes.oneOf(['left', 'center', 'right']),
390
+ hasShadow: PropTypes.bool,
391
+ transparent: PropTypes.bool,
392
+ className: PropTypes.node,
393
+ children: PropTypes.node.isRequired
394
+ };
395
+
396
+ const CardActions = ({
397
+ direction,
398
+ className,
399
+ children,
400
+ ...props
401
+ }) => {
402
+ return /*#__PURE__*/React__default.createElement("div", _extends({
403
+ className: classnames(['card_actions', {
404
+ [`card_actions-${direction}`]: direction
405
+ }, className])
406
+ }, props), children);
407
+ };
408
+ CardActions.propTypes = {
409
+ direction: PropTypes.oneOf(['portrait', 'landscape']),
410
+ className: PropTypes.node,
411
+ children: PropTypes.node.isRequired
412
+ };
413
+
414
+ const CardContent = ({
415
+ fullWidth,
416
+ className,
417
+ children,
418
+ ...props
419
+ }) => {
420
+ return /*#__PURE__*/React__default.createElement("div", _extends({
421
+ className: classnames(['card_content', {
422
+ 'card_content-fullWidth': fullWidth
423
+ }, className])
424
+ }, props), children);
425
+ };
426
+ CardContent.propTypes = {
427
+ fullWidth: PropTypes.bool,
428
+ className: PropTypes.node,
429
+ children: PropTypes.node.isRequired
430
+ };
431
+
432
+ const CardHeader = ({
433
+ label,
434
+ title,
435
+ subtitle,
436
+ actions,
437
+ className,
438
+ ...props
439
+ }) => {
440
+ return /*#__PURE__*/React__default.createElement("div", _extends({
441
+ className: classnames(['card_header', className])
442
+ }, props), actions && /*#__PURE__*/React__default.createElement("div", {
443
+ className: "card_headerActions"
444
+ }, actions), label ? /*#__PURE__*/React__default.createElement(Text, {
445
+ className: classnames('card_label')
446
+ }, label) : null, /*#__PURE__*/React__default.createElement(Text, {
447
+ className: classnames('card_title')
448
+ }, title), subtitle ? /*#__PURE__*/React__default.createElement(Text, {
449
+ className: classnames('card_subtitle')
450
+ }, subtitle) : null);
451
+ };
452
+ CardHeader.propTypes = {
453
+ label: PropTypes.string,
454
+ title: PropTypes.string.isRequired,
455
+ subtitle: PropTypes.string,
456
+ actions: PropTypes.node,
457
+ className: PropTypes.node,
458
+ children: PropTypes.node
459
+ };
460
+
461
+ const CardMedia = ({
462
+ width,
463
+ height,
464
+ image,
465
+ fullWidth,
466
+ className,
467
+ ...props
468
+ }) => {
469
+ return /*#__PURE__*/React__default.createElement("div", _extends({
470
+ className: classnames(['card_media', {
471
+ 'card_media-fullWidth': fullWidth
472
+ }, className])
473
+ }, props), /*#__PURE__*/React__default.createElement("div", {
474
+ className: 'card_mediaInner',
475
+ style: {
476
+ width: width + 'px',
477
+ paddingBottom: height,
478
+ backgroundImage: `url(${image})`
479
+ }
480
+ }));
481
+ };
482
+ CardMedia.propTypes = {
483
+ width: PropTypes.number,
484
+ height: PropTypes.number,
485
+ image: PropTypes.string.isRequired,
486
+ fullWidth: PropTypes.bool,
487
+ className: PropTypes.node
488
+ };
489
+
490
+ const Checkbox = ({
491
+ id,
492
+ value,
493
+ label,
494
+ checked,
495
+ disabled,
496
+ optional,
497
+ className,
498
+ ...props
499
+ }) => {
500
+ return /*#__PURE__*/React__default.createElement("div", {
501
+ className: classnames(['checkbox', {
502
+ 'checkbox-disabled': disabled
503
+ }, className])
504
+ }, /*#__PURE__*/React__default.createElement("input", _extends({
505
+ className: classnames('checkbox_control'),
506
+ type: "checkbox",
507
+ name: id,
508
+ id: id,
509
+ value: value,
510
+ checked: checked,
511
+ "aria-checked": checked,
512
+ disabled: disabled,
513
+ required: !(disabled || optional)
514
+ }, props)), /*#__PURE__*/React__default.createElement("label", {
515
+ className: classnames('checkbox_label'),
516
+ htmlFor: id
517
+ }, label));
518
+ };
519
+ Checkbox.propTypes = {
520
+ id: PropTypes.string.isRequired,
521
+ value: PropTypes.string.isRequired,
522
+ label: PropTypes.string.isRequired,
523
+ checked: PropTypes.bool,
524
+ disabled: PropTypes.bool,
525
+ optional: PropTypes.bool,
526
+ className: PropTypes.node
527
+ };
528
+
529
+ const InputLabel = ({
530
+ isLegend = false,
531
+ htmlFor,
532
+ label = 'Input label',
533
+ hint,
534
+ error
535
+ }) => {
536
+ const LabelTag = isLegend ? 'legend' : 'label';
537
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, label && /*#__PURE__*/React__default.createElement(LabelTag, _extends({
538
+ className: 'input_label'
539
+ }, !isLegend && {
540
+ htmlFor
541
+ }), label), hint && /*#__PURE__*/React__default.createElement("p", {
542
+ id: htmlFor + '-hint',
543
+ className: 'input_hint'
544
+ }, hint), error && /*#__PURE__*/React__default.createElement("p", {
545
+ id: htmlFor + '-error',
546
+ className: 'input_error'
547
+ }, error));
548
+ };
549
+ InputLabel.propTypes = {
550
+ isLegend: PropTypes.bool,
551
+ htmlFor: (props, propName, componentName) => {
552
+ if (!props.isLegend && !props[propName]) {
553
+ return new Error(`The prop \`${propName}\` is required in \`${componentName}\` when \`isLegend\` is false.`);
554
+ }
555
+ },
556
+ label: PropTypes.string.isRequired,
557
+ hint: PropTypes.string,
558
+ error: PropTypes.string
559
+ };
560
+
561
+ const Checkboxes = ({
562
+ onChange,
563
+ id,
564
+ label = 'Label',
565
+ direction = 'portrait',
566
+ error,
567
+ disabled,
568
+ optional,
569
+ hint,
570
+ children,
571
+ className
572
+ }) => {
573
+ return /*#__PURE__*/React__default.createElement("fieldset", _extends({
574
+ className: classnames(['input', {
575
+ 'js-error': error,
576
+ 'input-disabled': disabled,
577
+ 'input-optional': optional
578
+ }, className]),
579
+ onChange: onChange
580
+ }, hint || error ? {
581
+ 'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
582
+ } : null), /*#__PURE__*/React__default.createElement(InputLabel, {
583
+ isLegend: true,
584
+ label: label,
585
+ hint: hint,
586
+ error: error
587
+ }), /*#__PURE__*/React__default.createElement("div", {
588
+ className: classnames(['input_control', 'radios', {
589
+ [`radios-${direction}`]: direction
590
+ }])
591
+ }, React__default.Children.map(children, child => /*#__PURE__*/React__default.isValidElement(child) ? /*#__PURE__*/React__default.cloneElement(child, {
592
+ optional,
593
+ disabled
594
+ }) : child)));
595
+ };
596
+ Checkboxes.propTypes = {
597
+ onChange: PropTypes.func,
598
+ id: PropTypes.string.isRequired,
599
+ label: PropTypes.string.isRequired,
600
+ direction: PropTypes.oneOf(['portrait', 'landscape']),
601
+ error: PropTypes.bool,
602
+ disabled: PropTypes.bool,
603
+ optional: PropTypes.bool,
604
+ hint: PropTypes.string,
605
+ children: PropTypes.node.isRequired,
606
+ className: PropTypes.node
607
+ };
608
+
609
+ const Divider = ({
610
+ direction = 'landscape',
611
+ padding = 'md',
612
+ className,
613
+ ...props
614
+ }) => {
615
+ return /*#__PURE__*/React__default.createElement("div", _extends({
616
+ className: classnames(['divider', {
617
+ [`divider-${direction}`]: direction,
618
+ [`divider-${padding}`]: padding
619
+ }, className])
620
+ }, props));
621
+ };
622
+ Divider.propTypes = {
623
+ direction: PropTypes.oneOf(['landscape', 'portrait']),
624
+ padding: PropTypes.oneOf(['none', 'sm', 'md', 'lg']),
625
+ className: PropTypes.node
626
+ };
627
+
628
+ const Input = ({
629
+ onChange,
630
+ type = 'text',
631
+ id,
632
+ placeholder,
633
+ label = 'Input',
634
+ icon,
635
+ isFocused,
636
+ error,
637
+ disabled,
638
+ optional,
639
+ hint,
640
+ className,
641
+ ...props
642
+ }) => {
643
+ const inputRef = useRef(null);
644
+ useEffect(() => {
645
+ if (isFocused && inputRef.current) {
646
+ inputRef.current.focus();
647
+ }
648
+ }, [isFocused]);
649
+ const customIcon = icon || type === 'date' && /*#__PURE__*/React__default.createElement(CalendarBlank, null) || type === 'time' && /*#__PURE__*/React__default.createElement(Clock, null) || type === 'number' && /*#__PURE__*/React__default.createElement(CaretUpDown, null);
650
+ return /*#__PURE__*/React__default.createElement("div", {
651
+ className: classnames(['input', {
652
+ 'js-error': error,
653
+ 'input-disabled': disabled,
654
+ 'input-optional': optional,
655
+ 'input-withIcon': icon
656
+ }, className]),
657
+ onChange: onChange
658
+ }, /*#__PURE__*/React__default.createElement(InputLabel, {
659
+ htmlFor: id,
660
+ label: label,
661
+ hint: hint,
662
+ error: error
663
+ }), customIcon && /*#__PURE__*/React__default.createElement("div", {
664
+ className: 'input_icon'
665
+ }, customIcon), /*#__PURE__*/React__default.createElement("input", _extends({
666
+ ref: inputRef,
667
+ type: type,
668
+ className: 'input_control',
669
+ name: id,
670
+ id: id,
671
+ placeholder: placeholder,
672
+ disabled: disabled,
673
+ required: !(disabled || optional)
674
+ }, hint || error ? {
675
+ 'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
676
+ } : null, props)));
677
+ };
678
+ Input.propTypes = {
679
+ onChange: PropTypes.func,
680
+ type: PropTypes.oneOf(['date', 'email', 'number', 'tel', 'text', 'time']),
681
+ id: PropTypes.string.isRequired,
682
+ placeholder: PropTypes.string,
683
+ label: PropTypes.string.isRequired,
684
+ icon: PropTypes.node,
685
+ isFocused: PropTypes.bool,
686
+ error: PropTypes.bool,
687
+ disabled: PropTypes.bool,
688
+ optional: PropTypes.bool,
689
+ hint: PropTypes.string,
690
+ className: PropTypes.node
691
+ };
692
+
693
+ const Link$1 = ({
694
+ component = 'a',
695
+ icon,
696
+ color,
697
+ isExternal,
698
+ href,
699
+ className,
700
+ children,
701
+ ...props
702
+ }) => {
703
+ const Component = component || 'a';
704
+ return /*#__PURE__*/React__default.createElement(Component, _extends({
705
+ className: classnames(['link', {
706
+ [`text-${color}`]: color
707
+ }, className]),
708
+ href: isExternal ? href : undefined,
709
+ target: isExternal ? '_blank' : undefined,
710
+ rel: isExternal ? 'noopener noreferrer' : undefined
711
+ }, props), children, icon && !isExternal && /*#__PURE__*/React__default.createElement("span", {
712
+ className: 'link_icon'
713
+ }, icon), isExternal && /*#__PURE__*/React__default.createElement("span", {
714
+ className: 'link_icon'
715
+ }, /*#__PURE__*/React__default.createElement(ArrowSquareOut, null)));
716
+ };
717
+ Link$1.propTypes = {
718
+ component: PropTypes.oneOfType(['a', PropTypes.elementType]),
719
+ icon: PropTypes.node,
720
+ color: PropTypes.oneOf(['default', 'alt', 'disabled', 'contrast', 'contrastAlt', 'contrastDisabled', 'primary', 'secondary', 'inherit']),
721
+ href: PropTypes.string,
722
+ className: PropTypes.node,
723
+ children: PropTypes.node.isRequired
724
+ };
725
+
726
+ const List = ({
727
+ dense,
728
+ className,
729
+ children,
730
+ ...props
731
+ }) => {
732
+ return /*#__PURE__*/React__default.createElement("div", _extends({
733
+ className: classnames(['list', {
734
+ 'list-dense': dense
735
+ }, className])
736
+ }, props), children);
737
+ };
738
+ List.propTypes = {
739
+ dense: PropTypes.bool,
740
+ className: PropTypes.node,
741
+ children: PropTypes.node.isRequired
742
+ };
743
+
744
+ const ListItem = ({
745
+ icon,
746
+ bold,
747
+ className,
748
+ children = 'List item',
749
+ ...props
750
+ }) => {
751
+ return /*#__PURE__*/React__default.createElement(Text, _extends({
752
+ className: classnames(['list_item', {
753
+ 'list_item-bold': bold
754
+ }, className])
755
+ }, props), icon ? /*#__PURE__*/React__default.cloneElement(icon, {
756
+ className: `${icon.props.className ?? ''} list_itemIcon`
757
+ }) : null, children);
758
+ };
759
+ ListItem.propTypes = {
760
+ icon: PropTypes.node,
761
+ bold: PropTypes.bool,
762
+ className: PropTypes.node,
763
+ children: PropTypes.node.isRequired
764
+ };
765
+
766
+ const Nav = ({
767
+ direction,
768
+ dense,
769
+ className,
770
+ children,
771
+ ...props
772
+ }) => {
773
+ return /*#__PURE__*/React__default.createElement("nav", _extends({
774
+ className: classnames(['nav', {
775
+ [`nav-${direction}`]: direction,
776
+ 'nav-dense': dense
777
+ }, className])
778
+ }, props), /*#__PURE__*/React__default.createElement("div", {
779
+ className: "nav_container"
780
+ }, children));
781
+ };
782
+ Nav.propTypes = {
783
+ direction: PropTypes.oneOf(['portrait', 'landscape']),
784
+ dense: PropTypes.bool,
785
+ className: PropTypes.node,
786
+ children: PropTypes.node.isRequired
787
+ };
788
+
789
+ var dist = {};
790
+
791
+ var hasRequiredDist;
792
+ function requireDist() {
793
+ if (hasRequiredDist) return dist;
794
+ hasRequiredDist = 1;
795
+ Object.defineProperty(dist, "__esModule", {
796
+ value: true
797
+ });
798
+ dist.parse = parse;
799
+ dist.serialize = serialize;
800
+ /**
801
+ * RegExp to match cookie-name in RFC 6265 sec 4.1.1
802
+ * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
803
+ * which has been replaced by the token definition in RFC 7230 appendix B.
804
+ *
805
+ * cookie-name = token
806
+ * token = 1*tchar
807
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" /
808
+ * "*" / "+" / "-" / "." / "^" / "_" /
809
+ * "`" / "|" / "~" / DIGIT / ALPHA
810
+ *
811
+ * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
812
+ * Allow same range as cookie value, except `=`, which delimits end of name.
813
+ */
814
+ const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
815
+ /**
816
+ * RegExp to match cookie-value in RFC 6265 sec 4.1.1
817
+ *
818
+ * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
819
+ * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
820
+ * ; US-ASCII characters excluding CTLs,
821
+ * ; whitespace DQUOTE, comma, semicolon,
822
+ * ; and backslash
823
+ *
824
+ * Allowing more characters: https://github.com/jshttp/cookie/issues/191
825
+ * Comma, backslash, and DQUOTE are not part of the parsing algorithm.
826
+ */
827
+ const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
828
+ /**
829
+ * RegExp to match domain-value in RFC 6265 sec 4.1.1
830
+ *
831
+ * domain-value = <subdomain>
832
+ * ; defined in [RFC1034], Section 3.5, as
833
+ * ; enhanced by [RFC1123], Section 2.1
834
+ * <subdomain> = <label> | <subdomain> "." <label>
835
+ * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
836
+ * Labels must be 63 characters or less.
837
+ * 'let-dig' not 'letter' in the first char, per RFC1123
838
+ * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
839
+ * <let-dig-hyp> = <let-dig> | "-"
840
+ * <let-dig> = <letter> | <digit>
841
+ * <letter> = any one of the 52 alphabetic characters A through Z in
842
+ * upper case and a through z in lower case
843
+ * <digit> = any one of the ten digits 0 through 9
844
+ *
845
+ * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
846
+ *
847
+ * > (Note that a leading %x2E ("."), if present, is ignored even though that
848
+ * character is not permitted, but a trailing %x2E ("."), if present, will
849
+ * cause the user agent to ignore the attribute.)
850
+ */
851
+ const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
852
+ /**
853
+ * RegExp to match path-value in RFC 6265 sec 4.1.1
854
+ *
855
+ * path-value = <any CHAR except CTLs or ";">
856
+ * CHAR = %x01-7F
857
+ * ; defined in RFC 5234 appendix B.1
858
+ */
859
+ const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
860
+ const __toString = Object.prototype.toString;
861
+ const NullObject = /* @__PURE__ */(() => {
862
+ const C = function () {};
863
+ C.prototype = Object.create(null);
864
+ return C;
865
+ })();
866
+ /**
867
+ * Parse a cookie header.
868
+ *
869
+ * Parse the given cookie header string into an object
870
+ * The object has the various cookies as keys(names) => values
871
+ */
872
+ function parse(str, options) {
873
+ const obj = new NullObject();
874
+ const len = str.length;
875
+ // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
876
+ if (len < 2) return obj;
877
+ const dec = options?.decode || decode;
878
+ let index = 0;
879
+ do {
880
+ const eqIdx = str.indexOf("=", index);
881
+ if (eqIdx === -1) break; // No more cookie pairs.
882
+ const colonIdx = str.indexOf(";", index);
883
+ const endIdx = colonIdx === -1 ? len : colonIdx;
884
+ if (eqIdx > endIdx) {
885
+ // backtrack on prior semicolon
886
+ index = str.lastIndexOf(";", eqIdx - 1) + 1;
887
+ continue;
888
+ }
889
+ const keyStartIdx = startIndex(str, index, eqIdx);
890
+ const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
891
+ const key = str.slice(keyStartIdx, keyEndIdx);
892
+ // only assign once
893
+ if (obj[key] === undefined) {
894
+ let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
895
+ let valEndIdx = endIndex(str, endIdx, valStartIdx);
896
+ const value = dec(str.slice(valStartIdx, valEndIdx));
897
+ obj[key] = value;
898
+ }
899
+ index = endIdx + 1;
900
+ } while (index < len);
901
+ return obj;
902
+ }
903
+ function startIndex(str, index, max) {
904
+ do {
905
+ const code = str.charCodeAt(index);
906
+ if (code !== 0x20 /* */ && code !== 0x09 /* \t */) return index;
907
+ } while (++index < max);
908
+ return max;
909
+ }
910
+ function endIndex(str, index, min) {
911
+ while (index > min) {
912
+ const code = str.charCodeAt(--index);
913
+ if (code !== 0x20 /* */ && code !== 0x09 /* \t */) return index + 1;
914
+ }
915
+ return min;
916
+ }
917
+ /**
918
+ * Serialize data into a cookie header.
919
+ *
920
+ * Serialize a name value pair into a cookie string suitable for
921
+ * http headers. An optional options object specifies cookie parameters.
922
+ *
923
+ * serialize('foo', 'bar', { httpOnly: true })
924
+ * => "foo=bar; httpOnly"
925
+ */
926
+ function serialize(name, val, options) {
927
+ const enc = options?.encode || encodeURIComponent;
928
+ if (!cookieNameRegExp.test(name)) {
929
+ throw new TypeError(`argument name is invalid: ${name}`);
930
+ }
931
+ const value = enc(val);
932
+ if (!cookieValueRegExp.test(value)) {
933
+ throw new TypeError(`argument val is invalid: ${val}`);
934
+ }
935
+ let str = name + "=" + value;
936
+ if (!options) return str;
937
+ if (options.maxAge !== undefined) {
938
+ if (!Number.isInteger(options.maxAge)) {
939
+ throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
940
+ }
941
+ str += "; Max-Age=" + options.maxAge;
942
+ }
943
+ if (options.domain) {
944
+ if (!domainValueRegExp.test(options.domain)) {
945
+ throw new TypeError(`option domain is invalid: ${options.domain}`);
946
+ }
947
+ str += "; Domain=" + options.domain;
948
+ }
949
+ if (options.path) {
950
+ if (!pathValueRegExp.test(options.path)) {
951
+ throw new TypeError(`option path is invalid: ${options.path}`);
952
+ }
953
+ str += "; Path=" + options.path;
954
+ }
955
+ if (options.expires) {
956
+ if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
957
+ throw new TypeError(`option expires is invalid: ${options.expires}`);
958
+ }
959
+ str += "; Expires=" + options.expires.toUTCString();
960
+ }
961
+ if (options.httpOnly) {
962
+ str += "; HttpOnly";
963
+ }
964
+ if (options.secure) {
965
+ str += "; Secure";
966
+ }
967
+ if (options.partitioned) {
968
+ str += "; Partitioned";
969
+ }
970
+ if (options.priority) {
971
+ const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : undefined;
972
+ switch (priority) {
973
+ case "low":
974
+ str += "; Priority=Low";
975
+ break;
976
+ case "medium":
977
+ str += "; Priority=Medium";
978
+ break;
979
+ case "high":
980
+ str += "; Priority=High";
981
+ break;
982
+ default:
983
+ throw new TypeError(`option priority is invalid: ${options.priority}`);
984
+ }
985
+ }
986
+ if (options.sameSite) {
987
+ const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
988
+ switch (sameSite) {
989
+ case true:
990
+ case "strict":
991
+ str += "; SameSite=Strict";
992
+ break;
993
+ case "lax":
994
+ str += "; SameSite=Lax";
995
+ break;
996
+ case "none":
997
+ str += "; SameSite=None";
998
+ break;
999
+ default:
1000
+ throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
1001
+ }
1002
+ }
1003
+ return str;
1004
+ }
1005
+ /**
1006
+ * URL-decode string value. Optimized to skip native call when no %.
1007
+ */
1008
+ function decode(str) {
1009
+ if (str.indexOf("%") === -1) return str;
1010
+ try {
1011
+ return decodeURIComponent(str);
1012
+ } catch (e) {
1013
+ return str;
1014
+ }
1015
+ }
1016
+ /**
1017
+ * Determine if value is a Date.
1018
+ */
1019
+ function isDate(val) {
1020
+ return __toString.call(val) === "[object Date]";
1021
+ }
1022
+ return dist;
1023
+ }
1024
+
1025
+ requireDist();
1026
+
1027
+ /**
1028
+ * react-router v7.3.0
1029
+ *
1030
+ * Copyright (c) Remix Software Inc.
1031
+ *
1032
+ * This source code is licensed under the MIT license found in the
1033
+ * LICENSE.md file in the root directory of this source tree.
1034
+ *
1035
+ * @license MIT
1036
+ */
1037
+ function invariant(value, message) {
1038
+ if (value === false || value === null || typeof value === "undefined") {
1039
+ throw new Error(message);
1040
+ }
1041
+ }
1042
+ function warning(cond, message) {
1043
+ if (!cond) {
1044
+ if (typeof console !== "undefined") console.warn(message);
1045
+ try {
1046
+ throw new Error(message);
1047
+ } catch (e) {
1048
+ }
1049
+ }
1050
+ }
1051
+ function createPath({
1052
+ pathname = "/",
1053
+ search = "",
1054
+ hash = ""
1055
+ }) {
1056
+ if (search && search !== "?")
1057
+ pathname += search.charAt(0) === "?" ? search : "?" + search;
1058
+ if (hash && hash !== "#")
1059
+ pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
1060
+ return pathname;
1061
+ }
1062
+ function parsePath(path) {
1063
+ let parsedPath = {};
1064
+ if (path) {
1065
+ let hashIndex = path.indexOf("#");
1066
+ if (hashIndex >= 0) {
1067
+ parsedPath.hash = path.substring(hashIndex);
1068
+ path = path.substring(0, hashIndex);
1069
+ }
1070
+ let searchIndex = path.indexOf("?");
1071
+ if (searchIndex >= 0) {
1072
+ parsedPath.search = path.substring(searchIndex);
1073
+ path = path.substring(0, searchIndex);
1074
+ }
1075
+ if (path) {
1076
+ parsedPath.pathname = path;
1077
+ }
1078
+ }
1079
+ return parsedPath;
1080
+ }
1081
+ function matchRoutes(routes, locationArg, basename = "/") {
1082
+ return matchRoutesImpl(routes, locationArg, basename, false);
1083
+ }
1084
+ function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
1085
+ let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
1086
+ let pathname = stripBasename(location.pathname || "/", basename);
1087
+ if (pathname == null) {
1088
+ return null;
1089
+ }
1090
+ let branches = flattenRoutes(routes);
1091
+ rankRouteBranches(branches);
1092
+ let matches = null;
1093
+ for (let i = 0; matches == null && i < branches.length; ++i) {
1094
+ let decoded = decodePath(pathname);
1095
+ matches = matchRouteBranch(
1096
+ branches[i],
1097
+ decoded,
1098
+ allowPartial
1099
+ );
1100
+ }
1101
+ return matches;
1102
+ }
1103
+ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "") {
1104
+ let flattenRoute = (route, index, relativePath) => {
1105
+ let meta = {
1106
+ relativePath: relativePath === void 0 ? route.path || "" : relativePath,
1107
+ caseSensitive: route.caseSensitive === true,
1108
+ childrenIndex: index,
1109
+ route
1110
+ };
1111
+ if (meta.relativePath.startsWith("/")) {
1112
+ invariant(
1113
+ meta.relativePath.startsWith(parentPath),
1114
+ `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
1115
+ );
1116
+ meta.relativePath = meta.relativePath.slice(parentPath.length);
1117
+ }
1118
+ let path = joinPaths([parentPath, meta.relativePath]);
1119
+ let routesMeta = parentsMeta.concat(meta);
1120
+ if (route.children && route.children.length > 0) {
1121
+ invariant(
1122
+ // Our types know better, but runtime JS may not!
1123
+ // @ts-expect-error
1124
+ route.index !== true,
1125
+ `Index routes must not have child routes. Please remove all child routes from route path "${path}".`
1126
+ );
1127
+ flattenRoutes(route.children, branches, routesMeta, path);
1128
+ }
1129
+ if (route.path == null && !route.index) {
1130
+ return;
1131
+ }
1132
+ branches.push({
1133
+ path,
1134
+ score: computeScore(path, route.index),
1135
+ routesMeta
1136
+ });
1137
+ };
1138
+ routes.forEach((route, index) => {
1139
+ if (route.path === "" || !route.path?.includes("?")) {
1140
+ flattenRoute(route, index);
1141
+ } else {
1142
+ for (let exploded of explodeOptionalSegments(route.path)) {
1143
+ flattenRoute(route, index, exploded);
1144
+ }
1145
+ }
1146
+ });
1147
+ return branches;
1148
+ }
1149
+ function explodeOptionalSegments(path) {
1150
+ let segments = path.split("/");
1151
+ if (segments.length === 0) return [];
1152
+ let [first, ...rest] = segments;
1153
+ let isOptional = first.endsWith("?");
1154
+ let required = first.replace(/\?$/, "");
1155
+ if (rest.length === 0) {
1156
+ return isOptional ? [required, ""] : [required];
1157
+ }
1158
+ let restExploded = explodeOptionalSegments(rest.join("/"));
1159
+ let result = [];
1160
+ result.push(
1161
+ ...restExploded.map(
1162
+ (subpath) => subpath === "" ? required : [required, subpath].join("/")
1163
+ )
1164
+ );
1165
+ if (isOptional) {
1166
+ result.push(...restExploded);
1167
+ }
1168
+ return result.map(
1169
+ (exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded
1170
+ );
1171
+ }
1172
+ function rankRouteBranches(branches) {
1173
+ branches.sort(
1174
+ (a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(
1175
+ a.routesMeta.map((meta) => meta.childrenIndex),
1176
+ b.routesMeta.map((meta) => meta.childrenIndex)
1177
+ )
1178
+ );
1179
+ }
1180
+ var paramRe = /^:[\w-]+$/;
1181
+ var dynamicSegmentValue = 3;
1182
+ var indexRouteValue = 2;
1183
+ var emptySegmentValue = 1;
1184
+ var staticSegmentValue = 10;
1185
+ var splatPenalty = -2;
1186
+ var isSplat = (s) => s === "*";
1187
+ function computeScore(path, index) {
1188
+ let segments = path.split("/");
1189
+ let initialScore = segments.length;
1190
+ if (segments.some(isSplat)) {
1191
+ initialScore += splatPenalty;
1192
+ }
1193
+ if (index) {
1194
+ initialScore += indexRouteValue;
1195
+ }
1196
+ return segments.filter((s) => !isSplat(s)).reduce(
1197
+ (score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue),
1198
+ initialScore
1199
+ );
1200
+ }
1201
+ function compareIndexes(a, b) {
1202
+ let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
1203
+ return siblings ? (
1204
+ // If two routes are siblings, we should try to match the earlier sibling
1205
+ // first. This allows people to have fine-grained control over the matching
1206
+ // behavior by simply putting routes with identical paths in the order they
1207
+ // want them tried.
1208
+ a[a.length - 1] - b[b.length - 1]
1209
+ ) : (
1210
+ // Otherwise, it doesn't really make sense to rank non-siblings by index,
1211
+ // so they sort equally.
1212
+ 0
1213
+ );
1214
+ }
1215
+ function matchRouteBranch(branch, pathname, allowPartial = false) {
1216
+ let { routesMeta } = branch;
1217
+ let matchedParams = {};
1218
+ let matchedPathname = "/";
1219
+ let matches = [];
1220
+ for (let i = 0; i < routesMeta.length; ++i) {
1221
+ let meta = routesMeta[i];
1222
+ let end = i === routesMeta.length - 1;
1223
+ let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
1224
+ let match = matchPath(
1225
+ { path: meta.relativePath, caseSensitive: meta.caseSensitive, end },
1226
+ remainingPathname
1227
+ );
1228
+ let route = meta.route;
1229
+ if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
1230
+ match = matchPath(
1231
+ {
1232
+ path: meta.relativePath,
1233
+ caseSensitive: meta.caseSensitive,
1234
+ end: false
1235
+ },
1236
+ remainingPathname
1237
+ );
1238
+ }
1239
+ if (!match) {
1240
+ return null;
1241
+ }
1242
+ Object.assign(matchedParams, match.params);
1243
+ matches.push({
1244
+ // TODO: Can this as be avoided?
1245
+ params: matchedParams,
1246
+ pathname: joinPaths([matchedPathname, match.pathname]),
1247
+ pathnameBase: normalizePathname(
1248
+ joinPaths([matchedPathname, match.pathnameBase])
1249
+ ),
1250
+ route
1251
+ });
1252
+ if (match.pathnameBase !== "/") {
1253
+ matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
1254
+ }
1255
+ }
1256
+ return matches;
1257
+ }
1258
+ function matchPath(pattern, pathname) {
1259
+ if (typeof pattern === "string") {
1260
+ pattern = { path: pattern, caseSensitive: false, end: true };
1261
+ }
1262
+ let [matcher, compiledParams] = compilePath(
1263
+ pattern.path,
1264
+ pattern.caseSensitive,
1265
+ pattern.end
1266
+ );
1267
+ let match = pathname.match(matcher);
1268
+ if (!match) return null;
1269
+ let matchedPathname = match[0];
1270
+ let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
1271
+ let captureGroups = match.slice(1);
1272
+ let params = compiledParams.reduce(
1273
+ (memo2, { paramName, isOptional }, index) => {
1274
+ if (paramName === "*") {
1275
+ let splatValue = captureGroups[index] || "";
1276
+ pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
1277
+ }
1278
+ const value = captureGroups[index];
1279
+ if (isOptional && !value) {
1280
+ memo2[paramName] = void 0;
1281
+ } else {
1282
+ memo2[paramName] = (value || "").replace(/%2F/g, "/");
1283
+ }
1284
+ return memo2;
1285
+ },
1286
+ {}
1287
+ );
1288
+ return {
1289
+ params,
1290
+ pathname: matchedPathname,
1291
+ pathnameBase,
1292
+ pattern
1293
+ };
1294
+ }
1295
+ function compilePath(path, caseSensitive = false, end = true) {
1296
+ warning(
1297
+ path === "*" || !path.endsWith("*") || path.endsWith("/*"),
1298
+ `Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".`
1299
+ );
1300
+ let params = [];
1301
+ let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
1302
+ /\/:([\w-]+)(\?)?/g,
1303
+ (_, paramName, isOptional) => {
1304
+ params.push({ paramName, isOptional: isOptional != null });
1305
+ return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
1306
+ }
1307
+ );
1308
+ if (path.endsWith("*")) {
1309
+ params.push({ paramName: "*" });
1310
+ regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
1311
+ } else if (end) {
1312
+ regexpSource += "\\/*$";
1313
+ } else if (path !== "" && path !== "/") {
1314
+ regexpSource += "(?:(?=\\/|$))";
1315
+ } else ;
1316
+ let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
1317
+ return [matcher, params];
1318
+ }
1319
+ function decodePath(value) {
1320
+ try {
1321
+ return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
1322
+ } catch (error) {
1323
+ warning(
1324
+ false,
1325
+ `The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error}).`
1326
+ );
1327
+ return value;
1328
+ }
1329
+ }
1330
+ function stripBasename(pathname, basename) {
1331
+ if (basename === "/") return pathname;
1332
+ if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
1333
+ return null;
1334
+ }
1335
+ let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
1336
+ let nextChar = pathname.charAt(startIndex);
1337
+ if (nextChar && nextChar !== "/") {
1338
+ return null;
1339
+ }
1340
+ return pathname.slice(startIndex) || "/";
1341
+ }
1342
+ function resolvePath(to, fromPathname = "/") {
1343
+ let {
1344
+ pathname: toPathname,
1345
+ search = "",
1346
+ hash = ""
1347
+ } = typeof to === "string" ? parsePath(to) : to;
1348
+ let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
1349
+ return {
1350
+ pathname,
1351
+ search: normalizeSearch(search),
1352
+ hash: normalizeHash(hash)
1353
+ };
1354
+ }
1355
+ function resolvePathname(relativePath, fromPathname) {
1356
+ let segments = fromPathname.replace(/\/+$/, "").split("/");
1357
+ let relativeSegments = relativePath.split("/");
1358
+ relativeSegments.forEach((segment) => {
1359
+ if (segment === "..") {
1360
+ if (segments.length > 1) segments.pop();
1361
+ } else if (segment !== ".") {
1362
+ segments.push(segment);
1363
+ }
1364
+ });
1365
+ return segments.length > 1 ? segments.join("/") : "/";
1366
+ }
1367
+ function getInvalidPathError(char, field, dest, path) {
1368
+ return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify(
1369
+ path
1370
+ )}]. Please separate it out to the \`to.${dest}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
1371
+ }
1372
+ function getPathContributingMatches(matches) {
1373
+ return matches.filter(
1374
+ (match, index) => index === 0 || match.route.path && match.route.path.length > 0
1375
+ );
1376
+ }
1377
+ function getResolveToMatches(matches) {
1378
+ let pathMatches = getPathContributingMatches(matches);
1379
+ return pathMatches.map(
1380
+ (match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
1381
+ );
1382
+ }
1383
+ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {
1384
+ let to;
1385
+ if (typeof toArg === "string") {
1386
+ to = parsePath(toArg);
1387
+ } else {
1388
+ to = { ...toArg };
1389
+ invariant(
1390
+ !to.pathname || !to.pathname.includes("?"),
1391
+ getInvalidPathError("?", "pathname", "search", to)
1392
+ );
1393
+ invariant(
1394
+ !to.pathname || !to.pathname.includes("#"),
1395
+ getInvalidPathError("#", "pathname", "hash", to)
1396
+ );
1397
+ invariant(
1398
+ !to.search || !to.search.includes("#"),
1399
+ getInvalidPathError("#", "search", "hash", to)
1400
+ );
1401
+ }
1402
+ let isEmptyPath = toArg === "" || to.pathname === "";
1403
+ let toPathname = isEmptyPath ? "/" : to.pathname;
1404
+ let from;
1405
+ if (toPathname == null) {
1406
+ from = locationPathname;
1407
+ } else {
1408
+ let routePathnameIndex = routePathnames.length - 1;
1409
+ if (!isPathRelative && toPathname.startsWith("..")) {
1410
+ let toSegments = toPathname.split("/");
1411
+ while (toSegments[0] === "..") {
1412
+ toSegments.shift();
1413
+ routePathnameIndex -= 1;
1414
+ }
1415
+ to.pathname = toSegments.join("/");
1416
+ }
1417
+ from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
1418
+ }
1419
+ let path = resolvePath(to, from);
1420
+ let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
1421
+ let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
1422
+ if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
1423
+ path.pathname += "/";
1424
+ }
1425
+ return path;
1426
+ }
1427
+ var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
1428
+ var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
1429
+ var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
1430
+ var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
1431
+ function isRouteErrorResponse(error) {
1432
+ return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
1433
+ }
1434
+
1435
+ // lib/router/router.ts
1436
+ var validMutationMethodsArr = [
1437
+ "POST",
1438
+ "PUT",
1439
+ "PATCH",
1440
+ "DELETE"
1441
+ ];
1442
+ new Set(
1443
+ validMutationMethodsArr
1444
+ );
1445
+ var validRequestMethodsArr = [
1446
+ "GET",
1447
+ ...validMutationMethodsArr
1448
+ ];
1449
+ new Set(validRequestMethodsArr);
1450
+ var DataRouterContext = React.createContext(null);
1451
+ DataRouterContext.displayName = "DataRouter";
1452
+ var DataRouterStateContext = React.createContext(null);
1453
+ DataRouterStateContext.displayName = "DataRouterState";
1454
+ var ViewTransitionContext = React.createContext({
1455
+ isTransitioning: false
1456
+ });
1457
+ ViewTransitionContext.displayName = "ViewTransition";
1458
+ var FetchersContext = React.createContext(
1459
+ /* @__PURE__ */ new Map()
1460
+ );
1461
+ FetchersContext.displayName = "Fetchers";
1462
+ var AwaitContext = React.createContext(null);
1463
+ AwaitContext.displayName = "Await";
1464
+ var NavigationContext = React.createContext(
1465
+ null
1466
+ );
1467
+ NavigationContext.displayName = "Navigation";
1468
+ var LocationContext = React.createContext(
1469
+ null
1470
+ );
1471
+ LocationContext.displayName = "Location";
1472
+ var RouteContext = React.createContext({
1473
+ outlet: null,
1474
+ matches: [],
1475
+ isDataRoute: false
1476
+ });
1477
+ RouteContext.displayName = "Route";
1478
+ var RouteErrorContext = React.createContext(null);
1479
+ RouteErrorContext.displayName = "RouteError";
1480
+ function useHref(to, { relative } = {}) {
1481
+ invariant(
1482
+ useInRouterContext(),
1483
+ // TODO: This error is probably because they somehow have 2 versions of the
1484
+ // router loaded. We can help them understand how to avoid that.
1485
+ `useHref() may be used only in the context of a <Router> component.`
1486
+ );
1487
+ let { basename, navigator: navigator2 } = React.useContext(NavigationContext);
1488
+ let { hash, pathname, search } = useResolvedPath(to, { relative });
1489
+ let joinedPathname = pathname;
1490
+ if (basename !== "/") {
1491
+ joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
1492
+ }
1493
+ return navigator2.createHref({ pathname: joinedPathname, search, hash });
1494
+ }
1495
+ function useInRouterContext() {
1496
+ return React.useContext(LocationContext) != null;
1497
+ }
1498
+ function useLocation() {
1499
+ invariant(
1500
+ useInRouterContext(),
1501
+ // TODO: This error is probably because they somehow have 2 versions of the
1502
+ // router loaded. We can help them understand how to avoid that.
1503
+ `useLocation() may be used only in the context of a <Router> component.`
1504
+ );
1505
+ return React.useContext(LocationContext).location;
1506
+ }
1507
+ var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`;
1508
+ function useIsomorphicLayoutEffect(cb) {
1509
+ let isStatic = React.useContext(NavigationContext).static;
1510
+ if (!isStatic) {
1511
+ React.useLayoutEffect(cb);
1512
+ }
1513
+ }
1514
+ function useNavigate() {
1515
+ let { isDataRoute } = React.useContext(RouteContext);
1516
+ return isDataRoute ? useNavigateStable() : useNavigateUnstable();
1517
+ }
1518
+ function useNavigateUnstable() {
1519
+ invariant(
1520
+ useInRouterContext(),
1521
+ // TODO: This error is probably because they somehow have 2 versions of the
1522
+ // router loaded. We can help them understand how to avoid that.
1523
+ `useNavigate() may be used only in the context of a <Router> component.`
1524
+ );
1525
+ let dataRouterContext = React.useContext(DataRouterContext);
1526
+ let { basename, navigator: navigator2 } = React.useContext(NavigationContext);
1527
+ let { matches } = React.useContext(RouteContext);
1528
+ let { pathname: locationPathname } = useLocation();
1529
+ let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
1530
+ let activeRef = React.useRef(false);
1531
+ useIsomorphicLayoutEffect(() => {
1532
+ activeRef.current = true;
1533
+ });
1534
+ let navigate = React.useCallback(
1535
+ (to, options = {}) => {
1536
+ warning(activeRef.current, navigateEffectWarning);
1537
+ if (!activeRef.current) return;
1538
+ if (typeof to === "number") {
1539
+ navigator2.go(to);
1540
+ return;
1541
+ }
1542
+ let path = resolveTo(
1543
+ to,
1544
+ JSON.parse(routePathnamesJson),
1545
+ locationPathname,
1546
+ options.relative === "path"
1547
+ );
1548
+ if (dataRouterContext == null && basename !== "/") {
1549
+ path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
1550
+ }
1551
+ (!!options.replace ? navigator2.replace : navigator2.push)(
1552
+ path,
1553
+ options.state,
1554
+ options
1555
+ );
1556
+ },
1557
+ [
1558
+ basename,
1559
+ navigator2,
1560
+ routePathnamesJson,
1561
+ locationPathname,
1562
+ dataRouterContext
1563
+ ]
1564
+ );
1565
+ return navigate;
1566
+ }
1567
+ React.createContext(null);
1568
+ function useResolvedPath(to, { relative } = {}) {
1569
+ let { matches } = React.useContext(RouteContext);
1570
+ let { pathname: locationPathname } = useLocation();
1571
+ let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
1572
+ return React.useMemo(
1573
+ () => resolveTo(
1574
+ to,
1575
+ JSON.parse(routePathnamesJson),
1576
+ locationPathname,
1577
+ relative === "path"
1578
+ ),
1579
+ [to, routePathnamesJson, locationPathname, relative]
1580
+ );
1581
+ }
1582
+ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
1583
+ invariant(
1584
+ useInRouterContext(),
1585
+ // TODO: This error is probably because they somehow have 2 versions of the
1586
+ // router loaded. We can help them understand how to avoid that.
1587
+ `useRoutes() may be used only in the context of a <Router> component.`
1588
+ );
1589
+ let { navigator: navigator2, static: isStatic } = React.useContext(NavigationContext);
1590
+ let { matches: parentMatches } = React.useContext(RouteContext);
1591
+ let routeMatch = parentMatches[parentMatches.length - 1];
1592
+ let parentParams = routeMatch ? routeMatch.params : {};
1593
+ let parentPathname = routeMatch ? routeMatch.pathname : "/";
1594
+ let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
1595
+ let parentRoute = routeMatch && routeMatch.route;
1596
+ {
1597
+ let parentPath = parentRoute && parentRoute.path || "";
1598
+ warningOnce(
1599
+ parentPathname,
1600
+ !parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"),
1601
+ `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${parentPathname}" (under <Route path="${parentPath}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
1602
+
1603
+ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}">.`
1604
+ );
1605
+ }
1606
+ let locationFromContext = useLocation();
1607
+ let location;
1608
+ {
1609
+ location = locationFromContext;
1610
+ }
1611
+ let pathname = location.pathname || "/";
1612
+ let remainingPathname = pathname;
1613
+ if (parentPathnameBase !== "/") {
1614
+ let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
1615
+ let segments = pathname.replace(/^\//, "").split("/");
1616
+ remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
1617
+ }
1618
+ let matches = !isStatic && dataRouterState && dataRouterState.matches && dataRouterState.matches.length > 0 ? dataRouterState.matches : matchRoutes(routes, { pathname: remainingPathname });
1619
+ {
1620
+ warning(
1621
+ parentRoute || matches != null,
1622
+ `No routes matched location "${location.pathname}${location.search}${location.hash}" `
1623
+ );
1624
+ warning(
1625
+ matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0,
1626
+ `Matched leaf route at location "${location.pathname}${location.search}${location.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
1627
+ );
1628
+ }
1629
+ let renderedMatches = _renderMatches(
1630
+ matches && matches.map(
1631
+ (match) => Object.assign({}, match, {
1632
+ params: Object.assign({}, parentParams, match.params),
1633
+ pathname: joinPaths([
1634
+ parentPathnameBase,
1635
+ // Re-encode pathnames that were decoded inside matchRoutes
1636
+ navigator2.encodeLocation ? navigator2.encodeLocation(match.pathname).pathname : match.pathname
1637
+ ]),
1638
+ pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
1639
+ parentPathnameBase,
1640
+ // Re-encode pathnames that were decoded inside matchRoutes
1641
+ navigator2.encodeLocation ? navigator2.encodeLocation(match.pathnameBase).pathname : match.pathnameBase
1642
+ ])
1643
+ })
1644
+ ),
1645
+ parentMatches,
1646
+ dataRouterState,
1647
+ future
1648
+ );
1649
+ return renderedMatches;
1650
+ }
1651
+ function DefaultErrorComponent() {
1652
+ let error = useRouteError();
1653
+ let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
1654
+ let stack = error instanceof Error ? error.stack : null;
1655
+ let lightgrey = "rgba(200,200,200, 0.5)";
1656
+ let preStyles = { padding: "0.5rem", backgroundColor: lightgrey };
1657
+ let codeStyles = { padding: "2px 4px", backgroundColor: lightgrey };
1658
+ let devInfo = null;
1659
+ {
1660
+ console.error(
1661
+ "Error handled by React Router default ErrorBoundary:",
1662
+ error
1663
+ );
1664
+ devInfo = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", null, "\u{1F4BF} Hey developer \u{1F44B}"), /* @__PURE__ */ React.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ React.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ React.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
1665
+ }
1666
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ React.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ React.createElement("pre", { style: preStyles }, stack) : null, devInfo);
1667
+ }
1668
+ var defaultErrorElement = /* @__PURE__ */ React.createElement(DefaultErrorComponent, null);
1669
+ var RenderErrorBoundary = class extends React.Component {
1670
+ constructor(props) {
1671
+ super(props);
1672
+ this.state = {
1673
+ location: props.location,
1674
+ revalidation: props.revalidation,
1675
+ error: props.error
1676
+ };
1677
+ }
1678
+ static getDerivedStateFromError(error) {
1679
+ return { error };
1680
+ }
1681
+ static getDerivedStateFromProps(props, state) {
1682
+ if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
1683
+ return {
1684
+ error: props.error,
1685
+ location: props.location,
1686
+ revalidation: props.revalidation
1687
+ };
1688
+ }
1689
+ return {
1690
+ error: props.error !== void 0 ? props.error : state.error,
1691
+ location: state.location,
1692
+ revalidation: props.revalidation || state.revalidation
1693
+ };
1694
+ }
1695
+ componentDidCatch(error, errorInfo) {
1696
+ console.error(
1697
+ "React Router caught the following error during render",
1698
+ error,
1699
+ errorInfo
1700
+ );
1701
+ }
1702
+ render() {
1703
+ return this.state.error !== void 0 ? /* @__PURE__ */ React.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React.createElement(
1704
+ RouteErrorContext.Provider,
1705
+ {
1706
+ value: this.state.error,
1707
+ children: this.props.component
1708
+ }
1709
+ )) : this.props.children;
1710
+ }
1711
+ };
1712
+ function RenderedRoute({ routeContext, match, children }) {
1713
+ let dataRouterContext = React.useContext(DataRouterContext);
1714
+ if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
1715
+ dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
1716
+ }
1717
+ return /* @__PURE__ */ React.createElement(RouteContext.Provider, { value: routeContext }, children);
1718
+ }
1719
+ function _renderMatches(matches, parentMatches = [], dataRouterState = null, future = null) {
1720
+ if (matches == null) {
1721
+ if (!dataRouterState) {
1722
+ return null;
1723
+ }
1724
+ if (dataRouterState.errors) {
1725
+ matches = dataRouterState.matches;
1726
+ } else if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
1727
+ matches = dataRouterState.matches;
1728
+ } else {
1729
+ return null;
1730
+ }
1731
+ }
1732
+ let renderedMatches = matches;
1733
+ let errors = dataRouterState?.errors;
1734
+ if (errors != null) {
1735
+ let errorIndex = renderedMatches.findIndex(
1736
+ (m) => m.route.id && errors?.[m.route.id] !== void 0
1737
+ );
1738
+ invariant(
1739
+ errorIndex >= 0,
1740
+ `Could not find a matching route for errors on route IDs: ${Object.keys(
1741
+ errors
1742
+ ).join(",")}`
1743
+ );
1744
+ renderedMatches = renderedMatches.slice(
1745
+ 0,
1746
+ Math.min(renderedMatches.length, errorIndex + 1)
1747
+ );
1748
+ }
1749
+ let renderFallback = false;
1750
+ let fallbackIndex = -1;
1751
+ if (dataRouterState) {
1752
+ for (let i = 0; i < renderedMatches.length; i++) {
1753
+ let match = renderedMatches[i];
1754
+ if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
1755
+ fallbackIndex = i;
1756
+ }
1757
+ if (match.route.id) {
1758
+ let { loaderData, errors: errors2 } = dataRouterState;
1759
+ let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0);
1760
+ if (match.route.lazy || needsToRunLoader) {
1761
+ renderFallback = true;
1762
+ if (fallbackIndex >= 0) {
1763
+ renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
1764
+ } else {
1765
+ renderedMatches = [renderedMatches[0]];
1766
+ }
1767
+ break;
1768
+ }
1769
+ }
1770
+ }
1771
+ }
1772
+ return renderedMatches.reduceRight((outlet, match, index) => {
1773
+ let error;
1774
+ let shouldRenderHydrateFallback = false;
1775
+ let errorElement = null;
1776
+ let hydrateFallbackElement = null;
1777
+ if (dataRouterState) {
1778
+ error = errors && match.route.id ? errors[match.route.id] : void 0;
1779
+ errorElement = match.route.errorElement || defaultErrorElement;
1780
+ if (renderFallback) {
1781
+ if (fallbackIndex < 0 && index === 0) {
1782
+ warningOnce(
1783
+ "route-fallback",
1784
+ false,
1785
+ "No `HydrateFallback` element provided to render during initial hydration"
1786
+ );
1787
+ shouldRenderHydrateFallback = true;
1788
+ hydrateFallbackElement = null;
1789
+ } else if (fallbackIndex === index) {
1790
+ shouldRenderHydrateFallback = true;
1791
+ hydrateFallbackElement = match.route.hydrateFallbackElement || null;
1792
+ }
1793
+ }
1794
+ }
1795
+ let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
1796
+ let getChildren = () => {
1797
+ let children;
1798
+ if (error) {
1799
+ children = errorElement;
1800
+ } else if (shouldRenderHydrateFallback) {
1801
+ children = hydrateFallbackElement;
1802
+ } else if (match.route.Component) {
1803
+ children = /* @__PURE__ */ React.createElement(match.route.Component, null);
1804
+ } else if (match.route.element) {
1805
+ children = match.route.element;
1806
+ } else {
1807
+ children = outlet;
1808
+ }
1809
+ return /* @__PURE__ */ React.createElement(
1810
+ RenderedRoute,
1811
+ {
1812
+ match,
1813
+ routeContext: {
1814
+ outlet,
1815
+ matches: matches2,
1816
+ isDataRoute: dataRouterState != null
1817
+ },
1818
+ children
1819
+ }
1820
+ );
1821
+ };
1822
+ return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React.createElement(
1823
+ RenderErrorBoundary,
1824
+ {
1825
+ location: dataRouterState.location,
1826
+ revalidation: dataRouterState.revalidation,
1827
+ component: errorElement,
1828
+ error,
1829
+ children: getChildren(),
1830
+ routeContext: { outlet: null, matches: matches2, isDataRoute: true }
1831
+ }
1832
+ ) : getChildren();
1833
+ }, null);
1834
+ }
1835
+ function getDataRouterConsoleError(hookName) {
1836
+ return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1837
+ }
1838
+ function useDataRouterContext(hookName) {
1839
+ let ctx = React.useContext(DataRouterContext);
1840
+ invariant(ctx, getDataRouterConsoleError(hookName));
1841
+ return ctx;
1842
+ }
1843
+ function useDataRouterState(hookName) {
1844
+ let state = React.useContext(DataRouterStateContext);
1845
+ invariant(state, getDataRouterConsoleError(hookName));
1846
+ return state;
1847
+ }
1848
+ function useRouteContext(hookName) {
1849
+ let route = React.useContext(RouteContext);
1850
+ invariant(route, getDataRouterConsoleError(hookName));
1851
+ return route;
1852
+ }
1853
+ function useCurrentRouteId(hookName) {
1854
+ let route = useRouteContext(hookName);
1855
+ let thisRoute = route.matches[route.matches.length - 1];
1856
+ invariant(
1857
+ thisRoute.route.id,
1858
+ `${hookName} can only be used on routes that contain a unique "id"`
1859
+ );
1860
+ return thisRoute.route.id;
1861
+ }
1862
+ function useRouteId() {
1863
+ return useCurrentRouteId("useRouteId" /* UseRouteId */);
1864
+ }
1865
+ function useRouteError() {
1866
+ let error = React.useContext(RouteErrorContext);
1867
+ let state = useDataRouterState("useRouteError" /* UseRouteError */);
1868
+ let routeId = useCurrentRouteId("useRouteError" /* UseRouteError */);
1869
+ if (error !== void 0) {
1870
+ return error;
1871
+ }
1872
+ return state.errors?.[routeId];
1873
+ }
1874
+ function useNavigateStable() {
1875
+ let { router } = useDataRouterContext("useNavigate" /* UseNavigateStable */);
1876
+ let id = useCurrentRouteId("useNavigate" /* UseNavigateStable */);
1877
+ let activeRef = React.useRef(false);
1878
+ useIsomorphicLayoutEffect(() => {
1879
+ activeRef.current = true;
1880
+ });
1881
+ let navigate = React.useCallback(
1882
+ async (to, options = {}) => {
1883
+ warning(activeRef.current, navigateEffectWarning);
1884
+ if (!activeRef.current) return;
1885
+ if (typeof to === "number") {
1886
+ router.navigate(to);
1887
+ } else {
1888
+ await router.navigate(to, { fromRouteId: id, ...options });
1889
+ }
1890
+ },
1891
+ [router, id]
1892
+ );
1893
+ return navigate;
1894
+ }
1895
+ var alreadyWarned = {};
1896
+ function warningOnce(key, cond, message) {
1897
+ if (!cond && !alreadyWarned[key]) {
1898
+ alreadyWarned[key] = true;
1899
+ warning(false, message);
1900
+ }
1901
+ }
1902
+ React.memo(DataRoutes);
1903
+ function DataRoutes({
1904
+ routes,
1905
+ future,
1906
+ state
1907
+ }) {
1908
+ return useRoutesImpl(routes, void 0, state, future);
1909
+ }
1910
+
1911
+ // lib/dom/dom.ts
1912
+ var defaultMethod = "get";
1913
+ var defaultEncType = "application/x-www-form-urlencoded";
1914
+ function isHtmlElement(object) {
1915
+ return object != null && typeof object.tagName === "string";
1916
+ }
1917
+ function isButtonElement(object) {
1918
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
1919
+ }
1920
+ function isFormElement(object) {
1921
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
1922
+ }
1923
+ function isInputElement(object) {
1924
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
1925
+ }
1926
+ function isModifiedEvent(event) {
1927
+ return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
1928
+ }
1929
+ function shouldProcessLinkClick(event, target) {
1930
+ return event.button === 0 && // Ignore everything but left clicks
1931
+ (!target || target === "_self") && // Let browser handle "target=_blank" etc.
1932
+ !isModifiedEvent(event);
1933
+ }
1934
+ var _formDataSupportsSubmitter = null;
1935
+ function isFormDataSubmitterSupported() {
1936
+ if (_formDataSupportsSubmitter === null) {
1937
+ try {
1938
+ new FormData(
1939
+ document.createElement("form"),
1940
+ // @ts-expect-error if FormData supports the submitter parameter, this will throw
1941
+ 0
1942
+ );
1943
+ _formDataSupportsSubmitter = false;
1944
+ } catch (e) {
1945
+ _formDataSupportsSubmitter = true;
1946
+ }
1947
+ }
1948
+ return _formDataSupportsSubmitter;
1949
+ }
1950
+ var supportedFormEncTypes = /* @__PURE__ */ new Set([
1951
+ "application/x-www-form-urlencoded",
1952
+ "multipart/form-data",
1953
+ "text/plain"
1954
+ ]);
1955
+ function getFormEncType(encType) {
1956
+ if (encType != null && !supportedFormEncTypes.has(encType)) {
1957
+ warning(
1958
+ false,
1959
+ `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
1960
+ );
1961
+ return null;
1962
+ }
1963
+ return encType;
1964
+ }
1965
+ function getFormSubmissionInfo(target, basename) {
1966
+ let method;
1967
+ let action;
1968
+ let encType;
1969
+ let formData;
1970
+ let body;
1971
+ if (isFormElement(target)) {
1972
+ let attr = target.getAttribute("action");
1973
+ action = attr ? stripBasename(attr, basename) : null;
1974
+ method = target.getAttribute("method") || defaultMethod;
1975
+ encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
1976
+ formData = new FormData(target);
1977
+ } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
1978
+ let form = target.form;
1979
+ if (form == null) {
1980
+ throw new Error(
1981
+ `Cannot submit a <button> or <input type="submit"> without a <form>`
1982
+ );
1983
+ }
1984
+ let attr = target.getAttribute("formaction") || form.getAttribute("action");
1985
+ action = attr ? stripBasename(attr, basename) : null;
1986
+ method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
1987
+ encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
1988
+ formData = new FormData(form, target);
1989
+ if (!isFormDataSubmitterSupported()) {
1990
+ let { name, type, value } = target;
1991
+ if (type === "image") {
1992
+ let prefix = name ? `${name}.` : "";
1993
+ formData.append(`${prefix}x`, "0");
1994
+ formData.append(`${prefix}y`, "0");
1995
+ } else if (name) {
1996
+ formData.append(name, value);
1997
+ }
1998
+ }
1999
+ } else if (isHtmlElement(target)) {
2000
+ throw new Error(
2001
+ `Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
2002
+ );
2003
+ } else {
2004
+ method = defaultMethod;
2005
+ action = null;
2006
+ encType = defaultEncType;
2007
+ body = target;
2008
+ }
2009
+ if (formData && encType === "text/plain") {
2010
+ body = formData;
2011
+ formData = void 0;
2012
+ }
2013
+ return { action, method: method.toLowerCase(), encType, formData, body };
2014
+ }
2015
+
2016
+ // lib/dom/ssr/invariant.ts
2017
+ function invariant2(value, message) {
2018
+ if (value === false || value === null || typeof value === "undefined") {
2019
+ throw new Error(message);
2020
+ }
2021
+ }
2022
+
2023
+ // lib/dom/ssr/routeModules.ts
2024
+ async function loadRouteModule(route, routeModulesCache) {
2025
+ if (route.id in routeModulesCache) {
2026
+ return routeModulesCache[route.id];
2027
+ }
2028
+ try {
2029
+ let routeModule = await import(
2030
+ /* @vite-ignore */
2031
+ /* webpackIgnore: true */
2032
+ route.module
2033
+ );
2034
+ routeModulesCache[route.id] = routeModule;
2035
+ return routeModule;
2036
+ } catch (error) {
2037
+ console.error(
2038
+ `Error loading route module \`${route.module}\`, reloading page...`
2039
+ );
2040
+ console.error(error);
2041
+ if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
2042
+ import.meta.hot) {
2043
+ throw error;
2044
+ }
2045
+ window.location.reload();
2046
+ return new Promise(() => {
2047
+ });
2048
+ }
2049
+ }
2050
+ function isHtmlLinkDescriptor(object) {
2051
+ if (object == null) {
2052
+ return false;
2053
+ }
2054
+ if (object.href == null) {
2055
+ return object.rel === "preload" && typeof object.imageSrcSet === "string" && typeof object.imageSizes === "string";
2056
+ }
2057
+ return typeof object.rel === "string" && typeof object.href === "string";
2058
+ }
2059
+ async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
2060
+ let links = await Promise.all(
2061
+ matches.map(async (match) => {
2062
+ let route = manifest.routes[match.route.id];
2063
+ if (route) {
2064
+ let mod = await loadRouteModule(route, routeModules);
2065
+ return mod.links ? mod.links() : [];
2066
+ }
2067
+ return [];
2068
+ })
2069
+ );
2070
+ return dedupeLinkDescriptors(
2071
+ links.flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map(
2072
+ (link) => link.rel === "stylesheet" ? { ...link, rel: "prefetch", as: "style" } : { ...link, rel: "prefetch" }
2073
+ )
2074
+ );
2075
+ }
2076
+ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {
2077
+ let isNew = (match, index) => {
2078
+ if (!currentMatches[index]) return true;
2079
+ return match.route.id !== currentMatches[index].route.id;
2080
+ };
2081
+ let matchPathChanged = (match, index) => {
2082
+ return (
2083
+ // param change, /users/123 -> /users/456
2084
+ currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
2085
+ // e.g. /files/images/avatar.jpg -> files/finances.xls
2086
+ currentMatches[index].route.path?.endsWith("*") && currentMatches[index].params["*"] !== match.params["*"]
2087
+ );
2088
+ };
2089
+ if (mode === "assets") {
2090
+ return nextMatches.filter(
2091
+ (match, index) => isNew(match, index) || matchPathChanged(match, index)
2092
+ );
2093
+ }
2094
+ if (mode === "data") {
2095
+ return nextMatches.filter((match, index) => {
2096
+ let manifestRoute = manifest.routes[match.route.id];
2097
+ if (!manifestRoute || !manifestRoute.hasLoader) {
2098
+ return false;
2099
+ }
2100
+ if (isNew(match, index) || matchPathChanged(match, index)) {
2101
+ return true;
2102
+ }
2103
+ if (match.route.shouldRevalidate) {
2104
+ let routeChoice = match.route.shouldRevalidate({
2105
+ currentUrl: new URL(
2106
+ location.pathname + location.search + location.hash,
2107
+ window.origin
2108
+ ),
2109
+ currentParams: currentMatches[0]?.params || {},
2110
+ nextUrl: new URL(page, window.origin),
2111
+ nextParams: match.params,
2112
+ defaultShouldRevalidate: true
2113
+ });
2114
+ if (typeof routeChoice === "boolean") {
2115
+ return routeChoice;
2116
+ }
2117
+ }
2118
+ return true;
2119
+ });
2120
+ }
2121
+ return [];
2122
+ }
2123
+ function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
2124
+ return dedupeHrefs(
2125
+ matches.map((match) => {
2126
+ let route = manifest.routes[match.route.id];
2127
+ if (!route) return [];
2128
+ let hrefs = [route.module];
2129
+ if (route.clientActionModule) {
2130
+ hrefs = hrefs.concat(route.clientActionModule);
2131
+ }
2132
+ if (route.clientLoaderModule) {
2133
+ hrefs = hrefs.concat(route.clientLoaderModule);
2134
+ }
2135
+ if (includeHydrateFallback && route.hydrateFallbackModule) {
2136
+ hrefs = hrefs.concat(route.hydrateFallbackModule);
2137
+ }
2138
+ if (route.imports) {
2139
+ hrefs = hrefs.concat(route.imports);
2140
+ }
2141
+ return hrefs;
2142
+ }).flat(1)
2143
+ );
2144
+ }
2145
+ function dedupeHrefs(hrefs) {
2146
+ return [...new Set(hrefs)];
2147
+ }
2148
+ function sortKeys(obj) {
2149
+ let sorted = {};
2150
+ let keys = Object.keys(obj).sort();
2151
+ for (let key of keys) {
2152
+ sorted[key] = obj[key];
2153
+ }
2154
+ return sorted;
2155
+ }
2156
+ function dedupeLinkDescriptors(descriptors, preloads) {
2157
+ let set = /* @__PURE__ */ new Set();
2158
+ new Set(preloads);
2159
+ return descriptors.reduce((deduped, descriptor) => {
2160
+ let key = JSON.stringify(sortKeys(descriptor));
2161
+ if (!set.has(key)) {
2162
+ set.add(key);
2163
+ deduped.push({ key, link: descriptor });
2164
+ }
2165
+ return deduped;
2166
+ }, []);
2167
+ }
2168
+ function singleFetchUrl(reqUrl, basename) {
2169
+ let url = typeof reqUrl === "string" ? new URL(
2170
+ reqUrl,
2171
+ // This can be called during the SSR flow via PrefetchPageLinksImpl so
2172
+ // don't assume window is available
2173
+ typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
2174
+ ) : reqUrl;
2175
+ if (url.pathname === "/") {
2176
+ url.pathname = "_root.data";
2177
+ } else if (basename && stripBasename(url.pathname, basename) === "/") {
2178
+ url.pathname = `${basename.replace(/\/$/, "")}/_root.data`;
2179
+ } else {
2180
+ url.pathname = `${url.pathname.replace(/\/$/, "")}.data`;
2181
+ }
2182
+ return url;
2183
+ }
2184
+
2185
+ // lib/dom/ssr/components.tsx
2186
+ function useDataRouterContext2() {
2187
+ let context = React.useContext(DataRouterContext);
2188
+ invariant2(
2189
+ context,
2190
+ "You must render this element inside a <DataRouterContext.Provider> element"
2191
+ );
2192
+ return context;
2193
+ }
2194
+ function useDataRouterStateContext() {
2195
+ let context = React.useContext(DataRouterStateContext);
2196
+ invariant2(
2197
+ context,
2198
+ "You must render this element inside a <DataRouterStateContext.Provider> element"
2199
+ );
2200
+ return context;
2201
+ }
2202
+ var FrameworkContext = React.createContext(void 0);
2203
+ FrameworkContext.displayName = "FrameworkContext";
2204
+ function useFrameworkContext() {
2205
+ let context = React.useContext(FrameworkContext);
2206
+ invariant2(
2207
+ context,
2208
+ "You must render this element inside a <HydratedRouter> element"
2209
+ );
2210
+ return context;
2211
+ }
2212
+ function usePrefetchBehavior(prefetch, theirElementProps) {
2213
+ let frameworkContext = React.useContext(FrameworkContext);
2214
+ let [maybePrefetch, setMaybePrefetch] = React.useState(false);
2215
+ let [shouldPrefetch, setShouldPrefetch] = React.useState(false);
2216
+ let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
2217
+ let ref = React.useRef(null);
2218
+ React.useEffect(() => {
2219
+ if (prefetch === "render") {
2220
+ setShouldPrefetch(true);
2221
+ }
2222
+ if (prefetch === "viewport") {
2223
+ let callback = (entries) => {
2224
+ entries.forEach((entry) => {
2225
+ setShouldPrefetch(entry.isIntersecting);
2226
+ });
2227
+ };
2228
+ let observer = new IntersectionObserver(callback, { threshold: 0.5 });
2229
+ if (ref.current) observer.observe(ref.current);
2230
+ return () => {
2231
+ observer.disconnect();
2232
+ };
2233
+ }
2234
+ }, [prefetch]);
2235
+ React.useEffect(() => {
2236
+ if (maybePrefetch) {
2237
+ let id = setTimeout(() => {
2238
+ setShouldPrefetch(true);
2239
+ }, 100);
2240
+ return () => {
2241
+ clearTimeout(id);
2242
+ };
2243
+ }
2244
+ }, [maybePrefetch]);
2245
+ let setIntent = () => {
2246
+ setMaybePrefetch(true);
2247
+ };
2248
+ let cancelIntent = () => {
2249
+ setMaybePrefetch(false);
2250
+ setShouldPrefetch(false);
2251
+ };
2252
+ if (!frameworkContext) {
2253
+ return [false, ref, {}];
2254
+ }
2255
+ if (prefetch !== "intent") {
2256
+ return [shouldPrefetch, ref, {}];
2257
+ }
2258
+ return [
2259
+ shouldPrefetch,
2260
+ ref,
2261
+ {
2262
+ onFocus: composeEventHandlers(onFocus, setIntent),
2263
+ onBlur: composeEventHandlers(onBlur, cancelIntent),
2264
+ onMouseEnter: composeEventHandlers(onMouseEnter, setIntent),
2265
+ onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),
2266
+ onTouchStart: composeEventHandlers(onTouchStart, setIntent)
2267
+ }
2268
+ ];
2269
+ }
2270
+ function composeEventHandlers(theirHandler, ourHandler) {
2271
+ return (event) => {
2272
+ theirHandler && theirHandler(event);
2273
+ if (!event.defaultPrevented) {
2274
+ ourHandler(event);
2275
+ }
2276
+ };
2277
+ }
2278
+ function PrefetchPageLinks({
2279
+ page,
2280
+ ...dataLinkProps
2281
+ }) {
2282
+ let { router } = useDataRouterContext2();
2283
+ let matches = React.useMemo(
2284
+ () => matchRoutes(router.routes, page, router.basename),
2285
+ [router.routes, page, router.basename]
2286
+ );
2287
+ if (!matches) {
2288
+ return null;
2289
+ }
2290
+ return /* @__PURE__ */ React.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
2291
+ }
2292
+ function useKeyedPrefetchLinks(matches) {
2293
+ let { manifest, routeModules } = useFrameworkContext();
2294
+ let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React.useState([]);
2295
+ React.useEffect(() => {
2296
+ let interrupted = false;
2297
+ void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
2298
+ (links) => {
2299
+ if (!interrupted) {
2300
+ setKeyedPrefetchLinks(links);
2301
+ }
2302
+ }
2303
+ );
2304
+ return () => {
2305
+ interrupted = true;
2306
+ };
2307
+ }, [matches, manifest, routeModules]);
2308
+ return keyedPrefetchLinks;
2309
+ }
2310
+ function PrefetchPageLinksImpl({
2311
+ page,
2312
+ matches: nextMatches,
2313
+ ...linkProps
2314
+ }) {
2315
+ let location = useLocation();
2316
+ let { manifest, routeModules } = useFrameworkContext();
2317
+ let { basename } = useDataRouterContext2();
2318
+ let { loaderData, matches } = useDataRouterStateContext();
2319
+ let newMatchesForData = React.useMemo(
2320
+ () => getNewMatchesForLinks(
2321
+ page,
2322
+ nextMatches,
2323
+ matches,
2324
+ manifest,
2325
+ location,
2326
+ "data"
2327
+ ),
2328
+ [page, nextMatches, matches, manifest, location]
2329
+ );
2330
+ let newMatchesForAssets = React.useMemo(
2331
+ () => getNewMatchesForLinks(
2332
+ page,
2333
+ nextMatches,
2334
+ matches,
2335
+ manifest,
2336
+ location,
2337
+ "assets"
2338
+ ),
2339
+ [page, nextMatches, matches, manifest, location]
2340
+ );
2341
+ let dataHrefs = React.useMemo(() => {
2342
+ if (page === location.pathname + location.search + location.hash) {
2343
+ return [];
2344
+ }
2345
+ let routesParams = /* @__PURE__ */ new Set();
2346
+ let foundOptOutRoute = false;
2347
+ nextMatches.forEach((m) => {
2348
+ let manifestRoute = manifest.routes[m.route.id];
2349
+ if (!manifestRoute || !manifestRoute.hasLoader) {
2350
+ return;
2351
+ }
2352
+ if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && routeModules[m.route.id]?.shouldRevalidate) {
2353
+ foundOptOutRoute = true;
2354
+ } else if (manifestRoute.hasClientLoader) {
2355
+ foundOptOutRoute = true;
2356
+ } else {
2357
+ routesParams.add(m.route.id);
2358
+ }
2359
+ });
2360
+ if (routesParams.size === 0) {
2361
+ return [];
2362
+ }
2363
+ let url = singleFetchUrl(page, basename);
2364
+ if (foundOptOutRoute && routesParams.size > 0) {
2365
+ url.searchParams.set(
2366
+ "_routes",
2367
+ nextMatches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(",")
2368
+ );
2369
+ }
2370
+ return [url.pathname + url.search];
2371
+ }, [
2372
+ basename,
2373
+ loaderData,
2374
+ location,
2375
+ manifest,
2376
+ newMatchesForData,
2377
+ nextMatches,
2378
+ page,
2379
+ routeModules
2380
+ ]);
2381
+ let moduleHrefs = React.useMemo(
2382
+ () => getModuleLinkHrefs(newMatchesForAssets, manifest),
2383
+ [newMatchesForAssets, manifest]
2384
+ );
2385
+ let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
2386
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, dataHrefs.map((href2) => /* @__PURE__ */ React.createElement("link", { key: href2, rel: "prefetch", as: "fetch", href: href2, ...linkProps })), moduleHrefs.map((href2) => /* @__PURE__ */ React.createElement("link", { key: href2, rel: "modulepreload", href: href2, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
2387
+ // these don't spread `linkProps` because they are full link descriptors
2388
+ // already with their own props
2389
+ /* @__PURE__ */ React.createElement("link", { key, ...link })
2390
+ )));
2391
+ }
2392
+ function mergeRefs(...refs) {
2393
+ return (value) => {
2394
+ refs.forEach((ref) => {
2395
+ if (typeof ref === "function") {
2396
+ ref(value);
2397
+ } else if (ref != null) {
2398
+ ref.current = value;
2399
+ }
2400
+ });
2401
+ };
2402
+ }
2403
+
2404
+ // lib/dom/lib.tsx
2405
+ var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
2406
+ try {
2407
+ if (isBrowser) {
2408
+ window.__reactRouterVersion = "7.3.0";
2409
+ }
2410
+ } catch (e) {
2411
+ }
2412
+ var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
2413
+ var Link = React.forwardRef(
2414
+ function LinkWithRef({
2415
+ onClick,
2416
+ discover = "render",
2417
+ prefetch = "none",
2418
+ relative,
2419
+ reloadDocument,
2420
+ replace: replace2,
2421
+ state,
2422
+ target,
2423
+ to,
2424
+ preventScrollReset,
2425
+ viewTransition,
2426
+ ...rest
2427
+ }, forwardedRef) {
2428
+ let { basename } = React.useContext(NavigationContext);
2429
+ let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
2430
+ let absoluteHref;
2431
+ let isExternal = false;
2432
+ if (typeof to === "string" && isAbsolute) {
2433
+ absoluteHref = to;
2434
+ if (isBrowser) {
2435
+ try {
2436
+ let currentUrl = new URL(window.location.href);
2437
+ let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
2438
+ let path = stripBasename(targetUrl.pathname, basename);
2439
+ if (targetUrl.origin === currentUrl.origin && path != null) {
2440
+ to = path + targetUrl.search + targetUrl.hash;
2441
+ } else {
2442
+ isExternal = true;
2443
+ }
2444
+ } catch (e) {
2445
+ warning(
2446
+ false,
2447
+ `<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
2448
+ );
2449
+ }
2450
+ }
2451
+ }
2452
+ let href2 = useHref(to, { relative });
2453
+ let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
2454
+ prefetch,
2455
+ rest
2456
+ );
2457
+ let internalOnClick = useLinkClickHandler(to, {
2458
+ replace: replace2,
2459
+ state,
2460
+ target,
2461
+ preventScrollReset,
2462
+ relative,
2463
+ viewTransition
2464
+ });
2465
+ function handleClick(event) {
2466
+ if (onClick) onClick(event);
2467
+ if (!event.defaultPrevented) {
2468
+ internalOnClick(event);
2469
+ }
2470
+ }
2471
+ let link = (
2472
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
2473
+ /* @__PURE__ */ React.createElement(
2474
+ "a",
2475
+ {
2476
+ ...rest,
2477
+ ...prefetchHandlers,
2478
+ href: absoluteHref || href2,
2479
+ onClick: isExternal || reloadDocument ? onClick : handleClick,
2480
+ ref: mergeRefs(forwardedRef, prefetchRef),
2481
+ target,
2482
+ "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
2483
+ }
2484
+ )
2485
+ );
2486
+ return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(PrefetchPageLinks, { page: href2 })) : link;
2487
+ }
2488
+ );
2489
+ Link.displayName = "Link";
2490
+ var NavLink = React.forwardRef(
2491
+ function NavLinkWithRef({
2492
+ "aria-current": ariaCurrentProp = "page",
2493
+ caseSensitive = false,
2494
+ className: classNameProp = "",
2495
+ end = false,
2496
+ style: styleProp,
2497
+ to,
2498
+ viewTransition,
2499
+ children,
2500
+ ...rest
2501
+ }, ref) {
2502
+ let path = useResolvedPath(to, { relative: rest.relative });
2503
+ let location = useLocation();
2504
+ let routerState = React.useContext(DataRouterStateContext);
2505
+ let { navigator: navigator2, basename } = React.useContext(NavigationContext);
2506
+ let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
2507
+ // eslint-disable-next-line react-hooks/rules-of-hooks
2508
+ useViewTransitionState(path) && viewTransition === true;
2509
+ let toPathname = navigator2.encodeLocation ? navigator2.encodeLocation(path).pathname : path.pathname;
2510
+ let locationPathname = location.pathname;
2511
+ let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
2512
+ if (!caseSensitive) {
2513
+ locationPathname = locationPathname.toLowerCase();
2514
+ nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
2515
+ toPathname = toPathname.toLowerCase();
2516
+ }
2517
+ if (nextLocationPathname && basename) {
2518
+ nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
2519
+ }
2520
+ const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
2521
+ let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
2522
+ let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
2523
+ let renderProps = {
2524
+ isActive,
2525
+ isPending,
2526
+ isTransitioning
2527
+ };
2528
+ let ariaCurrent = isActive ? ariaCurrentProp : void 0;
2529
+ let className;
2530
+ if (typeof classNameProp === "function") {
2531
+ className = classNameProp(renderProps);
2532
+ } else {
2533
+ className = [
2534
+ classNameProp,
2535
+ isActive ? "active" : null,
2536
+ isPending ? "pending" : null,
2537
+ isTransitioning ? "transitioning" : null
2538
+ ].filter(Boolean).join(" ");
2539
+ }
2540
+ let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
2541
+ return /* @__PURE__ */ React.createElement(
2542
+ Link,
2543
+ {
2544
+ ...rest,
2545
+ "aria-current": ariaCurrent,
2546
+ className,
2547
+ ref,
2548
+ style,
2549
+ to,
2550
+ viewTransition
2551
+ },
2552
+ typeof children === "function" ? children(renderProps) : children
2553
+ );
2554
+ }
2555
+ );
2556
+ NavLink.displayName = "NavLink";
2557
+ var Form = React.forwardRef(
2558
+ ({
2559
+ discover = "render",
2560
+ fetcherKey,
2561
+ navigate,
2562
+ reloadDocument,
2563
+ replace: replace2,
2564
+ state,
2565
+ method = defaultMethod,
2566
+ action,
2567
+ onSubmit,
2568
+ relative,
2569
+ preventScrollReset,
2570
+ viewTransition,
2571
+ ...props
2572
+ }, forwardedRef) => {
2573
+ let submit = useSubmit();
2574
+ let formAction = useFormAction(action, { relative });
2575
+ let formMethod = method.toLowerCase() === "get" ? "get" : "post";
2576
+ let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX2.test(action);
2577
+ let submitHandler = (event) => {
2578
+ onSubmit && onSubmit(event);
2579
+ if (event.defaultPrevented) return;
2580
+ event.preventDefault();
2581
+ let submitter = event.nativeEvent.submitter;
2582
+ let submitMethod = submitter?.getAttribute("formmethod") || method;
2583
+ submit(submitter || event.currentTarget, {
2584
+ fetcherKey,
2585
+ method: submitMethod,
2586
+ navigate,
2587
+ replace: replace2,
2588
+ state,
2589
+ relative,
2590
+ preventScrollReset,
2591
+ viewTransition
2592
+ });
2593
+ };
2594
+ return /* @__PURE__ */ React.createElement(
2595
+ "form",
2596
+ {
2597
+ ref: forwardedRef,
2598
+ method: formMethod,
2599
+ action: formAction,
2600
+ onSubmit: reloadDocument ? onSubmit : submitHandler,
2601
+ ...props,
2602
+ "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
2603
+ }
2604
+ );
2605
+ }
2606
+ );
2607
+ Form.displayName = "Form";
2608
+ function getDataRouterConsoleError2(hookName) {
2609
+ return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
2610
+ }
2611
+ function useDataRouterContext3(hookName) {
2612
+ let ctx = React.useContext(DataRouterContext);
2613
+ invariant(ctx, getDataRouterConsoleError2(hookName));
2614
+ return ctx;
2615
+ }
2616
+ function useLinkClickHandler(to, {
2617
+ target,
2618
+ replace: replaceProp,
2619
+ state,
2620
+ preventScrollReset,
2621
+ relative,
2622
+ viewTransition
2623
+ } = {}) {
2624
+ let navigate = useNavigate();
2625
+ let location = useLocation();
2626
+ let path = useResolvedPath(to, { relative });
2627
+ return React.useCallback(
2628
+ (event) => {
2629
+ if (shouldProcessLinkClick(event, target)) {
2630
+ event.preventDefault();
2631
+ let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
2632
+ navigate(to, {
2633
+ replace: replace2,
2634
+ state,
2635
+ preventScrollReset,
2636
+ relative,
2637
+ viewTransition
2638
+ });
2639
+ }
2640
+ },
2641
+ [
2642
+ location,
2643
+ navigate,
2644
+ path,
2645
+ replaceProp,
2646
+ state,
2647
+ target,
2648
+ to,
2649
+ preventScrollReset,
2650
+ relative,
2651
+ viewTransition
2652
+ ]
2653
+ );
2654
+ }
2655
+ var fetcherId = 0;
2656
+ var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
2657
+ function useSubmit() {
2658
+ let { router } = useDataRouterContext3("useSubmit" /* UseSubmit */);
2659
+ let { basename } = React.useContext(NavigationContext);
2660
+ let currentRouteId = useRouteId();
2661
+ return React.useCallback(
2662
+ async (target, options = {}) => {
2663
+ let { action, method, encType, formData, body } = getFormSubmissionInfo(
2664
+ target,
2665
+ basename
2666
+ );
2667
+ if (options.navigate === false) {
2668
+ let key = options.fetcherKey || getUniqueFetcherId();
2669
+ await router.fetch(key, currentRouteId, options.action || action, {
2670
+ preventScrollReset: options.preventScrollReset,
2671
+ formData,
2672
+ body,
2673
+ formMethod: options.method || method,
2674
+ formEncType: options.encType || encType,
2675
+ flushSync: options.flushSync
2676
+ });
2677
+ } else {
2678
+ await router.navigate(options.action || action, {
2679
+ preventScrollReset: options.preventScrollReset,
2680
+ formData,
2681
+ body,
2682
+ formMethod: options.method || method,
2683
+ formEncType: options.encType || encType,
2684
+ replace: options.replace,
2685
+ state: options.state,
2686
+ fromRouteId: currentRouteId,
2687
+ flushSync: options.flushSync,
2688
+ viewTransition: options.viewTransition
2689
+ });
2690
+ }
2691
+ },
2692
+ [router, basename, currentRouteId]
2693
+ );
2694
+ }
2695
+ function useFormAction(action, { relative } = {}) {
2696
+ let { basename } = React.useContext(NavigationContext);
2697
+ let routeContext = React.useContext(RouteContext);
2698
+ invariant(routeContext, "useFormAction must be used inside a RouteContext");
2699
+ let [match] = routeContext.matches.slice(-1);
2700
+ let path = { ...useResolvedPath(action ? action : ".", { relative }) };
2701
+ let location = useLocation();
2702
+ if (action == null) {
2703
+ path.search = location.search;
2704
+ let params = new URLSearchParams(path.search);
2705
+ let indexValues = params.getAll("index");
2706
+ let hasNakedIndexParam = indexValues.some((v) => v === "");
2707
+ if (hasNakedIndexParam) {
2708
+ params.delete("index");
2709
+ indexValues.filter((v) => v).forEach((v) => params.append("index", v));
2710
+ let qs = params.toString();
2711
+ path.search = qs ? `?${qs}` : "";
2712
+ }
2713
+ }
2714
+ if ((!action || action === ".") && match.route.index) {
2715
+ path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
2716
+ }
2717
+ if (basename !== "/") {
2718
+ path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
2719
+ }
2720
+ return createPath(path);
2721
+ }
2722
+ function useViewTransitionState(to, opts = {}) {
2723
+ let vtContext = React.useContext(ViewTransitionContext);
2724
+ invariant(
2725
+ vtContext != null,
2726
+ "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
2727
+ );
2728
+ let { basename } = useDataRouterContext3(
2729
+ "useViewTransitionState" /* useViewTransitionState */
2730
+ );
2731
+ let path = useResolvedPath(to, { relative: opts.relative });
2732
+ if (!vtContext.isTransitioning) {
2733
+ return false;
2734
+ }
2735
+ let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
2736
+ let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
2737
+ return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
2738
+ }
2739
+
2740
+ // lib/server-runtime/crypto.ts
2741
+ new TextEncoder();
2742
+
2743
+ const SectionHeader = ({
2744
+ label,
2745
+ title,
2746
+ promoteTitle = false,
2747
+ titleComponent,
2748
+ subtitle,
2749
+ actions,
2750
+ className,
2751
+ ...props
2752
+ }) => {
2753
+ return /*#__PURE__*/React__default.createElement("div", _extends({
2754
+ className: classnames(['section_header', className])
2755
+ }, props), label ? /*#__PURE__*/React__default.createElement(Text, {
2756
+ className: classnames('section_label')
2757
+ }, label) : null, /*#__PURE__*/React__default.createElement(Text, {
2758
+ className: "section_title",
2759
+ component: titleComponent || (promoteTitle ? 'h1' : 'h2')
2760
+ }, title), subtitle ? /*#__PURE__*/React__default.createElement(Text, {
2761
+ className: classnames('section_subtitle')
2762
+ }, subtitle) : null, actions ? /*#__PURE__*/React__default.createElement("div", {
2763
+ className: "section_actions"
2764
+ }, actions) : null);
2765
+ };
2766
+ SectionHeader.propTypes = {
2767
+ label: PropTypes.string,
2768
+ title: PropTypes.string.isRequired,
2769
+ promoteTitle: PropTypes.bool,
2770
+ titleComponent: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p']).isRequired,
2771
+ subtitle: PropTypes.string,
2772
+ actions: PropTypes.node,
2773
+ className: PropTypes.node
2774
+ };
2775
+
2776
+ const Section = ({
2777
+ align = 'left',
2778
+ color = 'default',
2779
+ landing,
2780
+ header,
2781
+ className,
2782
+ children,
2783
+ ...props
2784
+ }) => {
2785
+ return /*#__PURE__*/React__default.createElement("div", _extends({
2786
+ className: classnames(['section', {
2787
+ [`section-${align}`]: align,
2788
+ [`section-${color}`]: color,
2789
+ 'section-landing': landing,
2790
+ 'section-header': header
2791
+ }, className])
2792
+ }, props), /*#__PURE__*/React__default.createElement("div", {
2793
+ className: 'section_container'
2794
+ }, React__default.Children.map(children, child => {
2795
+ if (/*#__PURE__*/React__default.isValidElement(child) && child.type === SectionHeader) {
2796
+ return /*#__PURE__*/React__default.cloneElement(child, {
2797
+ promoteTitle: landing || header
2798
+ });
2799
+ }
2800
+ return child;
2801
+ })));
2802
+ };
2803
+ Section.propTypes = {
2804
+ align: PropTypes.oneOf(['left', 'center', 'right']),
2805
+ color: PropTypes.oneOf(['default', 'paper', 'primary', 'primaryLight']),
2806
+ landing: PropTypes.bool,
2807
+ header: PropTypes.bool,
2808
+ className: PropTypes.node,
2809
+ children: PropTypes.node.isRequired
2810
+ };
2811
+
2812
+ const NavBar = ({
2813
+ homeLinkComponent,
2814
+ align,
2815
+ className,
2816
+ children,
2817
+ ...props
2818
+ }) => {
2819
+ const [isOpen, setIsOpen] = useState(false);
2820
+ const toggleNav = () => {
2821
+ setIsOpen(!isOpen);
2822
+ document.body.classList.toggle('js-navbar', !isOpen);
2823
+ };
2824
+ const HomeLinkComponent = homeLinkComponent || Link;
2825
+ return /*#__PURE__*/React__default.createElement("header", null, /*#__PURE__*/React__default.createElement(Section, _extends({
2826
+ className: classnames(['navbar', {
2827
+ [`navbar-${align}`]: align,
2828
+ 'js-opened': isOpen
2829
+ }, className])
2830
+ }, props), /*#__PURE__*/React__default.createElement("div", {
2831
+ className: "navbar_main"
2832
+ }, /*#__PURE__*/React__default.createElement(HomeLinkComponent, {
2833
+ to: "/",
2834
+ exact: true,
2835
+ className: "navbar_logo"
2836
+ }, /*#__PURE__*/React__default.createElement("img", {
2837
+ src: "https://pallote.com/logos/pallote-logo.svg",
2838
+ alt: "Logo for Pallote"
2839
+ })), /*#__PURE__*/React__default.createElement("button", {
2840
+ "aria-label": "Open mobile menu",
2841
+ className: classnames('navbar_button', {
2842
+ 'js-opened': isOpen
2843
+ }),
2844
+ onClick: toggleNav
2845
+ }, /*#__PURE__*/React__default.createElement("span", null))), /*#__PURE__*/React__default.createElement("nav", {
2846
+ "aria-label": "main-nav",
2847
+ className: classnames('navbar_nav nav', {
2848
+ 'js-opened': isOpen
2849
+ })
2850
+ }, /*#__PURE__*/React__default.createElement("div", {
2851
+ className: "nav_container"
2852
+ }, children))));
2853
+ };
2854
+ NavBar.propTypes = {
2855
+ align: PropTypes.oneOf(['left', 'right']),
2856
+ className: PropTypes.node,
2857
+ children: PropTypes.node.isRequired
2858
+ };
2859
+
2860
+ const NavItem = ({
2861
+ component,
2862
+ label,
2863
+ active,
2864
+ dropdown,
2865
+ icon,
2866
+ end,
2867
+ to,
2868
+ className,
2869
+ ...props
2870
+ }) => {
2871
+ const dropdownRef = useRef(null);
2872
+ const [isExpanded, setIsExpanded] = useState(false);
2873
+ const onClick = () => setIsExpanded(!isExpanded);
2874
+ let Component;
2875
+ if (dropdown) {
2876
+ Component = 'button';
2877
+ } else {
2878
+ Component = component || Link;
2879
+ }
2880
+ return /*#__PURE__*/React__default.createElement("div", {
2881
+ className: classnames(['nav_item', {
2882
+ 'nav_item-dropdown': dropdown,
2883
+ 'js-show': isExpanded
2884
+ }, className])
2885
+ }, /*#__PURE__*/React__default.createElement(Component, _extends({
2886
+ end: end,
2887
+ to: to,
2888
+ className: classnames(['nav_trigger', {
2889
+ 'nav_trigger-active': active
2890
+ }]),
2891
+ onClick: onClick
2892
+ }, props), icon ? /*#__PURE__*/React__default.createElement("span", {
2893
+ className: classnames('nav_icon')
2894
+ }, icon) : null, label), dropdown ? /*#__PURE__*/React__default.createElement("div", {
2895
+ ref: dropdownRef,
2896
+ className: "nav_target"
2897
+ }, dropdown) : null);
2898
+ };
2899
+ NavItem.propTypes = {
2900
+ label: PropTypes.string.isRequired,
2901
+ active: PropTypes.bool,
2902
+ dropdown: PropTypes.object,
2903
+ icon: PropTypes.node,
2904
+ end: PropTypes.node,
2905
+ to: PropTypes.node,
2906
+ className: PropTypes.node
2907
+ };
2908
+
2909
+ const Radio = ({
2910
+ id,
2911
+ name,
2912
+ value,
2913
+ label,
2914
+ checked,
2915
+ disabled,
2916
+ optional,
2917
+ className,
2918
+ ...props
2919
+ }) => {
2920
+ return /*#__PURE__*/React__default.createElement("div", {
2921
+ className: classnames(['radio', {
2922
+ 'radio-disabled': disabled
2923
+ }, className])
2924
+ }, /*#__PURE__*/React__default.createElement("input", _extends({
2925
+ className: classnames('radio_control'),
2926
+ type: "radio",
2927
+ id: id,
2928
+ name: name,
2929
+ value: value,
2930
+ checked: checked,
2931
+ "aria-checked": checked,
2932
+ disabled: disabled,
2933
+ required: !(disabled || optional)
2934
+ }, props)), /*#__PURE__*/React__default.createElement("label", {
2935
+ className: classnames('radio_label'),
2936
+ htmlFor: id
2937
+ }, label));
2938
+ };
2939
+ Radio.propTypes = {
2940
+ id: PropTypes.string.isRequired,
2941
+ name: PropTypes.string.isRequired,
2942
+ value: PropTypes.string.isRequired,
2943
+ label: PropTypes.string.isRequired,
2944
+ checked: PropTypes.bool,
2945
+ disabled: PropTypes.bool,
2946
+ optional: PropTypes.bool,
2947
+ className: PropTypes.node
2948
+ };
2949
+
2950
+ const RadioButtons = ({
2951
+ onChange,
2952
+ id,
2953
+ label = 'Label',
2954
+ direction = 'portrait',
2955
+ error,
2956
+ disabled,
2957
+ optional,
2958
+ hint,
2959
+ children,
2960
+ className
2961
+ }) => {
2962
+ return /*#__PURE__*/React__default.createElement("fieldset", _extends({
2963
+ className: classnames(['input', {
2964
+ 'js-error': error,
2965
+ 'input-disabled': disabled,
2966
+ 'input-optional': optional
2967
+ }, className]),
2968
+ onChange: onChange
2969
+ }, hint || error ? {
2970
+ 'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
2971
+ } : null), /*#__PURE__*/React__default.createElement(InputLabel, {
2972
+ isLegend: true,
2973
+ label: label,
2974
+ hint: hint,
2975
+ error: error
2976
+ }), /*#__PURE__*/React__default.createElement("div", {
2977
+ className: classnames(['input_control', 'radios', {
2978
+ [`radios-${direction}`]: direction
2979
+ }])
2980
+ }, React__default.Children.map(children, child => /*#__PURE__*/React__default.isValidElement(child) ? /*#__PURE__*/React__default.cloneElement(child, {
2981
+ optional,
2982
+ disabled
2983
+ }) : child)));
2984
+ };
2985
+ RadioButtons.propTypes = {
2986
+ onChange: PropTypes.func,
2987
+ id: PropTypes.string.isRequired,
2988
+ label: PropTypes.string.isRequired,
2989
+ direction: PropTypes.oneOf(['portrait', 'landscape']),
2990
+ error: PropTypes.bool,
2991
+ disabled: PropTypes.bool,
2992
+ optional: PropTypes.bool,
2993
+ hint: PropTypes.string,
2994
+ children: PropTypes.node.isRequired,
2995
+ className: PropTypes.node
2996
+ };
2997
+
2998
+ const SectionContent = ({
2999
+ align = 'left',
3000
+ className,
3001
+ children,
3002
+ ...props
3003
+ }) => {
3004
+ return /*#__PURE__*/React__default.createElement("div", _extends({
3005
+ className: classnames(['section_content', {
3006
+ [`section_content-${align}`]: align
3007
+ }, className])
3008
+ }, props), children);
3009
+ };
3010
+ SectionContent.propTypes = {
3011
+ align: PropTypes.oneOf(['left', 'center', 'right']),
3012
+ className: PropTypes.node,
3013
+ children: PropTypes.node.isRequired
3014
+ };
3015
+
3016
+ const Select = ({
3017
+ onChange,
3018
+ id,
3019
+ label = 'Select',
3020
+ isFocused,
3021
+ error,
3022
+ disabled,
3023
+ optional,
3024
+ dense,
3025
+ hint,
3026
+ children,
3027
+ className,
3028
+ ...props
3029
+ }) => {
3030
+ const inputRef = useRef(null);
3031
+ useEffect(() => {
3032
+ if (isFocused && inputRef.current) {
3033
+ inputRef.current.focus();
3034
+ }
3035
+ }, [isFocused]);
3036
+ return /*#__PURE__*/React__default.createElement("div", {
3037
+ className: classnames(['input', 'select', {
3038
+ 'input-focused': isFocused,
3039
+ 'js-error': error,
3040
+ 'input-disabled': disabled,
3041
+ 'input-optional': optional,
3042
+ 'input-dense': dense
3043
+ }, className]),
3044
+ onChange: onChange
3045
+ }, /*#__PURE__*/React__default.createElement(InputLabel, {
3046
+ htmlFor: id,
3047
+ label: label,
3048
+ hint: hint,
3049
+ error: error
3050
+ }), /*#__PURE__*/React__default.createElement("select", _extends({
3051
+ ref: inputRef,
3052
+ className: 'input_control',
3053
+ name: id,
3054
+ id: id,
3055
+ disabled: disabled,
3056
+ required: !(disabled || optional)
3057
+ }, hint || error ? {
3058
+ 'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
3059
+ } : null, props), children));
3060
+ };
3061
+ Select.propTypes = {
3062
+ onChange: PropTypes.func,
3063
+ id: PropTypes.string.isRequired,
3064
+ label: PropTypes.string.isRequired,
3065
+ isFocused: PropTypes.bool,
3066
+ error: PropTypes.bool,
3067
+ disabled: PropTypes.bool,
3068
+ optional: PropTypes.bool,
3069
+ dense: PropTypes.bool,
3070
+ hint: PropTypes.string,
3071
+ children: PropTypes.any.isRequired,
3072
+ className: PropTypes.node
3073
+ };
3074
+
3075
+ var nnfxDark = {
3076
+ "hljs": {
3077
+ "display": "block",
3078
+ "overflowX": "auto",
3079
+ "padding": "0.5em",
3080
+ "background": "#333",
3081
+ "color": "#fff"
3082
+ },
3083
+ "xml .hljs-meta": {
3084
+ "fontWeight": "bold",
3085
+ "fontStyle": "italic",
3086
+ "color": "#69f"
3087
+ },
3088
+ "hljs-comment": {
3089
+ "fontStyle": "italic",
3090
+ "color": "#9c6"
3091
+ },
3092
+ "hljs-quote": {
3093
+ "fontStyle": "italic",
3094
+ "color": "#9c6"
3095
+ },
3096
+ "hljs-name": {
3097
+ "color": "#a7a",
3098
+ "fontWeight": "bold"
3099
+ },
3100
+ "hljs-keyword": {
3101
+ "color": "#a7a"
3102
+ },
3103
+ "hljs-attr": {
3104
+ "fontWeight": "bold",
3105
+ "color": "#fff"
3106
+ },
3107
+ "hljs-string": {
3108
+ "fontWeight": "normal",
3109
+ "color": "#bce"
3110
+ },
3111
+ "hljs-variable": {
3112
+ "color": "#588"
3113
+ },
3114
+ "hljs-template-variable": {
3115
+ "color": "#588"
3116
+ },
3117
+ "hljs-code": {
3118
+ "color": "#bce"
3119
+ },
3120
+ "hljs-meta-string": {
3121
+ "color": "#bce"
3122
+ },
3123
+ "hljs-number": {
3124
+ "color": "#bce"
3125
+ },
3126
+ "hljs-regexp": {
3127
+ "color": "#bce"
3128
+ },
3129
+ "hljs-link": {
3130
+ "color": "#bce"
3131
+ },
3132
+ "hljs-title": {
3133
+ "color": "#d40"
3134
+ },
3135
+ "hljs-symbol": {
3136
+ "color": "#d40"
3137
+ },
3138
+ "hljs-bullet": {
3139
+ "color": "#d40"
3140
+ },
3141
+ "hljs-built_in": {
3142
+ "color": "#d40"
3143
+ },
3144
+ "hljs-builtin-name": {
3145
+ "color": "#d40"
3146
+ },
3147
+ "hljs-section": {
3148
+ "color": "#a85"
3149
+ },
3150
+ "hljs-meta": {
3151
+ "color": "#a85"
3152
+ },
3153
+ "hljs-class .hljs-title": {
3154
+ "color": "#96c"
3155
+ },
3156
+ "hljs-type": {
3157
+ "color": "#96c"
3158
+ },
3159
+ "hljs-function .hljs-title": {
3160
+ "color": "#fff"
3161
+ },
3162
+ "hljs-subst": {
3163
+ "color": "#fff"
3164
+ },
3165
+ "hljs-formula": {
3166
+ "backgroundColor": "#eee",
3167
+ "fontStyle": "italic"
3168
+ },
3169
+ "hljs-addition": {
3170
+ "backgroundColor": "#797"
3171
+ },
3172
+ "hljs-deletion": {
3173
+ "backgroundColor": "#c99"
3174
+ },
3175
+ "hljs-selector-id": {
3176
+ "color": "#964"
3177
+ },
3178
+ "hljs-selector-class": {
3179
+ "color": "#964"
3180
+ },
3181
+ "hljs-doctag": {
3182
+ "fontWeight": "bold"
3183
+ },
3184
+ "hljs-strong": {
3185
+ "fontWeight": "bold"
3186
+ },
3187
+ "hljs-emphasis": {
3188
+ "fontStyle": "italic"
3189
+ }
3190
+ };
3191
+
3192
+ const Snippet = ({
3193
+ content = 'Snippet',
3194
+ isDefault = false,
3195
+ dense = false,
3196
+ className,
3197
+ ...props
3198
+ }) => {
3199
+ return /*#__PURE__*/React__default.createElement("div", {
3200
+ className: classnames('snippet_wrapper')
3201
+ }, /*#__PURE__*/React__default.createElement(SyntaxHighlighter, _extends({
3202
+ language: "javascript",
3203
+ style: nnfxDark,
3204
+ className: classnames(['snippet', {
3205
+ ' snippet-dense': dense
3206
+ }, {
3207
+ ' snippet-default': isDefault
3208
+ }, className])
3209
+ }, props), content));
3210
+ };
3211
+ Snippet.propTypes = {
3212
+ content: PropTypes.string.isRequired,
3213
+ isDefault: PropTypes.bool,
3214
+ dense: PropTypes.bool,
3215
+ className: PropTypes.node
3216
+ };
3217
+
3218
+ const Status = ({
3219
+ color = 'inactive',
3220
+ dense,
3221
+ className,
3222
+ children = 'Status',
3223
+ ...props
3224
+ }) => {
3225
+ return /*#__PURE__*/React__default.createElement(Text, _extends({
3226
+ className: classnames(['status', {
3227
+ [`status-${color}`]: color,
3228
+ 'status-dense': dense
3229
+ }, className])
3230
+ }, props), children);
3231
+ };
3232
+ Status.propTypes = {
3233
+ color: PropTypes.oneOf(['inactive', 'success', 'info', 'warning', 'error']),
3234
+ dense: PropTypes.bool,
3235
+ className: PropTypes.node,
3236
+ children: PropTypes.node.isRequired
3237
+ };
3238
+
3239
+ const Switch = ({
3240
+ id,
3241
+ startLabel,
3242
+ endLabel,
3243
+ disabled,
3244
+ className,
3245
+ ...props
3246
+ }) => {
3247
+ return /*#__PURE__*/React__default.createElement("div", {
3248
+ className: classnames(['switch', {
3249
+ 'switch-disabled': disabled
3250
+ }, className])
3251
+ }, startLabel ? /*#__PURE__*/React__default.createElement(Text, {
3252
+ className: classnames('switch_label'),
3253
+ variant: "body"
3254
+ }, startLabel) : null, /*#__PURE__*/React__default.createElement("input", _extends({
3255
+ className: classnames('switch_input'),
3256
+ type: "checkbox",
3257
+ name: id,
3258
+ id: id,
3259
+ disabled: disabled
3260
+ }, props)), /*#__PURE__*/React__default.createElement("label", {
3261
+ className: classnames('switch_switch'),
3262
+ htmlFor: id
3263
+ }, /*#__PURE__*/React__default.createElement("div", {
3264
+ className: classnames('switch_toggle')
3265
+ })), endLabel ? /*#__PURE__*/React__default.createElement(Text, {
3266
+ className: classnames('switch_label'),
3267
+ variant: "body"
3268
+ }, endLabel) : null);
3269
+ };
3270
+ Switch.propTypes = {
3271
+ id: PropTypes.string,
3272
+ startLabel: PropTypes.string,
3273
+ endLabel: PropTypes.string,
3274
+ disabled: PropTypes.bool,
3275
+ className: PropTypes.node
3276
+ };
3277
+
3278
+ const TabsContext = /*#__PURE__*/createContext();
3279
+ const Tabs = ({
3280
+ direction,
3281
+ dense,
3282
+ hasBorder,
3283
+ className,
3284
+ children
3285
+ }) => {
3286
+ const [activeIndex, setActiveIndex] = useState(0);
3287
+ return /*#__PURE__*/React__default.createElement(TabsContext.Provider, {
3288
+ value: {
3289
+ activeIndex,
3290
+ setActiveIndex
3291
+ }
3292
+ }, /*#__PURE__*/React__default.createElement("div", {
3293
+ className: classnames(['tabs', {
3294
+ [`tabs-${direction}`]: direction,
3295
+ 'tabs-dense': dense,
3296
+ 'tabs-hasBorder': hasBorder
3297
+ }, className])
3298
+ }, children));
3299
+ };
3300
+ Tabs.propTypes = {
3301
+ direction: PropTypes.oneOf(['portrait', 'landscape']),
3302
+ dense: PropTypes.bool,
3303
+ hasBorder: PropTypes.bool,
3304
+ className: PropTypes.node,
3305
+ children: PropTypes.node.isRequired
3306
+ };
3307
+
3308
+ const Tab = ({
3309
+ index,
3310
+ label,
3311
+ className
3312
+ }) => {
3313
+ const {
3314
+ activeIndex,
3315
+ setActiveIndex
3316
+ } = useContext(TabsContext);
3317
+ const isSelected = activeIndex === index;
3318
+ return /*#__PURE__*/React__default.createElement("button", {
3319
+ className: classnames(['tab', {
3320
+ 'tab-active': isSelected
3321
+ }, className]),
3322
+ role: "tab",
3323
+ "aria-selected": isSelected,
3324
+ "aria-controls": `tabpanel-${index}`,
3325
+ id: `tab-${index}`,
3326
+ tabIndex: isSelected ? 0 : -1,
3327
+ onClick: () => setActiveIndex(index)
3328
+ }, label);
3329
+ };
3330
+ Tab.propTypes = {
3331
+ label: PropTypes.string,
3332
+ className: PropTypes.node.isRequired
3333
+ };
3334
+
3335
+ const TableFooter = ({
3336
+ className,
3337
+ ...props
3338
+ }) => {
3339
+ return /*#__PURE__*/React__default.createElement("div", _extends({
3340
+ className: classnames(['table_footer', className])
3341
+ }, props), /*#__PURE__*/React__default.createElement(Select, {
3342
+ dense: true,
3343
+ id: "rows",
3344
+ className: "table_rowSelect"
3345
+ }, /*#__PURE__*/React__default.createElement("option", {
3346
+ value: "1"
3347
+ }, "10"), /*#__PURE__*/React__default.createElement("option", {
3348
+ value: "2"
3349
+ }, "25"), /*#__PURE__*/React__default.createElement("option", {
3350
+ value: "2"
3351
+ }, "50"), /*#__PURE__*/React__default.createElement("option", {
3352
+ value: "2"
3353
+ }, "100"), /*#__PURE__*/React__default.createElement("option", {
3354
+ value: "2"
3355
+ }, "All")), /*#__PURE__*/React__default.createElement(Buttons, {
3356
+ className: "table_pagination"
3357
+ }, /*#__PURE__*/React__default.createElement(Button, {
3358
+ kind: "icon",
3359
+ variant: "transparent",
3360
+ size: "sm"
3361
+ }, /*#__PURE__*/React__default.createElement(CaretDoubleLeft, null)), /*#__PURE__*/React__default.createElement(Button, {
3362
+ kind: "icon",
3363
+ variant: "transparent",
3364
+ size: "sm"
3365
+ }, /*#__PURE__*/React__default.createElement(CaretLeft, null)), /*#__PURE__*/React__default.createElement(Button, {
3366
+ kind: "icon",
3367
+ size: "sm"
3368
+ }, "1"), /*#__PURE__*/React__default.createElement(Button, {
3369
+ kind: "icon",
3370
+ variant: "transparent",
3371
+ size: "sm"
3372
+ }, "2"), /*#__PURE__*/React__default.createElement(Button, {
3373
+ kind: "icon",
3374
+ variant: "transparent",
3375
+ size: "sm"
3376
+ }, "3"), /*#__PURE__*/React__default.createElement(Button, {
3377
+ kind: "icon",
3378
+ variant: "transparent",
3379
+ size: "sm"
3380
+ }, "\u2026"), /*#__PURE__*/React__default.createElement(Button, {
3381
+ kind: "icon",
3382
+ variant: "transparent",
3383
+ size: "sm"
3384
+ }, "8"), /*#__PURE__*/React__default.createElement(Button, {
3385
+ kind: "icon",
3386
+ variant: "transparent",
3387
+ size: "sm"
3388
+ }, /*#__PURE__*/React__default.createElement(CaretRight, null)), /*#__PURE__*/React__default.createElement(Button, {
3389
+ kind: "icon",
3390
+ variant: "transparent",
3391
+ size: "sm"
3392
+ }, /*#__PURE__*/React__default.createElement(CaretDoubleRight, null))));
3393
+ };
3394
+ TableFooter.propTypes = {
3395
+ className: PropTypes.node
3396
+ };
3397
+
3398
+ const DenseContext = /*#__PURE__*/createContext(false);
3399
+ const Table = ({
3400
+ striped,
3401
+ hasHover,
3402
+ dense,
3403
+ border,
3404
+ withFooter,
3405
+ className,
3406
+ children,
3407
+ ...props
3408
+ }) => {
3409
+ return /*#__PURE__*/React__default.createElement(DenseContext.Provider, {
3410
+ value: dense
3411
+ }, /*#__PURE__*/React__default.createElement("div", {
3412
+ className: classnames(['table', {
3413
+ 'table-striped': striped,
3414
+ 'table-hasHover': hasHover,
3415
+ 'table-dense': dense,
3416
+ 'table-border': border
3417
+ }, className])
3418
+ }, /*#__PURE__*/React__default.createElement("table", _extends({
3419
+ cellPadding: 0,
3420
+ cellSpacing: 0,
3421
+ className: classnames('table_content')
3422
+ }, props), children), withFooter ? /*#__PURE__*/React__default.createElement(TableFooter, {
3423
+ dense: dense ? dense : null
3424
+ }) : null));
3425
+ };
3426
+ Table.propTypes = {
3427
+ striped: PropTypes.bool,
3428
+ hasHover: PropTypes.bool,
3429
+ dense: PropTypes.bool,
3430
+ border: PropTypes.bool,
3431
+ withFooter: PropTypes.bool,
3432
+ className: PropTypes.node,
3433
+ children: PropTypes.node.isRequired
3434
+ };
3435
+
3436
+ const TableBody = ({
3437
+ className,
3438
+ children,
3439
+ ...props
3440
+ }) => {
3441
+ return /*#__PURE__*/React__default.createElement("tbody", _extends({
3442
+ className: classnames(['table_body', className])
3443
+ }, props), children);
3444
+ };
3445
+ TableBody.propTypes = {
3446
+ className: PropTypes.node,
3447
+ children: PropTypes.node.isRequired
3448
+ };
3449
+
3450
+ const TableCellComponentContext = /*#__PURE__*/createContext('td');
3451
+ const TableHead = ({
3452
+ className,
3453
+ children,
3454
+ ...props
3455
+ }) => {
3456
+ return /*#__PURE__*/React__default.createElement(TableCellComponentContext.Provider, {
3457
+ value: "th"
3458
+ }, /*#__PURE__*/React__default.createElement("thead", _extends({
3459
+ className: classnames(['table_head', className])
3460
+ }, props), children));
3461
+ };
3462
+ TableHead.propTypes = {
3463
+ className: PropTypes.node,
3464
+ children: PropTypes.node.isRequired
3465
+ };
3466
+
3467
+ const TableCell = ({
3468
+ kind = 'default',
3469
+ className,
3470
+ children,
3471
+ ...props
3472
+ }) => {
3473
+ const useTableCellComponent = () => useContext(TableCellComponentContext);
3474
+ const Component = useTableCellComponent();
3475
+ return /*#__PURE__*/React__default.createElement(Component, _extends({
3476
+ className: classnames(['table_cell', {
3477
+ [`table_cell-${kind}`]: kind
3478
+ }, className])
3479
+ }, props), children);
3480
+ };
3481
+ TableCell.propTypes = {
3482
+ kind: PropTypes.oneOf(['default', 'number', 'action']),
3483
+ className: PropTypes.node,
3484
+ children: PropTypes.node.isRequired
3485
+ };
3486
+
3487
+ const TableRow = ({
3488
+ className,
3489
+ children,
3490
+ ...props
3491
+ }) => {
3492
+ return /*#__PURE__*/React__default.createElement("tr", _extends({
3493
+ className: classnames(['table_row', className])
3494
+ }, props), children);
3495
+ };
3496
+ TableRow.propTypes = {
3497
+ className: PropTypes.node,
3498
+ children: PropTypes.node.isRequired
3499
+ };
3500
+
3501
+ const TabsControl = ({
3502
+ className,
3503
+ children
3504
+ }) => {
3505
+ return /*#__PURE__*/React__default.createElement("div", {
3506
+ role: "tablist",
3507
+ className: classnames(['tabs_controls', className])
3508
+ }, children);
3509
+ };
3510
+ TabsControl.propTypes = {
3511
+ className: PropTypes.node,
3512
+ children: PropTypes.node.isRequired
3513
+ };
3514
+
3515
+ const TabsPanel = ({
3516
+ index,
3517
+ className,
3518
+ children
3519
+ }) => {
3520
+ const {
3521
+ activeIndex
3522
+ } = useContext(TabsContext);
3523
+ const isActive = activeIndex === index;
3524
+ return isActive ? /*#__PURE__*/React__default.createElement("div", {
3525
+ className: classnames(['tabs_panel', className]),
3526
+ role: "tabpanel",
3527
+ id: `tabpanel-${index}`,
3528
+ "aria-labelledby": `tab-${index}`,
3529
+ hidden: !isActive
3530
+ }, children) : null;
3531
+ };
3532
+ TabsPanel.propTypes = {
3533
+ className: PropTypes.node,
3534
+ children: PropTypes.node.isRequired
3535
+ };
3536
+
3537
+ const Tag = ({
3538
+ color = 'primary',
3539
+ dense,
3540
+ className,
3541
+ children = 'Tag',
3542
+ ...props
3543
+ }) => {
3544
+ return /*#__PURE__*/React__default.createElement(Text, _extends({
3545
+ className: classnames(['tag', {
3546
+ [`tag-${color}`]: color,
3547
+ 'tag-dense': dense
3548
+ }, className])
3549
+ }, props), children);
3550
+ };
3551
+ Tag.propTypes = {
3552
+ color: PropTypes.oneOf(['primary', 'secondary', 'grey', 'success', 'info', 'warning', 'error']),
3553
+ dense: PropTypes.bool,
3554
+ className: PropTypes.node,
3555
+ children: PropTypes.node.isRequired
3556
+ };
3557
+
3558
+ const Textarea = ({
3559
+ onChange,
3560
+ id,
3561
+ placeholder,
3562
+ label = 'Textarea',
3563
+ isFocused,
3564
+ error,
3565
+ disabled,
3566
+ optional,
3567
+ hint,
3568
+ className,
3569
+ ...props
3570
+ }) => {
3571
+ const inputRef = useRef(null);
3572
+ useEffect(() => {
3573
+ if (isFocused && inputRef.current) {
3574
+ inputRef.current.focus();
3575
+ }
3576
+ }, [isFocused]);
3577
+ return /*#__PURE__*/React__default.createElement("div", {
3578
+ className: classnames(['input', {
3579
+ 'js-error': error,
3580
+ 'input-disabled': disabled,
3581
+ 'input-optional': optional
3582
+ }, className]),
3583
+ onChange: onChange
3584
+ }, /*#__PURE__*/React__default.createElement(InputLabel, {
3585
+ htmlFor: id,
3586
+ label: label,
3587
+ hint: hint,
3588
+ error: error
3589
+ }), /*#__PURE__*/React__default.createElement("textarea", _extends({
3590
+ ref: inputRef,
3591
+ className: 'input_control',
3592
+ name: id,
3593
+ id: id,
3594
+ placeholder: placeholder,
3595
+ disabled: disabled,
3596
+ required: !(disabled || optional),
3597
+ rows: 4
3598
+ }, hint || error ? {
3599
+ 'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
3600
+ } : null, props)));
3601
+ };
3602
+ Textarea.propTypes = {
3603
+ onChange: PropTypes.func,
3604
+ id: PropTypes.string.isRequired,
3605
+ placeholder: PropTypes.string,
3606
+ label: PropTypes.string.isRequired,
3607
+ isFocused: PropTypes.bool,
3608
+ error: PropTypes.bool,
3609
+ disabled: PropTypes.bool,
3610
+ optional: PropTypes.bool,
3611
+ hint: PropTypes.string,
3612
+ className: PropTypes.node
3613
+ };
3614
+
3615
+ export { Alert, Breadcrumbs, Button, Buttons, Card, CardActions, CardContent, CardHeader, CardMedia, Checkbox, Checkboxes, Color, Display, Divider, Grid, Input, InputLabel, Link$1 as Link, List, ListItem, Nav, NavBar, NavItem, Radio, RadioButtons, Section, SectionContent, SectionHeader, Select, Snippet, Status, Switch, Tab, Table, TableBody, TableCell, TableFooter, TableHead, TableRow, Tabs, TabsControl, TabsPanel, Tag, Text, Textarea };