@blockend/widget 1.0.31 → 1.0.32

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.
Files changed (162) hide show
  1. package/dist/AllRoutes-CPwuTwqd.js +2209 -0
  2. package/dist/Box-CIChapvH.js +55 -0
  3. package/dist/EstGas-CEFILtyf.js +12867 -0
  4. package/dist/Grow-DJZj9zjv.js +1656 -0
  5. package/dist/InputComp-DqF1JGIu.js +106 -0
  6. package/dist/LoadRoute-r3sHTYXM.js +126 -0
  7. package/dist/QuotesProgress-BXVLxZ8U.js +28 -0
  8. package/dist/SwapAsset-07WvVwl-.js +64 -0
  9. package/dist/Tooltip-CNAsCF8n.js +572 -0
  10. package/dist/TxnButton-D2TTkFYA.js +207 -0
  11. package/dist/WidgetForm.module-QHJ0-m5f.js +9 -0
  12. package/dist/{add-B8AfyNIx.js → add-t2GqC9VA.js} +3 -3
  13. package/dist/{all-wallets-BaLLU39i.js → all-wallets-DFyf0q31.js} +3 -3
  14. package/dist/{app-store-DNpoABj1.js → app-store-aAahwmBP.js} +3 -3
  15. package/dist/{apple-DzzHtaL4.js → apple-DeRgpwlc.js} +3 -3
  16. package/dist/{arrow-bottom-D2c13c51.js → arrow-bottom-DdEOkaAj.js} +3 -3
  17. package/dist/{arrow-bottom-circle-ls9OCLx1.js → arrow-bottom-circle-BWwREWcv.js} +3 -3
  18. package/dist/{arrow-left-BI3rQkNI.js → arrow-left-CulyLmoH.js} +3 -3
  19. package/dist/{arrow-right-rnMzhVod.js → arrow-right-Dwr7TISn.js} +3 -3
  20. package/dist/{arrow-top-CfA6PVMz.js → arrow-top-pL4rM_y8.js} +3 -3
  21. package/dist/{bank-CmpAmHgg.js → bank-CPuyK_08.js} +3 -3
  22. package/dist/basic-CVc9xEvb.js +5783 -0
  23. package/dist/{browser-mEcjgS1H.js → browser-Cbq2Zbp4.js} +3 -3
  24. package/dist/{card-DkgIWcMc.js → card-B_hUtPWK.js} +3 -3
  25. package/dist/ccip-BLVGcR4A.js +228 -0
  26. package/dist/{checkmark-B_A013n2.js → checkmark-WEqTsFAc.js} +3 -3
  27. package/dist/{checkmark-bold-DestuG2T.js → checkmark-bold-Du_ZvhqM.js} +3 -3
  28. package/dist/{chevron-bottom-Di3S86dj.js → chevron-bottom-C-s-lv4L.js} +3 -3
  29. package/dist/{chevron-left-A9Wj-3tj.js → chevron-left-C7NcRElx.js} +3 -3
  30. package/dist/{chevron-right-UFxJogOZ.js → chevron-right-CSzmAmdn.js} +3 -3
  31. package/dist/{chevron-top-BbZs3eaC.js → chevron-top-Dd99Wfel.js} +3 -3
  32. package/dist/{chrome-store-B4F6hJmy.js → chrome-store-C4p77Of0.js} +3 -3
  33. package/dist/{clock-BbAQ09uV.js → clock-Cib24qjH.js} +3 -3
  34. package/dist/clockIcon-C2W5xvyt.js +76 -0
  35. package/dist/{close-CY3oZP_D.js → close-BXjEkTvS.js} +3 -3
  36. package/dist/{coinPlaceholder-DpfsobZT.js → coinPlaceholder-BFNC7cQN.js} +3 -3
  37. package/dist/{compass-CHS7RZFk.js → compass-CXPX5Ycp.js} +3 -3
  38. package/dist/{copy-CEd4nGhs.js → copy-BEawMbmF.js} +3 -3
  39. package/dist/core-Bez9Ow7F.js +14967 -0
  40. package/dist/cursor-Cxq4Q9jk.js +7 -0
  41. package/dist/{cursor-transparent-Tm6k6Ws4.js → cursor-transparent-ZjJ0P2vr.js} +3 -3
  42. package/dist/{desktop-CrSyXZkL.js → desktop-BhZVovAp.js} +3 -3
  43. package/dist/{disconnect-BooT10E1.js → disconnect-AC-bffZO.js} +3 -3
  44. package/dist/{discord-B982Qaml.js → discord-dT97h-CC.js} +3 -3
  45. package/dist/down-DP56YSKp.js +606 -0
  46. package/dist/{etherscan-CFL0IcNl.js → etherscan-rYFRhRTM.js} +3 -3
  47. package/dist/ethertousd-CC_ezooz.js +6 -0
  48. package/dist/{exclamation-triangle-BBeGXYgt.js → exclamation-triangle-C-pCuC08.js} +3 -3
  49. package/dist/{extension-C5WqJw73.js → extension-BnqauLSn.js} +3 -3
  50. package/dist/{external-link-CcSxVDcd.js → external-link-M9D6e_F3.js} +3 -3
  51. package/dist/{facebook-DF0v9ED8.js → facebook-DHezcoD-.js} +3 -3
  52. package/dist/{farcaster-Boq7M4VK.js → farcaster-D0Ky-Imv.js} +3 -3
  53. package/dist/{filters-DfeymbPx.js → filters-B02NYLWq.js} +3 -3
  54. package/dist/getChainIds-CJd2TZYT.js +1888 -0
  55. package/dist/getCosmosAddress-DTZfw04G.js +9565 -0
  56. package/dist/{github-DQ8FV4bD.js → github-BzQkIMuE.js} +3 -3
  57. package/dist/{google-Dm8FDDZR.js → google-BpwCJ4Fs.js} +3 -3
  58. package/dist/hamburger-BzqwkUjE.js +3915 -0
  59. package/dist/{help-circle-CbgiAebR.js → help-circle-C0nOySHC.js} +3 -3
  60. package/dist/{id-CzqxUksI.js → id-DFP_kFd4.js} +3 -3
  61. package/dist/{image-CsCGTIN-.js → image-QiYOAGjM.js} +3 -3
  62. package/dist/index-CDq3vNnP.js +22 -0
  63. package/dist/index-CLzkn733.js +28223 -0
  64. package/dist/index-CjtwASJt.js +252 -0
  65. package/dist/index-CrC4B7xn.js +331 -0
  66. package/dist/index-D5hLIe-N.js +9 -0
  67. package/dist/index-DDk00SOL.js +159 -0
  68. package/dist/index-DTish3yr.js +1014 -0
  69. package/dist/index-DW3W7zaF.js +473 -0
  70. package/dist/index-DXdD3L9f.js +1460 -0
  71. package/dist/index-DaJ1272l.js +18613 -0
  72. package/dist/index-DxPp2gBS.js +992 -0
  73. package/dist/index-Dy_n2MPD.js +3010 -0
  74. package/dist/index-oc8HPfOF.js +13583 -0
  75. package/dist/index.es-Bsr7zP98.js +366 -0
  76. package/dist/index.es-C-j-Ghef.js +11678 -0
  77. package/dist/index.es.js +4 -4
  78. package/dist/{info-fKCfLW0k.js → info-BTLQJ-wd.js} +3 -3
  79. package/dist/{info-circle-Bt350Yzj.js → info-circle-Dla9169_.js} +3 -3
  80. package/dist/{lightbulb-BL9YBxiA.js → lightbulb-PN8DA_Wh.js} +3 -3
  81. package/dist/{mail-_g6CHQeQ.js → mail-BGYZut_4.js} +3 -3
  82. package/dist/{mobile-B-EQ4IcH.js → mobile-BM760ZzX.js} +3 -3
  83. package/dist/{more-C3rpOdUy.js → more-rHGnl2ck.js} +3 -3
  84. package/dist/{network-placeholder-D9Ak7Xj_.js → network-placeholder-CyQl-3_2.js} +3 -3
  85. package/dist/{nftPlaceholder-CIIm2V_o.js → nftPlaceholder-nuUJ8nKY.js} +3 -3
  86. package/dist/{off-DZjgI0eE.js → off-GYlwYDrT.js} +3 -3
  87. package/dist/{play-store-DvRnagoF.js → play-store-Ck01Ez1F.js} +3 -3
  88. package/dist/{plus-C2jN2huZ.js → plus-CQfXWgLw.js} +3 -3
  89. package/dist/{qr-code-B64HnZgi.js → qr-code-CyLVwLY7.js} +3 -3
  90. package/dist/{recycle-horizontal-CovcJGa_.js → recycle-horizontal-DvnWPcEQ.js} +3 -3
  91. package/dist/{refresh-J1Vw6QMA.js → refresh-BOxj8b2n.js} +3 -3
  92. package/dist/{reown-logo-BsXoZ3KT.js → reown-logo-D1iprOTg.js} +3 -3
  93. package/dist/{search-BC86wYXR.js → search-DrPaZPnc.js} +3 -3
  94. package/dist/secp256k1-DgmH1qVg.js +1251 -0
  95. package/dist/{send-BPA1bK5G.js → send-ybBREe4b.js} +3 -3
  96. package/dist/shareicon-D3Qj5j1T.js +262 -0
  97. package/dist/{sortDown-cDA6MpOw.js → sortDown-CjBaDQTU.js} +13 -13
  98. package/dist/{swapHorizontal-47_8ePle.js → swapHorizontal-BddjZdXK.js} +3 -3
  99. package/dist/{swapHorizontalBold-CJ7TzeQP.js → swapHorizontalBold-B6AWjPZ9.js} +3 -3
  100. package/dist/{swapHorizontalMedium-CTACgUR9.js → swapHorizontalMedium-CNacWoBn.js} +3 -3
  101. package/dist/{swapHorizontalRoundedBold-Ht3_LABp.js → swapHorizontalRoundedBold-B8VcPnqt.js} +3 -3
  102. package/dist/{swapVertical-DlS0V6DD.js → swapVertical-zY2BbSyQ.js} +3 -3
  103. package/dist/{telegram-UZ00kvIE.js → telegram-DS4l-8Oc.js} +3 -3
  104. package/dist/{three-dots-D9zVXr1j.js → three-dots-RctNqamK.js} +3 -3
  105. package/dist/truncate-D9t92mVX.js +7 -0
  106. package/dist/{twitch-CP6rpz4m.js → twitch-CJ0llIIH.js} +3 -3
  107. package/dist/{twitterIcon-Cm3I3FRU.js → twitterIcon-pgvN9-bP.js} +3 -3
  108. package/dist/unsupportedProp-BJVuEW_b.js +10 -0
  109. package/dist/useRegisterError-C_YLA1dw.js +9857 -0
  110. package/dist/validError-CDlJpg_f.js +6 -0
  111. package/dist/{verify-DuUE85WT.js → verify-BeZLo1Fq.js} +3 -3
  112. package/dist/{verify-filled-CfgydKPa.js → verify-filled-meyb7E16.js} +3 -3
  113. package/dist/w3m-modal-C-Jp9NVv.js +1471 -0
  114. package/dist/{wallet-BC2LSDlF.js → wallet-CFcOgSsz.js} +3 -3
  115. package/dist/{wallet-placeholder-DugEJ7xM.js → wallet-placeholder-CeUMILZq.js} +3 -3
  116. package/dist/{walletconnect-wayCaYfk.js → walletconnect-D6LB1PyC.js} +7 -9
  117. package/dist/{warning-circle-Cy9YuvwU.js → warning-circle-BRtzofvT.js} +3 -3
  118. package/dist/{x-jggPFiy-.js → x-DKQAOOh3.js} +3 -3
  119. package/package.json +1 -1
  120. package/dist/AllRoutes-Bdi5ZW8W.js +0 -2604
  121. package/dist/Box-e4gA-y_H.js +0 -60
  122. package/dist/EstGas-C5ihS0Mw.js +0 -17108
  123. package/dist/Grow-B4K-I-E-.js +0 -2212
  124. package/dist/InputComp-C_UUZxNU.js +0 -114
  125. package/dist/LoadRoute-CnDhVKdh.js +0 -142
  126. package/dist/QuotesProgress-DxgPgPJE.js +0 -29
  127. package/dist/SwapAsset-CmmuxeQF.js +0 -65
  128. package/dist/Tooltip-D8YjOOKU.js +0 -718
  129. package/dist/TxnButton-CF-TLZrD.js +0 -302
  130. package/dist/WidgetForm.module-DhUUlwZP.js +0 -13
  131. package/dist/basic-Cx2xxgd9.js +0 -7109
  132. package/dist/ccip-BKpquA5i.js +0 -250
  133. package/dist/clockIcon-jSNFFrLy.js +0 -76
  134. package/dist/core-C-gr9X18.js +0 -17217
  135. package/dist/cursor-BTtIlTHP.js +0 -7
  136. package/dist/down-DDk8OoJG.js +0 -809
  137. package/dist/ethertousd-BOknTgU4.js +0 -7
  138. package/dist/getChainIds-6iugk2h0.js +0 -2431
  139. package/dist/getCosmosAddress-BgD5iV6f.js +0 -13998
  140. package/dist/hamburger-BYe_G11E.js +0 -4562
  141. package/dist/index-BAmjBHYR.js +0 -1087
  142. package/dist/index-BxHeZ9IF.js +0 -543
  143. package/dist/index-C7cb2O7r.js +0 -16078
  144. package/dist/index-CF9p4S_X.js +0 -11
  145. package/dist/index-C_vo1L7p.js +0 -24384
  146. package/dist/index-Ch7w83dW.js +0 -4217
  147. package/dist/index-Crhenmgw.js +0 -188
  148. package/dist/index-Cz5Dosd2.js +0 -412
  149. package/dist/index-D5OnT-__.js +0 -35858
  150. package/dist/index-DArR1lwi.js +0 -1759
  151. package/dist/index-hEJSpZe-.js +0 -308
  152. package/dist/index-m2O0cbD8.js +0 -1883
  153. package/dist/index-sLx4Edw4.js +0 -22
  154. package/dist/index.es-DIbGJsfa.js +0 -475
  155. package/dist/index.es-t6sHlseh.js +0 -12916
  156. package/dist/secp256k1-BkBK0mD5.js +0 -1681
  157. package/dist/shareicon-C88Wx-AM.js +0 -314
  158. package/dist/truncate-DSxFWEga.js +0 -7
  159. package/dist/unsupportedProp-DkeDzLfM.js +0 -14
  160. package/dist/useRegisterError-W_UfecIN.js +0 -19288
  161. package/dist/validError-rariWQ7G.js +0 -14
  162. package/dist/w3m-modal-Bl-DPlah.js +0 -1721
@@ -1,2604 +0,0 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import React__default, { useState, useEffect } from "react";
4
- import { S as SortUp, a as SortDown } from "./sortDown-cDA6MpOw.js";
5
- import { t as truncate } from "./truncate-DSxFWEga.js";
6
- import { g as generateUtilityClasses, d as useDefaultProps, c as clsx, s as styled, a as composeClasses, e as useEnhancedEffect, v as useSlotProps, o as useTheme, q as useEventCallback, t as ownerDocument, b as refType, i as images, j as fixString, f as formatNumber } from "./useRegisterError-W_UfecIN.js";
7
- import { g as generateUtilityClass, _ as _objectWithoutPropertiesLoose, b as _extends, d as capitalize, p as process$1, P as PropTypes, m as useThemeProps, u as useStore } from "./index-D5OnT-__.js";
8
- import { S as Step, C as ClockIcon, G as Gas } from "./clockIcon-jSNFFrLy.js";
9
- import { T as Tooltip } from "./Tooltip-D8YjOOKU.js";
10
- import { O as OutputValueComp } from "./index-CF9p4S_X.js";
11
- import { B as Box } from "./Box-e4gA-y_H.js";
12
- import { c as createSvgIcon, d as debounce, r as reactIsExports } from "./index-Cz5Dosd2.js";
13
- import { b as useRtl } from "./Grow-B4K-I-E-.js";
14
- import { B as ButtonBase, o as ownerWindow } from "./getChainIds-6iugk2h0.js";
15
- import { u as unsupportedProp } from "./unsupportedProp-DkeDzLfM.js";
16
- let cachedType;
17
- function detectScrollType() {
18
- if (cachedType) {
19
- return cachedType;
20
- }
21
- const dummy = document.createElement("div");
22
- const container = document.createElement("div");
23
- container.style.width = "10px";
24
- container.style.height = "1px";
25
- dummy.appendChild(container);
26
- dummy.dir = "rtl";
27
- dummy.style.fontSize = "14px";
28
- dummy.style.width = "4px";
29
- dummy.style.height = "1px";
30
- dummy.style.position = "absolute";
31
- dummy.style.top = "-1000px";
32
- dummy.style.overflow = "scroll";
33
- document.body.appendChild(dummy);
34
- cachedType = "reverse";
35
- if (dummy.scrollLeft > 0) {
36
- cachedType = "default";
37
- } else {
38
- dummy.scrollLeft = 1;
39
- if (dummy.scrollLeft === 0) {
40
- cachedType = "negative";
41
- }
42
- }
43
- document.body.removeChild(dummy);
44
- return cachedType;
45
- }
46
- function getNormalizedScrollLeft(element, direction) {
47
- const scrollLeft = element.scrollLeft;
48
- if (direction !== "rtl") {
49
- return scrollLeft;
50
- }
51
- const type = detectScrollType();
52
- switch (type) {
53
- case "negative":
54
- return element.scrollWidth - element.clientWidth + scrollLeft;
55
- case "reverse":
56
- return element.scrollWidth - element.clientWidth - scrollLeft;
57
- default:
58
- return scrollLeft;
59
- }
60
- }
61
- function getTabUtilityClass(slot) {
62
- return generateUtilityClass("MuiTab", slot);
63
- }
64
- const tabClasses = generateUtilityClasses("MuiTab", ["root", "labelIcon", "textColorInherit", "textColorPrimary", "textColorSecondary", "selected", "disabled", "fullWidth", "wrapped", "iconWrapper"]);
65
- const _excluded$5 = ["className", "disabled", "disableFocusRipple", "fullWidth", "icon", "iconPosition", "indicator", "label", "onChange", "onClick", "onFocus", "selected", "selectionFollowsFocus", "textColor", "value", "wrapped"];
66
- const useUtilityClasses$3 = (ownerState) => {
67
- const {
68
- classes,
69
- textColor,
70
- fullWidth,
71
- wrapped,
72
- icon,
73
- label,
74
- selected,
75
- disabled
76
- } = ownerState;
77
- const slots = {
78
- root: ["root", icon && label && "labelIcon", `textColor${capitalize(textColor)}`, fullWidth && "fullWidth", wrapped && "wrapped", selected && "selected", disabled && "disabled"],
79
- iconWrapper: ["iconWrapper"]
80
- };
81
- return composeClasses(slots, getTabUtilityClass, classes);
82
- };
83
- const TabRoot = styled(ButtonBase, {
84
- name: "MuiTab",
85
- slot: "Root",
86
- overridesResolver: (props, styles2) => {
87
- const {
88
- ownerState
89
- } = props;
90
- return [styles2.root, ownerState.label && ownerState.icon && styles2.labelIcon, styles2[`textColor${capitalize(ownerState.textColor)}`], ownerState.fullWidth && styles2.fullWidth, ownerState.wrapped && styles2.wrapped, {
91
- [`& .${tabClasses.iconWrapper}`]: styles2.iconWrapper
92
- }];
93
- }
94
- })(({
95
- theme,
96
- ownerState
97
- }) => _extends({}, theme.typography.button, {
98
- maxWidth: 360,
99
- minWidth: 90,
100
- position: "relative",
101
- minHeight: 48,
102
- flexShrink: 0,
103
- padding: "12px 16px",
104
- overflow: "hidden",
105
- whiteSpace: "normal",
106
- textAlign: "center"
107
- }, ownerState.label && {
108
- flexDirection: ownerState.iconPosition === "top" || ownerState.iconPosition === "bottom" ? "column" : "row"
109
- }, {
110
- lineHeight: 1.25
111
- }, ownerState.icon && ownerState.label && {
112
- minHeight: 72,
113
- paddingTop: 9,
114
- paddingBottom: 9,
115
- [`& > .${tabClasses.iconWrapper}`]: _extends({}, ownerState.iconPosition === "top" && {
116
- marginBottom: 6
117
- }, ownerState.iconPosition === "bottom" && {
118
- marginTop: 6
119
- }, ownerState.iconPosition === "start" && {
120
- marginRight: theme.spacing(1)
121
- }, ownerState.iconPosition === "end" && {
122
- marginLeft: theme.spacing(1)
123
- })
124
- }, ownerState.textColor === "inherit" && {
125
- color: "inherit",
126
- opacity: 0.6,
127
- // same opacity as theme.palette.text.secondary
128
- [`&.${tabClasses.selected}`]: {
129
- opacity: 1
130
- },
131
- [`&.${tabClasses.disabled}`]: {
132
- opacity: (theme.vars || theme).palette.action.disabledOpacity
133
- }
134
- }, ownerState.textColor === "primary" && {
135
- color: (theme.vars || theme).palette.text.secondary,
136
- [`&.${tabClasses.selected}`]: {
137
- color: (theme.vars || theme).palette.primary.main
138
- },
139
- [`&.${tabClasses.disabled}`]: {
140
- color: (theme.vars || theme).palette.text.disabled
141
- }
142
- }, ownerState.textColor === "secondary" && {
143
- color: (theme.vars || theme).palette.text.secondary,
144
- [`&.${tabClasses.selected}`]: {
145
- color: (theme.vars || theme).palette.secondary.main
146
- },
147
- [`&.${tabClasses.disabled}`]: {
148
- color: (theme.vars || theme).palette.text.disabled
149
- }
150
- }, ownerState.fullWidth && {
151
- flexShrink: 1,
152
- flexGrow: 1,
153
- flexBasis: 0,
154
- maxWidth: "none"
155
- }, ownerState.wrapped && {
156
- fontSize: theme.typography.pxToRem(12)
157
- }));
158
- const Tab = /* @__PURE__ */ React.forwardRef(function Tab2(inProps, ref) {
159
- const props = useDefaultProps({
160
- props: inProps,
161
- name: "MuiTab"
162
- });
163
- const {
164
- className,
165
- disabled = false,
166
- disableFocusRipple = false,
167
- // eslint-disable-next-line react/prop-types
168
- fullWidth,
169
- icon: iconProp,
170
- iconPosition = "top",
171
- // eslint-disable-next-line react/prop-types
172
- indicator,
173
- label,
174
- onChange,
175
- onClick,
176
- onFocus,
177
- // eslint-disable-next-line react/prop-types
178
- selected,
179
- // eslint-disable-next-line react/prop-types
180
- selectionFollowsFocus,
181
- // eslint-disable-next-line react/prop-types
182
- textColor = "inherit",
183
- value,
184
- wrapped = false
185
- } = props, other = _objectWithoutPropertiesLoose(props, _excluded$5);
186
- const ownerState = _extends({}, props, {
187
- disabled,
188
- disableFocusRipple,
189
- selected,
190
- icon: !!iconProp,
191
- iconPosition,
192
- label: !!label,
193
- fullWidth,
194
- textColor,
195
- wrapped
196
- });
197
- const classes = useUtilityClasses$3(ownerState);
198
- const icon = iconProp && label && /* @__PURE__ */ React.isValidElement(iconProp) ? /* @__PURE__ */ React.cloneElement(iconProp, {
199
- className: clsx(classes.iconWrapper, iconProp.props.className)
200
- }) : iconProp;
201
- const handleClick = (event) => {
202
- if (!selected && onChange) {
203
- onChange(event, value);
204
- }
205
- if (onClick) {
206
- onClick(event);
207
- }
208
- };
209
- const handleFocus = (event) => {
210
- if (selectionFollowsFocus && !selected && onChange) {
211
- onChange(event, value);
212
- }
213
- if (onFocus) {
214
- onFocus(event);
215
- }
216
- };
217
- return /* @__PURE__ */ jsxs(TabRoot, _extends({
218
- focusRipple: !disableFocusRipple,
219
- className: clsx(classes.root, className),
220
- ref,
221
- role: "tab",
222
- "aria-selected": selected,
223
- disabled,
224
- onClick: handleClick,
225
- onFocus: handleFocus,
226
- ownerState,
227
- tabIndex: selected ? 0 : -1
228
- }, other, {
229
- children: [iconPosition === "top" || iconPosition === "start" ? /* @__PURE__ */ jsxs(React.Fragment, {
230
- children: [icon, label]
231
- }) : /* @__PURE__ */ jsxs(React.Fragment, {
232
- children: [label, icon]
233
- }), indicator]
234
- }));
235
- });
236
- process$1.env.NODE_ENV !== "production" ? Tab.propTypes = {
237
- // ┌────────────────────────────── Warning ──────────────────────────────┐
238
- // │ These PropTypes are generated from the TypeScript type definitions. │
239
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
240
- // └─────────────────────────────────────────────────────────────────────┘
241
- /**
242
- * This prop isn't supported.
243
- * Use the `component` prop if you need to change the children structure.
244
- */
245
- children: unsupportedProp,
246
- /**
247
- * Override or extend the styles applied to the component.
248
- */
249
- classes: PropTypes.object,
250
- /**
251
- * @ignore
252
- */
253
- className: PropTypes.string,
254
- /**
255
- * If `true`, the component is disabled.
256
- * @default false
257
- */
258
- disabled: PropTypes.bool,
259
- /**
260
- * If `true`, the keyboard focus ripple is disabled.
261
- * @default false
262
- */
263
- disableFocusRipple: PropTypes.bool,
264
- /**
265
- * If `true`, the ripple effect is disabled.
266
- *
267
- * ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
268
- * to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
269
- * @default false
270
- */
271
- disableRipple: PropTypes.bool,
272
- /**
273
- * The icon to display.
274
- */
275
- icon: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
276
- /**
277
- * The position of the icon relative to the label.
278
- * @default 'top'
279
- */
280
- iconPosition: PropTypes.oneOf(["bottom", "end", "start", "top"]),
281
- /**
282
- * The label element.
283
- */
284
- label: PropTypes.node,
285
- /**
286
- * @ignore
287
- */
288
- onChange: PropTypes.func,
289
- /**
290
- * @ignore
291
- */
292
- onClick: PropTypes.func,
293
- /**
294
- * @ignore
295
- */
296
- onFocus: PropTypes.func,
297
- /**
298
- * The system prop that allows defining system overrides as well as additional CSS styles.
299
- */
300
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
301
- /**
302
- * You can provide your own value. Otherwise, we fallback to the child position index.
303
- */
304
- value: PropTypes.any,
305
- /**
306
- * Tab labels appear in a single row.
307
- * They can use a second line if needed.
308
- * @default false
309
- */
310
- wrapped: PropTypes.bool
311
- } : void 0;
312
- const KeyboardArrowLeft = createSvgIcon(/* @__PURE__ */ jsx("path", {
313
- d: "M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"
314
- }), "KeyboardArrowLeft");
315
- const KeyboardArrowRight = createSvgIcon(/* @__PURE__ */ jsx("path", {
316
- d: "M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"
317
- }), "KeyboardArrowRight");
318
- function easeInOutSin(time) {
319
- return (1 + Math.sin(Math.PI * time - Math.PI / 2)) / 2;
320
- }
321
- function animate(property, element, to, options = {}, cb = () => {
322
- }) {
323
- const {
324
- ease = easeInOutSin,
325
- duration = 300
326
- // standard
327
- } = options;
328
- let start = null;
329
- const from = element[property];
330
- let cancelled = false;
331
- const cancel = () => {
332
- cancelled = true;
333
- };
334
- const step = (timestamp) => {
335
- if (cancelled) {
336
- cb(new Error("Animation cancelled"));
337
- return;
338
- }
339
- if (start === null) {
340
- start = timestamp;
341
- }
342
- const time = Math.min(1, (timestamp - start) / duration);
343
- element[property] = ease(time) * (to - from) + from;
344
- if (time >= 1) {
345
- requestAnimationFrame(() => {
346
- cb(null);
347
- });
348
- return;
349
- }
350
- requestAnimationFrame(step);
351
- };
352
- if (from === to) {
353
- cb(new Error("Element already at target position"));
354
- return cancel;
355
- }
356
- requestAnimationFrame(step);
357
- return cancel;
358
- }
359
- const _excluded$4 = ["onChange"];
360
- const styles = {
361
- width: 99,
362
- height: 99,
363
- position: "absolute",
364
- top: -9999,
365
- overflow: "scroll"
366
- };
367
- function ScrollbarSize(props) {
368
- const {
369
- onChange
370
- } = props, other = _objectWithoutPropertiesLoose(props, _excluded$4);
371
- const scrollbarHeight = React.useRef();
372
- const nodeRef = React.useRef(null);
373
- const setMeasurements = () => {
374
- scrollbarHeight.current = nodeRef.current.offsetHeight - nodeRef.current.clientHeight;
375
- };
376
- useEnhancedEffect(() => {
377
- const handleResize = debounce(() => {
378
- const prevHeight = scrollbarHeight.current;
379
- setMeasurements();
380
- if (prevHeight !== scrollbarHeight.current) {
381
- onChange(scrollbarHeight.current);
382
- }
383
- });
384
- const containerWindow = ownerWindow(nodeRef.current);
385
- containerWindow.addEventListener("resize", handleResize);
386
- return () => {
387
- handleResize.clear();
388
- containerWindow.removeEventListener("resize", handleResize);
389
- };
390
- }, [onChange]);
391
- React.useEffect(() => {
392
- setMeasurements();
393
- onChange(scrollbarHeight.current);
394
- }, [onChange]);
395
- return /* @__PURE__ */ jsx("div", _extends({
396
- style: styles
397
- }, other, {
398
- ref: nodeRef
399
- }));
400
- }
401
- process$1.env.NODE_ENV !== "production" ? ScrollbarSize.propTypes = {
402
- onChange: PropTypes.func.isRequired
403
- } : void 0;
404
- function getTabScrollButtonUtilityClass(slot) {
405
- return generateUtilityClass("MuiTabScrollButton", slot);
406
- }
407
- const tabScrollButtonClasses = generateUtilityClasses("MuiTabScrollButton", ["root", "vertical", "horizontal", "disabled"]);
408
- const _excluded$3 = ["className", "slots", "slotProps", "direction", "orientation", "disabled"];
409
- const useUtilityClasses$2 = (ownerState) => {
410
- const {
411
- classes,
412
- orientation,
413
- disabled
414
- } = ownerState;
415
- const slots = {
416
- root: ["root", orientation, disabled && "disabled"]
417
- };
418
- return composeClasses(slots, getTabScrollButtonUtilityClass, classes);
419
- };
420
- const TabScrollButtonRoot = styled(ButtonBase, {
421
- name: "MuiTabScrollButton",
422
- slot: "Root",
423
- overridesResolver: (props, styles2) => {
424
- const {
425
- ownerState
426
- } = props;
427
- return [styles2.root, ownerState.orientation && styles2[ownerState.orientation]];
428
- }
429
- })(({
430
- ownerState
431
- }) => _extends({
432
- width: 40,
433
- flexShrink: 0,
434
- opacity: 0.8,
435
- [`&.${tabScrollButtonClasses.disabled}`]: {
436
- opacity: 0
437
- }
438
- }, ownerState.orientation === "vertical" && {
439
- width: "100%",
440
- height: 40,
441
- "& svg": {
442
- transform: `rotate(${ownerState.isRtl ? -90 : 90}deg)`
443
- }
444
- }));
445
- const TabScrollButton = /* @__PURE__ */ React.forwardRef(function TabScrollButton2(inProps, ref) {
446
- var _slots$StartScrollBut, _slots$EndScrollButto;
447
- const props = useDefaultProps({
448
- props: inProps,
449
- name: "MuiTabScrollButton"
450
- });
451
- const {
452
- className,
453
- slots = {},
454
- slotProps = {},
455
- direction
456
- } = props, other = _objectWithoutPropertiesLoose(props, _excluded$3);
457
- const isRtl = useRtl();
458
- const ownerState = _extends({
459
- isRtl
460
- }, props);
461
- const classes = useUtilityClasses$2(ownerState);
462
- const StartButtonIcon = (_slots$StartScrollBut = slots.StartScrollButtonIcon) != null ? _slots$StartScrollBut : KeyboardArrowLeft;
463
- const EndButtonIcon = (_slots$EndScrollButto = slots.EndScrollButtonIcon) != null ? _slots$EndScrollButto : KeyboardArrowRight;
464
- const startButtonIconProps = useSlotProps({
465
- elementType: StartButtonIcon,
466
- externalSlotProps: slotProps.startScrollButtonIcon,
467
- additionalProps: {
468
- fontSize: "small"
469
- },
470
- ownerState
471
- });
472
- const endButtonIconProps = useSlotProps({
473
- elementType: EndButtonIcon,
474
- externalSlotProps: slotProps.endScrollButtonIcon,
475
- additionalProps: {
476
- fontSize: "small"
477
- },
478
- ownerState
479
- });
480
- return /* @__PURE__ */ jsx(TabScrollButtonRoot, _extends({
481
- component: "div",
482
- className: clsx(classes.root, className),
483
- ref,
484
- role: null,
485
- ownerState,
486
- tabIndex: null
487
- }, other, {
488
- children: direction === "left" ? /* @__PURE__ */ jsx(StartButtonIcon, _extends({}, startButtonIconProps)) : /* @__PURE__ */ jsx(EndButtonIcon, _extends({}, endButtonIconProps))
489
- }));
490
- });
491
- process$1.env.NODE_ENV !== "production" ? TabScrollButton.propTypes = {
492
- // ┌────────────────────────────── Warning ──────────────────────────────┐
493
- // │ These PropTypes are generated from the TypeScript type definitions. │
494
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
495
- // └─────────────────────────────────────────────────────────────────────┘
496
- /**
497
- * The content of the component.
498
- */
499
- children: PropTypes.node,
500
- /**
501
- * Override or extend the styles applied to the component.
502
- */
503
- classes: PropTypes.object,
504
- /**
505
- * @ignore
506
- */
507
- className: PropTypes.string,
508
- /**
509
- * The direction the button should indicate.
510
- */
511
- direction: PropTypes.oneOf(["left", "right"]).isRequired,
512
- /**
513
- * If `true`, the component is disabled.
514
- * @default false
515
- */
516
- disabled: PropTypes.bool,
517
- /**
518
- * The component orientation (layout flow direction).
519
- */
520
- orientation: PropTypes.oneOf(["horizontal", "vertical"]).isRequired,
521
- /**
522
- * The extra props for the slot components.
523
- * You can override the existing props or add new ones.
524
- * @default {}
525
- */
526
- slotProps: PropTypes.shape({
527
- endScrollButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
528
- startScrollButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
529
- }),
530
- /**
531
- * The components used for each slot inside.
532
- * @default {}
533
- */
534
- slots: PropTypes.shape({
535
- EndScrollButtonIcon: PropTypes.elementType,
536
- StartScrollButtonIcon: PropTypes.elementType
537
- }),
538
- /**
539
- * The system prop that allows defining system overrides as well as additional CSS styles.
540
- */
541
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
542
- } : void 0;
543
- function getTabsUtilityClass(slot) {
544
- return generateUtilityClass("MuiTabs", slot);
545
- }
546
- const tabsClasses = generateUtilityClasses("MuiTabs", ["root", "vertical", "flexContainer", "flexContainerVertical", "centered", "scroller", "fixed", "scrollableX", "scrollableY", "hideScrollbar", "scrollButtons", "scrollButtonsHideMobile", "indicator"]);
547
- const _excluded$2 = ["aria-label", "aria-labelledby", "action", "centered", "children", "className", "component", "allowScrollButtonsMobile", "indicatorColor", "onChange", "orientation", "ScrollButtonComponent", "scrollButtons", "selectionFollowsFocus", "slots", "slotProps", "TabIndicatorProps", "TabScrollButtonProps", "textColor", "value", "variant", "visibleScrollbar"];
548
- const nextItem = (list, item) => {
549
- if (list === item) {
550
- return list.firstChild;
551
- }
552
- if (item && item.nextElementSibling) {
553
- return item.nextElementSibling;
554
- }
555
- return list.firstChild;
556
- };
557
- const previousItem = (list, item) => {
558
- if (list === item) {
559
- return list.lastChild;
560
- }
561
- if (item && item.previousElementSibling) {
562
- return item.previousElementSibling;
563
- }
564
- return list.lastChild;
565
- };
566
- const moveFocus = (list, currentFocus, traversalFunction) => {
567
- let wrappedOnce = false;
568
- let nextFocus = traversalFunction(list, currentFocus);
569
- while (nextFocus) {
570
- if (nextFocus === list.firstChild) {
571
- if (wrappedOnce) {
572
- return;
573
- }
574
- wrappedOnce = true;
575
- }
576
- const nextFocusDisabled = nextFocus.disabled || nextFocus.getAttribute("aria-disabled") === "true";
577
- if (!nextFocus.hasAttribute("tabindex") || nextFocusDisabled) {
578
- nextFocus = traversalFunction(list, nextFocus);
579
- } else {
580
- nextFocus.focus();
581
- return;
582
- }
583
- }
584
- };
585
- const useUtilityClasses$1 = (ownerState) => {
586
- const {
587
- vertical,
588
- fixed,
589
- hideScrollbar,
590
- scrollableX,
591
- scrollableY,
592
- centered,
593
- scrollButtonsHideMobile,
594
- classes
595
- } = ownerState;
596
- const slots = {
597
- root: ["root", vertical && "vertical"],
598
- scroller: ["scroller", fixed && "fixed", hideScrollbar && "hideScrollbar", scrollableX && "scrollableX", scrollableY && "scrollableY"],
599
- flexContainer: ["flexContainer", vertical && "flexContainerVertical", centered && "centered"],
600
- indicator: ["indicator"],
601
- scrollButtons: ["scrollButtons", scrollButtonsHideMobile && "scrollButtonsHideMobile"],
602
- scrollableX: [scrollableX && "scrollableX"],
603
- hideScrollbar: [hideScrollbar && "hideScrollbar"]
604
- };
605
- return composeClasses(slots, getTabsUtilityClass, classes);
606
- };
607
- const TabsRoot = styled("div", {
608
- name: "MuiTabs",
609
- slot: "Root",
610
- overridesResolver: (props, styles2) => {
611
- const {
612
- ownerState
613
- } = props;
614
- return [{
615
- [`& .${tabsClasses.scrollButtons}`]: styles2.scrollButtons
616
- }, {
617
- [`& .${tabsClasses.scrollButtons}`]: ownerState.scrollButtonsHideMobile && styles2.scrollButtonsHideMobile
618
- }, styles2.root, ownerState.vertical && styles2.vertical];
619
- }
620
- })(({
621
- ownerState,
622
- theme
623
- }) => _extends({
624
- overflow: "hidden",
625
- minHeight: 48,
626
- // Add iOS momentum scrolling for iOS < 13.0
627
- WebkitOverflowScrolling: "touch",
628
- display: "flex"
629
- }, ownerState.vertical && {
630
- flexDirection: "column"
631
- }, ownerState.scrollButtonsHideMobile && {
632
- [`& .${tabsClasses.scrollButtons}`]: {
633
- [theme.breakpoints.down("sm")]: {
634
- display: "none"
635
- }
636
- }
637
- }));
638
- const TabsScroller = styled("div", {
639
- name: "MuiTabs",
640
- slot: "Scroller",
641
- overridesResolver: (props, styles2) => {
642
- const {
643
- ownerState
644
- } = props;
645
- return [styles2.scroller, ownerState.fixed && styles2.fixed, ownerState.hideScrollbar && styles2.hideScrollbar, ownerState.scrollableX && styles2.scrollableX, ownerState.scrollableY && styles2.scrollableY];
646
- }
647
- })(({
648
- ownerState
649
- }) => _extends({
650
- position: "relative",
651
- display: "inline-block",
652
- flex: "1 1 auto",
653
- whiteSpace: "nowrap"
654
- }, ownerState.fixed && {
655
- overflowX: "hidden",
656
- width: "100%"
657
- }, ownerState.hideScrollbar && {
658
- // Hide dimensionless scrollbar on macOS
659
- scrollbarWidth: "none",
660
- // Firefox
661
- "&::-webkit-scrollbar": {
662
- display: "none"
663
- // Safari + Chrome
664
- }
665
- }, ownerState.scrollableX && {
666
- overflowX: "auto",
667
- overflowY: "hidden"
668
- }, ownerState.scrollableY && {
669
- overflowY: "auto",
670
- overflowX: "hidden"
671
- }));
672
- const FlexContainer = styled("div", {
673
- name: "MuiTabs",
674
- slot: "FlexContainer",
675
- overridesResolver: (props, styles2) => {
676
- const {
677
- ownerState
678
- } = props;
679
- return [styles2.flexContainer, ownerState.vertical && styles2.flexContainerVertical, ownerState.centered && styles2.centered];
680
- }
681
- })(({
682
- ownerState
683
- }) => _extends({
684
- display: "flex"
685
- }, ownerState.vertical && {
686
- flexDirection: "column"
687
- }, ownerState.centered && {
688
- justifyContent: "center"
689
- }));
690
- const TabsIndicator = styled("span", {
691
- name: "MuiTabs",
692
- slot: "Indicator",
693
- overridesResolver: (props, styles2) => styles2.indicator
694
- })(({
695
- ownerState,
696
- theme
697
- }) => _extends({
698
- position: "absolute",
699
- height: 2,
700
- bottom: 0,
701
- width: "100%",
702
- transition: theme.transitions.create()
703
- }, ownerState.indicatorColor === "primary" && {
704
- backgroundColor: (theme.vars || theme).palette.primary.main
705
- }, ownerState.indicatorColor === "secondary" && {
706
- backgroundColor: (theme.vars || theme).palette.secondary.main
707
- }, ownerState.vertical && {
708
- height: "100%",
709
- width: 2,
710
- right: 0
711
- }));
712
- const TabsScrollbarSize = styled(ScrollbarSize)({
713
- overflowX: "auto",
714
- overflowY: "hidden",
715
- // Hide dimensionless scrollbar on macOS
716
- scrollbarWidth: "none",
717
- // Firefox
718
- "&::-webkit-scrollbar": {
719
- display: "none"
720
- // Safari + Chrome
721
- }
722
- });
723
- const defaultIndicatorStyle = {};
724
- let warnedOnceTabPresent = false;
725
- const Tabs = /* @__PURE__ */ React.forwardRef(function Tabs2(inProps, ref) {
726
- const props = useDefaultProps({
727
- props: inProps,
728
- name: "MuiTabs"
729
- });
730
- const theme = useTheme();
731
- const isRtl = useRtl();
732
- const {
733
- "aria-label": ariaLabel,
734
- "aria-labelledby": ariaLabelledBy,
735
- action,
736
- centered = false,
737
- children: childrenProp,
738
- className,
739
- component = "div",
740
- allowScrollButtonsMobile = false,
741
- indicatorColor = "primary",
742
- onChange,
743
- orientation = "horizontal",
744
- ScrollButtonComponent = TabScrollButton,
745
- scrollButtons = "auto",
746
- selectionFollowsFocus,
747
- slots = {},
748
- slotProps = {},
749
- TabIndicatorProps = {},
750
- TabScrollButtonProps = {},
751
- textColor = "primary",
752
- value,
753
- variant = "standard",
754
- visibleScrollbar = false
755
- } = props, other = _objectWithoutPropertiesLoose(props, _excluded$2);
756
- const scrollable = variant === "scrollable";
757
- const vertical = orientation === "vertical";
758
- const scrollStart = vertical ? "scrollTop" : "scrollLeft";
759
- const start = vertical ? "top" : "left";
760
- const end = vertical ? "bottom" : "right";
761
- const clientSize = vertical ? "clientHeight" : "clientWidth";
762
- const size = vertical ? "height" : "width";
763
- const ownerState = _extends({}, props, {
764
- component,
765
- allowScrollButtonsMobile,
766
- indicatorColor,
767
- orientation,
768
- vertical,
769
- scrollButtons,
770
- textColor,
771
- variant,
772
- visibleScrollbar,
773
- fixed: !scrollable,
774
- hideScrollbar: scrollable && !visibleScrollbar,
775
- scrollableX: scrollable && !vertical,
776
- scrollableY: scrollable && vertical,
777
- centered: centered && !scrollable,
778
- scrollButtonsHideMobile: !allowScrollButtonsMobile
779
- });
780
- const classes = useUtilityClasses$1(ownerState);
781
- const startScrollButtonIconProps = useSlotProps({
782
- elementType: slots.StartScrollButtonIcon,
783
- externalSlotProps: slotProps.startScrollButtonIcon,
784
- ownerState
785
- });
786
- const endScrollButtonIconProps = useSlotProps({
787
- elementType: slots.EndScrollButtonIcon,
788
- externalSlotProps: slotProps.endScrollButtonIcon,
789
- ownerState
790
- });
791
- if (process$1.env.NODE_ENV !== "production") {
792
- if (centered && scrollable) {
793
- }
794
- }
795
- const [mounted, setMounted] = React.useState(false);
796
- const [indicatorStyle, setIndicatorStyle] = React.useState(defaultIndicatorStyle);
797
- const [displayStartScroll, setDisplayStartScroll] = React.useState(false);
798
- const [displayEndScroll, setDisplayEndScroll] = React.useState(false);
799
- const [updateScrollObserver, setUpdateScrollObserver] = React.useState(false);
800
- const [scrollerStyle, setScrollerStyle] = React.useState({
801
- overflow: "hidden",
802
- scrollbarWidth: 0
803
- });
804
- const valueToIndex = /* @__PURE__ */ new Map();
805
- const tabsRef = React.useRef(null);
806
- const tabListRef = React.useRef(null);
807
- const getTabsMeta = () => {
808
- const tabsNode = tabsRef.current;
809
- let tabsMeta;
810
- if (tabsNode) {
811
- const rect = tabsNode.getBoundingClientRect();
812
- tabsMeta = {
813
- clientWidth: tabsNode.clientWidth,
814
- scrollLeft: tabsNode.scrollLeft,
815
- scrollTop: tabsNode.scrollTop,
816
- scrollLeftNormalized: getNormalizedScrollLeft(tabsNode, isRtl ? "rtl" : "ltr"),
817
- scrollWidth: tabsNode.scrollWidth,
818
- top: rect.top,
819
- bottom: rect.bottom,
820
- left: rect.left,
821
- right: rect.right
822
- };
823
- }
824
- let tabMeta;
825
- if (tabsNode && value !== false) {
826
- const children2 = tabListRef.current.children;
827
- if (children2.length > 0) {
828
- const tab = children2[valueToIndex.get(value)];
829
- if (process$1.env.NODE_ENV !== "production") {
830
- if (!tab) {
831
- }
832
- }
833
- tabMeta = tab ? tab.getBoundingClientRect() : null;
834
- if (process$1.env.NODE_ENV !== "production") {
835
- if (process$1.env.NODE_ENV !== "test" && !warnedOnceTabPresent && tabMeta && tabMeta.width === 0 && tabMeta.height === 0 && // if the whole Tabs component is hidden, don't warn
836
- tabsMeta.clientWidth !== 0) {
837
- tabsMeta = null;
838
- warnedOnceTabPresent = true;
839
- }
840
- }
841
- }
842
- }
843
- return {
844
- tabsMeta,
845
- tabMeta
846
- };
847
- };
848
- const updateIndicatorState = useEventCallback(() => {
849
- const {
850
- tabsMeta,
851
- tabMeta
852
- } = getTabsMeta();
853
- let startValue = 0;
854
- let startIndicator;
855
- if (vertical) {
856
- startIndicator = "top";
857
- if (tabMeta && tabsMeta) {
858
- startValue = tabMeta.top - tabsMeta.top + tabsMeta.scrollTop;
859
- }
860
- } else {
861
- startIndicator = isRtl ? "right" : "left";
862
- if (tabMeta && tabsMeta) {
863
- const correction = isRtl ? tabsMeta.scrollLeftNormalized + tabsMeta.clientWidth - tabsMeta.scrollWidth : tabsMeta.scrollLeft;
864
- startValue = (isRtl ? -1 : 1) * (tabMeta[startIndicator] - tabsMeta[startIndicator] + correction);
865
- }
866
- }
867
- const newIndicatorStyle = {
868
- [startIndicator]: startValue,
869
- // May be wrong until the font is loaded.
870
- [size]: tabMeta ? tabMeta[size] : 0
871
- };
872
- if (isNaN(indicatorStyle[startIndicator]) || isNaN(indicatorStyle[size])) {
873
- setIndicatorStyle(newIndicatorStyle);
874
- } else {
875
- const dStart = Math.abs(indicatorStyle[startIndicator] - newIndicatorStyle[startIndicator]);
876
- const dSize = Math.abs(indicatorStyle[size] - newIndicatorStyle[size]);
877
- if (dStart >= 1 || dSize >= 1) {
878
- setIndicatorStyle(newIndicatorStyle);
879
- }
880
- }
881
- });
882
- const scroll = (scrollValue, {
883
- animation = true
884
- } = {}) => {
885
- if (animation) {
886
- animate(scrollStart, tabsRef.current, scrollValue, {
887
- duration: theme.transitions.duration.standard
888
- });
889
- } else {
890
- tabsRef.current[scrollStart] = scrollValue;
891
- }
892
- };
893
- const moveTabsScroll = (delta) => {
894
- let scrollValue = tabsRef.current[scrollStart];
895
- if (vertical) {
896
- scrollValue += delta;
897
- } else {
898
- scrollValue += delta * (isRtl ? -1 : 1);
899
- scrollValue *= isRtl && detectScrollType() === "reverse" ? -1 : 1;
900
- }
901
- scroll(scrollValue);
902
- };
903
- const getScrollSize = () => {
904
- const containerSize = tabsRef.current[clientSize];
905
- let totalSize = 0;
906
- const children2 = Array.from(tabListRef.current.children);
907
- for (let i = 0; i < children2.length; i += 1) {
908
- const tab = children2[i];
909
- if (totalSize + tab[clientSize] > containerSize) {
910
- if (i === 0) {
911
- totalSize = containerSize;
912
- }
913
- break;
914
- }
915
- totalSize += tab[clientSize];
916
- }
917
- return totalSize;
918
- };
919
- const handleStartScrollClick = () => {
920
- moveTabsScroll(-1 * getScrollSize());
921
- };
922
- const handleEndScrollClick = () => {
923
- moveTabsScroll(getScrollSize());
924
- };
925
- const handleScrollbarSizeChange = React.useCallback((scrollbarWidth) => {
926
- setScrollerStyle({
927
- overflow: null,
928
- scrollbarWidth
929
- });
930
- }, []);
931
- const getConditionalElements = () => {
932
- const conditionalElements2 = {};
933
- conditionalElements2.scrollbarSizeListener = scrollable ? /* @__PURE__ */ jsx(TabsScrollbarSize, {
934
- onChange: handleScrollbarSizeChange,
935
- className: clsx(classes.scrollableX, classes.hideScrollbar)
936
- }) : null;
937
- const scrollButtonsActive = displayStartScroll || displayEndScroll;
938
- const showScrollButtons = scrollable && (scrollButtons === "auto" && scrollButtonsActive || scrollButtons === true);
939
- conditionalElements2.scrollButtonStart = showScrollButtons ? /* @__PURE__ */ jsx(ScrollButtonComponent, _extends({
940
- slots: {
941
- StartScrollButtonIcon: slots.StartScrollButtonIcon
942
- },
943
- slotProps: {
944
- startScrollButtonIcon: startScrollButtonIconProps
945
- },
946
- orientation,
947
- direction: isRtl ? "right" : "left",
948
- onClick: handleStartScrollClick,
949
- disabled: !displayStartScroll
950
- }, TabScrollButtonProps, {
951
- className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
952
- })) : null;
953
- conditionalElements2.scrollButtonEnd = showScrollButtons ? /* @__PURE__ */ jsx(ScrollButtonComponent, _extends({
954
- slots: {
955
- EndScrollButtonIcon: slots.EndScrollButtonIcon
956
- },
957
- slotProps: {
958
- endScrollButtonIcon: endScrollButtonIconProps
959
- },
960
- orientation,
961
- direction: isRtl ? "left" : "right",
962
- onClick: handleEndScrollClick,
963
- disabled: !displayEndScroll
964
- }, TabScrollButtonProps, {
965
- className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
966
- })) : null;
967
- return conditionalElements2;
968
- };
969
- const scrollSelectedIntoView = useEventCallback((animation) => {
970
- const {
971
- tabsMeta,
972
- tabMeta
973
- } = getTabsMeta();
974
- if (!tabMeta || !tabsMeta) {
975
- return;
976
- }
977
- if (tabMeta[start] < tabsMeta[start]) {
978
- const nextScrollStart = tabsMeta[scrollStart] + (tabMeta[start] - tabsMeta[start]);
979
- scroll(nextScrollStart, {
980
- animation
981
- });
982
- } else if (tabMeta[end] > tabsMeta[end]) {
983
- const nextScrollStart = tabsMeta[scrollStart] + (tabMeta[end] - tabsMeta[end]);
984
- scroll(nextScrollStart, {
985
- animation
986
- });
987
- }
988
- });
989
- const updateScrollButtonState = useEventCallback(() => {
990
- if (scrollable && scrollButtons !== false) {
991
- setUpdateScrollObserver(!updateScrollObserver);
992
- }
993
- });
994
- React.useEffect(() => {
995
- const handleResize = debounce(() => {
996
- if (tabsRef.current) {
997
- updateIndicatorState();
998
- }
999
- });
1000
- let resizeObserver;
1001
- const handleMutation = (records) => {
1002
- records.forEach((record) => {
1003
- record.removedNodes.forEach((item) => {
1004
- var _resizeObserver;
1005
- (_resizeObserver = resizeObserver) == null || _resizeObserver.unobserve(item);
1006
- });
1007
- record.addedNodes.forEach((item) => {
1008
- var _resizeObserver2;
1009
- (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.observe(item);
1010
- });
1011
- });
1012
- handleResize();
1013
- updateScrollButtonState();
1014
- };
1015
- const win = ownerWindow(tabsRef.current);
1016
- win.addEventListener("resize", handleResize);
1017
- let mutationObserver;
1018
- if (typeof ResizeObserver !== "undefined") {
1019
- resizeObserver = new ResizeObserver(handleResize);
1020
- Array.from(tabListRef.current.children).forEach((child) => {
1021
- resizeObserver.observe(child);
1022
- });
1023
- }
1024
- if (typeof MutationObserver !== "undefined") {
1025
- mutationObserver = new MutationObserver(handleMutation);
1026
- mutationObserver.observe(tabListRef.current, {
1027
- childList: true
1028
- });
1029
- }
1030
- return () => {
1031
- var _mutationObserver, _resizeObserver3;
1032
- handleResize.clear();
1033
- win.removeEventListener("resize", handleResize);
1034
- (_mutationObserver = mutationObserver) == null || _mutationObserver.disconnect();
1035
- (_resizeObserver3 = resizeObserver) == null || _resizeObserver3.disconnect();
1036
- };
1037
- }, [updateIndicatorState, updateScrollButtonState]);
1038
- React.useEffect(() => {
1039
- const tabListChildren = Array.from(tabListRef.current.children);
1040
- const length = tabListChildren.length;
1041
- if (typeof IntersectionObserver !== "undefined" && length > 0 && scrollable && scrollButtons !== false) {
1042
- const firstTab = tabListChildren[0];
1043
- const lastTab = tabListChildren[length - 1];
1044
- const observerOptions = {
1045
- root: tabsRef.current,
1046
- threshold: 0.99
1047
- };
1048
- const handleScrollButtonStart = (entries) => {
1049
- setDisplayStartScroll(!entries[0].isIntersecting);
1050
- };
1051
- const firstObserver = new IntersectionObserver(handleScrollButtonStart, observerOptions);
1052
- firstObserver.observe(firstTab);
1053
- const handleScrollButtonEnd = (entries) => {
1054
- setDisplayEndScroll(!entries[0].isIntersecting);
1055
- };
1056
- const lastObserver = new IntersectionObserver(handleScrollButtonEnd, observerOptions);
1057
- lastObserver.observe(lastTab);
1058
- return () => {
1059
- firstObserver.disconnect();
1060
- lastObserver.disconnect();
1061
- };
1062
- }
1063
- return void 0;
1064
- }, [scrollable, scrollButtons, updateScrollObserver, childrenProp == null ? void 0 : childrenProp.length]);
1065
- React.useEffect(() => {
1066
- setMounted(true);
1067
- }, []);
1068
- React.useEffect(() => {
1069
- updateIndicatorState();
1070
- });
1071
- React.useEffect(() => {
1072
- scrollSelectedIntoView(defaultIndicatorStyle !== indicatorStyle);
1073
- }, [scrollSelectedIntoView, indicatorStyle]);
1074
- React.useImperativeHandle(action, () => ({
1075
- updateIndicator: updateIndicatorState,
1076
- updateScrollButtons: updateScrollButtonState
1077
- }), [updateIndicatorState, updateScrollButtonState]);
1078
- const indicator = /* @__PURE__ */ jsx(TabsIndicator, _extends({}, TabIndicatorProps, {
1079
- className: clsx(classes.indicator, TabIndicatorProps.className),
1080
- ownerState,
1081
- style: _extends({}, indicatorStyle, TabIndicatorProps.style)
1082
- }));
1083
- let childIndex = 0;
1084
- const children = React.Children.map(childrenProp, (child) => {
1085
- if (!/* @__PURE__ */ React.isValidElement(child)) {
1086
- return null;
1087
- }
1088
- if (process$1.env.NODE_ENV !== "production") {
1089
- if (reactIsExports.isFragment(child)) {
1090
- }
1091
- }
1092
- const childValue = child.props.value === void 0 ? childIndex : child.props.value;
1093
- valueToIndex.set(childValue, childIndex);
1094
- const selected = childValue === value;
1095
- childIndex += 1;
1096
- return /* @__PURE__ */ React.cloneElement(child, _extends({
1097
- fullWidth: variant === "fullWidth",
1098
- indicator: selected && !mounted && indicator,
1099
- selected,
1100
- selectionFollowsFocus,
1101
- onChange,
1102
- textColor,
1103
- value: childValue
1104
- }, childIndex === 1 && value === false && !child.props.tabIndex ? {
1105
- tabIndex: 0
1106
- } : {}));
1107
- });
1108
- const handleKeyDown = (event) => {
1109
- const list = tabListRef.current;
1110
- const currentFocus = ownerDocument(list).activeElement;
1111
- const role = currentFocus.getAttribute("role");
1112
- if (role !== "tab") {
1113
- return;
1114
- }
1115
- let previousItemKey = orientation === "horizontal" ? "ArrowLeft" : "ArrowUp";
1116
- let nextItemKey = orientation === "horizontal" ? "ArrowRight" : "ArrowDown";
1117
- if (orientation === "horizontal" && isRtl) {
1118
- previousItemKey = "ArrowRight";
1119
- nextItemKey = "ArrowLeft";
1120
- }
1121
- switch (event.key) {
1122
- case previousItemKey:
1123
- event.preventDefault();
1124
- moveFocus(list, currentFocus, previousItem);
1125
- break;
1126
- case nextItemKey:
1127
- event.preventDefault();
1128
- moveFocus(list, currentFocus, nextItem);
1129
- break;
1130
- case "Home":
1131
- event.preventDefault();
1132
- moveFocus(list, null, nextItem);
1133
- break;
1134
- case "End":
1135
- event.preventDefault();
1136
- moveFocus(list, null, previousItem);
1137
- break;
1138
- }
1139
- };
1140
- const conditionalElements = getConditionalElements();
1141
- return /* @__PURE__ */ jsxs(TabsRoot, _extends({
1142
- className: clsx(classes.root, className),
1143
- ownerState,
1144
- ref,
1145
- as: component
1146
- }, other, {
1147
- children: [conditionalElements.scrollButtonStart, conditionalElements.scrollbarSizeListener, /* @__PURE__ */ jsxs(TabsScroller, {
1148
- className: classes.scroller,
1149
- ownerState,
1150
- style: {
1151
- overflow: scrollerStyle.overflow,
1152
- [vertical ? `margin${isRtl ? "Left" : "Right"}` : "marginBottom"]: visibleScrollbar ? void 0 : -scrollerStyle.scrollbarWidth
1153
- },
1154
- ref: tabsRef,
1155
- children: [/* @__PURE__ */ jsx(FlexContainer, {
1156
- "aria-label": ariaLabel,
1157
- "aria-labelledby": ariaLabelledBy,
1158
- "aria-orientation": orientation === "vertical" ? "vertical" : null,
1159
- className: classes.flexContainer,
1160
- ownerState,
1161
- onKeyDown: handleKeyDown,
1162
- ref: tabListRef,
1163
- role: "tablist",
1164
- children
1165
- }), mounted && indicator]
1166
- }), conditionalElements.scrollButtonEnd]
1167
- }));
1168
- });
1169
- process$1.env.NODE_ENV !== "production" ? Tabs.propTypes = {
1170
- // ┌────────────────────────────── Warning ──────────────────────────────┐
1171
- // │ These PropTypes are generated from the TypeScript type definitions. │
1172
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
1173
- // └─────────────────────────────────────────────────────────────────────┘
1174
- /**
1175
- * Callback fired when the component mounts.
1176
- * This is useful when you want to trigger an action programmatically.
1177
- * It supports two actions: `updateIndicator()` and `updateScrollButtons()`
1178
- *
1179
- * @param {object} actions This object contains all possible actions
1180
- * that can be triggered programmatically.
1181
- */
1182
- action: refType,
1183
- /**
1184
- * If `true`, the scroll buttons aren't forced hidden on mobile.
1185
- * By default the scroll buttons are hidden on mobile and takes precedence over `scrollButtons`.
1186
- * @default false
1187
- */
1188
- allowScrollButtonsMobile: PropTypes.bool,
1189
- /**
1190
- * The label for the Tabs as a string.
1191
- */
1192
- "aria-label": PropTypes.string,
1193
- /**
1194
- * An id or list of ids separated by a space that label the Tabs.
1195
- */
1196
- "aria-labelledby": PropTypes.string,
1197
- /**
1198
- * If `true`, the tabs are centered.
1199
- * This prop is intended for large views.
1200
- * @default false
1201
- */
1202
- centered: PropTypes.bool,
1203
- /**
1204
- * The content of the component.
1205
- */
1206
- children: PropTypes.node,
1207
- /**
1208
- * Override or extend the styles applied to the component.
1209
- */
1210
- classes: PropTypes.object,
1211
- /**
1212
- * @ignore
1213
- */
1214
- className: PropTypes.string,
1215
- /**
1216
- * The component used for the root node.
1217
- * Either a string to use a HTML element or a component.
1218
- */
1219
- component: PropTypes.elementType,
1220
- /**
1221
- * Determines the color of the indicator.
1222
- * @default 'primary'
1223
- */
1224
- indicatorColor: PropTypes.oneOfType([PropTypes.oneOf(["primary", "secondary"]), PropTypes.string]),
1225
- /**
1226
- * Callback fired when the value changes.
1227
- *
1228
- * @param {React.SyntheticEvent} event The event source of the callback. **Warning**: This is a generic event not a change event.
1229
- * @param {any} value We default to the index of the child (number)
1230
- */
1231
- onChange: PropTypes.func,
1232
- /**
1233
- * The component orientation (layout flow direction).
1234
- * @default 'horizontal'
1235
- */
1236
- orientation: PropTypes.oneOf(["horizontal", "vertical"]),
1237
- /**
1238
- * The component used to render the scroll buttons.
1239
- * @default TabScrollButton
1240
- */
1241
- ScrollButtonComponent: PropTypes.elementType,
1242
- /**
1243
- * Determine behavior of scroll buttons when tabs are set to scroll:
1244
- *
1245
- * - `auto` will only present them when not all the items are visible.
1246
- * - `true` will always present them.
1247
- * - `false` will never present them.
1248
- *
1249
- * By default the scroll buttons are hidden on mobile.
1250
- * This behavior can be disabled with `allowScrollButtonsMobile`.
1251
- * @default 'auto'
1252
- */
1253
- scrollButtons: PropTypes.oneOf(["auto", false, true]),
1254
- /**
1255
- * If `true` the selected tab changes on focus. Otherwise it only
1256
- * changes on activation.
1257
- */
1258
- selectionFollowsFocus: PropTypes.bool,
1259
- /**
1260
- * The extra props for the slot components.
1261
- * You can override the existing props or add new ones.
1262
- * @default {}
1263
- */
1264
- slotProps: PropTypes.shape({
1265
- endScrollButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
1266
- startScrollButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
1267
- }),
1268
- /**
1269
- * The components used for each slot inside.
1270
- * @default {}
1271
- */
1272
- slots: PropTypes.shape({
1273
- EndScrollButtonIcon: PropTypes.elementType,
1274
- StartScrollButtonIcon: PropTypes.elementType
1275
- }),
1276
- /**
1277
- * The system prop that allows defining system overrides as well as additional CSS styles.
1278
- */
1279
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
1280
- /**
1281
- * Props applied to the tab indicator element.
1282
- * @default {}
1283
- */
1284
- TabIndicatorProps: PropTypes.object,
1285
- /**
1286
- * Props applied to the [`TabScrollButton`](/material-ui/api/tab-scroll-button/) element.
1287
- * @default {}
1288
- */
1289
- TabScrollButtonProps: PropTypes.object,
1290
- /**
1291
- * Determines the color of the `Tab`.
1292
- * @default 'primary'
1293
- */
1294
- textColor: PropTypes.oneOf(["inherit", "primary", "secondary"]),
1295
- /**
1296
- * The value of the currently selected `Tab`.
1297
- * If you don't want any selected `Tab`, you can set this prop to `false`.
1298
- */
1299
- value: PropTypes.any,
1300
- /**
1301
- * Determines additional display behavior of the tabs:
1302
- *
1303
- * - `scrollable` will invoke scrolling properties and allow for horizontally
1304
- * scrolling (or swiping) of the tab bar.
1305
- * - `fullWidth` will make the tabs grow to use all the available space,
1306
- * which should be used for small views, like on mobile.
1307
- * - `standard` will render the default state.
1308
- * @default 'standard'
1309
- */
1310
- variant: PropTypes.oneOf(["fullWidth", "scrollable", "standard"]),
1311
- /**
1312
- * If `true`, the scrollbar is visible. It can be useful when displaying
1313
- * a long vertical list of tabs.
1314
- * @default false
1315
- */
1316
- visibleScrollbar: PropTypes.bool
1317
- } : void 0;
1318
- const Context = /* @__PURE__ */ React.createContext(null);
1319
- if (process$1.env.NODE_ENV !== "production") {
1320
- Context.displayName = "TabContext";
1321
- }
1322
- function useUniquePrefix() {
1323
- const [id, setId] = React.useState(null);
1324
- React.useEffect(() => {
1325
- setId(`mui-p-${Math.round(Math.random() * 1e5)}`);
1326
- }, []);
1327
- return id;
1328
- }
1329
- function TabContext(props) {
1330
- const {
1331
- children,
1332
- value
1333
- } = props;
1334
- const idPrefix = useUniquePrefix();
1335
- const context = React.useMemo(() => {
1336
- return {
1337
- idPrefix,
1338
- value
1339
- };
1340
- }, [idPrefix, value]);
1341
- return /* @__PURE__ */ jsx(Context.Provider, {
1342
- value: context,
1343
- children
1344
- });
1345
- }
1346
- process$1.env.NODE_ENV !== "production" ? TabContext.propTypes = {
1347
- // ┌────────────────────────────── Warning ──────────────────────────────┐
1348
- // │ These PropTypes are generated from the TypeScript type definitions. │
1349
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
1350
- // └─────────────────────────────────────────────────────────────────────┘
1351
- /**
1352
- * The content of the component.
1353
- */
1354
- children: PropTypes.node,
1355
- /**
1356
- * The value of the currently selected `Tab`.
1357
- */
1358
- value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
1359
- } : void 0;
1360
- function useTabContext() {
1361
- return React.useContext(Context);
1362
- }
1363
- function getPanelId(context, value) {
1364
- const {
1365
- idPrefix
1366
- } = context;
1367
- if (idPrefix === null) {
1368
- return null;
1369
- }
1370
- return `${context.idPrefix}-P-${value}`;
1371
- }
1372
- function getTabId(context, value) {
1373
- const {
1374
- idPrefix
1375
- } = context;
1376
- if (idPrefix === null) {
1377
- return null;
1378
- }
1379
- return `${context.idPrefix}-T-${value}`;
1380
- }
1381
- const _excluded$1 = ["children"];
1382
- const TabList = /* @__PURE__ */ React.forwardRef(function TabList2(props, ref) {
1383
- const {
1384
- children: childrenProp
1385
- } = props, other = _objectWithoutPropertiesLoose(props, _excluded$1);
1386
- const context = useTabContext();
1387
- if (context === null) {
1388
- throw new TypeError("No TabContext provided");
1389
- }
1390
- const children = React.Children.map(childrenProp, (child) => {
1391
- if (!/* @__PURE__ */ React.isValidElement(child)) {
1392
- return null;
1393
- }
1394
- return /* @__PURE__ */ React.cloneElement(child, {
1395
- // SOMEDAY: `Tabs` will set those themselves
1396
- "aria-controls": getPanelId(context, child.props.value),
1397
- id: getTabId(context, child.props.value)
1398
- });
1399
- });
1400
- return /* @__PURE__ */ jsx(Tabs, _extends({}, other, {
1401
- ref,
1402
- value: context.value,
1403
- children
1404
- }));
1405
- });
1406
- process$1.env.NODE_ENV !== "production" ? TabList.propTypes = {
1407
- // ┌────────────────────────────── Warning ──────────────────────────────┐
1408
- // │ These PropTypes are generated from the TypeScript type definitions. │
1409
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
1410
- // └─────────────────────────────────────────────────────────────────────┘
1411
- /**
1412
- * A list of `<Tab />` elements.
1413
- */
1414
- children: PropTypes.node
1415
- } : void 0;
1416
- function getTabPanelUtilityClass(slot) {
1417
- return generateUtilityClass("MuiTabPanel", slot);
1418
- }
1419
- generateUtilityClasses("MuiTabPanel", ["root"]);
1420
- const _excluded = ["children", "className", "value"];
1421
- const useUtilityClasses = (ownerState) => {
1422
- const {
1423
- classes
1424
- } = ownerState;
1425
- const slots = {
1426
- root: ["root"]
1427
- };
1428
- return composeClasses(slots, getTabPanelUtilityClass, classes);
1429
- };
1430
- const TabPanelRoot = styled("div", {
1431
- name: "MuiTabPanel",
1432
- slot: "Root",
1433
- overridesResolver: (props, styles2) => styles2.root
1434
- })(({
1435
- theme
1436
- }) => ({
1437
- padding: theme.spacing(3)
1438
- }));
1439
- const TabPanel = /* @__PURE__ */ React.forwardRef(function TabPanel2(inProps, ref) {
1440
- const props = useThemeProps({
1441
- props: inProps,
1442
- name: "MuiTabPanel"
1443
- });
1444
- const {
1445
- children,
1446
- className,
1447
- value
1448
- } = props, other = _objectWithoutPropertiesLoose(props, _excluded);
1449
- const ownerState = _extends({}, props);
1450
- const classes = useUtilityClasses(ownerState);
1451
- const context = useTabContext();
1452
- if (context === null) {
1453
- throw new TypeError("No TabContext provided");
1454
- }
1455
- const id = getPanelId(context, value);
1456
- const tabId = getTabId(context, value);
1457
- return /* @__PURE__ */ jsx(TabPanelRoot, _extends({
1458
- "aria-labelledby": tabId,
1459
- className: clsx(classes.root, className),
1460
- hidden: value !== context.value,
1461
- id,
1462
- ref,
1463
- role: "tabpanel",
1464
- ownerState
1465
- }, other, {
1466
- children: value === context.value && children
1467
- }));
1468
- });
1469
- process$1.env.NODE_ENV !== "production" ? TabPanel.propTypes = {
1470
- // ┌────────────────────────────── Warning ──────────────────────────────┐
1471
- // │ These PropTypes are generated from the TypeScript type definitions. │
1472
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
1473
- // └─────────────────────────────────────────────────────────────────────┘
1474
- /**
1475
- * The content of the component.
1476
- */
1477
- children: PropTypes.node,
1478
- /**
1479
- * Override or extend the styles applied to the component.
1480
- */
1481
- classes: PropTypes.object,
1482
- /**
1483
- * @ignore
1484
- */
1485
- className: PropTypes.string,
1486
- /**
1487
- * The system prop that allows defining system overrides as well as additional CSS styles.
1488
- */
1489
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
1490
- /**
1491
- * The `value` of the corresponding `Tab`. Must use the index of the `Tab` when
1492
- * no `value` was passed to `Tab`.
1493
- */
1494
- value: PropTypes.string.isRequired
1495
- } : void 0;
1496
- function Routes({ name, children }) {
1497
- return /* @__PURE__ */ jsx(
1498
- Tooltip,
1499
- {
1500
- componentsProps: {
1501
- tooltip: {
1502
- sx: {
1503
- bgcolor: "var(--tw-background-container)",
1504
- "& .MuiTooltip-arrow": {
1505
- color: "var(--tw-bg-container)"
1506
- },
1507
- border: "1px solid var(--tw-border-primary)",
1508
- color: "var(--tw-text-primary)",
1509
- boxShadow: "0px 0px 6.1px 0px #0000001A"
1510
- }
1511
- }
1512
- },
1513
- slotProps: {
1514
- popper: {
1515
- modifiers: [
1516
- {
1517
- name: "offset",
1518
- options: {
1519
- offset: [0, -14]
1520
- }
1521
- }
1522
- ]
1523
- }
1524
- },
1525
- className: "bw-text-text-button",
1526
- title: name,
1527
- placement: "top",
1528
- children
1529
- }
1530
- );
1531
- }
1532
- function Maxop({ fill, spinnerColor, stopColor }) {
1533
- return /* @__PURE__ */ jsxs(
1534
- "svg",
1535
- {
1536
- width: "100%",
1537
- height: "100%",
1538
- viewBox: "0 0 16 16",
1539
- fill: "none",
1540
- xmlns: "http://www.w3.org/2000/svg",
1541
- children: [
1542
- /* @__PURE__ */ jsx(
1543
- "rect",
1544
- {
1545
- x: "0.820312",
1546
- y: "1.4248",
1547
- width: "14",
1548
- height: "14",
1549
- rx: "7",
1550
- fill,
1551
- stroke: "url(#paint0_linear_739_20205)"
1552
- }
1553
- ),
1554
- /* @__PURE__ */ jsx(
1555
- "path",
1556
- {
1557
- d: "M7.34417 5.19093C7.49384 4.73028 8.14555 4.73028 8.29522 5.19093L8.53764 5.937C8.73845 6.55504 9.31438 6.97348 9.96422 6.97348H10.7487C11.233 6.97348 11.4344 7.59329 11.0426 7.87799L10.4079 8.33908C9.8822 8.72105 9.66222 9.3981 9.86303 10.0161L10.1054 10.7622C10.2551 11.2229 9.72788 11.6059 9.33602 11.3212L8.70137 10.8601C8.17564 10.4782 7.46375 10.4782 6.93802 10.8601L6.30337 11.3212C5.91152 11.6059 5.38428 11.2229 5.53395 10.7622L5.77637 10.0161C5.97718 9.3981 5.75719 8.72105 5.23146 8.33908L4.59681 7.87799C4.20496 7.59329 4.40635 6.97348 4.89071 6.97348H5.67517C6.32501 6.97348 6.90094 6.55504 7.10176 5.937L7.34417 5.19093Z",
1558
- stroke: "black"
1559
- }
1560
- ),
1561
- /* @__PURE__ */ jsx(
1562
- "path",
1563
- {
1564
- d: "M7.34417 5.19093C7.49384 4.73028 8.14555 4.73028 8.29522 5.19093L8.53764 5.937C8.73845 6.55504 9.31438 6.97348 9.96422 6.97348H10.7487C11.233 6.97348 11.4344 7.59329 11.0426 7.87799L10.4079 8.33908C9.8822 8.72105 9.66222 9.3981 9.86303 10.0161L10.1054 10.7622C10.2551 11.2229 9.72788 11.6059 9.33602 11.3212L8.70137 10.8601C8.17564 10.4782 7.46375 10.4782 6.93802 10.8601L6.30337 11.3212C5.91152 11.6059 5.38428 11.2229 5.53395 10.7622L5.77637 10.0161C5.97718 9.3981 5.75719 8.72105 5.23146 8.33908L4.59681 7.87799C4.20496 7.59329 4.40635 6.97348 4.89071 6.97348H5.67517C6.32501 6.97348 6.90094 6.55504 7.10176 5.937L7.34417 5.19093Z",
1565
- stroke: "url(#paint1_linear_739_20205)"
1566
- }
1567
- ),
1568
- /* @__PURE__ */ jsx(
1569
- "path",
1570
- {
1571
- d: "M7.34417 5.19093C7.49384 4.73028 8.14555 4.73028 8.29522 5.19093L8.53764 5.937C8.73845 6.55504 9.31438 6.97348 9.96422 6.97348H10.7487C11.233 6.97348 11.4344 7.59329 11.0426 7.87799L10.4079 8.33908C9.8822 8.72105 9.66222 9.3981 9.86303 10.0161L10.1054 10.7622C10.2551 11.2229 9.72788 11.6059 9.33602 11.3212L8.70137 10.8601C8.17564 10.4782 7.46375 10.4782 6.93802 10.8601L6.30337 11.3212C5.91152 11.6059 5.38428 11.2229 5.53395 10.7622L5.77637 10.0161C5.97718 9.3981 5.75719 8.72105 5.23146 8.33908L4.59681 7.87799C4.20496 7.59329 4.40635 6.97348 4.89071 6.97348H5.67517C6.32501 6.97348 6.90094 6.55504 7.10176 5.937L7.34417 5.19093Z",
1572
- stroke: "black",
1573
- "stroke-opacity": "0.2"
1574
- }
1575
- ),
1576
- /* @__PURE__ */ jsxs("defs", { children: [
1577
- /* @__PURE__ */ jsxs(
1578
- "linearGradient",
1579
- {
1580
- id: "paint0_linear_739_20205",
1581
- x1: "18.1645",
1582
- y1: "6.26376",
1583
- x2: "-8.973",
1584
- y2: "6.2369",
1585
- gradientUnits: "userSpaceOnUse",
1586
- children: [
1587
- /* @__PURE__ */ jsx("stop", { "stop-color": spinnerColor ? spinnerColor : "#2CFFE4" }),
1588
- /* @__PURE__ */ jsx("stop", { offset: "1", "stop-color": stopColor ? stopColor : "#A45EFF" })
1589
- ]
1590
- }
1591
- ),
1592
- /* @__PURE__ */ jsxs(
1593
- "linearGradient",
1594
- {
1595
- id: "paint1_linear_739_20205",
1596
- x1: "10.9776",
1597
- y1: "10.0041",
1598
- x2: "1.99984",
1599
- y2: "2.87371",
1600
- gradientUnits: "userSpaceOnUse",
1601
- children: [
1602
- /* @__PURE__ */ jsx("stop", { "stop-color": spinnerColor ? spinnerColor : "#2CFFE4" }),
1603
- /* @__PURE__ */ jsx("stop", { offset: "1", "stop-color": stopColor ? stopColor : "#A45EFF" })
1604
- ]
1605
- }
1606
- )
1607
- ] })
1608
- ]
1609
- }
1610
- );
1611
- }
1612
- function LowgasSvg({ fill }) {
1613
- return /* @__PURE__ */ jsxs(
1614
- "svg",
1615
- {
1616
- width: "100%",
1617
- height: "100%",
1618
- viewBox: "0 0 16 16",
1619
- fill: "none",
1620
- xmlns: "http://www.w3.org/2000/svg",
1621
- children: [
1622
- /* @__PURE__ */ jsx(
1623
- "rect",
1624
- {
1625
- x: "0.839844",
1626
- y: "0.938477",
1627
- width: "14",
1628
- height: "14",
1629
- rx: "7",
1630
- fill
1631
- }
1632
- ),
1633
- /* @__PURE__ */ jsx(
1634
- "rect",
1635
- {
1636
- x: "0.839844",
1637
- y: "0.938477",
1638
- width: "14",
1639
- height: "14",
1640
- rx: "7",
1641
- fill
1642
- }
1643
- ),
1644
- /* @__PURE__ */ jsx(
1645
- "rect",
1646
- {
1647
- x: "0.839844",
1648
- y: "0.938477",
1649
- width: "14",
1650
- height: "14",
1651
- rx: "7",
1652
- stroke: "#69AEF2"
1653
- }
1654
- ),
1655
- /* @__PURE__ */ jsx(
1656
- "path",
1657
- {
1658
- "fill-rule": "evenodd",
1659
- "clip-rule": "evenodd",
1660
- d: "M10.7198 5.55386C10.7352 5.56138 10.7489 5.57121 10.762 5.58393C10.7654 5.5874 10.7682 5.59087 10.7711 5.59434C10.9357 5.72676 11.1002 5.87653 11.2198 6.05696C11.3519 6.25646 11.4253 6.48719 11.3809 6.76072C11.3621 6.87522 11.3194 6.97526 11.2545 7.06373C11.2078 7.12677 11.1509 7.18228 11.0837 7.23085C11.0803 7.31933 11.0791 7.40607 11.0791 7.49223C11.0797 7.60269 11.0831 7.71661 11.0894 7.83342C11.1036 8.10752 11.1441 8.38393 11.1845 8.65804C11.2278 8.95296 11.271 9.24556 11.2824 9.55031C11.2978 9.94065 11.2522 10.2616 11.1253 10.4883C10.9841 10.7416 10.7546 10.8769 10.4164 10.8647C10.0126 10.8572 9.76438 10.6271 9.6522 10.202C9.55427 9.8302 9.56907 9.29934 9.6801 8.63144C9.67669 8.10231 9.60893 7.70157 9.47455 7.43152C9.38686 7.25514 9.26785 7.13833 9.11753 7.08282V10.5478C9.1665 10.5715 9.21091 10.6039 9.24849 10.6427C9.33504 10.7306 9.38914 10.8526 9.38914 10.9867V11.3326C9.38914 11.4199 9.3191 11.491 9.23312 11.491H5.23414C5.14816 11.491 5.07812 11.4199 5.07812 11.3326V10.9867C5.07812 10.8526 5.13222 10.7312 5.21877 10.6427C5.24553 10.6155 5.27571 10.5912 5.30817 10.571V5.2254C5.30817 4.99409 5.40098 4.78417 5.55074 4.63209C5.70049 4.48 5.90719 4.38574 6.13495 4.38574H8.28619C8.51452 4.38574 8.72236 4.48058 8.87268 4.63324C9.023 4.78591 9.11639 4.99698 9.11639 5.22945V6.75378C9.39312 6.81507 9.60437 6.99492 9.75128 7.28984C9.90901 7.60615 9.98759 8.05952 9.98986 8.64647C9.98986 8.65572 9.9893 8.66498 9.98759 8.67365H9.98816C9.88282 9.30224 9.86573 9.79261 9.95228 10.1205C10.0246 10.3963 10.1772 10.5455 10.4215 10.549H10.4243C10.6327 10.5559 10.7711 10.4784 10.8525 10.3321C10.9488 10.1598 10.9823 9.89554 10.9693 9.56246C10.9584 9.28026 10.9157 8.99286 10.8736 8.70372C10.8326 8.42499 10.7916 8.14395 10.7762 7.84903C10.77 7.7328 10.7665 7.61425 10.766 7.49166C10.7654 7.39451 10.7671 7.29851 10.7711 7.20425C10.4801 6.94519 10.303 6.68612 10.2484 6.42821C10.1966 6.1836 10.2512 5.94882 10.4192 5.72445C10.2911 5.63539 10.1607 5.56253 10.0286 5.50413C9.84808 5.42432 9.84694 5.41738 9.6579 5.38616C9.57306 5.37228 9.51554 5.29074 9.52921 5.20458C9.54288 5.11842 9.62316 5.06001 9.70801 5.07389C9.9221 5.10916 9.94773 5.12304 10.1533 5.21383C10.3486 5.30057 10.5371 5.41218 10.7198 5.55386ZM10.668 5.91817C10.5593 6.06621 10.5228 6.21425 10.5547 6.36344C10.5929 6.54386 10.7255 6.73585 10.9465 6.93883C10.9687 6.91859 10.9886 6.89719 11.0051 6.87464C11.0399 6.8278 11.0632 6.77286 11.0729 6.71041C11.1025 6.52767 11.0518 6.37096 10.9607 6.23333C10.8855 6.11941 10.7808 6.01416 10.668 5.91817ZM6.32286 5.1109H8.13472C8.22868 5.1109 8.31409 5.14964 8.37615 5.21268C8.38014 5.2173 8.38469 5.22135 8.38868 5.22655C8.44334 5.28843 8.47694 5.36997 8.47694 5.45786V6.63176C8.47694 6.72718 8.43879 6.8145 8.37672 6.87695C8.31523 6.9394 8.22982 6.97873 8.13529 6.97873H6.32286C6.22947 6.97873 6.14463 6.9394 6.082 6.87695L6.08143 6.87753C6.01993 6.81507 5.98121 6.72776 5.98121 6.63234V5.45729C5.98121 5.36187 6.01936 5.27513 6.08143 5.2121C6.08598 5.20805 6.08997 5.20342 6.09509 5.19995C6.15602 5.14444 6.23574 5.1109 6.32286 5.1109ZM8.9746 10.8324C8.97005 10.8329 8.96606 10.8329 8.96151 10.8329H5.49152C5.47216 10.8416 5.45451 10.8537 5.4397 10.8688C5.40952 10.8994 5.39073 10.9416 5.39073 10.9885V11.1758H9.0771V10.9885C9.0771 10.9422 9.05831 10.9 9.02813 10.8688C9.01276 10.8532 8.99453 10.841 8.9746 10.8324Z",
1661
- fill: "#69AEF2"
1662
- }
1663
- )
1664
- ]
1665
- }
1666
- );
1667
- }
1668
- function FastestSvg({ fill }) {
1669
- return /* @__PURE__ */ jsxs(
1670
- "svg",
1671
- {
1672
- width: "100%",
1673
- height: "100%",
1674
- viewBox: "0 0 16 16",
1675
- fill: "none",
1676
- xmlns: "http://www.w3.org/2000/svg",
1677
- children: [
1678
- /* @__PURE__ */ jsx(
1679
- "rect",
1680
- {
1681
- x: "1.16797",
1682
- y: "0.666992",
1683
- width: "14",
1684
- height: "14",
1685
- rx: "7",
1686
- fill
1687
- }
1688
- ),
1689
- /* @__PURE__ */ jsx(
1690
- "rect",
1691
- {
1692
- x: "1.16797",
1693
- y: "0.666992",
1694
- width: "14",
1695
- height: "14",
1696
- rx: "7",
1697
- fill
1698
- }
1699
- ),
1700
- /* @__PURE__ */ jsx(
1701
- "rect",
1702
- {
1703
- x: "1.16797",
1704
- y: "0.666992",
1705
- width: "14",
1706
- height: "14",
1707
- rx: "7",
1708
- stroke: "#FFC700"
1709
- }
1710
- ),
1711
- /* @__PURE__ */ jsx(
1712
- "path",
1713
- {
1714
- d: "M4.61719 8.06204L10.1435 3.3252L7.77508 6.48309H12.1172L4.61719 12.0094L8.16982 8.06204H4.61719Z",
1715
- fill: "#FFC700"
1716
- }
1717
- )
1718
- ]
1719
- }
1720
- );
1721
- }
1722
- function GasField$2({ gasImg, item, fromChain }) {
1723
- const [gas, setGas] = useState({});
1724
- useEffect(() => {
1725
- var _a;
1726
- let tempGasObj = { amountInUSD: 0 };
1727
- (_a = item == null ? void 0 : item.fee) == null ? void 0 : _a.forEach((item2) => {
1728
- if (item2.source == "FROM_SOURCE_WALLET") {
1729
- tempGasObj.amountInUSD += Number(item2.amountInUSD);
1730
- }
1731
- });
1732
- setGas(tempGasObj);
1733
- }, [item]);
1734
- return /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-text-sm bw-items-center bw-gap-x-1", children: [
1735
- /* @__PURE__ */ jsx(Gas, { fill: "var(--tw-text-secondary)" }),
1736
- /* @__PURE__ */ jsxs("p", { children: [
1737
- "$",
1738
- fixString((gas == null ? void 0 : gas.amountInUSD) || 0, 6) || 0
1739
- ] })
1740
- ] });
1741
- }
1742
- function MaxOutput({ routes, handleShowAllRoutes, handleRoutesData, convertVal, fromChain, toChain, sort }) {
1743
- var _a, _b, _c;
1744
- const configuration = useStore((state) => state.configuration);
1745
- const { gasnew, defaultCoin } = images;
1746
- const [recommendedGas, setRecommendedGas] = useState({});
1747
- const [recommendedTime, setRecommendedTime] = useState({});
1748
- function handleOpCalc(item, arr, i) {
1749
- var _a2;
1750
- truncate((item == null ? void 0 : item.minOutputAmountDisplay) * ((_a2 = item == null ? void 0 : item.to) == null ? void 0 : _a2.lastPrice) || 0, 4);
1751
- let outputAmount = item.outputAmountDisplay * (convertVal || 0);
1752
- let opVal = outputAmount || 0;
1753
- let lastLength = (arr[arr.length - 1].outputAmountDisplay || "") * convertVal;
1754
- let firstLength = (arr[0].outputAmountDisplay || "") * convertVal;
1755
- let firstOpVal = sort == "asc" ? lastLength : firstLength;
1756
- let lastOpVal = sort == "asc" ? firstLength : lastLength;
1757
- if (i == 0 && sort !== "asc" || i == arr.length - 1 && sort == "asc") {
1758
- return {
1759
- val: /* @__PURE__ */ jsxs("p", { className: "bw-text-[10px] bw-text-text-secondary bw-font-normal", children: [
1760
- /* @__PURE__ */ jsx("span", { className: "bw-text-text-greentext", children: `+$${fixString(formatNumber(firstOpVal - lastOpVal), 12)}` }),
1761
- " Higher Output"
1762
- ] }),
1763
- isMax: true
1764
- };
1765
- } else if (i == arr.length - 1 && sort !== "asc" || i === 0 && sort == "asc") {
1766
- return {
1767
- val: /* @__PURE__ */ jsxs("p", { className: "bw-text-[10px] bw-text-text-secondary bw-font-normal", children: [
1768
- /* @__PURE__ */ jsx("span", { className: `${firstOpVal - lastOpVal === 0 ? "bw-text-text-greentext" : "bw-bg-background-container"}`, children: `-$${fixString(formatNumber(firstOpVal - lastOpVal), 12)}` }),
1769
- " ",
1770
- firstOpVal - lastOpVal === 0 ? "Higher Output" : "Less Output"
1771
- ] }),
1772
- isMax: firstOpVal - lastOpVal === 0 ? true : false
1773
- };
1774
- } else {
1775
- return {
1776
- val: /* @__PURE__ */ jsxs("p", { className: "bw-text-[10px] bw-text-text-secondary bw-font-normal", children: [
1777
- /* @__PURE__ */ jsx("span", { className: `${firstOpVal - opVal === 0 ? "bw-text-text-greentext" : "bw-bg-background-container"}`, children: `-$${fixString(formatNumber(firstOpVal - opVal), 12)}` }),
1778
- " ",
1779
- firstOpVal - opVal === 0 ? "Higher Output" : "Less Output"
1780
- ] }),
1781
- isMax: firstOpVal - opVal === 0 ? true : false
1782
- };
1783
- }
1784
- }
1785
- return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("div", { className: "bw-h-[410px] bw-pt-2 bw-overflow-y-auto", children: (_c = (_b = (_a = routes.data) == null ? void 0 : _a.data) == null ? void 0 : _b.quotes) == null ? void 0 : _c.sort((a, b) => {
1786
- let opVal1 = Number(a.outputAmountDisplay || 0);
1787
- let opVal2 = Number(b.outputAmountDisplay || 0);
1788
- if (sort === "asc") {
1789
- return opVal1 - opVal2;
1790
- } else {
1791
- return opVal2 - opVal1;
1792
- }
1793
- }).map((item, i, arr) => {
1794
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
1795
- const calculatedOpVal = handleOpCalc(item, arr, i);
1796
- let outputVal = (item == null ? void 0 : item.outputAmountDisplay) || "";
1797
- let logoUrl = ((_b2 = (_a2 = item == null ? void 0 : item.providerDetails) == null ? void 0 : _a2.logoUrl) == null ? void 0 : _b2.length) ? (_c2 = item == null ? void 0 : item.providerDetails) == null ? void 0 : _c2.logoUrl : defaultCoin;
1798
- return /* @__PURE__ */ jsx(
1799
- "div",
1800
- {
1801
- onClick: () => {
1802
- handleRoutesData(item);
1803
- handleShowAllRoutes();
1804
- },
1805
- className: "bw-mb-4",
1806
- children: /* @__PURE__ */ jsxs(
1807
- "div",
1808
- {
1809
- style: {
1810
- boxShadow: configuration && configuration.customTheme && ((_e = (_d = configuration.customTheme) == null ? void 0 : _d.shadow) == null ? void 0 : _e.boxShadow) || "1px 1px 7px rgba(0, 0, 0, 0.15)"
1811
- },
1812
- className: ` bw-w-[93%] bw-mt-3 bw-cursor-pointer bw-ml-auto bw-mr-2 bw-flex bw-mb-8 bw-items-center bw-px-2 bw-relative bw-rounded-lg bw-pt-3 bw-pb-3 bw-border bw-border-border-primary`,
1813
- children: [
1814
- /* @__PURE__ */ jsxs("div", { className: "bw-absolute bw-flex bw-items-center bw-gap-x-1 bw-bottom-[-10%] bw-self-center bw-right-[47%]", children: [
1815
- ((_f = item.tags) == null ? void 0 : _f.includes("BEST_OUTPUT")) ? /* @__PURE__ */ jsx(Routes, { name: "Max Output", children: /* @__PURE__ */ jsx("div", { className: "bw-w-[20px] bw-h-[20px]", children: /* @__PURE__ */ jsx(Maxop, { fill: "var(--tw-background-container)" }) }) }) : /* @__PURE__ */ jsx(Fragment, {}),
1816
- ((_g = item.tags) == null ? void 0 : _g.includes("CHEAP")) ? /* @__PURE__ */ jsx(Routes, { name: "Lowest Gas", children: /* @__PURE__ */ jsx("div", { className: "bw-w-[20px] bw-h-[20px]", children: /* @__PURE__ */ jsx(LowgasSvg, { fill: "var(--tw-background-container)" }) }) }) : /* @__PURE__ */ jsx(Fragment, {}),
1817
- ((_h = item.tags) == null ? void 0 : _h.includes("FAST")) ? /* @__PURE__ */ jsx("div", { className: "bw-w-[20px] bw-h-[20px]", children: /* @__PURE__ */ jsx(FastestSvg, { fill: "var(--tw-background-container)" }) }) : /* @__PURE__ */ jsx(Fragment, {})
1818
- ] }),
1819
- /* @__PURE__ */ jsx("div", { className: "bw-w-[35px] bw-h-[35px] bw-absolute bw-z-50 bw-left-[-5%] bw-top-[-16%]", children: /* @__PURE__ */ jsx("img", { src: logoUrl, className: "bw-rounded-lg ", width: 35, height: 35 }) }),
1820
- /* @__PURE__ */ jsxs("div", { className: "bw-absolute bw-text-[10px] bw-text-text-primary bw-font-normal bw-left-5 bw-top-1", children: [
1821
- /* @__PURE__ */ jsx("span", { className: `${calculatedOpVal.color}`, children: calculatedOpVal == null ? void 0 : calculatedOpVal.val }),
1822
- " "
1823
- ] }),
1824
- /* @__PURE__ */ jsx("div", { className: "bw-flex bw-w-full bw-mt-4 bw-justify-between bw-items-center", children: /* @__PURE__ */ jsxs("div", { children: [
1825
- /* @__PURE__ */ jsx("p", { className: "bw-text-xs bw-font-semibold bw-text-text-primary", children: ((_i = item == null ? void 0 : item.providerDetails) == null ? void 0 : _i.name) || "" }),
1826
- /* @__PURE__ */ jsxs("p", { className: "bw-text-xs bw-font-normal bw-my-1 bw-text-text-secondary", children: [
1827
- "via",
1828
- " ",
1829
- ((_j = item == null ? void 0 : item.protocolsUsed) == null ? void 0 : _j.length) > 2 ? (item == null ? void 0 : item.protocolsUsed.slice(0, 2).map((item2, i2, arr2) => {
1830
- return i2 == arr2.length - 1 ? item2 : `${item2 + " >> "}`;
1831
- })) + `+${((_k = item == null ? void 0 : item.protocolsUsed) == null ? void 0 : _k.length) - 2}` : item == null ? void 0 : item.protocolsUsed.map((item2, i2, arr2) => {
1832
- return i2 == arr2.length - 1 ? item2 : `${item2 + " >> "}`;
1833
- }),
1834
- " "
1835
- ] }),
1836
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-1", children: [
1837
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-1", children: [
1838
- /* @__PURE__ */ jsx(Step, { fill: "var(--tw-text-secondary)" }),
1839
- /* @__PURE__ */ jsxs("p", { className: "bw-text-xs bw-font-normal bw-text-text-secondary", children: [
1840
- item.steps.length,
1841
- " Step"
1842
- ] })
1843
- ] }),
1844
- /* @__PURE__ */ jsxs("div", { className: "bw-text-xs bw-font-normal bw-text-text-secondary", children: [
1845
- " Slippage ",
1846
- item.slippage / 100,
1847
- "%"
1848
- ] })
1849
- ] })
1850
- ] }) }),
1851
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-flex-col bw-justify-between bw-w-full bw-items-end", children: [
1852
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-2", children: [
1853
- /* @__PURE__ */ jsxs("div", { className: ` bw-relative bw-rounded-[50%] bw-w-[21px] bw-h-[21px] bw-border bw-border-border-primary ${!((_l = item.to) == null ? void 0 : _l.image) ? "" : "bw-bg-background-coin"}`, children: [
1854
- ((_m = item.to) == null ? void 0 : _m.image) ? /* @__PURE__ */ jsx("img", { src: item.to.image, width: 20, height: 20, alt: "img", className: "bw-rounded-[50%] bw-max-w-[20px] bw-max-h-[20px] bw-object-contain" }) : /* @__PURE__ */ jsx("img", { src: defaultCoin, width: 20, height: 20, alt: "img", className: "bw-rounded-[50%]" }),
1855
- /* @__PURE__ */ jsxs("div", { className: `bw-bg-background-coin bw-absolute bw-bottom-[-30%] bw-right-[-15%] bw-rounded-[50%] bw-w-[12px] bw-h-[12px] bw-border bw-border-border-primary ${!(toChain == null ? void 0 : toChain.image) ? "" : "bw-bg-background-coin"}`, children: [
1856
- " ",
1857
- (toChain == null ? void 0 : toChain.image) ? /* @__PURE__ */ jsx("img", { src: toChain.image, width: 11, height: 11, className: "bw-rounded-[50%]", alt: "img" }) : /* @__PURE__ */ jsx("img", { src: defaultCoin, width: 11, height: 11, className: "bw-rounded-[50%]", alt: "img" })
1858
- ] })
1859
- ] }),
1860
- /* @__PURE__ */ jsx("p", { className: "bw-text-lg bw-break-words bw-font-medium bw-text-text-primary", children: /* @__PURE__ */ jsx(OutputValueComp, { value: outputVal, decimal: 12 }) })
1861
- ] }),
1862
- /* @__PURE__ */ jsx("div", { className: "bw-flex bw-text-xs bw-font-normal bw-mb-2 bw-items-center bw-gap-x-1", children: /* @__PURE__ */ jsxs("p", { className: "bw-text-text-secondary", children: [
1863
- "$",
1864
- /* @__PURE__ */ jsx(OutputValueComp, { value: ((_n = item.outputAmountDisplay * convertVal) == null ? void 0 : _n.toString()) || "", decimal: 10 })
1865
- ] }) }),
1866
- /* @__PURE__ */ jsxs("div", { className: "bw-text-sm bw-flex bw-items-center bw-gap-x-2 bw-font-medium bw-text-text-secondary", children: [
1867
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-text-sm bw-items-center bw-gap-x-1", children: [
1868
- /* @__PURE__ */ jsx(ClockIcon, { fill: "var(--tw-text-secondary)" }),
1869
- /* @__PURE__ */ jsxs("p", { children: [
1870
- " ",
1871
- item.estimatedTimeInSeconds >= 90 ? `${Math.round(truncate((item.estimatedTimeInSeconds || 60) / 60, 2) || 0)}min` : `${(item == null ? void 0 : item.estimatedTimeInSeconds) || 60} secs`
1872
- ] })
1873
- ] }),
1874
- /* @__PURE__ */ jsx(GasField$2, { item, gasImg: gasnew, fromChain })
1875
- ] })
1876
- ] })
1877
- ]
1878
- }
1879
- )
1880
- },
1881
- i
1882
- );
1883
- }) }) });
1884
- }
1885
- function GasField$1({ gasImg, item, fromChain }) {
1886
- const [gas, setGas] = useState({});
1887
- useEffect(() => {
1888
- var _a;
1889
- let tempGasObj = { amountInUSD: 0 };
1890
- (_a = item == null ? void 0 : item.fee) == null ? void 0 : _a.forEach((item2) => {
1891
- if (item2.source == "FROM_SOURCE_WALLET") {
1892
- tempGasObj.amountInUSD += Number(item2.amountInUSD);
1893
- }
1894
- });
1895
- setGas(tempGasObj);
1896
- }, [item]);
1897
- return /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-text-sm bw-items-center bw-gap-x-1", children: [
1898
- /* @__PURE__ */ jsx(Gas, { fill: "var(--tw-text-secondary)" }),
1899
- /* @__PURE__ */ jsxs("p", { children: [
1900
- "$",
1901
- fixString((gas == null ? void 0 : gas.amountInUSD) || 0, 6) || 0
1902
- ] })
1903
- ] });
1904
- }
1905
- function LowerGas({ routes, handleShowAllRoutes, handleRoutesData, convertVal, fromChain, sort, toChain }) {
1906
- var _a, _b, _c;
1907
- const { gasnew, defaultCoin } = images;
1908
- const [recommendedOp, setRecommendedOp] = useState({});
1909
- const [recommendedTime, setRecommendedTime] = useState({});
1910
- const configuration = useStore((state) => state.configuration);
1911
- function handleOpCalc(item, arr, i) {
1912
- var _a2, _b2, _c2;
1913
- let tempGasObj = { amountInUSD: 0 };
1914
- (_a2 = item == null ? void 0 : item.fee) == null ? void 0 : _a2.forEach((item2) => {
1915
- if (item2.source == "FROM_SOURCE_WALLET") {
1916
- tempGasObj.amountInUSD += Number(item2.amountInUSD);
1917
- }
1918
- });
1919
- let gasVal = tempGasObj.amountInUSD;
1920
- let tempGasObj1 = { amountInUSD: 0 };
1921
- (_b2 = arr[0].fee) == null ? void 0 : _b2.forEach((item2) => {
1922
- if (item2.source == "FROM_SOURCE_WALLET") {
1923
- tempGasObj1.amountInUSD += Number(item2.amountInUSD);
1924
- }
1925
- });
1926
- let tempGasObj2 = { amountInUSD: 0 };
1927
- (_c2 = arr[arr.length - 1].fee) == null ? void 0 : _c2.forEach((item2) => {
1928
- if (item2.source == "FROM_SOURCE_WALLET") {
1929
- tempGasObj2.amountInUSD += Number(item2.amountInUSD);
1930
- }
1931
- });
1932
- let gasFirstVal = sort === "desc" ? tempGasObj2.amountInUSD : tempGasObj1.amountInUSD;
1933
- let gasLastVal = sort === "desc" ? tempGasObj1.amountInUSD : tempGasObj2.amountInUSD;
1934
- if (i == 0 && sort !== "desc" || i == arr.length - 1 && sort == "desc") {
1935
- return {
1936
- val: /* @__PURE__ */ jsxs("p", { className: "bw-text-[10px] bw-text-text-secondary bw-font-normal", children: [
1937
- /* @__PURE__ */ jsx("span", { className: "bw-text-text-greentext", children: `$${truncate(gasLastVal - gasFirstVal, 4)}` }),
1938
- " Cheaper"
1939
- ] }),
1940
- isMax: true
1941
- };
1942
- } else if (i === 0 && sort !== "desc") {
1943
- return {
1944
- val: /* @__PURE__ */ jsxs("p", { className: "bw-text-[10px] bw-text-text-secondary bw-font-normal", children: [
1945
- /* @__PURE__ */ jsx("span", { className: `${truncate(gasFirstVal - gasLastVal, 4) === 0 ? "bw-text-text-greentext" : "bw-bg-background-container"}`, children: `$${truncate(gasFirstVal - gasLastVal, 4)}` }),
1946
- " ",
1947
- truncate(gasFirstVal - gasLastVal, 4) === 0 ? "Cheaper" : "Higher"
1948
- ] }),
1949
- isMax: truncate(gasFirstVal - gasLastVal, 4) === 0 ? true : false
1950
- };
1951
- } else if (i == arr.length - 1 && sort == "desc") {
1952
- return {
1953
- val: /* @__PURE__ */ jsxs("p", { className: "bw-text-[10px] bw-text-text-secondary bw-font-normal", children: [
1954
- /* @__PURE__ */ jsx("span", { className: `${truncate(gasLastVal - gasFirstVal, 4) === 0 ? "bw-text-text-greentext" : "bw-bg-background-container"}`, children: `$${truncate(gasLastVal - gasFirstVal, 4)}` }),
1955
- " ",
1956
- truncate(gasLastVal - gasFirstVal, 4) ? "Cheaper" : "Higher"
1957
- ] }),
1958
- isMax: truncate(gasLastVal - gasFirstVal, 4) === 0 ? true : false
1959
- };
1960
- } else {
1961
- return {
1962
- val: /* @__PURE__ */ jsxs("p", { className: "bw-text-[10px] bw-text-text-secondary bw-font-normal", children: [
1963
- /* @__PURE__ */ jsx("span", { className: `${truncate(gasVal - gasFirstVal, 4) === 0 ? "bw-text-text-greentext" : "bw-bg-background-container"}`, children: `$${truncate(gasVal - gasFirstVal, 4)}` }),
1964
- " ",
1965
- truncate(gasVal - gasFirstVal, 4) ? "Cheaper" : "Higher"
1966
- ] }),
1967
- isMax: truncate(gasVal - gasFirstVal, 4) === 0 ? true : false
1968
- };
1969
- }
1970
- }
1971
- return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("div", { className: "bw-h-[410px] bw-pt-2 bw-overflow-y-auto", children: (_c = (_b = (_a = routes == null ? void 0 : routes.data) == null ? void 0 : _a.data) == null ? void 0 : _b.quotes) == null ? void 0 : _c.sort((a, b) => {
1972
- var _a2, _b2;
1973
- let tempVal1 = { amountInUSD: 0 };
1974
- (_a2 = a == null ? void 0 : a.fee) == null ? void 0 : _a2.forEach((item) => {
1975
- if (item.source == "FROM_SOURCE_WALLET") {
1976
- tempVal1.amountInUSD += Number(item.amountInUSD);
1977
- }
1978
- });
1979
- let tempVal2 = { amountInUSD: 0 };
1980
- (_b2 = b == null ? void 0 : b.fee) == null ? void 0 : _b2.forEach((item) => {
1981
- if (item.source == "FROM_SOURCE_WALLET") {
1982
- tempVal2.amountInUSD += Number(item.amountInUSD);
1983
- }
1984
- });
1985
- let opVal1 = tempVal1.amountInUSD;
1986
- let opVal2 = tempVal2.amountInUSD;
1987
- if (sort === "asc") {
1988
- return opVal1 - opVal2;
1989
- } else if (sort === "none") {
1990
- return opVal1 - opVal2;
1991
- } else {
1992
- return opVal2 - opVal1;
1993
- }
1994
- }).map((item, i, arr) => {
1995
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
1996
- const calculatedOpVal = handleOpCalc(item, arr, i);
1997
- let outputVal = (item == null ? void 0 : item.outputAmountDisplay) || "";
1998
- let logoUrl = ((_b2 = (_a2 = item == null ? void 0 : item.providerDetails) == null ? void 0 : _a2.logoUrl) == null ? void 0 : _b2.length) ? (_c2 = item == null ? void 0 : item.providerDetails) == null ? void 0 : _c2.logoUrl : defaultCoin;
1999
- return /* @__PURE__ */ jsx(
2000
- "div",
2001
- {
2002
- onClick: () => {
2003
- handleRoutesData(item);
2004
- handleShowAllRoutes();
2005
- },
2006
- className: "bw-mb-4",
2007
- children: /* @__PURE__ */ jsxs(
2008
- "div",
2009
- {
2010
- style: {
2011
- boxShadow: configuration && configuration.customTheme && ((_e = (_d = configuration.customTheme) == null ? void 0 : _d.shadow) == null ? void 0 : _e.boxShadow) || "1px 1px 7px rgba(0, 0, 0, 0.15)"
2012
- },
2013
- className: ` bw-w-[93%] bw-mt-3 bw-cursor-pointer bw-ml-auto bw-mr-2 bw-flex bw-mb-8 bw-items-center bw-px-2 bw-relative bw-rounded-lg bw-pt-3 bw-pb-3 bw-border bw-border-border-primary`,
2014
- children: [
2015
- /* @__PURE__ */ jsxs("div", { className: "bw-absolute bw-flex bw-items-center bw-gap-x-1 bw-bottom-[-10%] bw-self-center bw-right-[47%]", children: [
2016
- ((_f = item.tags) == null ? void 0 : _f.includes("CHEAP")) ? /* @__PURE__ */ jsx(Routes, { name: "Lowest Gas", children: /* @__PURE__ */ jsx("div", { className: "bw-w-[20px] bw-h-[20px]", children: /* @__PURE__ */ jsx(LowgasSvg, { fill: "var(--tw-background-container)" }) }) }) : /* @__PURE__ */ jsx(Fragment, {}),
2017
- ((_g = item.tags) == null ? void 0 : _g.includes("BEST_OUTPUT")) ? /* @__PURE__ */ jsx(Routes, { name: "Max Output", children: /* @__PURE__ */ jsx("div", { className: "bw-w-[20px] bw-h-[20px]", children: /* @__PURE__ */ jsx(Maxop, { fill: "var(--tw-background-container)" }) }) }) : /* @__PURE__ */ jsx(Fragment, {}),
2018
- ((_h = item.tags) == null ? void 0 : _h.includes("FAST")) ? /* @__PURE__ */ jsx(Routes, { name: "Fastest", children: /* @__PURE__ */ jsx("div", { className: "bw-w-[20px] bw-h-[20px]", children: /* @__PURE__ */ jsx(FastestSvg, { fill: "var(--tw-background-container)" }) }) }) : /* @__PURE__ */ jsx(Fragment, {})
2019
- ] }),
2020
- /* @__PURE__ */ jsx("div", { className: "bw-w-[35px] bw-h-[35px] bw-absolute bw-z-50 bw-left-[-5%] bw-top-[-16%]", children: /* @__PURE__ */ jsx("img", { src: logoUrl, className: "bw-rounded-lg ", width: 35, height: 35 }) }),
2021
- /* @__PURE__ */ jsxs("div", { className: "bw-absolute bw-text-[10px] bw-text-text-primary bw-font-normal bw-left-5 bw-top-1", children: [
2022
- /* @__PURE__ */ jsx("span", { className: `${calculatedOpVal.color}`, children: calculatedOpVal == null ? void 0 : calculatedOpVal.val }),
2023
- " "
2024
- ] }),
2025
- /* @__PURE__ */ jsx("div", { className: "bw-flex bw-w-full bw-mt-4 bw-justify-between bw-items-center", children: /* @__PURE__ */ jsxs("div", { children: [
2026
- /* @__PURE__ */ jsx("p", { className: "bw-text-xs bw-font-semibold bw-text-text-primary", children: ((_i = item == null ? void 0 : item.providerDetails) == null ? void 0 : _i.name) || "" }),
2027
- /* @__PURE__ */ jsxs("p", { className: "bw-text-xs bw-font-normal bw-my-1 bw-text-text-secondary", children: [
2028
- "via",
2029
- " ",
2030
- ((_j = item == null ? void 0 : item.protocolsUsed) == null ? void 0 : _j.length) > 2 ? (item == null ? void 0 : item.protocolsUsed.slice(0, 2).map((item2, i2, arr2) => {
2031
- return i2 == arr2.length - 1 ? item2 : `${item2 + " >> "}`;
2032
- })) + `+${((_k = item == null ? void 0 : item.protocolsUsed) == null ? void 0 : _k.length) - 2}` : item == null ? void 0 : item.protocolsUsed.map((item2, i2, arr2) => {
2033
- return i2 == arr2.length - 1 ? item2 : `${item2 + " >> "}`;
2034
- }),
2035
- " "
2036
- ] }),
2037
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-1", children: [
2038
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-1", children: [
2039
- /* @__PURE__ */ jsx(Step, { fill: "var(--tw-text-secondary)" }),
2040
- /* @__PURE__ */ jsxs("p", { className: "bw-text-xs bw-font-normal bw-text-text-secondary", children: [
2041
- item.steps.length,
2042
- " Step"
2043
- ] })
2044
- ] }),
2045
- /* @__PURE__ */ jsxs("div", { className: "bw-text-xs bw-font-normal bw-text-text-secondary", children: [
2046
- " Slippage ",
2047
- item.slippage / 100,
2048
- "%"
2049
- ] })
2050
- ] })
2051
- ] }) }),
2052
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-flex-col bw-justify-between bw-w-full bw-items-end", children: [
2053
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-2", children: [
2054
- /* @__PURE__ */ jsxs("div", { className: ` bw-relative bw-rounded-[50%] bw-w-[21px] bw-h-[21px] bw-border bw-border-border-primary ${!((_l = item.to) == null ? void 0 : _l.image) ? "" : "bw-bg-background-coin"}`, children: [
2055
- ((_m = item.to) == null ? void 0 : _m.image) ? /* @__PURE__ */ jsx("img", { src: item.to.image, width: 20, height: 20, alt: "img", className: "bw-rounded-[50%] bw-max-w-[20px] bw-max-h-[20px] bw-object-contain" }) : /* @__PURE__ */ jsx("img", { src: defaultCoin, width: 20, height: 20, alt: "img", className: "bw-rounded-[50%]" }),
2056
- /* @__PURE__ */ jsxs("div", { className: ` bw-absolute bw-bottom-[-30%] bw-right-[-15%] bw-rounded-[50%] bw-w-[12px] bw-h-[12px] bw-border bw-border-border-primary ${!(toChain == null ? void 0 : toChain.image) ? "" : "bw-bg-background-coin"}`, children: [
2057
- " ",
2058
- (toChain == null ? void 0 : toChain.image) ? /* @__PURE__ */ jsx("img", { src: toChain.image, width: 11, height: 11, className: "bw-rounded-[50%]", alt: "img" }) : /* @__PURE__ */ jsx("img", { src: defaultCoin, width: 11, height: 11, className: "bw-rounded-[50%]", alt: "img" })
2059
- ] })
2060
- ] }),
2061
- /* @__PURE__ */ jsx("p", { className: "bw-text-lg bw-break-words bw-font-medium bw-text-text-primary", children: /* @__PURE__ */ jsx(OutputValueComp, { value: outputVal, decimal: 12 }) })
2062
- ] }),
2063
- /* @__PURE__ */ jsx("div", { className: "bw-flex bw-text-xs bw-font-normal bw-mb-2 bw-items-center bw-gap-x-1", children: /* @__PURE__ */ jsxs("p", { className: "bw-text-text-secondary", children: [
2064
- "$",
2065
- /* @__PURE__ */ jsx(OutputValueComp, { value: ((_n = (item.outputAmountDisplay || "") * convertVal) == null ? void 0 : _n.toString()) || "", decimal: 10 })
2066
- ] }) }),
2067
- /* @__PURE__ */ jsxs("div", { className: "bw-text-sm bw-flex bw-items-center bw-gap-x-2 bw-font-medium bw-text-text-secondary", children: [
2068
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-text-sm bw-items-center bw-gap-x-1", children: [
2069
- /* @__PURE__ */ jsx(ClockIcon, { fill: "var(--tw-text-secondary)" }),
2070
- /* @__PURE__ */ jsxs("p", { children: [
2071
- " ",
2072
- item.estimatedTimeInSeconds >= 90 ? `${Math.round(truncate((item.estimatedTimeInSeconds || 60) / 60, 2) || 0)}min` : `${(item == null ? void 0 : item.estimatedTimeInSeconds) || 60} secs`
2073
- ] })
2074
- ] }),
2075
- /* @__PURE__ */ jsx(GasField$1, { item, gasImg: gasnew, fromChain })
2076
- ] })
2077
- ] })
2078
- ]
2079
- }
2080
- )
2081
- },
2082
- i
2083
- );
2084
- }) }) });
2085
- }
2086
- function GasField({ gasImg, item, fromChain }) {
2087
- const [gas, setGas] = useState({});
2088
- useEffect(() => {
2089
- var _a;
2090
- let tempGasObj = { amountInUSD: 0 };
2091
- (_a = item == null ? void 0 : item.fee) == null ? void 0 : _a.forEach((item2) => {
2092
- if (item2.source == "FROM_SOURCE_WALLET") {
2093
- tempGasObj.amountInUSD += Number(item2.amountInUSD);
2094
- }
2095
- });
2096
- setGas(tempGasObj);
2097
- }, [item]);
2098
- return /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-text-sm bw-items-center bw-gap-x-1", children: [
2099
- /* @__PURE__ */ jsx(Gas, { fill: "var(--tw-text-secondary)" }),
2100
- /* @__PURE__ */ jsxs("p", { children: [
2101
- "$",
2102
- fixString((gas == null ? void 0 : gas.amountInUSD) || 0, 6) || 0
2103
- ] })
2104
- ] });
2105
- }
2106
- function Fastest({ routes, handleShowAllRoutes, handleRoutesData, convertVal, fromChain, sort, toChain }) {
2107
- var _a, _b, _c;
2108
- const { gasnew, defaultCoin } = images;
2109
- const [recommendedGas, setRecommendedGas] = useState({});
2110
- const [recommendedOp, setRecommendedOp] = useState({});
2111
- const configuration = useStore((state) => state.configuration);
2112
- function handleOpCalc(item, arr, i) {
2113
- let opVal = truncate((item.estimatedTimeInSeconds || 60) / 60, 2) || 0;
2114
- let firstOpVal = sort == "asc" ? truncate((arr[arr.length - 1].estimatedTimeInSeconds || 60) / 60, 2) || 0 : truncate((arr[0].estimatedTimeInSeconds || 60) / 60, 2) || 0;
2115
- let lastOpVal = sort == "asc" ? truncate((arr[0].estimatedTimeInSeconds || 60) / 60, 2) || 0 : truncate((arr[arr.length - 1].estimatedTimeInSeconds || 60) / 60, 2) || 0;
2116
- if (i == 0 && sort !== "asc" || i == arr.length - 1 && sort == "asc") {
2117
- return {
2118
- val: /* @__PURE__ */ jsxs("p", { className: "bw-text-[10px] bw-text-text-secondary bw-font-normal", children: [
2119
- /* @__PURE__ */ jsx("span", { className: "bw-text-text-greentext", children: `+${truncate(lastOpVal - firstOpVal || 0, 2)} Mins` }),
2120
- " Faster"
2121
- ] }),
2122
- isMax: true
2123
- };
2124
- } else if (i == arr.length - 1 && sort !== "asc" || i === 0 && sort == "asc") {
2125
- return {
2126
- val: /* @__PURE__ */ jsxs("p", { className: "bw-text-[10px] bw-text-text-secondary bw-font-normal", children: [
2127
- /* @__PURE__ */ jsx("span", { className: `${firstOpVal - lastOpVal === 0 ? "bw-text-text-greentext" : "bw-bg-background-container"}`, children: `${truncate(lastOpVal - firstOpVal, 2)} Mins` }),
2128
- " ",
2129
- firstOpVal - lastOpVal === 0 ? "Faster" : "Slower"
2130
- ] }),
2131
- isMax: firstOpVal - lastOpVal === 0 ? true : false
2132
- };
2133
- } else {
2134
- return {
2135
- val: /* @__PURE__ */ jsxs("p", { className: "bw-text-[10px] bw-text-text-secondary bw-font-normal", children: [
2136
- /* @__PURE__ */ jsx("span", { className: `${firstOpVal - opVal === 0 ? "bw-text-text-greentext" : "bw-bg-background-container"}`, children: `${truncate(opVal - firstOpVal, 2)} Mins` }),
2137
- " ",
2138
- firstOpVal - opVal === 0 ? "Faster" : "Slower"
2139
- ] }),
2140
- isMax: firstOpVal - opVal === 0 ? true : false
2141
- };
2142
- }
2143
- }
2144
- return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("div", { className: "bw-h-[410px] bw-pt-2 bw-overflow-y-auto", children: (_c = (_b = (_a = routes.data) == null ? void 0 : _a.data) == null ? void 0 : _b.quotes) == null ? void 0 : _c.sort((a, b) => {
2145
- let opVal1 = truncate((a.estimatedTimeInSeconds || 60) / 60, 2) || 0;
2146
- let opVal2 = truncate((b.estimatedTimeInSeconds || 60) / 60, 2) || 0;
2147
- if (sort === "asc") {
2148
- return opVal2 - opVal1;
2149
- } else {
2150
- return opVal1 - opVal2;
2151
- }
2152
- }).map((item, i, arr) => {
2153
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
2154
- const calculatedOpVal = handleOpCalc(item, arr, i);
2155
- let outputVal = (item == null ? void 0 : item.outputAmountDisplay) || "";
2156
- let logoUrl = ((_b2 = (_a2 = item == null ? void 0 : item.providerDetails) == null ? void 0 : _a2.logoUrl) == null ? void 0 : _b2.length) ? (_c2 = item == null ? void 0 : item.providerDetails) == null ? void 0 : _c2.logoUrl : defaultCoin;
2157
- return /* @__PURE__ */ jsx(
2158
- "div",
2159
- {
2160
- onClick: () => {
2161
- handleRoutesData(item);
2162
- handleShowAllRoutes();
2163
- },
2164
- className: "bw-mb-4",
2165
- children: /* @__PURE__ */ jsxs(
2166
- "div",
2167
- {
2168
- style: {
2169
- boxShadow: configuration && configuration.customTheme && ((_e = (_d = configuration.customTheme) == null ? void 0 : _d.shadow) == null ? void 0 : _e.boxShadow) || "1px 1px 7px rgba(0, 0, 0, 0.15)"
2170
- },
2171
- className: ` bw-w-[93%] bw-mt-3 bw-cursor-pointer bw-ml-auto bw-mr-2 bw-flex bw-mb-8 bw-items-center bw-px-2 bw-relative bw-rounded-lg bw-pt-3 bw-pb-3 bw-border bw-border-border-primary`,
2172
- children: [
2173
- /* @__PURE__ */ jsxs("div", { className: "bw-absolute bw-flex bw-items-center bw-gap-x-1 bw-bottom-[-10%] bw-self-center bw-right-[47%]", children: [
2174
- ((_f = item.tags) == null ? void 0 : _f.includes("FAST")) ? /* @__PURE__ */ jsx(Routes, { name: "Fastest", children: /* @__PURE__ */ jsx("div", { className: "bw-w-[20px] bw-h-[20px]", children: /* @__PURE__ */ jsx(FastestSvg, { fill: "var(--tw-background-container)" }) }) }) : /* @__PURE__ */ jsx(Fragment, {}),
2175
- ((_g = item.tags) == null ? void 0 : _g.includes("CHEAP")) ? /* @__PURE__ */ jsx(Routes, { name: "Lowest Gas", children: /* @__PURE__ */ jsx("div", { className: "bw-w-[20px] bw-h-[20px]", children: /* @__PURE__ */ jsx(LowgasSvg, { fill: "var(--tw-background-container)" }) }) }) : /* @__PURE__ */ jsx(Fragment, {}),
2176
- ((_h = item.tags) == null ? void 0 : _h.includes("BEST_OUTPUT")) ? /* @__PURE__ */ jsx(Routes, { name: "Max Output", children: /* @__PURE__ */ jsx("div", { className: "bw-w-[20px] bw-h-[20px]", children: /* @__PURE__ */ jsx(Maxop, { fill: "var(--tw-background-container)" }) }) }) : /* @__PURE__ */ jsx(Fragment, {})
2177
- ] }),
2178
- /* @__PURE__ */ jsx("div", { className: "bw-w-[35px] bw-h-[35px] bw-absolute bw-z-50 bw-left-[-5%] bw-top-[-16%]", children: /* @__PURE__ */ jsx("img", { src: logoUrl, className: "bw-rounded-lg ", width: 35, height: 35 }) }),
2179
- /* @__PURE__ */ jsxs("div", { className: "bw-absolute bw-text-[10px] bw-text-text-primary bw-font-normal bw-left-5 bw-top-1", children: [
2180
- /* @__PURE__ */ jsx("span", { className: `${calculatedOpVal.color}`, children: calculatedOpVal == null ? void 0 : calculatedOpVal.val }),
2181
- " "
2182
- ] }),
2183
- /* @__PURE__ */ jsx("div", { className: "bw-flex bw-w-full bw-mt-4 bw-justify-between bw-items-center", children: /* @__PURE__ */ jsxs("div", { children: [
2184
- /* @__PURE__ */ jsx("p", { className: "bw-text-xs bw-font-semibold bw-text-text-primary", children: ((_i = item == null ? void 0 : item.providerDetails) == null ? void 0 : _i.name) || "" }),
2185
- /* @__PURE__ */ jsxs("p", { className: "bw-text-xs bw-font-normal bw-my-1 bw-text-text-secondary", children: [
2186
- "via",
2187
- " ",
2188
- ((_j = item == null ? void 0 : item.protocolsUsed) == null ? void 0 : _j.length) > 2 ? (item == null ? void 0 : item.protocolsUsed.slice(0, 2).map((item2, i2, arr2) => {
2189
- return i2 == arr2.length - 1 ? item2 : `${item2 + " >> "}`;
2190
- })) + `+${((_k = item == null ? void 0 : item.protocolsUsed) == null ? void 0 : _k.length) - 2}` : item == null ? void 0 : item.protocolsUsed.map((item2, i2, arr2) => {
2191
- return i2 == arr2.length - 1 ? item2 : `${item2 + " >> "}`;
2192
- }),
2193
- " "
2194
- ] }),
2195
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-1", children: [
2196
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-1", children: [
2197
- /* @__PURE__ */ jsx(Step, { fill: "var(--tw-text-secondary)" }),
2198
- /* @__PURE__ */ jsxs("p", { className: "bw-text-xs bw-font-normal bw-text-text-secondary", children: [
2199
- item.steps.length,
2200
- " Step"
2201
- ] })
2202
- ] }),
2203
- /* @__PURE__ */ jsxs("div", { className: "bw-text-xs bw-font-normal bw-text-text-secondary", children: [
2204
- " Slippage ",
2205
- item.slippage / 100,
2206
- "%"
2207
- ] })
2208
- ] })
2209
- ] }) }),
2210
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-flex-col bw-justify-between bw-w-full bw-items-end", children: [
2211
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-2", children: [
2212
- /* @__PURE__ */ jsxs("div", { className: ` bw-relative bw-rounded-[50%] bw-w-[21px] bw-h-[21px] bw-border bw-border-border-primary ${!((_l = item == null ? void 0 : item.to) == null ? void 0 : _l.image) ? "" : "bw-bg-background-coin"}`, children: [
2213
- ((_m = item.to) == null ? void 0 : _m.image) ? /* @__PURE__ */ jsx("img", { src: item.to.image, width: 20, height: 20, alt: "img", className: "bw-rounded-[50%] bw-max-w-[20px] bw-max-h-[20px] bw-object-contain" }) : /* @__PURE__ */ jsx("img", { src: defaultCoin, width: 20, height: 20, alt: "img", className: "bw-rounded-[50%]" }),
2214
- /* @__PURE__ */ jsxs("div", { className: ` bw-absolute bw-bottom-[-30%] bw-right-[-15%] bw-rounded-[50%] bw-w-[12px] bw-h-[12px] bw-border bw-border-border-primary ${!(toChain == null ? void 0 : toChain.image) ? "" : "bw-bg-background-coin"}`, children: [
2215
- " ",
2216
- (toChain == null ? void 0 : toChain.image) ? /* @__PURE__ */ jsx("img", { src: toChain.image, width: 11, height: 11, className: "bw-rounded-[50%]", alt: "img" }) : /* @__PURE__ */ jsx("img", { src: defaultCoin, width: 11, height: 11, className: "bw-rounded-[50%]", alt: "img" })
2217
- ] })
2218
- ] }),
2219
- /* @__PURE__ */ jsx("p", { className: "bw-text-lg bw-break-words bw-font-medium bw-text-text-primary", children: /* @__PURE__ */ jsx(OutputValueComp, { value: outputVal, decimal: 12 }) })
2220
- ] }),
2221
- /* @__PURE__ */ jsx("div", { className: "bw-flex bw-text-xs bw-font-normal bw-mb-2 bw-items-center bw-gap-x-1", children: /* @__PURE__ */ jsxs("p", { className: "bw-text-text-secondary", children: [
2222
- "$",
2223
- /* @__PURE__ */ jsx(OutputValueComp, { value: ((_n = (item.outputAmountDisplay || "") * convertVal) == null ? void 0 : _n.toString()) || "", decimal: 10 })
2224
- ] }) }),
2225
- /* @__PURE__ */ jsxs("div", { className: "bw-text-sm bw-flex bw-items-center bw-gap-x-2 bw-font-medium bw-text-text-secondary", children: [
2226
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-text-sm bw-items-center bw-gap-x-1", children: [
2227
- /* @__PURE__ */ jsx(ClockIcon, { fill: "var(--tw-text-secondary)" }),
2228
- /* @__PURE__ */ jsx("p", { children: item.estimatedTimeInSeconds >= 90 ? `${Math.round(truncate((item.estimatedTimeInSeconds || 60) / 60, 2)) || 0}min` : `${(item == null ? void 0 : item.estimatedTimeInSeconds) || 60} secs` })
2229
- ] }),
2230
- /* @__PURE__ */ jsx(GasField, { item, gasImg: gasnew, fromChain })
2231
- ] })
2232
- ] })
2233
- ]
2234
- }
2235
- )
2236
- },
2237
- i
2238
- );
2239
- }) }) });
2240
- }
2241
- const Label1 = React__default.memo(function({ maxOpSort, value }) {
2242
- var _a, _b;
2243
- const configuration = useStore((state) => state.configuration);
2244
- return /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-2", children: [
2245
- /* @__PURE__ */ jsx("div", { className: "bw-w-[16px] bw-h-[16px]", children: /* @__PURE__ */ jsx(
2246
- Maxop,
2247
- {
2248
- fill: "var(--tw-background-container)",
2249
- spinnerColor: (_a = configuration == null ? void 0 : configuration.gradientStyle) == null ? void 0 : _a.spinnerColor,
2250
- stopColor: (_b = configuration == null ? void 0 : configuration.gradientStyle) == null ? void 0 : _b.stopColor
2251
- }
2252
- ) }),
2253
- /* @__PURE__ */ jsx(
2254
- "span",
2255
- {
2256
- className: `bw-text-xs ${value == 1 ? "bw-text-text-primary bw-font-medium" : "bw-text-text-secondary bw-font-medium"}`,
2257
- children: "Max Output"
2258
- }
2259
- ),
2260
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-gap-y-[2px] bw-items-center bw-flex-col bw-justify-center", children: [
2261
- /* @__PURE__ */ jsx(
2262
- SortUp,
2263
- {
2264
- isSelected: maxOpSort == "asc" ? true : false,
2265
- fill: "var(--tw-text-primary)"
2266
- }
2267
- ),
2268
- /* @__PURE__ */ jsx(
2269
- SortDown,
2270
- {
2271
- fill: "var(--tw-text-primary)",
2272
- isSelected: maxOpSort == "desc" ? true : false
2273
- }
2274
- )
2275
- ] })
2276
- ] });
2277
- });
2278
- const Label2 = React__default.memo(function({ lowestGasSort, value }) {
2279
- return /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-2", children: [
2280
- /* @__PURE__ */ jsx("div", { className: "bw-w-[16px] bw-h-[16px]", children: /* @__PURE__ */ jsx(LowgasSvg, { fill: "var(--tw-background-container)" }) }),
2281
- /* @__PURE__ */ jsx(
2282
- "span",
2283
- {
2284
- className: `bw-text-xs ${value == 2 ? "bw-text-text-primary bw-font-medium" : "bw-text-text-secondary bw-font-medium"}`,
2285
- children: "Lowest Gas"
2286
- }
2287
- ),
2288
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-gap-y-[2px] bw-items-center bw-flex-col bw-justify-center", children: [
2289
- /* @__PURE__ */ jsx(
2290
- SortUp,
2291
- {
2292
- fill: "var(--tw-text-primary)",
2293
- isSelected: lowestGasSort === "asc" ? true : false
2294
- }
2295
- ),
2296
- /* @__PURE__ */ jsx(
2297
- SortDown,
2298
- {
2299
- fill: "var(--tw-text-primary)",
2300
- isSelected: lowestGasSort === "desc" ? true : false
2301
- }
2302
- )
2303
- ] })
2304
- ] });
2305
- });
2306
- const Label3 = React__default.memo(function({ fastestSort, value }) {
2307
- return /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-center bw-gap-x-2", children: [
2308
- /* @__PURE__ */ jsx("div", { className: "bw-w-[16px] bw-h-[16px]", children: /* @__PURE__ */ jsx(FastestSvg, { fill: "var(--tw-background-container)" }) }),
2309
- /* @__PURE__ */ jsx(
2310
- "span",
2311
- {
2312
- className: `bw-text-xs ${value == 3 ? "bw-text-text-primary bw-font-medium" : "bw-text-text-secondary bw-font-medium"}`,
2313
- children: "Fastest"
2314
- }
2315
- ),
2316
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-gap-y-[2px] bw-items-center bw-flex-col bw-justify-center", children: [
2317
- /* @__PURE__ */ jsx(
2318
- SortUp,
2319
- {
2320
- fill: "var(--tw-text-primary)",
2321
- isSelected: fastestSort === "asc" ? true : false
2322
- }
2323
- ),
2324
- /* @__PURE__ */ jsx(
2325
- SortDown,
2326
- {
2327
- fill: "var(--tw-text-primary)",
2328
- isSelected: fastestSort === "desc" ? true : false
2329
- }
2330
- )
2331
- ] })
2332
- ] });
2333
- });
2334
- function TabComp({
2335
- routes,
2336
- handleShowAllRoutes,
2337
- handleRoutesData,
2338
- convertVal,
2339
- fromChain,
2340
- toChain
2341
- }) {
2342
- const [value, setValue] = useState("1");
2343
- const [maxOpSort, setMaxOpSort] = useState("none");
2344
- const [lowestGasSort, setLowestGasSort] = useState("none");
2345
- const [fastestSort, setFastestSort] = useState("none");
2346
- const configuration = useStore((state) => state.configuration);
2347
- function handleValue(e, val) {
2348
- setValue(val);
2349
- }
2350
- return /* @__PURE__ */ jsxs(TabContext, { value, children: [
2351
- /* @__PURE__ */ jsx(
2352
- Box,
2353
- {
2354
- sx: (theme) => ({
2355
- borderBottom: 1,
2356
- borderColor: "var(--tw-border-primary)",
2357
- width: "max-content",
2358
- [theme.breakpoints.down("sm")]: { width: "100%", overflowX: "auto" },
2359
- marginX: "auto"
2360
- }),
2361
- children: /* @__PURE__ */ jsxs(
2362
- TabList,
2363
- {
2364
- TabIndicatorProps: {
2365
- style: { background: "var(--tw-text-secondary)" }
2366
- },
2367
- sx: (theme) => ({
2368
- width: "max-content",
2369
- [theme.breakpoints.down("sm")]: {
2370
- width: "100%",
2371
- overflowX: "auto"
2372
- }
2373
- }),
2374
- onChange: handleValue,
2375
- "aria-label": "lab API tabs example",
2376
- children: [
2377
- /* @__PURE__ */ jsx(
2378
- Tab,
2379
- {
2380
- onClick: () => {
2381
- if (value == "1")
2382
- setMaxOpSort((prev) => {
2383
- if (prev == "none") {
2384
- return "asc";
2385
- } else if (prev === "asc") {
2386
- return "desc";
2387
- } else {
2388
- return "none";
2389
- }
2390
- });
2391
- else return true;
2392
- },
2393
- disableRipple: true,
2394
- sx: (theme) => {
2395
- var _a;
2396
- return {
2397
- textTransform: "none",
2398
- paddingBottom: "0px",
2399
- fontFamily: ((_a = configuration == null ? void 0 : configuration.customTheme) == null ? void 0 : _a.fontFamily) || "lato",
2400
- width: "120px",
2401
- paddingX: "5px",
2402
- [theme.breakpoints.down("sm")]: {
2403
- minWidth: "33%",
2404
- paddingX: "auto"
2405
- }
2406
- };
2407
- },
2408
- label: /* @__PURE__ */ jsx(Label1, { maxOpSort, value }),
2409
- value: "1"
2410
- }
2411
- ),
2412
- /* @__PURE__ */ jsx(
2413
- Tab,
2414
- {
2415
- onClick: () => {
2416
- if (value == "2")
2417
- setLowestGasSort((prev) => {
2418
- if (prev == "none") {
2419
- return "asc";
2420
- } else if (prev === "asc") {
2421
- return "desc";
2422
- } else {
2423
- return "none";
2424
- }
2425
- });
2426
- else return true;
2427
- },
2428
- disableRipple: true,
2429
- sx: (theme) => {
2430
- var _a;
2431
- return {
2432
- textTransform: "none",
2433
- paddingBottom: "0px",
2434
- fontFamily: ((_a = configuration == null ? void 0 : configuration.customTheme) == null ? void 0 : _a.fontFamily) || "lato",
2435
- width: "120px",
2436
- paddingX: "5px",
2437
- paddingLeft: "10px",
2438
- [theme.breakpoints.down("sm")]: {
2439
- minWidth: "33%",
2440
- paddingX: "auto",
2441
- paddingLeft: "auto"
2442
- }
2443
- };
2444
- },
2445
- label: /* @__PURE__ */ jsx(Label2, { lowestGasSort, value }),
2446
- value: "2"
2447
- }
2448
- ),
2449
- /* @__PURE__ */ jsx(
2450
- Tab,
2451
- {
2452
- onClick: () => {
2453
- if (value == "3")
2454
- setFastestSort((prev) => {
2455
- if (prev == "none") {
2456
- return "asc";
2457
- } else if (prev === "asc") {
2458
- return "desc";
2459
- } else {
2460
- return "none";
2461
- }
2462
- });
2463
- else return true;
2464
- },
2465
- disableRipple: true,
2466
- sx: (theme) => {
2467
- var _a;
2468
- return {
2469
- textTransform: "none",
2470
- paddingBottom: "0px",
2471
- fontFamily: ((_a = configuration == null ? void 0 : configuration.customTheme) == null ? void 0 : _a.fontFamily) || "lato",
2472
- width: "110px",
2473
- paddingX: "5px",
2474
- [theme.breakpoints.down("sm")]: {
2475
- minWidth: "33%",
2476
- paddingX: "auto"
2477
- }
2478
- };
2479
- },
2480
- label: /* @__PURE__ */ jsx(Label3, { fastestSort, value }),
2481
- value: "3"
2482
- }
2483
- )
2484
- ]
2485
- }
2486
- )
2487
- }
2488
- ),
2489
- /* @__PURE__ */ jsx(
2490
- TabPanel,
2491
- {
2492
- sx: { paddingLeft: "0px", paddingRight: "0px", paddingTop: "10px" },
2493
- value: "1",
2494
- children: /* @__PURE__ */ jsx(
2495
- MaxOutput,
2496
- {
2497
- routes,
2498
- handleRoutesData,
2499
- handleShowAllRoutes,
2500
- convertVal,
2501
- fromChain,
2502
- sort: maxOpSort,
2503
- toChain
2504
- }
2505
- )
2506
- }
2507
- ),
2508
- /* @__PURE__ */ jsx(
2509
- TabPanel,
2510
- {
2511
- sx: { paddingLeft: "0px", paddingRight: "0px", paddingTop: "10px" },
2512
- value: "2",
2513
- children: /* @__PURE__ */ jsx(
2514
- LowerGas,
2515
- {
2516
- routes,
2517
- handleRoutesData,
2518
- handleShowAllRoutes,
2519
- convertVal,
2520
- fromChain,
2521
- sort: lowestGasSort,
2522
- toChain
2523
- }
2524
- )
2525
- }
2526
- ),
2527
- /* @__PURE__ */ jsx(
2528
- TabPanel,
2529
- {
2530
- sx: { paddingLeft: "0px", paddingRight: "0px", paddingTop: "10px" },
2531
- value: "3",
2532
- children: /* @__PURE__ */ jsx(
2533
- Fastest,
2534
- {
2535
- routes,
2536
- handleRoutesData,
2537
- handleShowAllRoutes,
2538
- convertVal,
2539
- fromChain,
2540
- sort: fastestSort,
2541
- toChain
2542
- }
2543
- )
2544
- }
2545
- )
2546
- ] });
2547
- }
2548
- function RoutesBack({ fill1, fill2 }) {
2549
- return /* @__PURE__ */ jsxs("svg", { width: "25", height: "25", viewBox: "0 0 25 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2550
- /* @__PURE__ */ jsx("circle", { cx: "12.4758", cy: "12.4774", r: "11.9774", transform: "rotate(90 12.4758 12.4774)", stroke: fill1 }),
2551
- /* @__PURE__ */ jsx("path", { d: "M14.4375 6.27832L8.45786 12.258L14.4122 18.2121", stroke: fill2, "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })
2552
- ] });
2553
- }
2554
- function AllRoutes({ routes, handleShowAllRoutes, handleRoutesData, convertVal, amount }) {
2555
- var _a, _b, _c;
2556
- const fromChain = useStore((state) => state.fromChain);
2557
- const fromCoin = useStore((state) => state.fromCoin);
2558
- const toChain = useStore((state) => state.toChain);
2559
- const { defaultCoin } = images;
2560
- return /* @__PURE__ */ jsxs("div", { children: [
2561
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-w-full bw-relative bw-justify-between bw-mb-2", children: [
2562
- /* @__PURE__ */ jsxs("div", { className: "bw-flex bw-items-start bw-gap-x-3", children: [
2563
- /* @__PURE__ */ jsx(
2564
- "button",
2565
- {
2566
- onClick: () => {
2567
- handleShowAllRoutes();
2568
- },
2569
- className: "bw-mt-1",
2570
- children: /* @__PURE__ */ jsx(RoutesBack, { fill1: "var(--tw-background-secondary)", fill2: "var(--tw-text-secondary)" })
2571
- }
2572
- ),
2573
- /* @__PURE__ */ jsxs("div", { className: "bw-text-lg bw-font-normal bw-text-text-secondary", children: [
2574
- /* @__PURE__ */ jsxs("div", { className: "", children: [
2575
- /* @__PURE__ */ jsx("span", { className: "", children: ((_c = (_b = (_a = routes.data) == null ? void 0 : _a.data) == null ? void 0 : _b.quotes) == null ? void 0 : _c.length) || 0 }),
2576
- " Routes For"
2577
- ] }),
2578
- " ",
2579
- /* @__PURE__ */ jsx("p", { className: "bw-text-xs bw-font-bold bw-mt-2", children: `${fromCoin == null ? void 0 : fromCoin.coin} on ${fromChain == null ? void 0 : fromChain.chain}` })
2580
- ] })
2581
- ] }),
2582
- /* @__PURE__ */ jsxs("div", { className: " bw-flex bw-items-center bw-gap-x-2", children: [
2583
- /* @__PURE__ */ jsxs("div", { children: [
2584
- /* @__PURE__ */ jsx("p", { className: "bw-text-2xl bw-font-bold bw-mb-2 bw-leading-none bw-text-right bw-text-text-primary", children: amount }),
2585
- /* @__PURE__ */ jsxs("p", { className: "bw-text-sm bw-font-bold bw-text-right bw-text-text-secondary", children: [
2586
- "$",
2587
- formatNumber(amount * (fromCoin == null ? void 0 : fromCoin.lastPrice) || 0, 10)
2588
- ] })
2589
- ] }),
2590
- /* @__PURE__ */ jsxs("div", { className: " bw-bg-background-coin bw-flex bw-justify-center bw-items-center bw-mb-2 bw-relative bw-rounded-[50%] bw-w-[35px] bw-h-[35px] bw-border bw-border-border-primary", children: [
2591
- (fromCoin == null ? void 0 : fromCoin.image) ? /* @__PURE__ */ jsx("img", { src: fromCoin.image, width: 34, height: 34, alt: "img", className: "bw-rounded-[50%] bw-max-w-[34px] bw-max-h-[34px] bw-object-contain bw-min-w-[34px] bw-h-[34px]" }) : /* @__PURE__ */ jsx("img", { src: defaultCoin, width: 34, height: 34, alt: "img", className: "bw-rounded-[50%] bw-min-w-[34px] bw-h-[34px]" }),
2592
- /* @__PURE__ */ jsxs("div", { className: "bw-bg-background-coin bw-absolute bw-bottom-[-30%] bw-right-4 bw-rounded-[50%] bw-w-[19px] bw-h-[19px] bw-border bw-border-border-primary", children: [
2593
- " ",
2594
- (fromCoin == null ? void 0 : fromCoin.image) ? /* @__PURE__ */ jsx("img", { src: fromChain.image, width: 18, height: 18, className: "bw-rounded-[50%]", alt: "img" }) : /* @__PURE__ */ jsx("img", { src: defaultCoin, width: 18, height: 18, className: "bw-rounded-[50%]", alt: "img" })
2595
- ] })
2596
- ] })
2597
- ] })
2598
- ] }),
2599
- /* @__PURE__ */ jsx(TabComp, { routes, handleShowAllRoutes, handleRoutesData, convertVal, fromChain, toChain })
2600
- ] });
2601
- }
2602
- export {
2603
- AllRoutes as default
2604
- };