@opentripplanner/trip-details 2.1.0-alpha.1 → 2.1.1
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/__mocks__/{custom-messages.yml → custom-english-messages.yml} +7 -0
- package/__mocks__/custom-french-messages.yml +10 -0
- package/esm/fare-table.js +153 -0
- package/esm/fare-table.js.map +1 -0
- package/esm/index.js +26 -46
- package/esm/index.js.map +1 -1
- package/esm/types.js +11 -0
- package/esm/types.js.map +1 -1
- package/esm/utils.js +29 -0
- package/esm/utils.js.map +1 -0
- package/i18n/en-US.yml +7 -0
- package/i18n/fr.yml +7 -0
- package/lib/fare-table.d.ts +4 -0
- package/lib/fare-table.d.ts.map +1 -0
- package/lib/fare-table.js +160 -0
- package/lib/fare-table.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +32 -52
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +32 -11
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +18 -0
- package/lib/types.js.map +1 -1
- package/lib/utils.d.ts +13 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +41 -0
- package/lib/utils.js.map +1 -0
- package/package.json +4 -4
- package/src/TripDetails.story.tsx +61 -38
- package/src/fare-table.tsx +222 -0
- package/src/index.tsx +38 -60
- package/src/types.ts +34 -11
- package/src/utils.tsx +30 -0
- package/tsconfig.tsbuildinfo +177 -24
- package/esm/fare-detail.js +0 -111
- package/esm/fare-detail.js.map +0 -1
- package/lib/fare-detail.d.ts +0 -3
- package/lib/fare-detail.d.ts.map +0 -1
- package/lib/fare-detail.js +0 -115
- package/lib/fare-detail.js.map +0 -1
- package/src/fare-detail.tsx +0 -157
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Prettier does not recognize the import type syntax.
|
|
2
2
|
// eslint-disable-next-line prettier/prettier
|
|
3
|
-
import type { Itinerary, Leg, Fare } from "@opentripplanner/types";
|
|
3
|
+
import type { FareDetails, Money, Itinerary, Leg, Fare, } from "@opentripplanner/types";
|
|
4
4
|
import type { ReactElement } from "react";
|
|
5
5
|
|
|
6
6
|
export interface CaloriesDetailsProps {
|
|
@@ -13,18 +13,37 @@ export interface DepartureDetailsProps {
|
|
|
13
13
|
departureDate: Date;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
|
|
16
|
+
export enum FareTableText {
|
|
17
|
+
regular = "regular",
|
|
18
|
+
youth = "youth",
|
|
19
|
+
senior = "senior",
|
|
20
|
+
special = "special",
|
|
21
|
+
cash = "cash",
|
|
22
|
+
electronic = "electronic"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface FareTableLayout {
|
|
18
26
|
cols: {
|
|
27
|
+
header: FareTableText;
|
|
19
28
|
key: string;
|
|
20
|
-
header: string;
|
|
21
29
|
}[];
|
|
30
|
+
header: FareTableText;
|
|
31
|
+
}
|
|
32
|
+
export interface TransitFareData {
|
|
33
|
+
[key: string]: Money
|
|
22
34
|
}
|
|
23
35
|
|
|
24
36
|
export interface FareDetailsProps {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
37
|
+
maxTNCFare: number;
|
|
38
|
+
minTNCFare: number;
|
|
39
|
+
transitFares: TransitFareData;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface FareLegTableProps {
|
|
43
|
+
layout?: FareTableLayout[];
|
|
44
|
+
legs?: Leg[];
|
|
45
|
+
transitFareDetails?: FareDetails;
|
|
46
|
+
transitFares?: TransitFareData;
|
|
28
47
|
}
|
|
29
48
|
|
|
30
49
|
export interface TransitFareProps {
|
|
@@ -53,16 +72,20 @@ export interface TripDetailsProps {
|
|
|
53
72
|
* Slot for a custom component to render the expandable section for departure.
|
|
54
73
|
*/
|
|
55
74
|
DepartureDetails?: React.ElementType<DepartureDetailsProps>;
|
|
75
|
+
/**
|
|
76
|
+
* Slot for a custom component to render the expandable section for fares.
|
|
77
|
+
*/
|
|
78
|
+
FareDetails?: React.ElementType<FareDetailsProps>;
|
|
79
|
+
/**
|
|
80
|
+
* Column and table configuration for fare details/fare by leg table.
|
|
81
|
+
*/
|
|
82
|
+
fareDetailsLayout?: FareTableLayout[];
|
|
56
83
|
/**
|
|
57
84
|
* Mapping between fare keys and human-readable names for them.
|
|
58
85
|
*/
|
|
59
86
|
fareKeyNameMap?: {
|
|
60
87
|
[name: string]: string;
|
|
61
88
|
};
|
|
62
|
-
/**
|
|
63
|
-
* Column and table configuration for fare details/fare by leg table.
|
|
64
|
-
*/
|
|
65
|
-
fareDetailsLayout?: FareDetailsLayout[];
|
|
66
89
|
/**
|
|
67
90
|
* Itinerary that the user has selected to view, contains multiple legs.
|
|
68
91
|
*/
|
package/src/utils.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
import { FormattedNumber } from "react-intl";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Format text bold (used with FormattedMessage).
|
|
6
|
+
*/
|
|
7
|
+
export function boldText(contents: ReactElement): ReactElement {
|
|
8
|
+
return <strong>{contents}</strong>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Render formatted fare.
|
|
13
|
+
* @param currencyCode The ISO currency code to use (USD, GBP, EUR).
|
|
14
|
+
* @param fare The fare value, in currency units, to be shown.
|
|
15
|
+
* @returns The formatted fare value according to the selected locale.
|
|
16
|
+
*/
|
|
17
|
+
export function renderFare(currencyCode: string, fare: number): ReactElement {
|
|
18
|
+
return (
|
|
19
|
+
<FormattedNumber
|
|
20
|
+
currency={currencyCode}
|
|
21
|
+
// For dollars in locales such as 'fr',
|
|
22
|
+
// this will limit the display to just the dollar sign
|
|
23
|
+
// (otherwise it will render e.g. '2,50 $US' instead of '2,50 $').
|
|
24
|
+
currencyDisplay="narrowSymbol"
|
|
25
|
+
value={fare}
|
|
26
|
+
// eslint-disable-next-line react/style-prop-object
|
|
27
|
+
style="currency"
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -182,8 +182,13 @@
|
|
|
182
182
|
"affectsGlobalScope": true
|
|
183
183
|
},
|
|
184
184
|
"../types/lib/index.d.ts": {
|
|
185
|
-
"version": "
|
|
186
|
-
"signature": "
|
|
185
|
+
"version": "329a87eef5d7da893a8b9ac9a3debac348ebd3c034c64393483e85c31e3edea2",
|
|
186
|
+
"signature": "329a87eef5d7da893a8b9ac9a3debac348ebd3c034c64393483e85c31e3edea2",
|
|
187
|
+
"affectsGlobalScope": false
|
|
188
|
+
},
|
|
189
|
+
"../../node_modules/@types/flat/index.d.ts": {
|
|
190
|
+
"version": "d9890ea8f1da57be3c2e2d3627b787cd4b4a463fd1747c823a0de24b240c8fe5",
|
|
191
|
+
"signature": "d9890ea8f1da57be3c2e2d3627b787cd4b4a463fd1747c823a0de24b240c8fe5",
|
|
187
192
|
"affectsGlobalScope": false
|
|
188
193
|
},
|
|
189
194
|
"../../node_modules/@types/hoist-non-react-statics/index.d.ts": {
|
|
@@ -561,24 +566,69 @@
|
|
|
561
566
|
"signature": "516e2ded162ddc84294deb452dda9982b2a938e6df2d7f838ae0fd8b4ed38159",
|
|
562
567
|
"affectsGlobalScope": false
|
|
563
568
|
},
|
|
569
|
+
"../../node_modules/@styled-icons/styled-icon/index.d.ts": {
|
|
570
|
+
"version": "a4ce8cb63b46ff55db10c4bdd3007240a42ba71c03f159ea7e6517aef9a8013c",
|
|
571
|
+
"signature": "a4ce8cb63b46ff55db10c4bdd3007240a42ba71c03f159ea7e6517aef9a8013c",
|
|
572
|
+
"affectsGlobalScope": false
|
|
573
|
+
},
|
|
574
|
+
"../../node_modules/@styled-icons/boxicons-regular/Transfer/Transfer.d.ts": {
|
|
575
|
+
"version": "8a237d3bc8b7d9d4aa2f03d3ada1c230493177df302d91f9da46d69b730f0d9c",
|
|
576
|
+
"signature": "8a237d3bc8b7d9d4aa2f03d3ada1c230493177df302d91f9da46d69b730f0d9c",
|
|
577
|
+
"affectsGlobalScope": false
|
|
578
|
+
},
|
|
579
|
+
"./src/utils.tsx": {
|
|
580
|
+
"version": "f05b036e2c3a090da6dd6852320669d527389a929553de8d5fb067c9c7bfd38f",
|
|
581
|
+
"signature": "624668423c973a8a094b3584213fab36eff916bbae1e0d8d7274fb965d5573e4",
|
|
582
|
+
"affectsGlobalScope": false
|
|
583
|
+
},
|
|
564
584
|
"./src/types.ts": {
|
|
565
|
-
"version": "
|
|
566
|
-
"signature": "
|
|
585
|
+
"version": "853e8563f3fe41f14da5f08eec31cc094f7d1c1fc640f21fca0467f3969a3b38",
|
|
586
|
+
"signature": "3e7f40398ddb92472734e499ca1568e6ccb8ac35f17bf7be2668a71dab0edf05",
|
|
567
587
|
"affectsGlobalScope": false
|
|
568
588
|
},
|
|
569
|
-
"./src/fare-
|
|
570
|
-
"version": "
|
|
571
|
-
"signature": "
|
|
589
|
+
"./src/fare-table.tsx": {
|
|
590
|
+
"version": "b37b931463d3c7c72c3bd3fe039490e5b3709f28e9bc539f6d899f594d3c5ffb",
|
|
591
|
+
"signature": "8c2bf7f8d8026785763349df6fbeea93dd5a53a1138bcb73a00404fdaaf483d0",
|
|
572
592
|
"affectsGlobalScope": false
|
|
573
593
|
},
|
|
574
|
-
"
|
|
575
|
-
"version": "
|
|
576
|
-
"signature": "
|
|
594
|
+
"./node_modules/@opentripplanner/core-utils/lib/itinerary.d.ts": {
|
|
595
|
+
"version": "a07c41727948317d80ef3e2cf9fec370486b75574f361555da8eb78530ccbb3a",
|
|
596
|
+
"signature": "a07c41727948317d80ef3e2cf9fec370486b75574f361555da8eb78530ccbb3a",
|
|
577
597
|
"affectsGlobalScope": false
|
|
578
598
|
},
|
|
579
|
-
"
|
|
580
|
-
"version": "
|
|
581
|
-
"signature": "
|
|
599
|
+
"./node_modules/@opentripplanner/core-utils/lib/map.d.ts": {
|
|
600
|
+
"version": "bfd604d32f4b9db8bfec69a5a12f13afc760d5ad4010667b01c391d69d1a30e6",
|
|
601
|
+
"signature": "bfd604d32f4b9db8bfec69a5a12f13afc760d5ad4010667b01c391d69d1a30e6",
|
|
602
|
+
"affectsGlobalScope": false
|
|
603
|
+
},
|
|
604
|
+
"./node_modules/@opentripplanner/core-utils/lib/route.d.ts": {
|
|
605
|
+
"version": "f269f9dc86a5f777fa82a691591f0cd1227425185df11f181c0a9d4fa265f8ab",
|
|
606
|
+
"signature": "f269f9dc86a5f777fa82a691591f0cd1227425185df11f181c0a9d4fa265f8ab",
|
|
607
|
+
"affectsGlobalScope": false
|
|
608
|
+
},
|
|
609
|
+
"./node_modules/@opentripplanner/core-utils/lib/storage.d.ts": {
|
|
610
|
+
"version": "1e9704378dc57075033c705776320e7122c7c27853f503649d56f5582863ddfc",
|
|
611
|
+
"signature": "1e9704378dc57075033c705776320e7122c7c27853f503649d56f5582863ddfc",
|
|
612
|
+
"affectsGlobalScope": false
|
|
613
|
+
},
|
|
614
|
+
"./node_modules/@opentripplanner/core-utils/lib/deprecated-with-types.d.ts": {
|
|
615
|
+
"version": "6e634df2bb6d19b246e382c2e05d13cdd125e64bd3ffc8de5272fd3df5f0b0f3",
|
|
616
|
+
"signature": "6e634df2bb6d19b246e382c2e05d13cdd125e64bd3ffc8de5272fd3df5f0b0f3",
|
|
617
|
+
"affectsGlobalScope": false
|
|
618
|
+
},
|
|
619
|
+
"./node_modules/@opentripplanner/core-utils/lib/time.d.ts": {
|
|
620
|
+
"version": "43907d551124ee597a01cd6d19ddd3c7444120ad6fccd128ce98e391273e01f0",
|
|
621
|
+
"signature": "43907d551124ee597a01cd6d19ddd3c7444120ad6fccd128ce98e391273e01f0",
|
|
622
|
+
"affectsGlobalScope": false
|
|
623
|
+
},
|
|
624
|
+
"./node_modules/@opentripplanner/core-utils/lib/ui.d.ts": {
|
|
625
|
+
"version": "3500cb4a6ce399f44f2b6e34700cba39c17cb9211967301084c2fa8aea47855a",
|
|
626
|
+
"signature": "3500cb4a6ce399f44f2b6e34700cba39c17cb9211967301084c2fa8aea47855a",
|
|
627
|
+
"affectsGlobalScope": false
|
|
628
|
+
},
|
|
629
|
+
"./node_modules/@opentripplanner/core-utils/lib/index.d.ts": {
|
|
630
|
+
"version": "1d70ffdcee3aaa052be9562efd39d3b97c5ece8cc3ebb190eed4205c2201674a",
|
|
631
|
+
"signature": "1d70ffdcee3aaa052be9562efd39d3b97c5ece8cc3ebb190eed4205c2201674a",
|
|
582
632
|
"affectsGlobalScope": false
|
|
583
633
|
},
|
|
584
634
|
"../../node_modules/@styled-icons/fa-solid/CalendarAlt/CalendarAlt.d.ts": {
|
|
@@ -632,8 +682,8 @@
|
|
|
632
682
|
"affectsGlobalScope": false
|
|
633
683
|
},
|
|
634
684
|
"./src/index.tsx": {
|
|
635
|
-
"version": "
|
|
636
|
-
"signature": "
|
|
685
|
+
"version": "cc6c71abef0a4b6cd6e5e1c303cf064f66e3f9411712fd1fa6ff60dfa6ae1eaa",
|
|
686
|
+
"signature": "280628cb5b434821e3fb27721ecfb6d348b6aa9eea0e28fd5bee326a9444ed34",
|
|
637
687
|
"affectsGlobalScope": false
|
|
638
688
|
},
|
|
639
689
|
"./src/__unpublished__/external-types.d.ts": {
|
|
@@ -701,9 +751,9 @@
|
|
|
701
751
|
"signature": "117ffeecf6c55e25b6446f449ad079029b5e7317399b0a693858faaaea5ca73e",
|
|
702
752
|
"affectsGlobalScope": false
|
|
703
753
|
},
|
|
704
|
-
"../../node_modules/@types/
|
|
705
|
-
"version": "
|
|
706
|
-
"signature": "
|
|
754
|
+
"../../node_modules/@types/estree/index.d.ts": {
|
|
755
|
+
"version": "7d7c8ef7d48a035142c07dae60545ecc0e4af4c337742760cb09726f2f8e31db",
|
|
756
|
+
"signature": "7d7c8ef7d48a035142c07dae60545ecc0e4af4c337742760cb09726f2f8e31db",
|
|
707
757
|
"affectsGlobalScope": false
|
|
708
758
|
},
|
|
709
759
|
"../../node_modules/@types/node/assert/strict.d.ts": {
|
|
@@ -966,6 +1016,16 @@
|
|
|
966
1016
|
"signature": "30368d3789ec56ef3006c5f2115bd00faa21471aed6cbe6fec54a5683e5497ed",
|
|
967
1017
|
"affectsGlobalScope": false
|
|
968
1018
|
},
|
|
1019
|
+
"../../node_modules/@types/fs-extra/index.d.ts": {
|
|
1020
|
+
"version": "6435575b4feae200831d37df9f871de6e695c64d3148611fe1b4d714d648ea24",
|
|
1021
|
+
"signature": "6435575b4feae200831d37df9f871de6e695c64d3148611fe1b4d714d648ea24",
|
|
1022
|
+
"affectsGlobalScope": false
|
|
1023
|
+
},
|
|
1024
|
+
"../../node_modules/@types/geojson/index.d.ts": {
|
|
1025
|
+
"version": "8c2e6e491e1a08855b8bf70820184ff66ae0d43f7cf0311fc680e6d860af211c",
|
|
1026
|
+
"signature": "8c2e6e491e1a08855b8bf70820184ff66ae0d43f7cf0311fc680e6d860af211c",
|
|
1027
|
+
"affectsGlobalScope": false
|
|
1028
|
+
},
|
|
969
1029
|
"../../node_modules/@types/minimatch/index.d.ts": {
|
|
970
1030
|
"version": "95c22bc19835e28e2e524a4bb8898eb5f2107b640d7279a6d3aade261916bbf2",
|
|
971
1031
|
"signature": "95c22bc19835e28e2e524a4bb8898eb5f2107b640d7279a6d3aade261916bbf2",
|
|
@@ -1526,6 +1586,11 @@
|
|
|
1526
1586
|
"signature": "3a1e165b22a1cb8df82c44c9a09502fd2b33f160cd277de2cd3a055d8e5c6b27",
|
|
1527
1587
|
"affectsGlobalScope": false
|
|
1528
1588
|
},
|
|
1589
|
+
"../../node_modules/@types/json-stable-stringify/index.d.ts": {
|
|
1590
|
+
"version": "626520302b2c8880e9eaa3a6a12022cc8b577a32e4d903aef85e3dd275063da4",
|
|
1591
|
+
"signature": "626520302b2c8880e9eaa3a6a12022cc8b577a32e4d903aef85e3dd275063da4",
|
|
1592
|
+
"affectsGlobalScope": false
|
|
1593
|
+
},
|
|
1529
1594
|
"../../node_modules/@types/json5/index.d.ts": {
|
|
1530
1595
|
"version": "96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538",
|
|
1531
1596
|
"signature": "96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538",
|
|
@@ -1945,6 +2010,9 @@
|
|
|
1945
2010
|
"../../node_modules/@formatjs/ecma402-abstract/index.d.ts",
|
|
1946
2011
|
"../../node_modules/@formatjs/intl/src/types.d.ts"
|
|
1947
2012
|
],
|
|
2013
|
+
"../../node_modules/@styled-icons/boxicons-regular/Transfer/Transfer.d.ts": [
|
|
2014
|
+
"../../node_modules/@styled-icons/styled-icon/index.d.ts"
|
|
2015
|
+
],
|
|
1948
2016
|
"../../node_modules/@styled-icons/fa-solid/CalendarAlt/CalendarAlt.d.ts": [
|
|
1949
2017
|
"../../node_modules/@styled-icons/styled-icon/index.d.ts"
|
|
1950
2018
|
],
|
|
@@ -2000,6 +2068,10 @@
|
|
|
2000
2068
|
"../../node_modules/@types/color-convert/route.d.ts": [
|
|
2001
2069
|
"../../node_modules/@types/color-convert/conversions.d.ts"
|
|
2002
2070
|
],
|
|
2071
|
+
"../../node_modules/@types/fs-extra/index.d.ts": [
|
|
2072
|
+
"../../node_modules/@types/node/fs.d.ts",
|
|
2073
|
+
"../../node_modules/@types/node/index.d.ts"
|
|
2074
|
+
],
|
|
2003
2075
|
"../../node_modules/@types/glob/index.d.ts": [
|
|
2004
2076
|
"../../node_modules/@types/minimatch/index.d.ts",
|
|
2005
2077
|
"../../node_modules/@types/node/events.d.ts",
|
|
@@ -2895,15 +2967,43 @@
|
|
|
2895
2967
|
"../../node_modules/vfile-message/index.d.ts": [
|
|
2896
2968
|
"../../node_modules/@types/unist/index.d.ts"
|
|
2897
2969
|
],
|
|
2970
|
+
"./node_modules/@opentripplanner/core-utils/lib/deprecated-with-types.d.ts": [
|
|
2971
|
+
"../types/lib/index.d.ts"
|
|
2972
|
+
],
|
|
2973
|
+
"./node_modules/@opentripplanner/core-utils/lib/index.d.ts": [
|
|
2974
|
+
"./node_modules/@opentripplanner/core-utils/lib/itinerary.d.ts",
|
|
2975
|
+
"./node_modules/@opentripplanner/core-utils/lib/map.d.ts",
|
|
2976
|
+
"./node_modules/@opentripplanner/core-utils/lib/route.d.ts",
|
|
2977
|
+
"./node_modules/@opentripplanner/core-utils/lib/storage.d.ts",
|
|
2978
|
+
"./node_modules/@opentripplanner/core-utils/lib/time.d.ts",
|
|
2979
|
+
"./node_modules/@opentripplanner/core-utils/lib/ui.d.ts"
|
|
2980
|
+
],
|
|
2981
|
+
"./node_modules/@opentripplanner/core-utils/lib/itinerary.d.ts": [
|
|
2982
|
+
"../types/lib/index.d.ts"
|
|
2983
|
+
],
|
|
2984
|
+
"./node_modules/@opentripplanner/core-utils/lib/map.d.ts": [
|
|
2985
|
+
"../types/lib/index.d.ts"
|
|
2986
|
+
],
|
|
2987
|
+
"./node_modules/@opentripplanner/core-utils/lib/route.d.ts": [
|
|
2988
|
+
"../types/lib/index.d.ts"
|
|
2989
|
+
],
|
|
2990
|
+
"./node_modules/@opentripplanner/core-utils/lib/time.d.ts": [
|
|
2991
|
+
"../types/lib/index.d.ts",
|
|
2992
|
+
"./node_modules/@opentripplanner/core-utils/lib/deprecated-with-types.d.ts"
|
|
2993
|
+
],
|
|
2898
2994
|
"./src/__unpublished__/external-types.d.ts": [
|
|
2899
2995
|
"../../node_modules/@types/react/index.d.ts"
|
|
2900
2996
|
],
|
|
2901
|
-
"./src/fare-
|
|
2997
|
+
"./src/fare-table.tsx": [
|
|
2998
|
+
"../../node_modules/@styled-icons/boxicons-regular/Transfer/Transfer.d.ts",
|
|
2999
|
+
"../../node_modules/@types/flat/index.d.ts",
|
|
2902
3000
|
"../../node_modules/@types/react/index.d.ts",
|
|
2903
3001
|
"../../node_modules/@types/styled-components/index.d.ts",
|
|
2904
3002
|
"../../node_modules/react-intl/index.d.ts",
|
|
2905
3003
|
"../types/lib/index.d.ts",
|
|
2906
|
-
"./src/
|
|
3004
|
+
"./src/__unpublished__/messages.d.ts",
|
|
3005
|
+
"./src/types.ts",
|
|
3006
|
+
"./src/utils.tsx"
|
|
2907
3007
|
],
|
|
2908
3008
|
"./src/index.tsx": [
|
|
2909
3009
|
"../../node_modules/@styled-icons/fa-solid/CalendarAlt/CalendarAlt.d.ts",
|
|
@@ -2916,11 +3016,13 @@
|
|
|
2916
3016
|
"../../node_modules/@types/react/index.d.ts",
|
|
2917
3017
|
"../../node_modules/react-intl/index.d.ts",
|
|
2918
3018
|
"../types/lib/index.d.ts",
|
|
3019
|
+
"./node_modules/@opentripplanner/core-utils/lib/index.d.ts",
|
|
2919
3020
|
"./src/__unpublished__/messages.d.ts",
|
|
2920
|
-
"./src/fare-
|
|
3021
|
+
"./src/fare-table.tsx",
|
|
2921
3022
|
"./src/styled.ts",
|
|
2922
3023
|
"./src/trip-detail.tsx",
|
|
2923
|
-
"./src/types.ts"
|
|
3024
|
+
"./src/types.ts",
|
|
3025
|
+
"./src/utils.tsx"
|
|
2924
3026
|
],
|
|
2925
3027
|
"./src/styled.ts": [
|
|
2926
3028
|
"../../node_modules/@types/styled-components/index.d.ts"
|
|
@@ -2936,6 +3038,10 @@
|
|
|
2936
3038
|
"../../node_modules/@types/react/index.d.ts",
|
|
2937
3039
|
"../types/lib/index.d.ts"
|
|
2938
3040
|
],
|
|
3041
|
+
"./src/utils.tsx": [
|
|
3042
|
+
"../../node_modules/@types/react/index.d.ts",
|
|
3043
|
+
"../../node_modules/react-intl/index.d.ts"
|
|
3044
|
+
],
|
|
2939
3045
|
"../types/lib/index.d.ts": [
|
|
2940
3046
|
"../../node_modules/@types/react/index.d.ts"
|
|
2941
3047
|
]
|
|
@@ -3117,6 +3223,9 @@
|
|
|
3117
3223
|
"../../node_modules/@formatjs/ecma402-abstract/index.d.ts",
|
|
3118
3224
|
"../../node_modules/@formatjs/intl/src/types.d.ts"
|
|
3119
3225
|
],
|
|
3226
|
+
"../../node_modules/@styled-icons/boxicons-regular/Transfer/Transfer.d.ts": [
|
|
3227
|
+
"../../node_modules/@styled-icons/styled-icon/index.d.ts"
|
|
3228
|
+
],
|
|
3120
3229
|
"../../node_modules/@styled-icons/fa-solid/CalendarAlt/CalendarAlt.d.ts": [
|
|
3121
3230
|
"../../node_modules/@styled-icons/styled-icon/index.d.ts"
|
|
3122
3231
|
],
|
|
@@ -3172,6 +3281,10 @@
|
|
|
3172
3281
|
"../../node_modules/@types/color-convert/route.d.ts": [
|
|
3173
3282
|
"../../node_modules/@types/color-convert/conversions.d.ts"
|
|
3174
3283
|
],
|
|
3284
|
+
"../../node_modules/@types/fs-extra/index.d.ts": [
|
|
3285
|
+
"../../node_modules/@types/node/fs.d.ts",
|
|
3286
|
+
"../../node_modules/@types/node/index.d.ts"
|
|
3287
|
+
],
|
|
3175
3288
|
"../../node_modules/@types/glob/index.d.ts": [
|
|
3176
3289
|
"../../node_modules/@types/minimatch/index.d.ts",
|
|
3177
3290
|
"../../node_modules/@types/node/events.d.ts",
|
|
@@ -4067,10 +4180,34 @@
|
|
|
4067
4180
|
"../../node_modules/vfile-message/index.d.ts": [
|
|
4068
4181
|
"../../node_modules/@types/unist/index.d.ts"
|
|
4069
4182
|
],
|
|
4183
|
+
"./node_modules/@opentripplanner/core-utils/lib/deprecated-with-types.d.ts": [
|
|
4184
|
+
"../types/lib/index.d.ts"
|
|
4185
|
+
],
|
|
4186
|
+
"./node_modules/@opentripplanner/core-utils/lib/index.d.ts": [
|
|
4187
|
+
"./node_modules/@opentripplanner/core-utils/lib/itinerary.d.ts",
|
|
4188
|
+
"./node_modules/@opentripplanner/core-utils/lib/map.d.ts",
|
|
4189
|
+
"./node_modules/@opentripplanner/core-utils/lib/route.d.ts",
|
|
4190
|
+
"./node_modules/@opentripplanner/core-utils/lib/storage.d.ts",
|
|
4191
|
+
"./node_modules/@opentripplanner/core-utils/lib/time.d.ts",
|
|
4192
|
+
"./node_modules/@opentripplanner/core-utils/lib/ui.d.ts"
|
|
4193
|
+
],
|
|
4194
|
+
"./node_modules/@opentripplanner/core-utils/lib/itinerary.d.ts": [
|
|
4195
|
+
"../types/lib/index.d.ts"
|
|
4196
|
+
],
|
|
4197
|
+
"./node_modules/@opentripplanner/core-utils/lib/map.d.ts": [
|
|
4198
|
+
"../types/lib/index.d.ts"
|
|
4199
|
+
],
|
|
4200
|
+
"./node_modules/@opentripplanner/core-utils/lib/route.d.ts": [
|
|
4201
|
+
"../types/lib/index.d.ts"
|
|
4202
|
+
],
|
|
4203
|
+
"./node_modules/@opentripplanner/core-utils/lib/time.d.ts": [
|
|
4204
|
+
"../types/lib/index.d.ts",
|
|
4205
|
+
"./node_modules/@opentripplanner/core-utils/lib/deprecated-with-types.d.ts"
|
|
4206
|
+
],
|
|
4070
4207
|
"./src/__unpublished__/external-types.d.ts": [
|
|
4071
4208
|
"../../node_modules/@types/react/index.d.ts"
|
|
4072
4209
|
],
|
|
4073
|
-
"./src/fare-
|
|
4210
|
+
"./src/fare-table.tsx": [
|
|
4074
4211
|
"./src/types.ts"
|
|
4075
4212
|
],
|
|
4076
4213
|
"./src/index.tsx": [
|
|
@@ -4088,6 +4225,9 @@
|
|
|
4088
4225
|
"../../node_modules/@types/react/index.d.ts",
|
|
4089
4226
|
"../types/lib/index.d.ts"
|
|
4090
4227
|
],
|
|
4228
|
+
"./src/utils.tsx": [
|
|
4229
|
+
"../../node_modules/@types/react/index.d.ts"
|
|
4230
|
+
],
|
|
4091
4231
|
"../types/lib/index.d.ts": [
|
|
4092
4232
|
"../../node_modules/@types/react/index.d.ts"
|
|
4093
4233
|
]
|
|
@@ -4151,6 +4291,7 @@
|
|
|
4151
4291
|
"../../node_modules/@formatjs/intl/src/relativeTime.d.ts",
|
|
4152
4292
|
"../../node_modules/@formatjs/intl/src/types.d.ts",
|
|
4153
4293
|
"../../node_modules/@formatjs/intl/src/utils.d.ts",
|
|
4294
|
+
"../../node_modules/@styled-icons/boxicons-regular/Transfer/Transfer.d.ts",
|
|
4154
4295
|
"../../node_modules/@styled-icons/fa-solid/CalendarAlt/CalendarAlt.d.ts",
|
|
4155
4296
|
"../../node_modules/@styled-icons/fa-solid/HandPaper/HandPaper.d.ts",
|
|
4156
4297
|
"../../node_modules/@styled-icons/fa-solid/Heartbeat/Heartbeat.d.ts",
|
|
@@ -4169,7 +4310,9 @@
|
|
|
4169
4310
|
"../../node_modules/@types/color-convert/route.d.ts",
|
|
4170
4311
|
"../../node_modules/@types/color-name/index.d.ts",
|
|
4171
4312
|
"../../node_modules/@types/cookie/index.d.ts",
|
|
4313
|
+
"../../node_modules/@types/estree/index.d.ts",
|
|
4172
4314
|
"../../node_modules/@types/flat/index.d.ts",
|
|
4315
|
+
"../../node_modules/@types/fs-extra/index.d.ts",
|
|
4173
4316
|
"../../node_modules/@types/geojson/index.d.ts",
|
|
4174
4317
|
"../../node_modules/@types/glob/index.d.ts",
|
|
4175
4318
|
"../../node_modules/@types/graceful-fs/index.d.ts",
|
|
@@ -4209,6 +4352,7 @@
|
|
|
4209
4352
|
"../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts",
|
|
4210
4353
|
"../../node_modules/@types/js-levenshtein/index.d.ts",
|
|
4211
4354
|
"../../node_modules/@types/json-schema/index.d.ts",
|
|
4355
|
+
"../../node_modules/@types/json-stable-stringify/index.d.ts",
|
|
4212
4356
|
"../../node_modules/@types/json5/index.d.ts",
|
|
4213
4357
|
"../../node_modules/@types/mdast/index.d.ts",
|
|
4214
4358
|
"../../node_modules/@types/minimatch/index.d.ts",
|
|
@@ -4435,13 +4579,22 @@
|
|
|
4435
4579
|
"../../node_modules/typescript/lib/lib.scripthost.d.ts",
|
|
4436
4580
|
"../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts",
|
|
4437
4581
|
"../../node_modules/vfile-message/index.d.ts",
|
|
4582
|
+
"./node_modules/@opentripplanner/core-utils/lib/deprecated-with-types.d.ts",
|
|
4583
|
+
"./node_modules/@opentripplanner/core-utils/lib/index.d.ts",
|
|
4584
|
+
"./node_modules/@opentripplanner/core-utils/lib/itinerary.d.ts",
|
|
4585
|
+
"./node_modules/@opentripplanner/core-utils/lib/map.d.ts",
|
|
4586
|
+
"./node_modules/@opentripplanner/core-utils/lib/route.d.ts",
|
|
4587
|
+
"./node_modules/@opentripplanner/core-utils/lib/storage.d.ts",
|
|
4588
|
+
"./node_modules/@opentripplanner/core-utils/lib/time.d.ts",
|
|
4589
|
+
"./node_modules/@opentripplanner/core-utils/lib/ui.d.ts",
|
|
4438
4590
|
"./src/__unpublished__/external-types.d.ts",
|
|
4439
4591
|
"./src/__unpublished__/messages.d.ts",
|
|
4440
|
-
"./src/fare-
|
|
4592
|
+
"./src/fare-table.tsx",
|
|
4441
4593
|
"./src/index.tsx",
|
|
4442
4594
|
"./src/styled.ts",
|
|
4443
4595
|
"./src/trip-detail.tsx",
|
|
4444
4596
|
"./src/types.ts",
|
|
4597
|
+
"./src/utils.tsx",
|
|
4445
4598
|
"../types/lib/index.d.ts"
|
|
4446
4599
|
]
|
|
4447
4600
|
},
|
package/esm/fare-detail.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
-
|
|
7
|
-
/* eslint-disable import/prefer-default-export */
|
|
8
|
-
import React from "react";
|
|
9
|
-
import styled from "styled-components";
|
|
10
|
-
import { FormattedNumber } from "react-intl";
|
|
11
|
-
var TableHeader = styled.thead.withConfig({
|
|
12
|
-
displayName: "fare-detail__TableHeader",
|
|
13
|
-
componentId: "sc-9025ni-0"
|
|
14
|
-
})(["th{max-width:5ch;min-width:5ch;padding:0.75em 1.5em;text-align:center;}th:nth-of-type(2n + 1){background:#cccccc22;}th.main{color:#ffffffcc;background:#333333;}"]);
|
|
15
|
-
var TotalRow = styled.tr.withConfig({
|
|
16
|
-
displayName: "fare-detail__TotalRow",
|
|
17
|
-
componentId: "sc-9025ni-1"
|
|
18
|
-
})(["border-top:2px solid #333;font-weight:600;"]);
|
|
19
|
-
var Table = styled.table.withConfig({
|
|
20
|
-
displayName: "fare-detail__Table",
|
|
21
|
-
componentId: "sc-9025ni-2"
|
|
22
|
-
})(["border-collapse:collapse;display:block;font-family:sans-serif;margin:-8px;margin-bottom:16px;padding:0;td{text-align:right;}td:nth-of-type(2n + 1){background:#cccccc22;}td.no-zebra{background:transparent;}th:first-of-type{height:40px;}"]);
|
|
23
|
-
|
|
24
|
-
var FareTypeTable = function FareTypeTable(props) {
|
|
25
|
-
var header = props.header,
|
|
26
|
-
fareTotals = props.fareTotals,
|
|
27
|
-
cols = props.cols,
|
|
28
|
-
legs = props.legs;
|
|
29
|
-
return /*#__PURE__*/React.createElement(Table, null, /*#__PURE__*/React.createElement(TableHeader, null, /*#__PURE__*/React.createElement("th", {
|
|
30
|
-
className: "main"
|
|
31
|
-
}, header), cols.map(function (col) {
|
|
32
|
-
return /*#__PURE__*/React.createElement("th", {
|
|
33
|
-
key: col.header
|
|
34
|
-
}, col.header);
|
|
35
|
-
})), legs.map(function (leg, index) {
|
|
36
|
-
return /*#__PURE__*/React.createElement("tr", {
|
|
37
|
-
key: index
|
|
38
|
-
}, /*#__PURE__*/React.createElement("td", {
|
|
39
|
-
className: "no-zebra"
|
|
40
|
-
}, leg.routeShortName), cols.map(function (col) {
|
|
41
|
-
var _fare$price, _legs$0$fares, _legs$0$fares$col$key, _legs$0$fares$col$key2;
|
|
42
|
-
|
|
43
|
-
var fare = leg.fares[col.key];
|
|
44
|
-
return /*#__PURE__*/React.createElement("td", {
|
|
45
|
-
key: col.key
|
|
46
|
-
}, /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
47
|
-
value: (fare === null || fare === void 0 ? void 0 : (_fare$price = fare.price) === null || _fare$price === void 0 ? void 0 : _fare$price.cents) / 100 || 0 // This isn't a "real" style prop
|
|
48
|
-
// eslint-disable-next-line react/style-prop-object
|
|
49
|
-
,
|
|
50
|
-
style: "currency",
|
|
51
|
-
currency: (fare === null || fare === void 0 ? void 0 : fare.price.currency.currencyCode) || ( // This is how the itinerary-wide currency code is calculated on the back-end
|
|
52
|
-
legs === null || legs === void 0 ? void 0 : (_legs$0$fares = legs[0].fares) === null || _legs$0$fares === void 0 ? void 0 : (_legs$0$fares$col$key = _legs$0$fares[col.key]) === null || _legs$0$fares$col$key === void 0 ? void 0 : (_legs$0$fares$col$key2 = _legs$0$fares$col$key.price) === null || _legs$0$fares$col$key2 === void 0 ? void 0 : _legs$0$fares$col$key2.currency.currencyCode),
|
|
53
|
-
currencyDisplay: "narrowSymbol"
|
|
54
|
-
}));
|
|
55
|
-
}));
|
|
56
|
-
}), /*#__PURE__*/React.createElement(TotalRow, null, /*#__PURE__*/React.createElement("td", {
|
|
57
|
-
className: "no-zebra"
|
|
58
|
-
}, "Total"), cols.map(function (col) {
|
|
59
|
-
var _fare$currency;
|
|
60
|
-
|
|
61
|
-
var fare = fareTotals[col.key];
|
|
62
|
-
return /*#__PURE__*/React.createElement("td", {
|
|
63
|
-
key: col.key
|
|
64
|
-
}, /*#__PURE__*/React.createElement(FormattedNumber, {
|
|
65
|
-
value: ((fare === null || fare === void 0 ? void 0 : fare.cents) || 0) / 100 // This isn't a "real" style prop
|
|
66
|
-
// eslint-disable-next-line react/style-prop-object
|
|
67
|
-
,
|
|
68
|
-
style: "currency",
|
|
69
|
-
currency: fare === null || fare === void 0 ? void 0 : (_fare$currency = fare.currency) === null || _fare$currency === void 0 ? void 0 : _fare$currency.currencyCode,
|
|
70
|
-
currencyDisplay: "narrowSymbol"
|
|
71
|
-
}));
|
|
72
|
-
})));
|
|
73
|
-
}; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
export var FareDetails = function FareDetails(props) {
|
|
77
|
-
var legs = props.legs,
|
|
78
|
-
transitFares = props.transitFares,
|
|
79
|
-
layout = props.layout;
|
|
80
|
-
var fareKeys = Object.keys(transitFares.details);
|
|
81
|
-
var legsWithFares = legs.map(function (leg, index) {
|
|
82
|
-
var fares = fareKeys.reduce(function (prev, key) {
|
|
83
|
-
var _transitFares$details;
|
|
84
|
-
|
|
85
|
-
var fareForKey = (_transitFares$details = transitFares.details[key]) === null || _transitFares$details === void 0 ? void 0 : _transitFares$details.find(function (detail) {
|
|
86
|
-
return detail.legIndex === index;
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
if (fareForKey) {
|
|
90
|
-
prev[key] = fareForKey;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return prev;
|
|
94
|
-
}, {});
|
|
95
|
-
return _objectSpread(_objectSpread({}, leg), {}, {
|
|
96
|
-
fares: fares
|
|
97
|
-
});
|
|
98
|
-
}).filter(function (leg) {
|
|
99
|
-
return leg.transitLeg;
|
|
100
|
-
});
|
|
101
|
-
return /*#__PURE__*/React.createElement("div", null, layout.map(function (config) {
|
|
102
|
-
return /*#__PURE__*/React.createElement(FareTypeTable, {
|
|
103
|
-
header: config.header,
|
|
104
|
-
cols: config.cols,
|
|
105
|
-
key: config.header,
|
|
106
|
-
legs: legsWithFares,
|
|
107
|
-
fareTotals: transitFares.fare
|
|
108
|
-
});
|
|
109
|
-
}));
|
|
110
|
-
};
|
|
111
|
-
//# sourceMappingURL=fare-detail.js.map
|
package/esm/fare-detail.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/fare-detail.tsx"],"names":["React","styled","FormattedNumber","TableHeader","thead","TotalRow","tr","Table","table","FareTypeTable","props","header","fareTotals","cols","legs","map","col","leg","index","routeShortName","fare","fares","key","price","cents","currency","currencyCode","FareDetails","transitFares","layout","fareKeys","Object","keys","details","legsWithFares","reduce","prev","fareForKey","find","detail","legIndex","filter","transitLeg","config"],"mappings":"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","sourcesContent":["/* eslint-disable import/prefer-default-export */\nimport { Leg, Money } from \"@opentripplanner/types\";\n\nimport React from \"react\";\nimport styled from \"styled-components\";\nimport { FormattedNumber } from \"react-intl\";\nimport { FareDetailsProps } from \"./types\";\n\ntype LegWithFare = Leg & { fares: { [key: string]: { price: Money } } };\n\ninterface FareTypeTableProps {\n header: string;\n cols: {\n key: string;\n header: string;\n }[];\n legs: LegWithFare[];\n fareTotals: { [fareKey: string]: Money };\n}\n\nconst TableHeader = styled.thead`\n th {\n max-width: 5ch;\n min-width: 5ch;\n padding: 0.75em 1.5em;\n text-align: center;\n }\n th:nth-of-type(2n + 1) {\n background: #cccccc22;\n }\n th.main {\n color: #ffffffcc;\n background: #333333;\n }\n`;\n\nconst TotalRow = styled.tr`\n border-top: 2px solid #333;\n font-weight: 600;\n`;\n\nconst Table = styled.table`\n border-collapse: collapse;\n display: block;\n font-family: sans-serif;\n margin: -8px;\n /* This line can not be sorted alphabetically, because it must come after the margin rule */\n margin-bottom: 16px;\n padding: 0;\n\n td {\n text-align: right;\n }\n td:nth-of-type(2n + 1) {\n background: #cccccc22;\n }\n td.no-zebra {\n background: transparent;\n }\n th:first-of-type {\n height: 40px;\n }\n`;\n\nconst FareTypeTable = (props: FareTypeTableProps): JSX.Element => {\n const { header, fareTotals, cols, legs } = props;\n return (\n <Table>\n <TableHeader>\n <th className=\"main\">{header}</th>\n {cols.map(col => (\n <th key={col.header}>{col.header}</th>\n ))}\n </TableHeader>\n {legs.map((leg, index) => (\n <tr key={index}>\n <td className=\"no-zebra\">{leg.routeShortName}</td>\n {cols.map(col => {\n const fare = leg.fares[col.key];\n return (\n <td key={col.key}>\n <FormattedNumber\n value={fare?.price?.cents / 100 || 0}\n // This isn't a \"real\" style prop\n // eslint-disable-next-line react/style-prop-object\n style=\"currency\"\n currency={\n fare?.price.currency.currencyCode ||\n // This is how the itinerary-wide currency code is calculated on the back-end\n legs?.[0].fares?.[col.key]?.price?.currency.currencyCode\n }\n currencyDisplay=\"narrowSymbol\"\n />\n </td>\n );\n })}\n </tr>\n ))}\n <TotalRow>\n <td className=\"no-zebra\">Total</td>\n {cols.map(col => {\n const fare = fareTotals[col.key];\n return (\n <td key={col.key}>\n <FormattedNumber\n value={(fare?.cents || 0) / 100}\n // This isn't a \"real\" style prop\n // eslint-disable-next-line react/style-prop-object\n style=\"currency\"\n currency={fare?.currency?.currencyCode}\n currencyDisplay=\"narrowSymbol\"\n />\n </td>\n );\n })}\n </TotalRow>\n </Table>\n );\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const FareDetails = (props: FareDetailsProps): JSX.Element => {\n const { legs, transitFares, layout } = props;\n const fareKeys = Object.keys(transitFares.details);\n\n const legsWithFares = legs\n .map((leg, index) => {\n const fares = fareKeys.reduce((prev, key) => {\n const fareForKey = transitFares.details[key]?.find(\n detail => detail.legIndex === index\n );\n if (fareForKey) {\n prev[key] = fareForKey;\n }\n return prev;\n }, {});\n return {\n ...leg,\n fares\n };\n })\n .filter(leg => leg.transitLeg);\n\n return (\n <div>\n {layout.map(config => (\n <FareTypeTable\n header={config.header}\n cols={config.cols}\n key={config.header}\n legs={legsWithFares}\n fareTotals={transitFares.fare}\n />\n ))}\n </div>\n );\n};\n"],"file":"fare-detail.js"}
|
package/lib/fare-detail.d.ts
DELETED
package/lib/fare-detail.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fare-detail.d.ts","sourceRoot":"","sources":["../src/fare-detail.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAmH3C,eAAO,MAAM,WAAW,UAAW,gBAAgB,KAAG,WAmCrD,CAAC"}
|