@0xsequence/marketplace-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/README.md +8 -0
  2. package/dist/chunk-3TYUQEFM.js +115 -0
  3. package/dist/chunk-3TYUQEFM.js.map +1 -0
  4. package/dist/chunk-4ESPWOBV.js +13 -0
  5. package/dist/chunk-4ESPWOBV.js.map +1 -0
  6. package/dist/chunk-4PFMUVE4.js +78 -0
  7. package/dist/chunk-4PFMUVE4.js.map +1 -0
  8. package/dist/chunk-5WRI5ZAA.js +31 -0
  9. package/dist/chunk-5WRI5ZAA.js.map +1 -0
  10. package/dist/chunk-6S4FYXP6.js +43 -0
  11. package/dist/chunk-6S4FYXP6.js.map +1 -0
  12. package/dist/chunk-7OO74L2K.js +41 -0
  13. package/dist/chunk-7OO74L2K.js.map +1 -0
  14. package/dist/chunk-BBB3XUB4.js +213 -0
  15. package/dist/chunk-BBB3XUB4.js.map +1 -0
  16. package/dist/chunk-BCNFYVAL.js +1 -0
  17. package/dist/chunk-BCNFYVAL.js.map +1 -0
  18. package/dist/chunk-D7QQP6MS.js +2 -0
  19. package/dist/chunk-D7QQP6MS.js.map +1 -0
  20. package/dist/chunk-DBFOPEV6.js +23 -0
  21. package/dist/chunk-DBFOPEV6.js.map +1 -0
  22. package/dist/chunk-EDTC7UES.js +176 -0
  23. package/dist/chunk-EDTC7UES.js.map +1 -0
  24. package/dist/chunk-G3D572BT.js +249 -0
  25. package/dist/chunk-G3D572BT.js.map +1 -0
  26. package/dist/chunk-HGBEC3WX.js +1285 -0
  27. package/dist/chunk-HGBEC3WX.js.map +1 -0
  28. package/dist/chunk-MJ4YU7RW.js +2 -0
  29. package/dist/chunk-MJ4YU7RW.js.map +1 -0
  30. package/dist/chunk-NJ2GXOPW.js +2 -0
  31. package/dist/chunk-NJ2GXOPW.js.map +1 -0
  32. package/dist/chunk-O5JXKTWP.js +1029 -0
  33. package/dist/chunk-O5JXKTWP.js.map +1 -0
  34. package/dist/chunk-O642NH7U.js +15 -0
  35. package/dist/chunk-O642NH7U.js.map +1 -0
  36. package/dist/chunk-QOJXWHRZ.js +71 -0
  37. package/dist/chunk-QOJXWHRZ.js.map +1 -0
  38. package/dist/chunk-QVFMD6S2.js +21 -0
  39. package/dist/chunk-QVFMD6S2.js.map +1 -0
  40. package/dist/chunk-RNUHUVLC.js +214 -0
  41. package/dist/chunk-RNUHUVLC.js.map +1 -0
  42. package/dist/chunk-SM7V6ZWI.js +2740 -0
  43. package/dist/chunk-SM7V6ZWI.js.map +1 -0
  44. package/dist/chunk-STO74F2I.js +14 -0
  45. package/dist/chunk-STO74F2I.js.map +1 -0
  46. package/dist/chunk-TZGLKJRF.js +198 -0
  47. package/dist/chunk-TZGLKJRF.js.map +1 -0
  48. package/dist/chunk-UYRQ5MJQ.js +1027 -0
  49. package/dist/chunk-UYRQ5MJQ.js.map +1 -0
  50. package/dist/chunk-VPGWEMWL.js +162 -0
  51. package/dist/chunk-VPGWEMWL.js.map +1 -0
  52. package/dist/chunk-ZE2LNX65.js +394 -0
  53. package/dist/chunk-ZE2LNX65.js.map +1 -0
  54. package/dist/create-config-Dz0gCiQ0.d.ts +8 -0
  55. package/dist/get-query-client-D46hbjk6.d.ts +5 -0
  56. package/dist/index.css +232 -0
  57. package/dist/index.d.ts +16 -0
  58. package/dist/index.js +76 -0
  59. package/dist/index.js.map +1 -0
  60. package/dist/marketplace-config-DZbtyrma.d.ts +57 -0
  61. package/dist/marketplace.gen-Ceofb9Cs.d.ts +904 -0
  62. package/dist/react/_internal/api/index.d.ts +51 -0
  63. package/dist/react/_internal/api/index.js +134 -0
  64. package/dist/react/_internal/api/index.js.map +1 -0
  65. package/dist/react/_internal/index.d.ts +22 -0
  66. package/dist/react/_internal/index.js +150 -0
  67. package/dist/react/_internal/index.js.map +1 -0
  68. package/dist/react/_internal/wagmi/index.d.ts +12 -0
  69. package/dist/react/_internal/wagmi/index.js +12 -0
  70. package/dist/react/_internal/wagmi/index.js.map +1 -0
  71. package/dist/react/hooks/index.d.ts +381 -0
  72. package/dist/react/hooks/index.js +82 -0
  73. package/dist/react/hooks/index.js.map +1 -0
  74. package/dist/react/index.css +233 -0
  75. package/dist/react/index.css.map +1 -0
  76. package/dist/react/index.d.ts +27 -0
  77. package/dist/react/index.js +113 -0
  78. package/dist/react/index.js.map +1 -0
  79. package/dist/react/ssr/index.d.ts +94 -0
  80. package/dist/react/ssr/index.js +351 -0
  81. package/dist/react/ssr/index.js.map +1 -0
  82. package/dist/react/ui/icons/index.css +25 -0
  83. package/dist/react/ui/icons/index.css.map +1 -0
  84. package/dist/react/ui/icons/index.d.ts +2 -0
  85. package/dist/react/ui/icons/index.js +12 -0
  86. package/dist/react/ui/icons/index.js.map +1 -0
  87. package/dist/react/ui/index.css +233 -0
  88. package/dist/react/ui/index.css.map +1 -0
  89. package/dist/react/ui/index.d.ts +112 -0
  90. package/dist/react/ui/index.js +34 -0
  91. package/dist/react/ui/index.js.map +1 -0
  92. package/dist/react/ui/modals/_internal/components/actionModal/index.css +44 -0
  93. package/dist/react/ui/modals/_internal/components/actionModal/index.css.map +1 -0
  94. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +31 -0
  95. package/dist/react/ui/modals/_internal/components/actionModal/index.js +39 -0
  96. package/dist/react/ui/modals/_internal/components/actionModal/index.js.map +1 -0
  97. package/dist/react/ui/styles/index.css +36 -0
  98. package/dist/react/ui/styles/index.css.map +1 -0
  99. package/dist/react/ui/styles/index.d.ts +5 -0
  100. package/dist/react/ui/styles/index.js +13 -0
  101. package/dist/react/ui/styles/index.js.map +1 -0
  102. package/dist/sdk-config-xWkdBdrL.d.ts +24 -0
  103. package/dist/services-BIwQ1C1c.d.ts +20 -0
  104. package/dist/styles/index.css +233 -0
  105. package/dist/styles/index.css.map +1 -0
  106. package/dist/styles/index.d.ts +58 -0
  107. package/dist/styles/index.js +5019 -0
  108. package/dist/styles/index.js.map +1 -0
  109. package/dist/styles.css-BVaTR5nO.d.ts +3 -0
  110. package/dist/types/index.d.ts +12 -0
  111. package/dist/types/index.js +39 -0
  112. package/dist/types/index.js.map +1 -0
  113. package/dist/types-BrAQ8-w4.d.ts +12 -0
  114. package/dist/utils/abi/abi/standard/index.d.ts +25 -0
  115. package/dist/utils/abi/abi/standard/index.js +8 -0
  116. package/dist/utils/abi/abi/standard/index.js.map +1 -0
  117. package/dist/utils/abi/abi/token/index.d.ts +1125 -0
  118. package/dist/utils/abi/abi/token/index.js +13 -0
  119. package/dist/utils/abi/abi/token/index.js.map +1 -0
  120. package/dist/utils/abi/clients/index.d.ts +27 -0
  121. package/dist/utils/abi/clients/index.js +13 -0
  122. package/dist/utils/abi/clients/index.js.map +1 -0
  123. package/dist/utils/index.d.ts +23 -0
  124. package/dist/utils/index.js +37 -0
  125. package/dist/utils/index.js.map +1 -0
  126. package/package.json +74 -0
  127. package/src/consts.ts +2 -0
  128. package/src/index.ts +3 -0
  129. package/src/react/_internal/api/get-query-client.ts +32 -0
  130. package/src/react/_internal/api/index.ts +5 -0
  131. package/src/react/_internal/api/marketplace-api.ts +31 -0
  132. package/src/react/_internal/api/marketplace.gen.ts +1911 -0
  133. package/src/react/_internal/api/query-keys.ts +61 -0
  134. package/src/react/_internal/api/services.ts +101 -0
  135. package/src/react/_internal/consts.ts +1 -0
  136. package/src/react/_internal/get-provider.ts +6 -0
  137. package/src/react/_internal/index.ts +5 -0
  138. package/src/react/_internal/types.ts +13 -0
  139. package/src/react/_internal/wagmi/create-config.ts +62 -0
  140. package/src/react/_internal/wagmi/embedded.ts +87 -0
  141. package/src/react/_internal/wagmi/index.ts +3 -0
  142. package/src/react/_internal/wagmi/universal.ts +82 -0
  143. package/src/react/hooks/index.ts +17 -0
  144. package/src/react/hooks/options/marketplaceConfigOptions.ts +62 -0
  145. package/src/react/hooks/useBalanceOfCollectible.tsx +51 -0
  146. package/src/react/hooks/useCollectible.tsx +47 -0
  147. package/src/react/hooks/useCollection.tsx +42 -0
  148. package/src/react/hooks/useCollectionCounts.tsx +61 -0
  149. package/src/react/hooks/useConfig.tsx +15 -0
  150. package/src/react/hooks/useCurrencies.tsx +76 -0
  151. package/src/react/hooks/useFilters.tsx +39 -0
  152. package/src/react/hooks/useFloorOrder.tsx +28 -0
  153. package/src/react/hooks/useGenerateListingTransaction.tsx +63 -0
  154. package/src/react/hooks/useGenerateOfferTransaction.tsx +60 -0
  155. package/src/react/hooks/useGenerateSellTransaction.tsx +43 -0
  156. package/src/react/hooks/useHighestOffer.tsx +46 -0
  157. package/src/react/hooks/useListBalances.tsx +56 -0
  158. package/src/react/hooks/useListCollectibles.tsx +54 -0
  159. package/src/react/hooks/useListOffersForCollectible.tsx +53 -0
  160. package/src/react/hooks/useLowestListing.tsx +47 -0
  161. package/src/react/hooks/useMarketplaceConfig.tsx +10 -0
  162. package/src/react/hooks/useRoyaltyPercentage.tsx +45 -0
  163. package/src/react/hooks/useTransferTokens.tsx +81 -0
  164. package/src/react/index.ts +5 -0
  165. package/src/react/provider.tsx +24 -0
  166. package/src/react/ssr/create-ssr-client.ts +31 -0
  167. package/src/react/ssr/index.ts +1 -0
  168. package/src/react/ui/icons/ArrowUp.tsx +29 -0
  169. package/src/react/ui/icons/CalendarIcon.tsx +29 -0
  170. package/src/react/ui/icons/InfoIcon.tsx +36 -0
  171. package/src/react/ui/icons/InventoryIcon.tsx +41 -0
  172. package/src/react/ui/icons/MinusIcon.tsx +31 -0
  173. package/src/react/ui/icons/PlusIcon.tsx +29 -0
  174. package/src/react/ui/icons/PositiveCircleIcon.tsx +35 -0
  175. package/src/react/ui/icons/index.ts +7 -0
  176. package/src/react/ui/icons/styles.css.ts +35 -0
  177. package/src/react/ui/index.ts +6 -0
  178. package/src/react/ui/modals/Account/index.tsx +29 -0
  179. package/src/react/ui/modals/CreateListingModal/_store.ts +326 -0
  180. package/src/react/ui/modals/CreateListingModal/_utils/getCreateListingTransactionTitleMessage.ts +30 -0
  181. package/src/react/ui/modals/CreateListingModal/index.tsx +146 -0
  182. package/src/react/ui/modals/MakeOfferModal/_store.ts +296 -0
  183. package/src/react/ui/modals/MakeOfferModal/_utils/getMakeOfferTransactionTitleMessage.ts +28 -0
  184. package/src/react/ui/modals/MakeOfferModal/index.tsx +157 -0
  185. package/src/react/ui/modals/SellModal/_store.ts +274 -0
  186. package/src/react/ui/modals/SellModal/_utils/getSellTransactionTitleMessage.ts +28 -0
  187. package/src/react/ui/modals/SellModal/index.tsx +126 -0
  188. package/src/react/ui/modals/SellModal/utils.ts +38 -0
  189. package/src/react/ui/modals/SuccessfulPurchaseModal/_store.ts +58 -0
  190. package/src/react/ui/modals/SuccessfulPurchaseModal/index.tsx +186 -0
  191. package/src/react/ui/modals/SuccessfulPurchaseModal/styles.css.ts +52 -0
  192. package/src/react/ui/modals/TransferModal/_store.ts +58 -0
  193. package/src/react/ui/modals/TransferModal/_utils/getTransferTransactionTitleMessage.ts +28 -0
  194. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +102 -0
  195. package/src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx +130 -0
  196. package/src/react/ui/modals/TransferModal/index.tsx +92 -0
  197. package/src/react/ui/modals/TransferModal/messages.ts +14 -0
  198. package/src/react/ui/modals/TransferModal/styles.css.ts +20 -0
  199. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +94 -0
  200. package/src/react/ui/modals/_internal/components/actionModal/index.ts +3 -0
  201. package/src/react/ui/modals/_internal/components/actionModal/store.ts +19 -0
  202. package/src/react/ui/modals/_internal/components/actionModal/styles.css.ts +15 -0
  203. package/src/react/ui/modals/_internal/components/alertMessage/index.tsx +21 -0
  204. package/src/react/ui/modals/_internal/components/alertMessage/styles.css.ts +22 -0
  205. package/src/react/ui/modals/_internal/components/calendar/index.tsx +59 -0
  206. package/src/react/ui/modals/_internal/components/calendarPopover/index.tsx +41 -0
  207. package/src/react/ui/modals/_internal/components/calendarPopover/styles.css.ts +16 -0
  208. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +76 -0
  209. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/styles.css.ts +33 -0
  210. package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +127 -0
  211. package/src/react/ui/modals/_internal/components/expirationDateSelect/styles.css.ts +25 -0
  212. package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +54 -0
  213. package/src/react/ui/modals/_internal/components/priceInput/index.tsx +72 -0
  214. package/src/react/ui/modals/_internal/components/priceInput/styles.css.ts +23 -0
  215. package/src/react/ui/modals/_internal/components/priceInput/types.ts +4 -0
  216. package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +168 -0
  217. package/src/react/ui/modals/_internal/components/quantityInput/styles.css.ts +30 -0
  218. package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +132 -0
  219. package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +41 -0
  220. package/src/react/ui/modals/_internal/components/switchChainModal/styles.css.ts +37 -0
  221. package/src/react/ui/modals/_internal/components/timeAgo/index.tsx +32 -0
  222. package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +58 -0
  223. package/src/react/ui/modals/_internal/components/tokenPreview/styles.css.ts +11 -0
  224. package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +48 -0
  225. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +80 -0
  226. package/src/react/ui/modals/_internal/components/transactionHeader/index.tsx +30 -0
  227. package/src/react/ui/modals/_internal/components/transactionPreview/consts.ts +27 -0
  228. package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +111 -0
  229. package/src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx +24 -0
  230. package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +123 -0
  231. package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +87 -0
  232. package/src/react/ui/modals/_internal/components/transactionStatusModal/styles.css.ts +15 -0
  233. package/src/react/ui/modals/_internal/stores/accountModal.ts +3 -0
  234. package/src/react/ui/modals/modal-provider.tsx +27 -0
  235. package/src/react/ui/styles/index.ts +1 -0
  236. package/src/react/ui/styles/modal.css.ts +73 -0
  237. package/src/styles/index.ts +18 -0
  238. package/src/types/api-types.ts +48 -0
  239. package/src/types/index.ts +4 -0
  240. package/src/types/marketplace-config.ts +63 -0
  241. package/src/types/messages.ts +43 -0
  242. package/src/types/sdk-config.ts +23 -0
  243. package/src/types/types.ts +6 -0
  244. package/src/utils/abi/abi/standard/EIP2981.ts +15 -0
  245. package/src/utils/abi/abi/standard/index.ts +1 -0
  246. package/src/utils/abi/abi/token/ERC1155.ts +324 -0
  247. package/src/utils/abi/abi/token/ERC20.ts +185 -0
  248. package/src/utils/abi/abi/token/ERC721.ts +506 -0
  249. package/src/utils/abi/abi/token/index.ts +3 -0
  250. package/src/utils/abi/clients/ERC1155.ts +82 -0
  251. package/src/utils/abi/clients/ERC20.ts +101 -0
  252. package/src/utils/abi/clients/ERC721.ts +97 -0
  253. package/src/utils/abi/clients/index.ts +3 -0
  254. package/src/utils/address.ts +26 -0
  255. package/src/utils/get-public-rpc-client.ts +32 -0
  256. package/src/utils/index.ts +6 -0
  257. package/src/utils/network.ts +5 -0
  258. package/src/utils/price.ts +21 -0
@@ -0,0 +1,5019 @@
1
+ "use client"
2
+ import "../chunk-4ESPWOBV.js";
3
+ import {
4
+ alertMessageBox,
5
+ alertMessageBoxVariants,
6
+ collectiblesGrid,
7
+ collectiblesGridImage,
8
+ collectiblesGridImagePale,
9
+ collectiblesGridItem,
10
+ currencySelect,
11
+ dateSelectButton,
12
+ dateSelectPopoverContent,
13
+ priceInputWrapper,
14
+ quantityInputWrapper,
15
+ rangeSelect,
16
+ switchChainCta,
17
+ switchChainModalContent,
18
+ tokenPreview,
19
+ transferModalContent
20
+ } from "../chunk-QOJXWHRZ.js";
21
+ import {
22
+ iconVariants
23
+ } from "../chunk-3TYUQEFM.js";
24
+ import {
25
+ cta
26
+ } from "../chunk-O642NH7U.js";
27
+ import "../chunk-NJ2GXOPW.js";
28
+ export {
29
+ alertMessageBox,
30
+ alertMessageBoxVariants,
31
+ collectiblesGrid,
32
+ collectiblesGridImage,
33
+ collectiblesGridImagePale,
34
+ collectiblesGridItem,
35
+ cta,
36
+ currencySelect,
37
+ dateSelectButton,
38
+ dateSelectPopoverContent,
39
+ iconVariants,
40
+ priceInputWrapper,
41
+ quantityInputWrapper,
42
+ rangeSelect,
43
+ switchChainCta,
44
+ switchChainModalContent,
45
+ tokenPreview,
46
+ transferModalContent
47
+ };
48
+ //# sourceMappingURL=index.js.map) {
49
+ options.quotes = "single";
50
+ }
51
+ var quote = options.quotes == "double" ? '"' : "'";
52
+ var isIdentifier = options.isIdentifier;
53
+ var firstChar = string.charAt(0);
54
+ var output = "";
55
+ var counter = 0;
56
+ var length = string.length;
57
+ while (counter < length) {
58
+ var character = string.charAt(counter++);
59
+ var codePoint = character.charCodeAt();
60
+ var value = void 0;
61
+ if (codePoint < 32 || codePoint > 126) {
62
+ if (codePoint >= 55296 && codePoint <= 56319 && counter < length) {
63
+ var extra = string.charCodeAt(counter++);
64
+ if ((extra & 64512) == 56320) {
65
+ codePoint = ((codePoint & 1023) << 10) + (extra & 1023) + 65536;
66
+ } else {
67
+ counter--;
68
+ }
69
+ }
70
+ value = "\\" + codePoint.toString(16).toUpperCase() + " ";
71
+ } else {
72
+ if (options.escapeEverything) {
73
+ if (regexAnySingleEscape.test(character)) {
74
+ value = "\\" + character;
75
+ } else {
76
+ value = "\\" + codePoint.toString(16).toUpperCase() + " ";
77
+ }
78
+ } else if (/[\t\n\f\r\x0B]/.test(character)) {
79
+ value = "\\" + codePoint.toString(16).toUpperCase() + " ";
80
+ } else if (character == "\\" || !isIdentifier && (character == '"' && quote == character || character == "'" && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
81
+ value = "\\" + character;
82
+ } else {
83
+ value = character;
84
+ }
85
+ }
86
+ output += value;
87
+ }
88
+ if (isIdentifier) {
89
+ if (/^-[-\d]/.test(output)) {
90
+ output = "\\-" + output.slice(1);
91
+ } else if (/\d/.test(firstChar)) {
92
+ output = "\\3" + firstChar + " " + output.slice(1);
93
+ }
94
+ }
95
+ output = output.replace(regexExcessiveSpaces, function($0, $1, $2) {
96
+ if ($1 && $1.length % 2) {
97
+ return $0;
98
+ }
99
+ return ($1 || "") + $2;
100
+ });
101
+ if (!isIdentifier && options.wrap) {
102
+ return quote + output + quote;
103
+ }
104
+ return output;
105
+ };
106
+ cssesc3.options = {
107
+ "escapeEverything": false,
108
+ "isIdentifier": false,
109
+ "quotes": "single",
110
+ "wrap": false
111
+ };
112
+ cssesc3.version = "3.0.0";
113
+ module.exports = cssesc3;
114
+ }
115
+ });
116
+
117
+ // node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js
118
+ var require_cjs = __commonJS({
119
+ "node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"(exports, module) {
120
+ "use strict";
121
+ var isMergeableObject = function isMergeableObject2(value) {
122
+ return isNonNullObject(value) && !isSpecial(value);
123
+ };
124
+ function isNonNullObject(value) {
125
+ return !!value && typeof value === "object";
126
+ }
127
+ function isSpecial(value) {
128
+ var stringValue = Object.prototype.toString.call(value);
129
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
130
+ }
131
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
132
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
133
+ function isReactElement(value) {
134
+ return value.$$typeof === REACT_ELEMENT_TYPE;
135
+ }
136
+ function emptyTarget(val) {
137
+ return Array.isArray(val) ? [] : {};
138
+ }
139
+ function cloneUnlessOtherwiseSpecified(value, options) {
140
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
141
+ }
142
+ function defaultArrayMerge(target, source, options) {
143
+ return target.concat(source).map(function(element) {
144
+ return cloneUnlessOtherwiseSpecified(element, options);
145
+ });
146
+ }
147
+ function getMergeFunction(key, options) {
148
+ if (!options.customMerge) {
149
+ return deepmerge2;
150
+ }
151
+ var customMerge = options.customMerge(key);
152
+ return typeof customMerge === "function" ? customMerge : deepmerge2;
153
+ }
154
+ function getEnumerableOwnPropertySymbols(target) {
155
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
156
+ return Object.propertyIsEnumerable.call(target, symbol);
157
+ }) : [];
158
+ }
159
+ function getKeys(target) {
160
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
161
+ }
162
+ function propertyIsOnObject(object, property) {
163
+ try {
164
+ return property in object;
165
+ } catch (_) {
166
+ return false;
167
+ }
168
+ }
169
+ function propertyIsUnsafe(target, key) {
170
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
171
+ }
172
+ function mergeObject(target, source, options) {
173
+ var destination = {};
174
+ if (options.isMergeableObject(target)) {
175
+ getKeys(target).forEach(function(key) {
176
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
177
+ });
178
+ }
179
+ getKeys(source).forEach(function(key) {
180
+ if (propertyIsUnsafe(target, key)) {
181
+ return;
182
+ }
183
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
184
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
185
+ } else {
186
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
187
+ }
188
+ });
189
+ return destination;
190
+ }
191
+ function deepmerge2(target, source, options) {
192
+ options = options || {};
193
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
194
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
195
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
196
+ var sourceIsArray = Array.isArray(source);
197
+ var targetIsArray = Array.isArray(target);
198
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
199
+ if (!sourceAndTargetTypesMatch) {
200
+ return cloneUnlessOtherwiseSpecified(source, options);
201
+ } else if (sourceIsArray) {
202
+ return options.arrayMerge(target, source, options);
203
+ } else {
204
+ return mergeObject(target, source, options);
205
+ }
206
+ }
207
+ deepmerge2.all = function deepmergeAll(array, options) {
208
+ if (!Array.isArray(array)) {
209
+ throw new Error("first argument should be an array");
210
+ }
211
+ return array.reduce(function(prev, next) {
212
+ return deepmerge2(prev, next, options);
213
+ }, {});
214
+ };
215
+ var deepmerge_1 = deepmerge2;
216
+ module.exports = deepmerge_1;
217
+ }
218
+ });
219
+
220
+ // src/react/ui/icons/styles.css.ts
221
+ import { vars } from "@0xsequence/design-system";
222
+
223
+ // node_modules/.pnpm/@vanilla-extract+css@1.16.0/node_modules/@vanilla-extract/css/functionSerializer/dist/vanilla-extract-css-functionSerializer.esm.js
224
+ function addFunctionSerializer(target, recipe2) {
225
+ Object.defineProperty(target, "__recipe__", {
226
+ value: recipe2,
227
+ writable: false
228
+ });
229
+ return target;
230
+ }
231
+
232
+ // node_modules/.pnpm/@vanilla-extract+css@1.16.0/node_modules/@vanilla-extract/css/recipe/dist/vanilla-extract-css-recipe.esm.js
233
+ var addRecipe = addFunctionSerializer;
234
+
235
+ // node_modules/.pnpm/@vanilla-extract+css@1.16.0/node_modules/@vanilla-extract/css/injectStyles/dist/vanilla-extract-css-injectStyles.esm.js
236
+ var stylesheets = {};
237
+ var injectStyles = (_ref) => {
238
+ var {
239
+ fileScope,
240
+ css
241
+ } = _ref;
242
+ var fileScopeId = fileScope.packageName ? [fileScope.packageName, fileScope.filePath].join("/") : fileScope.filePath;
243
+ var stylesheet = stylesheets[fileScopeId];
244
+ if (!stylesheet) {
245
+ var styleEl = document.createElement("style");
246
+ if (fileScope.packageName) {
247
+ styleEl.setAttribute("data-package", fileScope.packageName);
248
+ }
249
+ styleEl.setAttribute("data-file", fileScope.filePath);
250
+ styleEl.setAttribute("type", "text/css");
251
+ stylesheet = stylesheets[fileScopeId] = styleEl;
252
+ document.head.appendChild(styleEl);
253
+ }
254
+ stylesheet.innerHTML = css;
255
+ };
256
+
257
+ // node_modules/.pnpm/@vanilla-extract+private@1.0.6/node_modules/@vanilla-extract/private/dist/vanilla-extract-private.esm.js
258
+ function getVarName(variable) {
259
+ var matches = variable.match(/^var\((.*)\)$/);
260
+ if (matches) {
261
+ return matches[1];
262
+ }
263
+ return variable;
264
+ }
265
+
266
+ // node_modules/.pnpm/@vanilla-extract+css@1.16.0/node_modules/@vanilla-extract/css/dist/transformCss-69f2fb6d.esm.js
267
+ var import_cssesc = __toESM(require_cssesc());
268
+
269
+ // node_modules/.pnpm/modern-ahocorasick@1.0.1/node_modules/modern-ahocorasick/dist/index.mjs
270
+ var AhoCorasick = class {
271
+ constructor(keywords) {
272
+ const { failure, gotoFn, output } = this._buildTables(keywords);
273
+ this.gotoFn = gotoFn;
274
+ this.output = output;
275
+ this.failure = failure;
276
+ }
277
+ _buildTables(keywords) {
278
+ const gotoFn = {
279
+ 0: {}
280
+ };
281
+ const output = {};
282
+ let state = 0;
283
+ for (const word of keywords) {
284
+ let curr = 0;
285
+ for (const l of word) {
286
+ if (gotoFn[curr] && l in gotoFn[curr]) {
287
+ curr = gotoFn[curr][l];
288
+ } else {
289
+ state++;
290
+ gotoFn[curr][l] = state;
291
+ gotoFn[state] = {};
292
+ curr = state;
293
+ output[state] = [];
294
+ }
295
+ }
296
+ output[curr].push(word);
297
+ }
298
+ const failure = {};
299
+ const xs = [];
300
+ for (const l in gotoFn[0]) {
301
+ const state2 = gotoFn[0][l];
302
+ failure[state2] = 0;
303
+ xs.push(state2);
304
+ }
305
+ while (xs.length > 0) {
306
+ const r = xs.shift();
307
+ if (r !== void 0) {
308
+ for (const l in gotoFn[r]) {
309
+ const s = gotoFn[r][l];
310
+ xs.push(s);
311
+ let state2 = failure[r];
312
+ while (state2 > 0 && !(l in gotoFn[state2])) {
313
+ state2 = failure[state2];
314
+ }
315
+ if (l in gotoFn[state2]) {
316
+ const fs = gotoFn[state2][l];
317
+ failure[s] = fs;
318
+ output[s] = [...output[s], ...output[fs]];
319
+ } else {
320
+ failure[s] = 0;
321
+ }
322
+ }
323
+ }
324
+ }
325
+ return {
326
+ gotoFn,
327
+ output,
328
+ failure
329
+ };
330
+ }
331
+ search(str) {
332
+ let state = 0;
333
+ const results = [];
334
+ for (let i = 0; i < str.length; i++) {
335
+ const l = str[i];
336
+ while (state > 0 && !(l in this.gotoFn[state])) {
337
+ state = this.failure[state];
338
+ }
339
+ if (!(l in this.gotoFn[state])) {
340
+ continue;
341
+ }
342
+ state = this.gotoFn[state][l];
343
+ if (this.output[state].length > 0) {
344
+ const foundStrs = this.output[state];
345
+ results.push([i, foundStrs]);
346
+ }
347
+ }
348
+ return results;
349
+ }
350
+ };
351
+
352
+ // node_modules/.pnpm/@vanilla-extract+css@1.16.0/node_modules/@vanilla-extract/css/adapter/dist/vanilla-extract-css-adapter.esm.js
353
+ var mockAdapter = {
354
+ appendCss: () => {
355
+ },
356
+ registerClassName: () => {
357
+ },
358
+ onEndFileScope: () => {
359
+ },
360
+ registerComposition: () => {
361
+ },
362
+ markCompositionUsed: () => {
363
+ },
364
+ getIdentOption: () => process.env.NODE_ENV === "production" ? "short" : "debug"
365
+ };
366
+ var adapterStack = [mockAdapter];
367
+ var currentAdapter = () => {
368
+ if (adapterStack.length < 1) {
369
+ throw new Error("No adapter configured");
370
+ }
371
+ return adapterStack[adapterStack.length - 1];
372
+ };
373
+ var hasConfiguredAdapter = false;
374
+ var setAdapterIfNotSet = (newAdapter) => {
375
+ if (!hasConfiguredAdapter) {
376
+ setAdapter(newAdapter);
377
+ }
378
+ };
379
+ var setAdapter = (newAdapter) => {
380
+ if (!newAdapter) {
381
+ throw new Error('No adapter provided when calling "setAdapter"');
382
+ }
383
+ hasConfiguredAdapter = true;
384
+ adapterStack.push(newAdapter);
385
+ };
386
+ var appendCss = function appendCss2() {
387
+ return currentAdapter().appendCss(...arguments);
388
+ };
389
+ var registerClassName = function registerClassName2() {
390
+ return currentAdapter().registerClassName(...arguments);
391
+ };
392
+ var registerComposition = function registerComposition2() {
393
+ return currentAdapter().registerComposition(...arguments);
394
+ };
395
+ var markCompositionUsed = function markCompositionUsed2() {
396
+ return currentAdapter().markCompositionUsed(...arguments);
397
+ };
398
+ var getIdentOption = function getIdentOption2() {
399
+ var adapter = currentAdapter();
400
+ if (!("getIdentOption" in adapter)) {
401
+ return process.env.NODE_ENV === "production" ? "short" : "debug";
402
+ }
403
+ return adapter.getIdentOption(...arguments);
404
+ };
405
+
406
+ // node_modules/.pnpm/@vanilla-extract+css@1.16.0/node_modules/@vanilla-extract/css/dist/taggedTemplateLiteral-10998315.esm.js
407
+ function _taggedTemplateLiteral(strings, raw) {
408
+ if (!raw) {
409
+ raw = strings.slice(0);
410
+ }
411
+ return Object.freeze(Object.defineProperties(strings, {
412
+ raw: {
413
+ value: Object.freeze(raw)
414
+ }
415
+ }));
416
+ }
417
+
418
+ // node_modules/.pnpm/css-what@6.1.0/node_modules/css-what/lib/es/types.js
419
+ var SelectorType;
420
+ (function(SelectorType2) {
421
+ SelectorType2["Attribute"] = "attribute";
422
+ SelectorType2["Pseudo"] = "pseudo";
423
+ SelectorType2["PseudoElement"] = "pseudo-element";
424
+ SelectorType2["Tag"] = "tag";
425
+ SelectorType2["Universal"] = "universal";
426
+ SelectorType2["Adjacent"] = "adjacent";
427
+ SelectorType2["Child"] = "child";
428
+ SelectorType2["Descendant"] = "descendant";
429
+ SelectorType2["Parent"] = "parent";
430
+ SelectorType2["Sibling"] = "sibling";
431
+ SelectorType2["ColumnCombinator"] = "column-combinator";
432
+ })(SelectorType || (SelectorType = {}));
433
+ var AttributeAction;
434
+ (function(AttributeAction2) {
435
+ AttributeAction2["Any"] = "any";
436
+ AttributeAction2["Element"] = "element";
437
+ AttributeAction2["End"] = "end";
438
+ AttributeAction2["Equals"] = "equals";
439
+ AttributeAction2["Exists"] = "exists";
440
+ AttributeAction2["Hyphen"] = "hyphen";
441
+ AttributeAction2["Not"] = "not";
442
+ AttributeAction2["Start"] = "start";
443
+ })(AttributeAction || (AttributeAction = {}));
444
+
445
+ // node_modules/.pnpm/css-what@6.1.0/node_modules/css-what/lib/es/parse.js
446
+ var reName = /^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/;
447
+ var reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi;
448
+ var actionTypes = /* @__PURE__ */ new Map([
449
+ [126, AttributeAction.Element],
450
+ [94, AttributeAction.Start],
451
+ [36, AttributeAction.End],
452
+ [42, AttributeAction.Any],
453
+ [33, AttributeAction.Not],
454
+ [124, AttributeAction.Hyphen]
455
+ ]);
456
+ var unpackPseudos = /* @__PURE__ */ new Set([
457
+ "has",
458
+ "not",
459
+ "matches",
460
+ "is",
461
+ "where",
462
+ "host",
463
+ "host-context"
464
+ ]);
465
+ function isTraversal(selector) {
466
+ switch (selector.type) {
467
+ case SelectorType.Adjacent:
468
+ case SelectorType.Child:
469
+ case SelectorType.Descendant:
470
+ case SelectorType.Parent:
471
+ case SelectorType.Sibling:
472
+ case SelectorType.ColumnCombinator:
473
+ return true;
474
+ default:
475
+ return false;
476
+ }
477
+ }
478
+ var stripQuotesFromPseudos = /* @__PURE__ */ new Set(["contains", "icontains"]);
479
+ function funescape(_, escaped, escapedWhitespace) {
480
+ const high = parseInt(escaped, 16) - 65536;
481
+ return high !== high || escapedWhitespace ? escaped : high < 0 ? (
482
+ // BMP codepoint
483
+ String.fromCharCode(high + 65536)
484
+ ) : (
485
+ // Supplemental Plane codepoint (surrogate pair)
486
+ String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320)
487
+ );
488
+ }
489
+ function unescapeCSS(str) {
490
+ return str.replace(reEscape, funescape);
491
+ }
492
+ function isQuote(c) {
493
+ return c === 39 || c === 34;
494
+ }
495
+ function isWhitespace(c) {
496
+ return c === 32 || c === 9 || c === 10 || c === 12 || c === 13;
497
+ }
498
+ function parse(selector) {
499
+ const subselects = [];
500
+ const endIndex = parseSelector(subselects, `${selector}`, 0);
501
+ if (endIndex < selector.length) {
502
+ throw new Error(`Unmatched selector: ${selector.slice(endIndex)}`);
503
+ }
504
+ return subselects;
505
+ }
506
+ function parseSelector(subselects, selector, selectorIndex) {
507
+ let tokens = [];
508
+ function getName(offset) {
509
+ const match = selector.slice(selectorIndex + offset).match(reName);
510
+ if (!match) {
511
+ throw new Error(`Expected name, found ${selector.slice(selectorIndex)}`);
512
+ }
513
+ const [name] = match;
514
+ selectorIndex += offset + name.length;
515
+ return unescapeCSS(name);
516
+ }
517
+ function stripWhitespace(offset) {
518
+ selectorIndex += offset;
519
+ while (selectorIndex < selector.length && isWhitespace(selector.charCodeAt(selectorIndex))) {
520
+ selectorIndex++;
521
+ }
522
+ }
523
+ function readValueWithParenthesis() {
524
+ selectorIndex += 1;
525
+ const start = selectorIndex;
526
+ let counter = 1;
527
+ for (; counter > 0 && selectorIndex < selector.length; selectorIndex++) {
528
+ if (selector.charCodeAt(selectorIndex) === 40 && !isEscaped(selectorIndex)) {
529
+ counter++;
530
+ } else if (selector.charCodeAt(selectorIndex) === 41 && !isEscaped(selectorIndex)) {
531
+ counter--;
532
+ }
533
+ }
534
+ if (counter) {
535
+ throw new Error("Parenthesis not matched");
536
+ }
537
+ return unescapeCSS(selector.slice(start, selectorIndex - 1));
538
+ }
539
+ function isEscaped(pos) {
540
+ let slashCount = 0;
541
+ while (selector.charCodeAt(--pos) === 92)
542
+ slashCount++;
543
+ return (slashCount & 1) === 1;
544
+ }
545
+ function ensureNotTraversal() {
546
+ if (tokens.length > 0 && isTraversal(tokens[tokens.length - 1])) {
547
+ throw new Error("Did not expect successive traversals.");
548
+ }
549
+ }
550
+ function addTraversal(type) {
551
+ if (tokens.length > 0 && tokens[tokens.length - 1].type === SelectorType.Descendant) {
552
+ tokens[tokens.length - 1].type = type;
553
+ return;
554
+ }
555
+ ensureNotTraversal();
556
+ tokens.push({ type });
557
+ }
558
+ function addSpecialAttribute(name, action) {
559
+ tokens.push({
560
+ type: SelectorType.Attribute,
561
+ name,
562
+ action,
563
+ value: getName(1),
564
+ namespace: null,
565
+ ignoreCase: "quirks"
566
+ });
567
+ }
568
+ function finalizeSubselector() {
569
+ if (tokens.length && tokens[tokens.length - 1].type === SelectorType.Descendant) {
570
+ tokens.pop();
571
+ }
572
+ if (tokens.length === 0) {
573
+ throw new Error("Empty sub-selector");
574
+ }
575
+ subselects.push(tokens);
576
+ }
577
+ stripWhitespace(0);
578
+ if (selector.length === selectorIndex) {
579
+ return selectorIndex;
580
+ }
581
+ loop: while (selectorIndex < selector.length) {
582
+ const firstChar = selector.charCodeAt(selectorIndex);
583
+ switch (firstChar) {
584
+ // Whitespace
585
+ case 32:
586
+ case 9:
587
+ case 10:
588
+ case 12:
589
+ case 13: {
590
+ if (tokens.length === 0 || tokens[0].type !== SelectorType.Descendant) {
591
+ ensureNotTraversal();
592
+ tokens.push({ type: SelectorType.Descendant });
593
+ }
594
+ stripWhitespace(1);
595
+ break;
596
+ }
597
+ // Traversals
598
+ case 62: {
599
+ addTraversal(SelectorType.Child);
600
+ stripWhitespace(1);
601
+ break;
602
+ }
603
+ case 60: {
604
+ addTraversal(SelectorType.Parent);
605
+ stripWhitespace(1);
606
+ break;
607
+ }
608
+ case 126: {
609
+ addTraversal(SelectorType.Sibling);
610
+ stripWhitespace(1);
611
+ break;
612
+ }
613
+ case 43: {
614
+ addTraversal(SelectorType.Adjacent);
615
+ stripWhitespace(1);
616
+ break;
617
+ }
618
+ // Special attribute selectors: .class, #id
619
+ case 46: {
620
+ addSpecialAttribute("class", AttributeAction.Element);
621
+ break;
622
+ }
623
+ case 35: {
624
+ addSpecialAttribute("id", AttributeAction.Equals);
625
+ break;
626
+ }
627
+ case 91: {
628
+ stripWhitespace(1);
629
+ let name;
630
+ let namespace = null;
631
+ if (selector.charCodeAt(selectorIndex) === 124) {
632
+ name = getName(1);
633
+ } else if (selector.startsWith("*|", selectorIndex)) {
634
+ namespace = "*";
635
+ name = getName(2);
636
+ } else {
637
+ name = getName(0);
638
+ if (selector.charCodeAt(selectorIndex) === 124 && selector.charCodeAt(selectorIndex + 1) !== 61) {
639
+ namespace = name;
640
+ name = getName(1);
641
+ }
642
+ }
643
+ stripWhitespace(0);
644
+ let action = AttributeAction.Exists;
645
+ const possibleAction = actionTypes.get(selector.charCodeAt(selectorIndex));
646
+ if (possibleAction) {
647
+ action = possibleAction;
648
+ if (selector.charCodeAt(selectorIndex + 1) !== 61) {
649
+ throw new Error("Expected `=`");
650
+ }
651
+ stripWhitespace(2);
652
+ } else if (selector.charCodeAt(selectorIndex) === 61) {
653
+ action = AttributeAction.Equals;
654
+ stripWhitespace(1);
655
+ }
656
+ let value = "";
657
+ let ignoreCase = null;
658
+ if (action !== "exists") {
659
+ if (isQuote(selector.charCodeAt(selectorIndex))) {
660
+ const quote = selector.charCodeAt(selectorIndex);
661
+ let sectionEnd = selectorIndex + 1;
662
+ while (sectionEnd < selector.length && (selector.charCodeAt(sectionEnd) !== quote || isEscaped(sectionEnd))) {
663
+ sectionEnd += 1;
664
+ }
665
+ if (selector.charCodeAt(sectionEnd) !== quote) {
666
+ throw new Error("Attribute value didn't end");
667
+ }
668
+ value = unescapeCSS(selector.slice(selectorIndex + 1, sectionEnd));
669
+ selectorIndex = sectionEnd + 1;
670
+ } else {
671
+ const valueStart = selectorIndex;
672
+ while (selectorIndex < selector.length && (!isWhitespace(selector.charCodeAt(selectorIndex)) && selector.charCodeAt(selectorIndex) !== 93 || isEscaped(selectorIndex))) {
673
+ selectorIndex += 1;
674
+ }
675
+ value = unescapeCSS(selector.slice(valueStart, selectorIndex));
676
+ }
677
+ stripWhitespace(0);
678
+ const forceIgnore = selector.charCodeAt(selectorIndex) | 32;
679
+ if (forceIgnore === 115) {
680
+ ignoreCase = false;
681
+ stripWhitespace(1);
682
+ } else if (forceIgnore === 105) {
683
+ ignoreCase = true;
684
+ stripWhitespace(1);
685
+ }
686
+ }
687
+ if (selector.charCodeAt(selectorIndex) !== 93) {
688
+ throw new Error("Attribute selector didn't terminate");
689
+ }
690
+ selectorIndex += 1;
691
+ const attributeSelector = {
692
+ type: SelectorType.Attribute,
693
+ name,
694
+ action,
695
+ value,
696
+ namespace,
697
+ ignoreCase
698
+ };
699
+ tokens.push(attributeSelector);
700
+ break;
701
+ }
702
+ case 58: {
703
+ if (selector.charCodeAt(selectorIndex + 1) === 58) {
704
+ tokens.push({
705
+ type: SelectorType.PseudoElement,
706
+ name: getName(2).toLowerCase(),
707
+ data: selector.charCodeAt(selectorIndex) === 40 ? readValueWithParenthesis() : null
708
+ });
709
+ continue;
710
+ }
711
+ const name = getName(1).toLowerCase();
712
+ let data = null;
713
+ if (selector.charCodeAt(selectorIndex) === 40) {
714
+ if (unpackPseudos.has(name)) {
715
+ if (isQuote(selector.charCodeAt(selectorIndex + 1))) {
716
+ throw new Error(`Pseudo-selector ${name} cannot be quoted`);
717
+ }
718
+ data = [];
719
+ selectorIndex = parseSelector(data, selector, selectorIndex + 1);
720
+ if (selector.charCodeAt(selectorIndex) !== 41) {
721
+ throw new Error(`Missing closing parenthesis in :${name} (${selector})`);
722
+ }
723
+ selectorIndex += 1;
724
+ } else {
725
+ data = readValueWithParenthesis();
726
+ if (stripQuotesFromPseudos.has(name)) {
727
+ const quot = data.charCodeAt(0);
728
+ if (quot === data.charCodeAt(data.length - 1) && isQuote(quot)) {
729
+ data = data.slice(1, -1);
730
+ }
731
+ }
732
+ data = unescapeCSS(data);
733
+ }
734
+ }
735
+ tokens.push({ type: SelectorType.Pseudo, name, data });
736
+ break;
737
+ }
738
+ case 44: {
739
+ finalizeSubselector();
740
+ tokens = [];
741
+ stripWhitespace(1);
742
+ break;
743
+ }
744
+ default: {
745
+ if (selector.startsWith("/*", selectorIndex)) {
746
+ const endIndex = selector.indexOf("*/", selectorIndex + 2);
747
+ if (endIndex < 0) {
748
+ throw new Error("Comment was not terminated");
749
+ }
750
+ selectorIndex = endIndex + 2;
751
+ if (tokens.length === 0) {
752
+ stripWhitespace(0);
753
+ }
754
+ break;
755
+ }
756
+ let namespace = null;
757
+ let name;
758
+ if (firstChar === 42) {
759
+ selectorIndex += 1;
760
+ name = "*";
761
+ } else if (firstChar === 124) {
762
+ name = "";
763
+ if (selector.charCodeAt(selectorIndex + 1) === 124) {
764
+ addTraversal(SelectorType.ColumnCombinator);
765
+ stripWhitespace(2);
766
+ break;
767
+ }
768
+ } else if (reName.test(selector.slice(selectorIndex))) {
769
+ name = getName(0);
770
+ } else {
771
+ break loop;
772
+ }
773
+ if (selector.charCodeAt(selectorIndex) === 124 && selector.charCodeAt(selectorIndex + 1) !== 124) {
774
+ namespace = name;
775
+ if (selector.charCodeAt(selectorIndex + 1) === 42) {
776
+ name = "*";
777
+ selectorIndex += 2;
778
+ } else {
779
+ name = getName(1);
780
+ }
781
+ }
782
+ tokens.push(name === "*" ? { type: SelectorType.Universal, namespace } : { type: SelectorType.Tag, name, namespace });
783
+ }
784
+ }
785
+ }
786
+ finalizeSubselector();
787
+ return selectorIndex;
788
+ }
789
+
790
+ // node_modules/.pnpm/dedent@1.5.3/node_modules/dedent/dist/dedent.mjs
791
+ function ownKeys(object, enumerableOnly) {
792
+ var keys = Object.keys(object);
793
+ if (Object.getOwnPropertySymbols) {
794
+ var symbols = Object.getOwnPropertySymbols(object);
795
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
796
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
797
+ })), keys.push.apply(keys, symbols);
798
+ }
799
+ return keys;
800
+ }
801
+ function _objectSpread(target) {
802
+ for (var i = 1; i < arguments.length; i++) {
803
+ var source = null != arguments[i] ? arguments[i] : {};
804
+ i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
805
+ _defineProperty(target, key, source[key]);
806
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
807
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
808
+ });
809
+ }
810
+ return target;
811
+ }
812
+ function _defineProperty(obj, key, value) {
813
+ key = _toPropertyKey(key);
814
+ if (key in obj) {
815
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
816
+ } else {
817
+ obj[key] = value;
818
+ }
819
+ return obj;
820
+ }
821
+ function _toPropertyKey(arg) {
822
+ var key = _toPrimitive(arg, "string");
823
+ return typeof key === "symbol" ? key : String(key);
824
+ }
825
+ function _toPrimitive(input, hint) {
826
+ if (typeof input !== "object" || input === null) return input;
827
+ var prim = input[Symbol.toPrimitive];
828
+ if (prim !== void 0) {
829
+ var res = prim.call(input, hint || "default");
830
+ if (typeof res !== "object") return res;
831
+ throw new TypeError("@@toPrimitive must return a primitive value.");
832
+ }
833
+ return (hint === "string" ? String : Number)(input);
834
+ }
835
+ var dedent = createDedent({});
836
+ var dedent_default = dedent;
837
+ function createDedent(options) {
838
+ dedent2.withOptions = (newOptions) => createDedent(_objectSpread(_objectSpread({}, options), newOptions));
839
+ return dedent2;
840
+ function dedent2(strings, ...values) {
841
+ const raw = typeof strings === "string" ? [strings] : strings.raw;
842
+ const {
843
+ escapeSpecialCharacters = Array.isArray(strings)
844
+ } = options;
845
+ let result = "";
846
+ for (let i = 0; i < raw.length; i++) {
847
+ let next = raw[i];
848
+ if (escapeSpecialCharacters) {
849
+ next = next.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{");
850
+ }
851
+ result += next;
852
+ if (i < values.length) {
853
+ result += values[i];
854
+ }
855
+ }
856
+ const lines = result.split("\n");
857
+ let mindent = null;
858
+ for (const l of lines) {
859
+ const m = l.match(/^(\s+)\S+/);
860
+ if (m) {
861
+ const indent = m[1].length;
862
+ if (!mindent) {
863
+ mindent = indent;
864
+ } else {
865
+ mindent = Math.min(mindent, indent);
866
+ }
867
+ }
868
+ }
869
+ if (mindent !== null) {
870
+ const m = mindent;
871
+ result = lines.map((l) => l[0] === " " || l[0] === " " ? l.slice(m) : l).join("\n");
872
+ }
873
+ result = result.trim();
874
+ if (escapeSpecialCharacters) {
875
+ result = result.replace(/\\n/g, "\n");
876
+ }
877
+ return result;
878
+ }
879
+ }
880
+
881
+ // node_modules/.pnpm/media-query-parser@2.0.2/node_modules/media-query-parser/dist/media-query-parser.esm.js
882
+ var __assign = function() {
883
+ __assign = Object.assign || function __assign2(t) {
884
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
885
+ s = arguments[i];
886
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
887
+ }
888
+ return t;
889
+ };
890
+ return __assign.apply(this, arguments);
891
+ };
892
+ function __rest(s, e) {
893
+ var t = {};
894
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
895
+ t[p] = s[p];
896
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
897
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
898
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
899
+ t[p[i]] = s[p[i]];
900
+ }
901
+ return t;
902
+ }
903
+ function __values(o) {
904
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
905
+ if (m) return m.call(o);
906
+ if (o && typeof o.length === "number") return {
907
+ next: function() {
908
+ if (o && i >= o.length) o = void 0;
909
+ return { value: o && o[i++], done: !o };
910
+ }
911
+ };
912
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
913
+ }
914
+ function __read(o, n) {
915
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
916
+ if (!m) return o;
917
+ var i = m.call(o), r, ar = [], e;
918
+ try {
919
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
920
+ } catch (error) {
921
+ e = { error };
922
+ } finally {
923
+ try {
924
+ if (r && !r.done && (m = i["return"])) m.call(i);
925
+ } finally {
926
+ if (e) throw e.error;
927
+ }
928
+ }
929
+ return ar;
930
+ }
931
+ var weirdNewlines = /(\u000D|\u000C|\u000D\u000A)/g;
932
+ var nullOrSurrogates = /[\u0000\uD800-\uDFFF]/g;
933
+ var commentRegex = /(\/\*)[\s\S]*?(\*\/)/g;
934
+ var lexicalAnalysis = function lexicalAnalysis2(str, index) {
935
+ if (index === void 0) {
936
+ index = 0;
937
+ }
938
+ str = str.replace(weirdNewlines, "\n").replace(nullOrSurrogates, "\uFFFD");
939
+ str = str.replace(commentRegex, "");
940
+ var tokens = [];
941
+ for (; index < str.length; index += 1) {
942
+ var code = str.charCodeAt(index);
943
+ if (code === 9 || code === 32 || code === 10) {
944
+ var code_1 = str.charCodeAt(++index);
945
+ while (code_1 === 9 || code_1 === 32 || code_1 === 10) {
946
+ code_1 = str.charCodeAt(++index);
947
+ }
948
+ index -= 1;
949
+ tokens.push({
950
+ type: "<whitespace-token>"
951
+ });
952
+ } else if (code === 34) {
953
+ var result = consumeString(str, index);
954
+ if (result === null) {
955
+ return null;
956
+ }
957
+ var _a = __read(result, 2), lastIndex = _a[0], value = _a[1];
958
+ tokens.push({
959
+ type: "<string-token>",
960
+ value
961
+ });
962
+ index = lastIndex;
963
+ } else if (code === 35) {
964
+ if (index + 1 < str.length) {
965
+ var nextCode = str.charCodeAt(index + 1);
966
+ if (nextCode === 95 || nextCode >= 65 && nextCode <= 90 || nextCode >= 97 && nextCode <= 122 || nextCode >= 128 || nextCode >= 48 && nextCode <= 57 || nextCode === 92 && index + 2 < str.length && str.charCodeAt(index + 2) !== 10) {
967
+ var flag = wouldStartIdentifier(str, index + 1) ? "id" : "unrestricted";
968
+ var result = consumeIdentUnsafe(str, index + 1);
969
+ if (result !== null) {
970
+ var _b = __read(result, 2), lastIndex = _b[0], value = _b[1];
971
+ tokens.push({
972
+ type: "<hash-token>",
973
+ value: value.toLowerCase(),
974
+ flag
975
+ });
976
+ index = lastIndex;
977
+ continue;
978
+ }
979
+ }
980
+ }
981
+ tokens.push({
982
+ type: "<delim-token>",
983
+ value: code
984
+ });
985
+ } else if (code === 39) {
986
+ var result = consumeString(str, index);
987
+ if (result === null) {
988
+ return null;
989
+ }
990
+ var _c = __read(result, 2), lastIndex = _c[0], value = _c[1];
991
+ tokens.push({
992
+ type: "<string-token>",
993
+ value
994
+ });
995
+ index = lastIndex;
996
+ } else if (code === 40) {
997
+ tokens.push({
998
+ type: "<(-token>"
999
+ });
1000
+ } else if (code === 41) {
1001
+ tokens.push({
1002
+ type: "<)-token>"
1003
+ });
1004
+ } else if (code === 43) {
1005
+ var plusNumeric = consumeNumeric(str, index);
1006
+ if (plusNumeric === null) {
1007
+ tokens.push({
1008
+ type: "<delim-token>",
1009
+ value: code
1010
+ });
1011
+ } else {
1012
+ var _d = __read(plusNumeric, 2), lastIndex = _d[0], tokenTuple = _d[1];
1013
+ if (tokenTuple[0] === "<dimension-token>") {
1014
+ tokens.push({
1015
+ type: "<dimension-token>",
1016
+ value: tokenTuple[1],
1017
+ unit: tokenTuple[2].toLowerCase(),
1018
+ flag: "number"
1019
+ });
1020
+ } else if (tokenTuple[0] === "<number-token>") {
1021
+ tokens.push({
1022
+ type: tokenTuple[0],
1023
+ value: tokenTuple[1],
1024
+ flag: tokenTuple[2]
1025
+ });
1026
+ } else {
1027
+ tokens.push({
1028
+ type: tokenTuple[0],
1029
+ value: tokenTuple[1],
1030
+ flag: "number"
1031
+ });
1032
+ }
1033
+ index = lastIndex;
1034
+ }
1035
+ } else if (code === 44) {
1036
+ tokens.push({
1037
+ type: "<comma-token>"
1038
+ });
1039
+ } else if (code === 45) {
1040
+ var minusNumeric = consumeNumeric(str, index);
1041
+ if (minusNumeric !== null) {
1042
+ var _e = __read(minusNumeric, 2), lastIndex = _e[0], tokenTuple = _e[1];
1043
+ if (tokenTuple[0] === "<dimension-token>") {
1044
+ tokens.push({
1045
+ type: "<dimension-token>",
1046
+ value: tokenTuple[1],
1047
+ unit: tokenTuple[2].toLowerCase(),
1048
+ flag: "number"
1049
+ });
1050
+ } else if (tokenTuple[0] === "<number-token>") {
1051
+ tokens.push({
1052
+ type: tokenTuple[0],
1053
+ value: tokenTuple[1],
1054
+ flag: tokenTuple[2]
1055
+ });
1056
+ } else {
1057
+ tokens.push({
1058
+ type: tokenTuple[0],
1059
+ value: tokenTuple[1],
1060
+ flag: "number"
1061
+ });
1062
+ }
1063
+ index = lastIndex;
1064
+ continue;
1065
+ }
1066
+ if (index + 2 < str.length) {
1067
+ var nextCode = str.charCodeAt(index + 1);
1068
+ var nextNextCode = str.charCodeAt(index + 2);
1069
+ if (nextCode === 45 && nextNextCode === 62) {
1070
+ tokens.push({
1071
+ type: "<CDC-token>"
1072
+ });
1073
+ index += 2;
1074
+ continue;
1075
+ }
1076
+ }
1077
+ var result = consumeIdentLike(str, index);
1078
+ if (result !== null) {
1079
+ var _f = __read(result, 3), lastIndex = _f[0], value = _f[1], type = _f[2];
1080
+ tokens.push({
1081
+ type,
1082
+ value
1083
+ });
1084
+ index = lastIndex;
1085
+ continue;
1086
+ }
1087
+ tokens.push({
1088
+ type: "<delim-token>",
1089
+ value: code
1090
+ });
1091
+ } else if (code === 46) {
1092
+ var minusNumeric = consumeNumeric(str, index);
1093
+ if (minusNumeric === null) {
1094
+ tokens.push({
1095
+ type: "<delim-token>",
1096
+ value: code
1097
+ });
1098
+ } else {
1099
+ var _g = __read(minusNumeric, 2), lastIndex = _g[0], tokenTuple = _g[1];
1100
+ if (tokenTuple[0] === "<dimension-token>") {
1101
+ tokens.push({
1102
+ type: "<dimension-token>",
1103
+ value: tokenTuple[1],
1104
+ unit: tokenTuple[2].toLowerCase(),
1105
+ flag: "number"
1106
+ });
1107
+ } else if (tokenTuple[0] === "<number-token>") {
1108
+ tokens.push({
1109
+ type: tokenTuple[0],
1110
+ value: tokenTuple[1],
1111
+ flag: tokenTuple[2]
1112
+ });
1113
+ } else {
1114
+ tokens.push({
1115
+ type: tokenTuple[0],
1116
+ value: tokenTuple[1],
1117
+ flag: "number"
1118
+ });
1119
+ }
1120
+ index = lastIndex;
1121
+ continue;
1122
+ }
1123
+ } else if (code === 58) {
1124
+ tokens.push({
1125
+ type: "<colon-token>"
1126
+ });
1127
+ } else if (code === 59) {
1128
+ tokens.push({
1129
+ type: "<semicolon-token>"
1130
+ });
1131
+ } else if (code === 60) {
1132
+ if (index + 3 < str.length) {
1133
+ var nextCode = str.charCodeAt(index + 1);
1134
+ var nextNextCode = str.charCodeAt(index + 2);
1135
+ var nextNextNextCode = str.charCodeAt(index + 3);
1136
+ if (nextCode === 33 && nextNextCode === 45 && nextNextNextCode === 45) {
1137
+ tokens.push({
1138
+ type: "<CDO-token>"
1139
+ });
1140
+ index += 3;
1141
+ continue;
1142
+ }
1143
+ }
1144
+ tokens.push({
1145
+ type: "<delim-token>",
1146
+ value: code
1147
+ });
1148
+ } else if (code === 64) {
1149
+ var result = consumeIdent(str, index + 1);
1150
+ if (result !== null) {
1151
+ var _h = __read(result, 2), lastIndex = _h[0], value = _h[1];
1152
+ tokens.push({
1153
+ type: "<at-keyword-token>",
1154
+ value: value.toLowerCase()
1155
+ });
1156
+ index = lastIndex;
1157
+ continue;
1158
+ }
1159
+ tokens.push({
1160
+ type: "<delim-token>",
1161
+ value: code
1162
+ });
1163
+ } else if (code === 91) {
1164
+ tokens.push({
1165
+ type: "<[-token>"
1166
+ });
1167
+ } else if (code === 92) {
1168
+ var result = consumeEscape(str, index);
1169
+ if (result === null) {
1170
+ return null;
1171
+ }
1172
+ var _j = __read(result, 2), lastIndex = _j[0], value = _j[1];
1173
+ str = str.slice(0, index) + value + str.slice(lastIndex + 1);
1174
+ index -= 1;
1175
+ } else if (code === 93) {
1176
+ tokens.push({
1177
+ type: "<]-token>"
1178
+ });
1179
+ } else if (code === 123) {
1180
+ tokens.push({
1181
+ type: "<{-token>"
1182
+ });
1183
+ } else if (code === 125) {
1184
+ tokens.push({
1185
+ type: "<}-token>"
1186
+ });
1187
+ } else if (code >= 48 && code <= 57) {
1188
+ var result = consumeNumeric(str, index);
1189
+ var _k = __read(result, 2), lastIndex = _k[0], tokenTuple = _k[1];
1190
+ if (tokenTuple[0] === "<dimension-token>") {
1191
+ tokens.push({
1192
+ type: "<dimension-token>",
1193
+ value: tokenTuple[1],
1194
+ unit: tokenTuple[2].toLowerCase(),
1195
+ flag: "number"
1196
+ });
1197
+ } else if (tokenTuple[0] === "<number-token>") {
1198
+ tokens.push({
1199
+ type: tokenTuple[0],
1200
+ value: tokenTuple[1],
1201
+ flag: tokenTuple[2]
1202
+ });
1203
+ } else {
1204
+ tokens.push({
1205
+ type: tokenTuple[0],
1206
+ value: tokenTuple[1],
1207
+ flag: "number"
1208
+ });
1209
+ }
1210
+ index = lastIndex;
1211
+ } else if (code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 128) {
1212
+ var result = consumeIdentLike(str, index);
1213
+ if (result === null) {
1214
+ return null;
1215
+ }
1216
+ var _l = __read(result, 3), lastIndex = _l[0], value = _l[1], type = _l[2];
1217
+ tokens.push({
1218
+ type,
1219
+ value
1220
+ });
1221
+ index = lastIndex;
1222
+ } else {
1223
+ tokens.push({
1224
+ type: "<delim-token>",
1225
+ value: code
1226
+ });
1227
+ }
1228
+ }
1229
+ tokens.push({
1230
+ type: "<EOF-token>"
1231
+ });
1232
+ return tokens;
1233
+ };
1234
+ var consumeString = function consumeString2(str, index) {
1235
+ if (str.length <= index + 1) return null;
1236
+ var firstCode = str.charCodeAt(index);
1237
+ var charCodes = [];
1238
+ for (var i = index + 1; i < str.length; i += 1) {
1239
+ var code = str.charCodeAt(i);
1240
+ if (code === firstCode) {
1241
+ return [i, String.fromCharCode.apply(null, charCodes)];
1242
+ } else if (code === 92) {
1243
+ var result = consumeEscape(str, i);
1244
+ if (result === null) return null;
1245
+ var _a = __read(result, 2), lastIndex = _a[0], charCode = _a[1];
1246
+ charCodes.push(charCode);
1247
+ i = lastIndex;
1248
+ } else if (code === 10) {
1249
+ return null;
1250
+ } else {
1251
+ charCodes.push(code);
1252
+ }
1253
+ }
1254
+ return null;
1255
+ };
1256
+ var wouldStartIdentifier = function wouldStartIdentifier2(str, index) {
1257
+ if (str.length <= index) return false;
1258
+ var code = str.charCodeAt(index);
1259
+ if (code === 45) {
1260
+ if (str.length <= index + 1) return false;
1261
+ var nextCode = str.charCodeAt(index + 1);
1262
+ if (nextCode === 45 || nextCode === 95 || nextCode >= 65 && nextCode <= 90 || nextCode >= 97 && nextCode <= 122 || nextCode >= 128) {
1263
+ return true;
1264
+ } else if (nextCode === 92) {
1265
+ if (str.length <= index + 2) return false;
1266
+ var nextNextCode = str.charCodeAt(index + 2);
1267
+ return nextNextCode !== 10;
1268
+ } else {
1269
+ return false;
1270
+ }
1271
+ } else if (code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 128) {
1272
+ return true;
1273
+ } else if (code === 92) {
1274
+ if (str.length <= index + 1) return false;
1275
+ var nextCode = str.charCodeAt(index + 1);
1276
+ return nextCode !== 10;
1277
+ } else {
1278
+ return false;
1279
+ }
1280
+ };
1281
+ var consumeEscape = function consumeEscape2(str, index) {
1282
+ if (str.length <= index + 1) return null;
1283
+ if (str.charCodeAt(index) !== 92) return null;
1284
+ var code = str.charCodeAt(index + 1);
1285
+ if (code === 10) {
1286
+ return null;
1287
+ } else if (code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102) {
1288
+ var hexCharCodes = [code];
1289
+ var min = Math.min(index + 7, str.length);
1290
+ var i = index + 2;
1291
+ for (; i < min; i += 1) {
1292
+ var code_2 = str.charCodeAt(i);
1293
+ if (code_2 >= 48 && code_2 <= 57 || code_2 >= 65 && code_2 <= 70 || code_2 >= 97 && code_2 <= 102) {
1294
+ hexCharCodes.push(code_2);
1295
+ } else {
1296
+ break;
1297
+ }
1298
+ }
1299
+ if (i < str.length) {
1300
+ var code_3 = str.charCodeAt(i);
1301
+ if (code_3 === 9 || code_3 === 32 || code_3 === 10) {
1302
+ i += 1;
1303
+ }
1304
+ }
1305
+ return [i - 1, parseInt(String.fromCharCode.apply(null, hexCharCodes), 16)];
1306
+ } else {
1307
+ return [index + 1, code];
1308
+ }
1309
+ };
1310
+ var consumeNumeric = function consumeNumeric2(str, index) {
1311
+ var numberResult = consumeNumber(str, index);
1312
+ if (numberResult === null) return null;
1313
+ var _a = __read(numberResult, 3), numberEndIndex = _a[0], numberValue = _a[1], numberFlag = _a[2];
1314
+ var identResult = consumeIdent(str, numberEndIndex + 1);
1315
+ if (identResult !== null) {
1316
+ var _b = __read(identResult, 2), identEndIndex = _b[0], identValue = _b[1];
1317
+ return [identEndIndex, ["<dimension-token>", numberValue, identValue]];
1318
+ }
1319
+ if (numberEndIndex + 1 < str.length && str.charCodeAt(numberEndIndex + 1) === 37) {
1320
+ return [numberEndIndex + 1, ["<percentage-token>", numberValue]];
1321
+ }
1322
+ return [numberEndIndex, ["<number-token>", numberValue, numberFlag]];
1323
+ };
1324
+ var consumeNumber = function consumeNumber2(str, index) {
1325
+ if (str.length <= index) return null;
1326
+ var flag = "integer";
1327
+ var numberChars = [];
1328
+ var firstCode = str.charCodeAt(index);
1329
+ if (firstCode === 43 || firstCode === 45) {
1330
+ index += 1;
1331
+ if (firstCode === 45) numberChars.push(45);
1332
+ }
1333
+ while (index < str.length) {
1334
+ var code = str.charCodeAt(index);
1335
+ if (code >= 48 && code <= 57) {
1336
+ numberChars.push(code);
1337
+ index += 1;
1338
+ } else {
1339
+ break;
1340
+ }
1341
+ }
1342
+ if (index + 1 < str.length) {
1343
+ var nextCode = str.charCodeAt(index);
1344
+ var nextNextCode = str.charCodeAt(index + 1);
1345
+ if (nextCode === 46 && nextNextCode >= 48 && nextNextCode <= 57) {
1346
+ numberChars.push(nextCode, nextNextCode);
1347
+ flag = "number";
1348
+ index += 2;
1349
+ while (index < str.length) {
1350
+ var code = str.charCodeAt(index);
1351
+ if (code >= 48 && code <= 57) {
1352
+ numberChars.push(code);
1353
+ index += 1;
1354
+ } else {
1355
+ break;
1356
+ }
1357
+ }
1358
+ }
1359
+ }
1360
+ if (index + 1 < str.length) {
1361
+ var nextCode = str.charCodeAt(index);
1362
+ var nextNextCode = str.charCodeAt(index + 1);
1363
+ var nextNextNextCode = str.charCodeAt(index + 2);
1364
+ if (nextCode === 69 || nextCode === 101) {
1365
+ var nextNextIsDigit = nextNextCode >= 48 && nextNextCode <= 57;
1366
+ if (nextNextIsDigit || (nextNextCode === 43 || nextNextCode === 45) && nextNextNextCode >= 48 && nextNextNextCode <= 57) {
1367
+ flag = "number";
1368
+ if (nextNextIsDigit) {
1369
+ numberChars.push(69, nextNextCode);
1370
+ index += 2;
1371
+ } else if (nextNextCode === 45) {
1372
+ numberChars.push(69, 45, nextNextNextCode);
1373
+ index += 3;
1374
+ } else {
1375
+ numberChars.push(69, nextNextNextCode);
1376
+ index += 3;
1377
+ }
1378
+ while (index < str.length) {
1379
+ var code = str.charCodeAt(index);
1380
+ if (code >= 48 && code <= 57) {
1381
+ numberChars.push(code);
1382
+ index += 1;
1383
+ } else {
1384
+ break;
1385
+ }
1386
+ }
1387
+ }
1388
+ }
1389
+ }
1390
+ var numberString = String.fromCharCode.apply(null, numberChars);
1391
+ var value = flag === "number" ? parseFloat(numberString) : parseInt(numberString);
1392
+ if (value === -0) value = 0;
1393
+ return Number.isNaN(value) ? null : [index - 1, value, flag];
1394
+ };
1395
+ var consumeIdentUnsafe = function consumeIdentUnsafe2(str, index) {
1396
+ if (str.length <= index) {
1397
+ return null;
1398
+ }
1399
+ var identChars = [];
1400
+ for (var code = str.charCodeAt(index); index < str.length; code = str.charCodeAt(++index)) {
1401
+ if (code === 45 || code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 128 || code >= 48 && code <= 57) {
1402
+ identChars.push(code);
1403
+ continue;
1404
+ } else {
1405
+ var result = consumeEscape(str, index);
1406
+ if (result !== null) {
1407
+ var _a = __read(result, 2), lastIndex = _a[0], code_4 = _a[1];
1408
+ identChars.push(code_4);
1409
+ index = lastIndex;
1410
+ continue;
1411
+ }
1412
+ }
1413
+ break;
1414
+ }
1415
+ return index === 0 ? null : [index - 1, String.fromCharCode.apply(null, identChars)];
1416
+ };
1417
+ var consumeIdent = function consumeIdent2(str, index) {
1418
+ if (str.length <= index || !wouldStartIdentifier(str, index)) {
1419
+ return null;
1420
+ }
1421
+ var identChars = [];
1422
+ for (var code = str.charCodeAt(index); index < str.length; code = str.charCodeAt(++index)) {
1423
+ if (code === 45 || code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 128 || code >= 48 && code <= 57) {
1424
+ identChars.push(code);
1425
+ continue;
1426
+ } else {
1427
+ var result = consumeEscape(str, index);
1428
+ if (result !== null) {
1429
+ var _a = __read(result, 2), lastIndex = _a[0], code_5 = _a[1];
1430
+ identChars.push(code_5);
1431
+ index = lastIndex;
1432
+ continue;
1433
+ }
1434
+ }
1435
+ break;
1436
+ }
1437
+ return [index - 1, String.fromCharCode.apply(null, identChars)];
1438
+ };
1439
+ var consumeUrl = function consumeUrl2(str, index) {
1440
+ var code = str.charCodeAt(index);
1441
+ while (code === 9 || code === 32 || code === 10) {
1442
+ code = str.charCodeAt(++index);
1443
+ }
1444
+ var urlChars = [];
1445
+ var hasFinishedWord = false;
1446
+ while (index < str.length) {
1447
+ if (code === 41) {
1448
+ return [index, String.fromCharCode.apply(null, urlChars)];
1449
+ } else if (code === 34 || code === 39 || code === 40) {
1450
+ return null;
1451
+ } else if (code === 9 || code === 32 || code === 10) {
1452
+ if (!hasFinishedWord && urlChars.length !== 0) hasFinishedWord = true;
1453
+ } else if (code === 92) {
1454
+ var result = consumeEscape(str, index);
1455
+ if (result === null || hasFinishedWord) return null;
1456
+ var _a = __read(result, 2), lastIndex = _a[0], value = _a[1];
1457
+ urlChars.push(value);
1458
+ index = lastIndex;
1459
+ } else {
1460
+ if (hasFinishedWord) return null;
1461
+ urlChars.push(code);
1462
+ }
1463
+ code = str.charCodeAt(++index);
1464
+ }
1465
+ return null;
1466
+ };
1467
+ var consumeIdentLike = function consumeIdentLike2(str, index) {
1468
+ var result = consumeIdent(str, index);
1469
+ if (result === null) return null;
1470
+ var _a = __read(result, 2), lastIndex = _a[0], value = _a[1];
1471
+ if (value.toLowerCase() === "url") {
1472
+ if (str.length > lastIndex + 1) {
1473
+ var nextCode = str.charCodeAt(lastIndex + 1);
1474
+ if (nextCode === 40) {
1475
+ for (var offset = 2; lastIndex + offset < str.length; offset += 1) {
1476
+ var nextNextCode = str.charCodeAt(lastIndex + offset);
1477
+ if (nextNextCode === 34 || nextNextCode === 39) {
1478
+ return [lastIndex + 1, value.toLowerCase(), "<function-token>"];
1479
+ } else if (nextNextCode !== 9 && nextNextCode !== 32 && nextNextCode !== 10) {
1480
+ var result_1 = consumeUrl(str, lastIndex + offset);
1481
+ if (result_1 === null) return null;
1482
+ var _b = __read(result_1, 2), lastUrlIndex = _b[0], value_1 = _b[1];
1483
+ return [lastUrlIndex, value_1, "<url-token>"];
1484
+ }
1485
+ }
1486
+ return [lastIndex + 1, value.toLowerCase(), "<function-token>"];
1487
+ }
1488
+ }
1489
+ } else if (str.length > lastIndex + 1) {
1490
+ var nextCode = str.charCodeAt(lastIndex + 1);
1491
+ if (nextCode === 40) {
1492
+ return [lastIndex + 1, value.toLowerCase(), "<function-token>"];
1493
+ }
1494
+ }
1495
+ return [lastIndex, value.toLowerCase(), "<ident-token>"];
1496
+ };
1497
+ var simplifyAST = function simplifyAST2(ast) {
1498
+ for (var i = ast.length - 1; i >= 0; i--) {
1499
+ ast[i] = simplifyMediaQuery(ast[i]);
1500
+ }
1501
+ return ast;
1502
+ };
1503
+ var simplifyMediaQuery = function simplifyMediaQuery2(mediaQuery) {
1504
+ if (mediaQuery.mediaCondition === null) return mediaQuery;
1505
+ var mediaCondition = simplifyMediaCondition(mediaQuery.mediaCondition);
1506
+ if (mediaCondition.operator === null && mediaCondition.children.length === 1 && "children" in mediaCondition.children[0]) {
1507
+ mediaCondition = mediaCondition.children[0];
1508
+ }
1509
+ return {
1510
+ mediaPrefix: mediaQuery.mediaPrefix,
1511
+ mediaType: mediaQuery.mediaType,
1512
+ mediaCondition
1513
+ };
1514
+ };
1515
+ var simplifyMediaCondition = function simplifyMediaCondition2(mediaCondition) {
1516
+ for (var i = mediaCondition.children.length - 1; i >= 0; i--) {
1517
+ var unsimplifiedChild = mediaCondition.children[i];
1518
+ if (!("context" in unsimplifiedChild)) {
1519
+ var child = simplifyMediaCondition2(unsimplifiedChild);
1520
+ if (child.operator === null && child.children.length === 1) {
1521
+ mediaCondition.children[i] = child.children[0];
1522
+ } else if (child.operator === mediaCondition.operator && (child.operator === "and" || child.operator === "or")) {
1523
+ var spliceArgs = [i, 1];
1524
+ for (var i_1 = 0; i_1 < child.children.length; i_1++) {
1525
+ spliceArgs.push(child.children[i_1]);
1526
+ }
1527
+ mediaCondition.children.splice.apply(mediaCondition.children, spliceArgs);
1528
+ }
1529
+ }
1530
+ }
1531
+ return mediaCondition;
1532
+ };
1533
+ var createError = function createError2(message, err) {
1534
+ if (err instanceof Error) {
1535
+ return new Error("".concat(err.message.trim(), "\n").concat(message.trim()));
1536
+ } else {
1537
+ return new Error(message.trim());
1538
+ }
1539
+ };
1540
+ var toAST = function toAST2(str) {
1541
+ return simplifyAST(toUnflattenedAST(str));
1542
+ };
1543
+ var toUnflattenedAST = function toUnflattenedAST2(str) {
1544
+ var tokenList = lexicalAnalysis(str.trim());
1545
+ if (tokenList === null) {
1546
+ throw createError("Failed tokenizing");
1547
+ }
1548
+ var startIndex = 0;
1549
+ var endIndex = tokenList.length - 1;
1550
+ if (tokenList[0].type === "<at-keyword-token>" && tokenList[0].value === "media") {
1551
+ if (tokenList[1].type !== "<whitespace-token>") {
1552
+ throw createError("Expected whitespace after media");
1553
+ }
1554
+ startIndex = 2;
1555
+ for (var i = 2; i < tokenList.length - 1; i++) {
1556
+ var token = tokenList[i];
1557
+ if (token.type === "<{-token>") {
1558
+ endIndex = i;
1559
+ break;
1560
+ } else if (token.type === "<semicolon-token>") {
1561
+ throw createError("Expected '{' in media query but found ';'");
1562
+ }
1563
+ }
1564
+ }
1565
+ tokenList = tokenList.slice(startIndex, endIndex);
1566
+ return syntacticAnalysis(tokenList);
1567
+ };
1568
+ var removeWhitespace = function removeWhitespace2(tokenList) {
1569
+ var newTokenList = [];
1570
+ var before = false;
1571
+ for (var i = 0; i < tokenList.length; i++) {
1572
+ if (tokenList[i].type === "<whitespace-token>") {
1573
+ before = true;
1574
+ if (newTokenList.length > 0) {
1575
+ newTokenList[newTokenList.length - 1].wsAfter = true;
1576
+ }
1577
+ } else {
1578
+ newTokenList.push(__assign(__assign({}, tokenList[i]), {
1579
+ wsBefore: before,
1580
+ wsAfter: false
1581
+ }));
1582
+ before = false;
1583
+ }
1584
+ }
1585
+ return newTokenList;
1586
+ };
1587
+ var syntacticAnalysis = function syntacticAnalysis2(tokenList) {
1588
+ var e_1, _a;
1589
+ var mediaQueryList = [[]];
1590
+ for (var i = 0; i < tokenList.length; i++) {
1591
+ var token = tokenList[i];
1592
+ if (token.type === "<comma-token>") {
1593
+ mediaQueryList.push([]);
1594
+ } else {
1595
+ mediaQueryList[mediaQueryList.length - 1].push(token);
1596
+ }
1597
+ }
1598
+ var mediaQueries = mediaQueryList.map(removeWhitespace);
1599
+ if (mediaQueries.length === 1 && mediaQueries[0].length === 0) {
1600
+ return [{
1601
+ mediaCondition: null,
1602
+ mediaPrefix: null,
1603
+ mediaType: "all"
1604
+ }];
1605
+ } else {
1606
+ var mediaQueryTokens = mediaQueries.map(function(mediaQueryTokens2) {
1607
+ if (mediaQueryTokens2.length === 0) {
1608
+ return null;
1609
+ } else {
1610
+ return tokenizeMediaQuery(mediaQueryTokens2);
1611
+ }
1612
+ });
1613
+ var nonNullMediaQueryTokens = [];
1614
+ try {
1615
+ for (var mediaQueryTokens_1 = __values(mediaQueryTokens), mediaQueryTokens_1_1 = mediaQueryTokens_1.next(); !mediaQueryTokens_1_1.done; mediaQueryTokens_1_1 = mediaQueryTokens_1.next()) {
1616
+ var mediaQueryToken = mediaQueryTokens_1_1.value;
1617
+ if (mediaQueryToken !== null) {
1618
+ nonNullMediaQueryTokens.push(mediaQueryToken);
1619
+ }
1620
+ }
1621
+ } catch (e_1_1) {
1622
+ e_1 = {
1623
+ error: e_1_1
1624
+ };
1625
+ } finally {
1626
+ try {
1627
+ if (mediaQueryTokens_1_1 && !mediaQueryTokens_1_1.done && (_a = mediaQueryTokens_1["return"])) _a.call(mediaQueryTokens_1);
1628
+ } finally {
1629
+ if (e_1) throw e_1.error;
1630
+ }
1631
+ }
1632
+ if (nonNullMediaQueryTokens.length === 0) {
1633
+ throw createError("No valid media queries");
1634
+ }
1635
+ return nonNullMediaQueryTokens;
1636
+ }
1637
+ };
1638
+ var tokenizeMediaQuery = function tokenizeMediaQuery2(tokens) {
1639
+ var firstToken = tokens[0];
1640
+ if (firstToken.type === "<(-token>") {
1641
+ try {
1642
+ return {
1643
+ mediaPrefix: null,
1644
+ mediaType: "all",
1645
+ mediaCondition: tokenizeMediaCondition(tokens, true)
1646
+ };
1647
+ } catch (err) {
1648
+ throw createError("Expected media condition after '('", err);
1649
+ }
1650
+ } else if (firstToken.type === "<ident-token>") {
1651
+ var mediaPrefix = null;
1652
+ var mediaType = void 0;
1653
+ var value = firstToken.value;
1654
+ if (value === "only" || value === "not") {
1655
+ mediaPrefix = value;
1656
+ }
1657
+ var firstIndex = mediaPrefix === null ? 0 : 1;
1658
+ if (tokens.length <= firstIndex) {
1659
+ throw createError("Expected extra token in media query");
1660
+ }
1661
+ var firstNonUnaryToken = tokens[firstIndex];
1662
+ if (firstNonUnaryToken.type === "<ident-token>") {
1663
+ var value_1 = firstNonUnaryToken.value;
1664
+ if (value_1 === "all") {
1665
+ mediaType = "all";
1666
+ } else if (value_1 === "print" || value_1 === "screen") {
1667
+ mediaType = value_1;
1668
+ } else if (value_1 === "tty" || value_1 === "tv" || value_1 === "projection" || value_1 === "handheld" || value_1 === "braille" || value_1 === "embossed" || value_1 === "aural" || value_1 === "speech") {
1669
+ mediaPrefix = mediaPrefix === "not" ? null : "not";
1670
+ mediaType = "all";
1671
+ } else {
1672
+ throw createError("Unknown ident '".concat(value_1, "' in media query"));
1673
+ }
1674
+ } else if (mediaPrefix === "not" && firstNonUnaryToken.type === "<(-token>") {
1675
+ var tokensWithParens = [{
1676
+ type: "<(-token>",
1677
+ wsBefore: false,
1678
+ wsAfter: false
1679
+ }];
1680
+ tokensWithParens.push.apply(tokensWithParens, tokens);
1681
+ tokensWithParens.push({
1682
+ type: "<)-token>",
1683
+ wsBefore: false,
1684
+ wsAfter: false
1685
+ });
1686
+ try {
1687
+ return {
1688
+ mediaPrefix: null,
1689
+ mediaType: "all",
1690
+ mediaCondition: tokenizeMediaCondition(tokensWithParens, true)
1691
+ };
1692
+ } catch (err) {
1693
+ throw createError("Expected media condition after '('", err);
1694
+ }
1695
+ } else {
1696
+ throw createError("Invalid media query");
1697
+ }
1698
+ if (firstIndex + 1 === tokens.length) {
1699
+ return {
1700
+ mediaPrefix,
1701
+ mediaType,
1702
+ mediaCondition: null
1703
+ };
1704
+ } else if (firstIndex + 4 < tokens.length) {
1705
+ var secondNonUnaryToken = tokens[firstIndex + 1];
1706
+ if (secondNonUnaryToken.type === "<ident-token>" && secondNonUnaryToken.value === "and") {
1707
+ try {
1708
+ return {
1709
+ mediaPrefix,
1710
+ mediaType,
1711
+ mediaCondition: tokenizeMediaCondition(tokens.slice(firstIndex + 2), false)
1712
+ };
1713
+ } catch (err) {
1714
+ throw createError("Expected media condition after 'and'", err);
1715
+ }
1716
+ } else {
1717
+ throw createError("Expected 'and' after media prefix");
1718
+ }
1719
+ } else {
1720
+ throw createError("Expected media condition after media prefix");
1721
+ }
1722
+ } else {
1723
+ throw createError("Expected media condition or media prefix");
1724
+ }
1725
+ };
1726
+ var tokenizeMediaCondition = function tokenizeMediaCondition2(tokens, mayContainOr, previousOperator) {
1727
+ if (previousOperator === void 0) {
1728
+ previousOperator = null;
1729
+ }
1730
+ if (tokens.length < 3 || tokens[0].type !== "<(-token>" || tokens[tokens.length - 1].type !== "<)-token>") {
1731
+ throw new Error("Invalid media condition");
1732
+ }
1733
+ var endIndexOfFirstFeature = tokens.length - 1;
1734
+ var maxDepth = 0;
1735
+ var count = 0;
1736
+ for (var i = 0; i < tokens.length; i++) {
1737
+ var token = tokens[i];
1738
+ if (token.type === "<(-token>") {
1739
+ count += 1;
1740
+ maxDepth = Math.max(maxDepth, count);
1741
+ } else if (token.type === "<)-token>") {
1742
+ count -= 1;
1743
+ }
1744
+ if (count === 0) {
1745
+ endIndexOfFirstFeature = i;
1746
+ break;
1747
+ }
1748
+ }
1749
+ if (count !== 0) {
1750
+ throw new Error("Mismatched parens\nInvalid media condition");
1751
+ }
1752
+ var child;
1753
+ var featureTokens = tokens.slice(0, endIndexOfFirstFeature + 1);
1754
+ if (maxDepth === 1) {
1755
+ child = tokenizeMediaFeature(featureTokens);
1756
+ } else {
1757
+ if (featureTokens[1].type === "<ident-token>" && featureTokens[1].value === "not") {
1758
+ child = tokenizeMediaCondition2(featureTokens.slice(2, -1), true, "not");
1759
+ } else {
1760
+ child = tokenizeMediaCondition2(featureTokens.slice(1, -1), true);
1761
+ }
1762
+ }
1763
+ if (endIndexOfFirstFeature === tokens.length - 1) {
1764
+ return {
1765
+ operator: previousOperator,
1766
+ children: [child]
1767
+ };
1768
+ } else {
1769
+ var nextToken = tokens[endIndexOfFirstFeature + 1];
1770
+ if (nextToken.type !== "<ident-token>") {
1771
+ throw new Error("Invalid operator\nInvalid media condition");
1772
+ } else if (previousOperator !== null && previousOperator !== nextToken.value) {
1773
+ throw new Error("'".concat(nextToken.value, "' and '").concat(previousOperator, "' must not be at same level\nInvalid media condition"));
1774
+ } else if (nextToken.value === "or" && !mayContainOr) {
1775
+ throw new Error("Cannot use 'or' at top level of a media query\nInvalid media condition");
1776
+ } else if (nextToken.value !== "and" && nextToken.value !== "or") {
1777
+ throw new Error("Invalid operator: '".concat(nextToken.value, "'\nInvalid media condition"));
1778
+ }
1779
+ var siblings = tokenizeMediaCondition2(tokens.slice(endIndexOfFirstFeature + 2), mayContainOr, nextToken.value);
1780
+ return {
1781
+ operator: nextToken.value,
1782
+ children: [child].concat(siblings.children)
1783
+ };
1784
+ }
1785
+ };
1786
+ var tokenizeMediaFeature = function tokenizeMediaFeature2(rawTokens) {
1787
+ if (rawTokens.length < 3 || rawTokens[0].type !== "<(-token>" || rawTokens[rawTokens.length - 1].type !== "<)-token>") {
1788
+ throw new Error("Invalid media feature");
1789
+ }
1790
+ var tokens = [rawTokens[0]];
1791
+ for (var i = 1; i < rawTokens.length; i++) {
1792
+ if (i < rawTokens.length - 2) {
1793
+ var a = rawTokens[i];
1794
+ var b = rawTokens[i + 1];
1795
+ var c = rawTokens[i + 2];
1796
+ if (a.type === "<number-token>" && a.value > 0 && b.type === "<delim-token>" && b.value === 47 && c.type === "<number-token>" && c.value > 0) {
1797
+ tokens.push({
1798
+ type: "<ratio-token>",
1799
+ numerator: a.value,
1800
+ denominator: c.value,
1801
+ wsBefore: a.wsBefore,
1802
+ wsAfter: c.wsAfter
1803
+ });
1804
+ i += 2;
1805
+ continue;
1806
+ }
1807
+ }
1808
+ tokens.push(rawTokens[i]);
1809
+ }
1810
+ var nextToken = tokens[1];
1811
+ if (nextToken.type === "<ident-token>" && tokens.length === 3) {
1812
+ return {
1813
+ context: "boolean",
1814
+ feature: nextToken.value
1815
+ };
1816
+ } else if (tokens.length === 5 && tokens[1].type === "<ident-token>" && tokens[2].type === "<colon-token>") {
1817
+ var valueToken = tokens[3];
1818
+ if (valueToken.type === "<number-token>" || valueToken.type === "<dimension-token>" || valueToken.type === "<ratio-token>" || valueToken.type === "<ident-token>") {
1819
+ var feature = tokens[1].value;
1820
+ var prefix = null;
1821
+ var slice = feature.slice(0, 4);
1822
+ if (slice === "min-") {
1823
+ prefix = "min";
1824
+ feature = feature.slice(4);
1825
+ } else if (slice === "max-") {
1826
+ prefix = "max";
1827
+ feature = feature.slice(4);
1828
+ }
1829
+ valueToken.wsBefore;
1830
+ valueToken.wsAfter;
1831
+ var value = __rest(valueToken, ["wsBefore", "wsAfter"]);
1832
+ return {
1833
+ context: "value",
1834
+ prefix,
1835
+ feature,
1836
+ value
1837
+ };
1838
+ }
1839
+ } else if (tokens.length >= 5) {
1840
+ try {
1841
+ var range = tokenizeRange(tokens);
1842
+ return {
1843
+ context: "range",
1844
+ feature: range.featureName,
1845
+ range
1846
+ };
1847
+ } catch (err) {
1848
+ throw createError("Invalid media feature", err);
1849
+ }
1850
+ }
1851
+ throw new Error("Invalid media feature");
1852
+ };
1853
+ var tokenizeRange = function tokenizeRange2(tokens) {
1854
+ var _a, _b, _c, _d;
1855
+ if (tokens.length < 5 || tokens[0].type !== "<(-token>" || tokens[tokens.length - 1].type !== "<)-token>") {
1856
+ throw new Error("Invalid range");
1857
+ }
1858
+ var range = {
1859
+ leftToken: null,
1860
+ leftOp: null,
1861
+ featureName: "",
1862
+ rightOp: null,
1863
+ rightToken: null
1864
+ };
1865
+ var hasLeft = tokens[1].type === "<number-token>" || tokens[1].type === "<dimension-token>" || tokens[1].type === "<ratio-token>" || tokens[1].type === "<ident-token>" && tokens[1].value === "infinite";
1866
+ if (tokens[2].type === "<delim-token>") {
1867
+ if (tokens[2].value === 60) {
1868
+ if (tokens[3].type === "<delim-token>" && tokens[3].value === 61 && !tokens[3].wsBefore) {
1869
+ range[hasLeft ? "leftOp" : "rightOp"] = "<=";
1870
+ } else {
1871
+ range[hasLeft ? "leftOp" : "rightOp"] = "<";
1872
+ }
1873
+ } else if (tokens[2].value === 62) {
1874
+ if (tokens[3].type === "<delim-token>" && tokens[3].value === 61 && !tokens[3].wsBefore) {
1875
+ range[hasLeft ? "leftOp" : "rightOp"] = ">=";
1876
+ } else {
1877
+ range[hasLeft ? "leftOp" : "rightOp"] = ">";
1878
+ }
1879
+ } else if (tokens[2].value === 61) {
1880
+ range[hasLeft ? "leftOp" : "rightOp"] = "=";
1881
+ } else {
1882
+ throw new Error("Invalid range");
1883
+ }
1884
+ if (hasLeft) {
1885
+ range.leftToken = tokens[1];
1886
+ } else if (tokens[1].type === "<ident-token>") {
1887
+ range.featureName = tokens[1].value;
1888
+ } else {
1889
+ throw new Error("Invalid range");
1890
+ }
1891
+ var tokenIndexAfterFirstOp = 2 + ((_b = (_a = range[hasLeft ? "leftOp" : "rightOp"]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0);
1892
+ var tokenAfterFirstOp = tokens[tokenIndexAfterFirstOp];
1893
+ if (hasLeft) {
1894
+ if (tokenAfterFirstOp.type === "<ident-token>") {
1895
+ range.featureName = tokenAfterFirstOp.value;
1896
+ if (tokens.length >= 7) {
1897
+ var secondOpToken = tokens[tokenIndexAfterFirstOp + 1];
1898
+ var followingToken = tokens[tokenIndexAfterFirstOp + 2];
1899
+ if (secondOpToken.type === "<delim-token>") {
1900
+ var charCode = secondOpToken.value;
1901
+ if (charCode === 60) {
1902
+ if (followingToken.type === "<delim-token>" && followingToken.value === 61 && !followingToken.wsBefore) {
1903
+ range.rightOp = "<=";
1904
+ } else {
1905
+ range.rightOp = "<";
1906
+ }
1907
+ } else if (charCode === 62) {
1908
+ if (followingToken.type === "<delim-token>" && followingToken.value === 61 && !followingToken.wsBefore) {
1909
+ range.rightOp = ">=";
1910
+ } else {
1911
+ range.rightOp = ">";
1912
+ }
1913
+ } else {
1914
+ throw new Error("Invalid range");
1915
+ }
1916
+ var tokenAfterSecondOp = tokens[tokenIndexAfterFirstOp + 1 + ((_d = (_c = range.rightOp) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0)];
1917
+ range.rightToken = tokenAfterSecondOp;
1918
+ } else {
1919
+ throw new Error("Invalid range");
1920
+ }
1921
+ } else if (tokenIndexAfterFirstOp + 2 !== tokens.length) {
1922
+ throw new Error("Invalid range");
1923
+ }
1924
+ } else {
1925
+ throw new Error("Invalid range");
1926
+ }
1927
+ } else {
1928
+ range.rightToken = tokenAfterFirstOp;
1929
+ }
1930
+ var validRange = null;
1931
+ var lt = range.leftToken, leftOp = range.leftOp, featureName = range.featureName, rightOp = range.rightOp, rt = range.rightToken;
1932
+ var leftToken = null;
1933
+ if (lt !== null) {
1934
+ if (lt.type === "<ident-token>") {
1935
+ var type = lt.type, value = lt.value;
1936
+ if (value === "infinite") {
1937
+ leftToken = {
1938
+ type,
1939
+ value
1940
+ };
1941
+ }
1942
+ } else if (lt.type === "<number-token>" || lt.type === "<dimension-token>" || lt.type === "<ratio-token>") {
1943
+ lt.wsBefore;
1944
+ lt.wsAfter;
1945
+ var ltNoWS = __rest(lt, ["wsBefore", "wsAfter"]);
1946
+ leftToken = ltNoWS;
1947
+ }
1948
+ }
1949
+ var rightToken = null;
1950
+ if (rt !== null) {
1951
+ if (rt.type === "<ident-token>") {
1952
+ var type = rt.type, value = rt.value;
1953
+ if (value === "infinite") {
1954
+ rightToken = {
1955
+ type,
1956
+ value
1957
+ };
1958
+ }
1959
+ } else if (rt.type === "<number-token>" || rt.type === "<dimension-token>" || rt.type === "<ratio-token>") {
1960
+ rt.wsBefore;
1961
+ rt.wsAfter;
1962
+ var rtNoWS = __rest(rt, ["wsBefore", "wsAfter"]);
1963
+ rightToken = rtNoWS;
1964
+ }
1965
+ }
1966
+ if (leftToken !== null && rightToken !== null) {
1967
+ if ((leftOp === "<" || leftOp === "<=") && (rightOp === "<" || rightOp === "<=")) {
1968
+ validRange = {
1969
+ leftToken,
1970
+ leftOp,
1971
+ featureName,
1972
+ rightOp,
1973
+ rightToken
1974
+ };
1975
+ } else if ((leftOp === ">" || leftOp === ">=") && (rightOp === ">" || rightOp === ">=")) {
1976
+ validRange = {
1977
+ leftToken,
1978
+ leftOp,
1979
+ featureName,
1980
+ rightOp,
1981
+ rightToken
1982
+ };
1983
+ } else {
1984
+ throw new Error("Invalid range");
1985
+ }
1986
+ } else if (leftToken === null && leftOp === null && rightOp !== null && rightToken !== null) {
1987
+ validRange = {
1988
+ leftToken,
1989
+ leftOp,
1990
+ featureName,
1991
+ rightOp,
1992
+ rightToken
1993
+ };
1994
+ } else if (leftToken !== null && leftOp !== null && rightOp === null && rightToken === null) {
1995
+ validRange = {
1996
+ leftToken,
1997
+ leftOp,
1998
+ featureName,
1999
+ rightOp,
2000
+ rightToken
2001
+ };
2002
+ }
2003
+ return validRange;
2004
+ } else {
2005
+ throw new Error("Invalid range");
2006
+ }
2007
+ };
2008
+
2009
+ // node_modules/.pnpm/@vanilla-extract+css@1.16.0/node_modules/@vanilla-extract/css/dist/transformCss-69f2fb6d.esm.js
2010
+ function toPrimitive(t, r) {
2011
+ if ("object" != typeof t || !t) return t;
2012
+ var e = t[Symbol.toPrimitive];
2013
+ if (void 0 !== e) {
2014
+ var i = e.call(t, r || "default");
2015
+ if ("object" != typeof i) return i;
2016
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2017
+ }
2018
+ return ("string" === r ? String : Number)(t);
2019
+ }
2020
+ function toPropertyKey(t) {
2021
+ var i = toPrimitive(t, "string");
2022
+ return "symbol" == typeof i ? i : String(i);
2023
+ }
2024
+ function _defineProperty2(obj, key, value) {
2025
+ key = toPropertyKey(key);
2026
+ if (key in obj) {
2027
+ Object.defineProperty(obj, key, {
2028
+ value,
2029
+ enumerable: true,
2030
+ configurable: true,
2031
+ writable: true
2032
+ });
2033
+ } else {
2034
+ obj[key] = value;
2035
+ }
2036
+ return obj;
2037
+ }
2038
+ function ownKeys2(e, r) {
2039
+ var t = Object.keys(e);
2040
+ if (Object.getOwnPropertySymbols) {
2041
+ var o = Object.getOwnPropertySymbols(e);
2042
+ r && (o = o.filter(function(r2) {
2043
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
2044
+ })), t.push.apply(t, o);
2045
+ }
2046
+ return t;
2047
+ }
2048
+ function _objectSpread2(e) {
2049
+ for (var r = 1; r < arguments.length; r++) {
2050
+ var t = null != arguments[r] ? arguments[r] : {};
2051
+ r % 2 ? ownKeys2(Object(t), true).forEach(function(r2) {
2052
+ _defineProperty2(e, r2, t[r2]);
2053
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r2) {
2054
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
2055
+ });
2056
+ }
2057
+ return e;
2058
+ }
2059
+ function _objectWithoutPropertiesLoose(source, excluded) {
2060
+ if (source == null) return {};
2061
+ var target = {};
2062
+ var sourceKeys = Object.keys(source);
2063
+ var key, i;
2064
+ for (i = 0; i < sourceKeys.length; i++) {
2065
+ key = sourceKeys[i];
2066
+ if (excluded.indexOf(key) >= 0) continue;
2067
+ target[key] = source[key];
2068
+ }
2069
+ return target;
2070
+ }
2071
+ function _objectWithoutProperties(source, excluded) {
2072
+ if (source == null) return {};
2073
+ var target = _objectWithoutPropertiesLoose(source, excluded);
2074
+ var key, i;
2075
+ if (Object.getOwnPropertySymbols) {
2076
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2077
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
2078
+ key = sourceSymbolKeys[i];
2079
+ if (excluded.indexOf(key) >= 0) continue;
2080
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2081
+ target[key] = source[key];
2082
+ }
2083
+ }
2084
+ return target;
2085
+ }
2086
+ function forEach(obj, fn) {
2087
+ for (var _key in obj) {
2088
+ fn(obj[_key], _key);
2089
+ }
2090
+ }
2091
+ function omit(obj, omitKeys) {
2092
+ var result = {};
2093
+ for (var _key2 in obj) {
2094
+ if (omitKeys.indexOf(_key2) === -1) {
2095
+ result[_key2] = obj[_key2];
2096
+ }
2097
+ }
2098
+ return result;
2099
+ }
2100
+ function mapKeys(obj, fn) {
2101
+ var result = {};
2102
+ for (var _key3 in obj) {
2103
+ result[fn(obj[_key3], _key3)] = obj[_key3];
2104
+ }
2105
+ return result;
2106
+ }
2107
+ function composeStylesIntoSet(set) {
2108
+ for (var _len = arguments.length, classNames = new Array(_len > 1 ? _len - 1 : 0), _key5 = 1; _key5 < _len; _key5++) {
2109
+ classNames[_key5 - 1] = arguments[_key5];
2110
+ }
2111
+ for (var className of classNames) {
2112
+ if (className.length === 0) {
2113
+ continue;
2114
+ }
2115
+ if (typeof className === "string") {
2116
+ if (className.includes(" ")) {
2117
+ composeStylesIntoSet(set, ...className.trim().split(" "));
2118
+ } else {
2119
+ set.add(className);
2120
+ }
2121
+ } else if (Array.isArray(className)) {
2122
+ composeStylesIntoSet(set, ...className);
2123
+ }
2124
+ }
2125
+ }
2126
+ function dudupeAndJoinClassList(classNames) {
2127
+ var set = /* @__PURE__ */ new Set();
2128
+ composeStylesIntoSet(set, ...classNames);
2129
+ return Array.from(set).join(" ");
2130
+ }
2131
+ var _templateObject$1;
2132
+ function escapeRegex(string) {
2133
+ return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
2134
+ }
2135
+ var validateSelector = (selector, targetClassName) => {
2136
+ var replaceTarget = () => {
2137
+ var targetRegex = new RegExp(".".concat(escapeRegex((0, import_cssesc.default)(targetClassName, {
2138
+ isIdentifier: true
2139
+ }))), "g");
2140
+ return selector.replace(targetRegex, "&");
2141
+ };
2142
+ var selectorParts;
2143
+ try {
2144
+ selectorParts = parse(selector);
2145
+ } catch (err) {
2146
+ throw new Error("Invalid selector: ".concat(replaceTarget()));
2147
+ }
2148
+ selectorParts.forEach((tokens) => {
2149
+ try {
2150
+ for (var i = tokens.length - 1; i >= -1; i--) {
2151
+ if (!tokens[i]) {
2152
+ throw new Error();
2153
+ }
2154
+ var token = tokens[i];
2155
+ if (token.type === "child" || token.type === "parent" || token.type === "sibling" || token.type === "adjacent" || token.type === "descendant") {
2156
+ throw new Error();
2157
+ }
2158
+ if (token.type === "attribute" && token.name === "class" && token.value === targetClassName) {
2159
+ return;
2160
+ }
2161
+ }
2162
+ } catch (err) {
2163
+ throw new Error(dedent_default(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n Invalid selector: ", "\n \n Style selectors must target the '&' character (along with any modifiers), e.g. ", " or ", ".\n \n This is to ensure that each style block only affects the styling of a single class.\n \n If your selector is targeting another class, you should move it to the style definition for that class, e.g. given we have styles for 'parent' and 'child' elements, instead of adding a selector of ", ") to 'parent', you should add ", " to 'child').\n \n If your selector is targeting something global, use the 'globalStyle' function instead, e.g. if you wanted to write ", ", you should instead write 'globalStyle(", ", { ... })'\n "])), replaceTarget(), "`${parent} &`", "`${parent} &:hover`", "`& ${child}`", "`${parent} &`", "`& h1`", "`${parent} h1`"));
2164
+ }
2165
+ });
2166
+ };
2167
+ var ConditionalRuleset = class _ConditionalRuleset {
2168
+ /**
2169
+ * Stores information about where conditions must be in relation to other conditions
2170
+ *
2171
+ * e.g. mobile -> tablet, desktop
2172
+ */
2173
+ constructor() {
2174
+ this.ruleset = /* @__PURE__ */ new Map();
2175
+ this.precedenceLookup = /* @__PURE__ */ new Map();
2176
+ }
2177
+ findOrCreateCondition(conditionQuery) {
2178
+ var targetCondition = this.ruleset.get(conditionQuery);
2179
+ if (!targetCondition) {
2180
+ targetCondition = {
2181
+ query: conditionQuery,
2182
+ rules: [],
2183
+ children: new _ConditionalRuleset()
2184
+ };
2185
+ this.ruleset.set(conditionQuery, targetCondition);
2186
+ }
2187
+ return targetCondition;
2188
+ }
2189
+ getConditionalRulesetByPath(conditionPath) {
2190
+ var currRuleset = this;
2191
+ for (var query of conditionPath) {
2192
+ var condition = currRuleset.findOrCreateCondition(query);
2193
+ currRuleset = condition.children;
2194
+ }
2195
+ return currRuleset;
2196
+ }
2197
+ addRule(rule, conditionQuery, conditionPath) {
2198
+ var ruleset = this.getConditionalRulesetByPath(conditionPath);
2199
+ var targetCondition = ruleset.findOrCreateCondition(conditionQuery);
2200
+ if (!targetCondition) {
2201
+ throw new Error("Failed to add conditional rule");
2202
+ }
2203
+ targetCondition.rules.push(rule);
2204
+ }
2205
+ addConditionPrecedence(conditionPath, conditionOrder) {
2206
+ var ruleset = this.getConditionalRulesetByPath(conditionPath);
2207
+ for (var i = 0; i < conditionOrder.length; i++) {
2208
+ var _ruleset$precedenceLo;
2209
+ var query = conditionOrder[i];
2210
+ var conditionPrecedence = (_ruleset$precedenceLo = ruleset.precedenceLookup.get(query)) !== null && _ruleset$precedenceLo !== void 0 ? _ruleset$precedenceLo : /* @__PURE__ */ new Set();
2211
+ for (var lowerPrecedenceCondition of conditionOrder.slice(i + 1)) {
2212
+ conditionPrecedence.add(lowerPrecedenceCondition);
2213
+ }
2214
+ ruleset.precedenceLookup.set(query, conditionPrecedence);
2215
+ }
2216
+ }
2217
+ isCompatible(incomingRuleset) {
2218
+ for (var [condition, orderPrecedence] of this.precedenceLookup.entries()) {
2219
+ for (var lowerPrecedenceCondition of orderPrecedence) {
2220
+ var _incomingRuleset$prec;
2221
+ if ((_incomingRuleset$prec = incomingRuleset.precedenceLookup.get(lowerPrecedenceCondition)) !== null && _incomingRuleset$prec !== void 0 && _incomingRuleset$prec.has(condition)) {
2222
+ return false;
2223
+ }
2224
+ }
2225
+ }
2226
+ for (var {
2227
+ query,
2228
+ children
2229
+ } of incomingRuleset.ruleset.values()) {
2230
+ var matchingCondition = this.ruleset.get(query);
2231
+ if (matchingCondition && !matchingCondition.children.isCompatible(children)) {
2232
+ return false;
2233
+ }
2234
+ }
2235
+ return true;
2236
+ }
2237
+ merge(incomingRuleset) {
2238
+ for (var {
2239
+ query,
2240
+ rules,
2241
+ children
2242
+ } of incomingRuleset.ruleset.values()) {
2243
+ var matchingCondition = this.ruleset.get(query);
2244
+ if (matchingCondition) {
2245
+ matchingCondition.rules.push(...rules);
2246
+ matchingCondition.children.merge(children);
2247
+ } else {
2248
+ this.ruleset.set(query, {
2249
+ query,
2250
+ rules,
2251
+ children
2252
+ });
2253
+ }
2254
+ }
2255
+ for (var [condition, incomingOrderPrecedence] of incomingRuleset.precedenceLookup.entries()) {
2256
+ var _this$precedenceLooku;
2257
+ var orderPrecedence = (_this$precedenceLooku = this.precedenceLookup.get(condition)) !== null && _this$precedenceLooku !== void 0 ? _this$precedenceLooku : /* @__PURE__ */ new Set();
2258
+ this.precedenceLookup.set(condition, /* @__PURE__ */ new Set([...orderPrecedence, ...incomingOrderPrecedence]));
2259
+ }
2260
+ }
2261
+ /**
2262
+ * Merge another ConditionalRuleset into this one if they are compatible
2263
+ *
2264
+ * @returns true if successful, false if the ruleset is incompatible
2265
+ */
2266
+ mergeIfCompatible(incomingRuleset) {
2267
+ if (!this.isCompatible(incomingRuleset)) {
2268
+ return false;
2269
+ }
2270
+ this.merge(incomingRuleset);
2271
+ return true;
2272
+ }
2273
+ getSortedRuleset() {
2274
+ var _this = this;
2275
+ var sortedRuleset = [];
2276
+ var _loop = function _loop2(dependents2) {
2277
+ var conditionForQuery = _this.ruleset.get(query);
2278
+ if (!conditionForQuery) {
2279
+ throw new Error("Can't find condition for ".concat(query));
2280
+ }
2281
+ var firstMatchingDependent = sortedRuleset.findIndex((condition) => dependents2.has(condition.query));
2282
+ if (firstMatchingDependent > -1) {
2283
+ sortedRuleset.splice(firstMatchingDependent, 0, conditionForQuery);
2284
+ } else {
2285
+ sortedRuleset.push(conditionForQuery);
2286
+ }
2287
+ };
2288
+ for (var [query, dependents] of this.precedenceLookup.entries()) {
2289
+ _loop(dependents);
2290
+ }
2291
+ return sortedRuleset;
2292
+ }
2293
+ renderToArray() {
2294
+ var arr = [];
2295
+ for (var {
2296
+ query,
2297
+ rules,
2298
+ children
2299
+ } of this.getSortedRuleset()) {
2300
+ var selectors = {};
2301
+ for (var rule of rules) {
2302
+ selectors[rule.selector] = _objectSpread2(_objectSpread2({}, selectors[rule.selector]), rule.rule);
2303
+ }
2304
+ Object.assign(selectors, ...children.renderToArray());
2305
+ arr.push({
2306
+ [query]: selectors
2307
+ });
2308
+ }
2309
+ return arr;
2310
+ }
2311
+ };
2312
+ var simplePseudoMap = {
2313
+ ":-moz-any-link": true,
2314
+ ":-moz-full-screen": true,
2315
+ ":-moz-placeholder": true,
2316
+ ":-moz-read-only": true,
2317
+ ":-moz-read-write": true,
2318
+ ":-ms-fullscreen": true,
2319
+ ":-ms-input-placeholder": true,
2320
+ ":-webkit-any-link": true,
2321
+ ":-webkit-full-screen": true,
2322
+ "::-moz-color-swatch": true,
2323
+ "::-moz-list-bullet": true,
2324
+ "::-moz-list-number": true,
2325
+ "::-moz-page-sequence": true,
2326
+ "::-moz-page": true,
2327
+ "::-moz-placeholder": true,
2328
+ "::-moz-progress-bar": true,
2329
+ "::-moz-range-progress": true,
2330
+ "::-moz-range-thumb": true,
2331
+ "::-moz-range-track": true,
2332
+ "::-moz-scrolled-page-sequence": true,
2333
+ "::-moz-selection": true,
2334
+ "::-ms-backdrop": true,
2335
+ "::-ms-browse": true,
2336
+ "::-ms-check": true,
2337
+ "::-ms-clear": true,
2338
+ "::-ms-fill-lower": true,
2339
+ "::-ms-fill-upper": true,
2340
+ "::-ms-fill": true,
2341
+ "::-ms-reveal": true,
2342
+ "::-ms-thumb": true,
2343
+ "::-ms-ticks-after": true,
2344
+ "::-ms-ticks-before": true,
2345
+ "::-ms-tooltip": true,
2346
+ "::-ms-track": true,
2347
+ "::-ms-value": true,
2348
+ "::-webkit-backdrop": true,
2349
+ "::-webkit-calendar-picker-indicator": true,
2350
+ "::-webkit-inner-spin-button": true,
2351
+ "::-webkit-input-placeholder": true,
2352
+ "::-webkit-meter-bar": true,
2353
+ "::-webkit-meter-even-less-good-value": true,
2354
+ "::-webkit-meter-inner-element": true,
2355
+ "::-webkit-meter-optimum-value": true,
2356
+ "::-webkit-meter-suboptimum-value": true,
2357
+ "::-webkit-outer-spin-button": true,
2358
+ "::-webkit-progress-bar": true,
2359
+ "::-webkit-progress-inner-element": true,
2360
+ "::-webkit-progress-inner-value": true,
2361
+ "::-webkit-progress-value": true,
2362
+ "::-webkit-resizer": true,
2363
+ "::-webkit-scrollbar-button": true,
2364
+ "::-webkit-scrollbar-corner": true,
2365
+ "::-webkit-scrollbar-thumb": true,
2366
+ "::-webkit-scrollbar-track-piece": true,
2367
+ "::-webkit-scrollbar-track": true,
2368
+ "::-webkit-scrollbar": true,
2369
+ "::-webkit-search-cancel-button": true,
2370
+ "::-webkit-search-results-button": true,
2371
+ "::-webkit-slider-runnable-track": true,
2372
+ "::-webkit-slider-thumb": true,
2373
+ "::after": true,
2374
+ "::backdrop": true,
2375
+ "::before": true,
2376
+ "::cue": true,
2377
+ "::file-selector-button": true,
2378
+ "::first-letter": true,
2379
+ "::first-line": true,
2380
+ "::grammar-error": true,
2381
+ "::marker": true,
2382
+ "::placeholder": true,
2383
+ "::selection": true,
2384
+ "::spelling-error": true,
2385
+ "::target-text": true,
2386
+ "::view-transition-group": true,
2387
+ "::view-transition-image-pair": true,
2388
+ "::view-transition-new": true,
2389
+ "::view-transition-old": true,
2390
+ "::view-transition": true,
2391
+ ":active": true,
2392
+ ":after": true,
2393
+ ":any-link": true,
2394
+ ":before": true,
2395
+ ":blank": true,
2396
+ ":checked": true,
2397
+ ":default": true,
2398
+ ":defined": true,
2399
+ ":disabled": true,
2400
+ ":empty": true,
2401
+ ":enabled": true,
2402
+ ":first-child": true,
2403
+ ":first-letter": true,
2404
+ ":first-line": true,
2405
+ ":first-of-type": true,
2406
+ ":first": true,
2407
+ ":focus-visible": true,
2408
+ ":focus-within": true,
2409
+ ":focus": true,
2410
+ ":fullscreen": true,
2411
+ ":hover": true,
2412
+ ":in-range": true,
2413
+ ":indeterminate": true,
2414
+ ":invalid": true,
2415
+ ":last-child": true,
2416
+ ":last-of-type": true,
2417
+ ":left": true,
2418
+ ":link": true,
2419
+ ":only-child": true,
2420
+ ":only-of-type": true,
2421
+ ":optional": true,
2422
+ ":out-of-range": true,
2423
+ ":placeholder-shown": true,
2424
+ ":read-only": true,
2425
+ ":read-write": true,
2426
+ ":required": true,
2427
+ ":right": true,
2428
+ ":root": true,
2429
+ ":scope": true,
2430
+ ":target": true,
2431
+ ":valid": true,
2432
+ ":visited": true
2433
+ };
2434
+ var simplePseudos = Object.keys(simplePseudoMap);
2435
+ var simplePseudoLookup = simplePseudoMap;
2436
+ var _templateObject;
2437
+ var createMediaQueryError = (mediaQuery, msg) => new Error(dedent_default(_templateObject || (_templateObject = _taggedTemplateLiteral(['\n Invalid media query: "', '"\n\n ', "\n\n Read more on MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries\n "])), mediaQuery, msg));
2438
+ var validateMediaQuery = (mediaQuery) => {
2439
+ if (mediaQuery === "@media ") {
2440
+ throw createMediaQueryError(mediaQuery, "Query is empty");
2441
+ }
2442
+ try {
2443
+ toAST(mediaQuery);
2444
+ } catch (e) {
2445
+ throw createMediaQueryError(mediaQuery, e.message);
2446
+ }
2447
+ };
2448
+ var _excluded = ["vars"];
2449
+ var _excluded2 = ["content"];
2450
+ var DECLARATION = "__DECLARATION";
2451
+ var UNITLESS = {
2452
+ animationIterationCount: true,
2453
+ borderImage: true,
2454
+ borderImageOutset: true,
2455
+ borderImageSlice: true,
2456
+ borderImageWidth: true,
2457
+ boxFlex: true,
2458
+ boxFlexGroup: true,
2459
+ columnCount: true,
2460
+ columns: true,
2461
+ flex: true,
2462
+ flexGrow: true,
2463
+ flexShrink: true,
2464
+ fontWeight: true,
2465
+ gridArea: true,
2466
+ gridColumn: true,
2467
+ gridColumnEnd: true,
2468
+ gridColumnStart: true,
2469
+ gridRow: true,
2470
+ gridRowEnd: true,
2471
+ gridRowStart: true,
2472
+ initialLetter: true,
2473
+ lineClamp: true,
2474
+ lineHeight: true,
2475
+ maxLines: true,
2476
+ opacity: true,
2477
+ order: true,
2478
+ orphans: true,
2479
+ scale: true,
2480
+ tabSize: true,
2481
+ WebkitLineClamp: true,
2482
+ widows: true,
2483
+ zIndex: true,
2484
+ zoom: true,
2485
+ // svg properties
2486
+ fillOpacity: true,
2487
+ floodOpacity: true,
2488
+ maskBorder: true,
2489
+ maskBorderOutset: true,
2490
+ maskBorderSlice: true,
2491
+ maskBorderWidth: true,
2492
+ shapeImageThreshold: true,
2493
+ stopOpacity: true,
2494
+ strokeDashoffset: true,
2495
+ strokeMiterlimit: true,
2496
+ strokeOpacity: true,
2497
+ strokeWidth: true
2498
+ };
2499
+ function dashify(str) {
2500
+ return str.replace(/([A-Z])/g, "-$1").replace(/^ms-/, "-ms-").toLowerCase();
2501
+ }
2502
+ function replaceBetweenIndexes(target, startIndex, endIndex, replacement) {
2503
+ var start = target.slice(0, startIndex);
2504
+ var end = target.slice(endIndex);
2505
+ return "".concat(start).concat(replacement).concat(end);
2506
+ }
2507
+ var DOUBLE_SPACE = " ";
2508
+ var specialKeys = [...simplePseudos, "@layer", "@media", "@supports", "@container", "selectors"];
2509
+ var Stylesheet = class {
2510
+ constructor(localClassNames2, composedClassLists2) {
2511
+ this.rules = [];
2512
+ this.conditionalRulesets = [new ConditionalRuleset()];
2513
+ this.fontFaceRules = [];
2514
+ this.keyframesRules = [];
2515
+ this.localClassNamesMap = new Map(localClassNames2.map((localClassName) => [localClassName, localClassName]));
2516
+ this.localClassNamesSearch = new AhoCorasick(localClassNames2);
2517
+ this.layers = /* @__PURE__ */ new Map();
2518
+ this.composedClassLists = composedClassLists2.map((_ref) => {
2519
+ var {
2520
+ identifier,
2521
+ classList
2522
+ } = _ref;
2523
+ return {
2524
+ identifier,
2525
+ regex: RegExp("(".concat(classList, ")"), "g")
2526
+ };
2527
+ }).reverse();
2528
+ }
2529
+ processCssObj(root) {
2530
+ if (root.type === "fontFace") {
2531
+ this.fontFaceRules.push(root.rule);
2532
+ return;
2533
+ }
2534
+ if (root.type === "keyframes") {
2535
+ root.rule = Object.fromEntries(Object.entries(root.rule).map((_ref2) => {
2536
+ var [keyframe, rule] = _ref2;
2537
+ return [keyframe, this.transformProperties(rule)];
2538
+ }));
2539
+ this.keyframesRules.push(root);
2540
+ return;
2541
+ }
2542
+ this.currConditionalRuleset = new ConditionalRuleset();
2543
+ if (root.type === "layer") {
2544
+ var layerDefinition = "@layer ".concat(root.name);
2545
+ this.addLayer([layerDefinition]);
2546
+ } else {
2547
+ var mainRule = omit(root.rule, specialKeys);
2548
+ this.addRule({
2549
+ selector: root.selector,
2550
+ rule: mainRule
2551
+ });
2552
+ this.transformLayer(root, root.rule["@layer"]);
2553
+ this.transformMedia(root, root.rule["@media"]);
2554
+ this.transformSupports(root, root.rule["@supports"]);
2555
+ this.transformContainer(root, root.rule["@container"]);
2556
+ this.transformSimplePseudos(root, root.rule);
2557
+ this.transformSelectors(root, root.rule);
2558
+ }
2559
+ var activeConditionalRuleset = this.conditionalRulesets[this.conditionalRulesets.length - 1];
2560
+ if (!activeConditionalRuleset.mergeIfCompatible(this.currConditionalRuleset)) {
2561
+ this.conditionalRulesets.push(this.currConditionalRuleset);
2562
+ }
2563
+ }
2564
+ addConditionalRule(cssRule, conditions) {
2565
+ var rule = this.transformVars(this.transformProperties(cssRule.rule));
2566
+ var selector = this.transformSelector(cssRule.selector);
2567
+ if (!this.currConditionalRuleset) {
2568
+ throw new Error("Couldn't add conditional rule");
2569
+ }
2570
+ var conditionQuery = conditions[conditions.length - 1];
2571
+ var parentConditions = conditions.slice(0, conditions.length - 1);
2572
+ this.currConditionalRuleset.addRule({
2573
+ selector,
2574
+ rule
2575
+ }, conditionQuery, parentConditions);
2576
+ }
2577
+ addRule(cssRule) {
2578
+ var rule = this.transformVars(this.transformProperties(cssRule.rule));
2579
+ var selector = this.transformSelector(cssRule.selector);
2580
+ this.rules.push({
2581
+ selector,
2582
+ rule
2583
+ });
2584
+ }
2585
+ addLayer(layer) {
2586
+ var uniqueLayerKey = layer.join(" - ");
2587
+ this.layers.set(uniqueLayerKey, layer);
2588
+ }
2589
+ transformProperties(cssRule) {
2590
+ return this.transformContent(this.pixelifyProperties(cssRule));
2591
+ }
2592
+ pixelifyProperties(cssRule) {
2593
+ forEach(cssRule, (value, key) => {
2594
+ if (typeof value === "number" && value !== 0 && !UNITLESS[key]) {
2595
+ cssRule[key] = "".concat(value, "px");
2596
+ }
2597
+ });
2598
+ return cssRule;
2599
+ }
2600
+ transformVars(_ref3) {
2601
+ var {
2602
+ vars: vars2
2603
+ } = _ref3, rest = _objectWithoutProperties(_ref3, _excluded);
2604
+ if (!vars2) {
2605
+ return rest;
2606
+ }
2607
+ return _objectSpread2(_objectSpread2({}, mapKeys(vars2, (_value, key) => getVarName(key))), rest);
2608
+ }
2609
+ transformContent(_ref4) {
2610
+ var {
2611
+ content
2612
+ } = _ref4, rest = _objectWithoutProperties(_ref4, _excluded2);
2613
+ if (typeof content === "undefined") {
2614
+ return rest;
2615
+ }
2616
+ var contentArray = Array.isArray(content) ? content : [content];
2617
+ return _objectSpread2({
2618
+ content: contentArray.map((value) => (
2619
+ // This logic was adapted from Stitches :)
2620
+ value && (value.includes('"') || value.includes("'") || /^([A-Za-z\-]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)(\s|$)/.test(value)) ? value : '"'.concat(value, '"')
2621
+ ))
2622
+ }, rest);
2623
+ }
2624
+ transformClassname(identifier) {
2625
+ return ".".concat((0, import_cssesc.default)(identifier, {
2626
+ isIdentifier: true
2627
+ }));
2628
+ }
2629
+ transformSelector(selector) {
2630
+ var transformedSelector = selector;
2631
+ var _loop = function _loop2(identifier2) {
2632
+ transformedSelector = transformedSelector.replace(regex, () => {
2633
+ markCompositionUsed(identifier2);
2634
+ return identifier2;
2635
+ });
2636
+ };
2637
+ for (var {
2638
+ identifier,
2639
+ regex
2640
+ } of this.composedClassLists) {
2641
+ _loop(identifier);
2642
+ }
2643
+ if (this.localClassNamesMap.has(transformedSelector)) {
2644
+ return this.transformClassname(transformedSelector);
2645
+ }
2646
+ var results = this.localClassNamesSearch.search(transformedSelector);
2647
+ var lastReplaceIndex = transformedSelector.length;
2648
+ for (var i = results.length - 1; i >= 0; i--) {
2649
+ var [endIndex, [firstMatch]] = results[i];
2650
+ var startIndex = endIndex - firstMatch.length + 1;
2651
+ if (startIndex >= lastReplaceIndex) {
2652
+ continue;
2653
+ }
2654
+ lastReplaceIndex = startIndex;
2655
+ if (transformedSelector[startIndex - 1] !== ".") {
2656
+ transformedSelector = replaceBetweenIndexes(transformedSelector, startIndex, endIndex + 1, this.transformClassname(firstMatch));
2657
+ }
2658
+ }
2659
+ return transformedSelector;
2660
+ }
2661
+ transformSelectors(root, rule, conditions) {
2662
+ forEach(rule.selectors, (selectorRule, selector) => {
2663
+ if (root.type !== "local") {
2664
+ throw new Error("Selectors are not allowed within ".concat(root.type === "global" ? '"globalStyle"' : '"selectors"'));
2665
+ }
2666
+ var transformedSelector = this.transformSelector(selector.replace(RegExp("&", "g"), root.selector));
2667
+ validateSelector(transformedSelector, root.selector);
2668
+ var rule2 = {
2669
+ selector: transformedSelector,
2670
+ rule: omit(selectorRule, specialKeys)
2671
+ };
2672
+ if (conditions) {
2673
+ this.addConditionalRule(rule2, conditions);
2674
+ } else {
2675
+ this.addRule(rule2);
2676
+ }
2677
+ var selectorRoot = {
2678
+ type: "selector",
2679
+ selector: transformedSelector,
2680
+ rule: selectorRule
2681
+ };
2682
+ this.transformLayer(selectorRoot, selectorRule["@layer"], conditions);
2683
+ this.transformSupports(selectorRoot, selectorRule["@supports"], conditions);
2684
+ this.transformMedia(selectorRoot, selectorRule["@media"], conditions);
2685
+ });
2686
+ }
2687
+ transformMedia(root, rules) {
2688
+ var parentConditions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
2689
+ if (rules) {
2690
+ var _this$currConditional;
2691
+ (_this$currConditional = this.currConditionalRuleset) === null || _this$currConditional === void 0 || _this$currConditional.addConditionPrecedence(parentConditions, Object.keys(rules).map((query2) => "@media ".concat(query2)));
2692
+ for (var [query, mediaRule] of Object.entries(rules)) {
2693
+ var mediaQuery = "@media ".concat(query);
2694
+ validateMediaQuery(mediaQuery);
2695
+ var conditions = [...parentConditions, mediaQuery];
2696
+ this.addConditionalRule({
2697
+ selector: root.selector,
2698
+ rule: omit(mediaRule, specialKeys)
2699
+ }, conditions);
2700
+ if (root.type === "local") {
2701
+ this.transformSimplePseudos(root, mediaRule, conditions);
2702
+ this.transformSelectors(root, mediaRule, conditions);
2703
+ }
2704
+ this.transformLayer(root, mediaRule["@layer"], conditions);
2705
+ this.transformSupports(root, mediaRule["@supports"], conditions);
2706
+ this.transformContainer(root, mediaRule["@container"], conditions);
2707
+ }
2708
+ }
2709
+ }
2710
+ transformContainer(root, rules) {
2711
+ var parentConditions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
2712
+ if (rules) {
2713
+ var _this$currConditional2;
2714
+ (_this$currConditional2 = this.currConditionalRuleset) === null || _this$currConditional2 === void 0 || _this$currConditional2.addConditionPrecedence(parentConditions, Object.keys(rules).map((query) => "@container ".concat(query)));
2715
+ forEach(rules, (containerRule, query) => {
2716
+ var containerQuery = "@container ".concat(query);
2717
+ var conditions = [...parentConditions, containerQuery];
2718
+ this.addConditionalRule({
2719
+ selector: root.selector,
2720
+ rule: omit(containerRule, specialKeys)
2721
+ }, conditions);
2722
+ if (root.type === "local") {
2723
+ this.transformSimplePseudos(root, containerRule, conditions);
2724
+ this.transformSelectors(root, containerRule, conditions);
2725
+ }
2726
+ this.transformLayer(root, containerRule["@layer"], conditions);
2727
+ this.transformSupports(root, containerRule["@supports"], conditions);
2728
+ this.transformMedia(root, containerRule["@media"], conditions);
2729
+ });
2730
+ }
2731
+ }
2732
+ transformLayer(root, rules) {
2733
+ var parentConditions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
2734
+ if (rules) {
2735
+ var _this$currConditional3;
2736
+ (_this$currConditional3 = this.currConditionalRuleset) === null || _this$currConditional3 === void 0 || _this$currConditional3.addConditionPrecedence(parentConditions, Object.keys(rules).map((name) => "@layer ".concat(name)));
2737
+ forEach(rules, (layerRule, name) => {
2738
+ var conditions = [...parentConditions, "@layer ".concat(name)];
2739
+ this.addLayer(conditions);
2740
+ this.addConditionalRule({
2741
+ selector: root.selector,
2742
+ rule: omit(layerRule, specialKeys)
2743
+ }, conditions);
2744
+ if (root.type === "local") {
2745
+ this.transformSimplePseudos(root, layerRule, conditions);
2746
+ this.transformSelectors(root, layerRule, conditions);
2747
+ }
2748
+ this.transformMedia(root, layerRule["@media"], conditions);
2749
+ this.transformSupports(root, layerRule["@supports"], conditions);
2750
+ this.transformContainer(root, layerRule["@container"], conditions);
2751
+ });
2752
+ }
2753
+ }
2754
+ transformSupports(root, rules) {
2755
+ var parentConditions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
2756
+ if (rules) {
2757
+ var _this$currConditional4;
2758
+ (_this$currConditional4 = this.currConditionalRuleset) === null || _this$currConditional4 === void 0 || _this$currConditional4.addConditionPrecedence(parentConditions, Object.keys(rules).map((query) => "@supports ".concat(query)));
2759
+ forEach(rules, (supportsRule, query) => {
2760
+ var conditions = [...parentConditions, "@supports ".concat(query)];
2761
+ this.addConditionalRule({
2762
+ selector: root.selector,
2763
+ rule: omit(supportsRule, specialKeys)
2764
+ }, conditions);
2765
+ if (root.type === "local") {
2766
+ this.transformSimplePseudos(root, supportsRule, conditions);
2767
+ this.transformSelectors(root, supportsRule, conditions);
2768
+ }
2769
+ this.transformLayer(root, supportsRule["@layer"], conditions);
2770
+ this.transformMedia(root, supportsRule["@media"], conditions);
2771
+ this.transformContainer(root, supportsRule["@container"], conditions);
2772
+ });
2773
+ }
2774
+ }
2775
+ transformSimplePseudos(root, rule, conditions) {
2776
+ for (var key of Object.keys(rule)) {
2777
+ if (simplePseudoLookup[key]) {
2778
+ if (root.type !== "local") {
2779
+ throw new Error("Simple pseudos are not valid in ".concat(root.type === "global" ? '"globalStyle"' : '"selectors"'));
2780
+ }
2781
+ if (conditions) {
2782
+ this.addConditionalRule({
2783
+ selector: "".concat(root.selector).concat(key),
2784
+ rule: rule[key]
2785
+ }, conditions);
2786
+ } else {
2787
+ this.addRule({
2788
+ conditions,
2789
+ selector: "".concat(root.selector).concat(key),
2790
+ rule: rule[key]
2791
+ });
2792
+ }
2793
+ }
2794
+ }
2795
+ }
2796
+ toCss() {
2797
+ var css = [];
2798
+ for (var fontFaceRule of this.fontFaceRules) {
2799
+ css.push(renderCss({
2800
+ "@font-face": fontFaceRule
2801
+ }));
2802
+ }
2803
+ for (var keyframe of this.keyframesRules) {
2804
+ css.push(renderCss({
2805
+ ["@keyframes ".concat(keyframe.name)]: keyframe.rule
2806
+ }));
2807
+ }
2808
+ for (var layer of this.layers.values()) {
2809
+ var [definition, ...nesting] = layer.reverse();
2810
+ var cssObj = {
2811
+ [definition]: DECLARATION
2812
+ };
2813
+ for (var part of nesting) {
2814
+ cssObj = {
2815
+ [part]: cssObj
2816
+ };
2817
+ }
2818
+ css.push(renderCss(cssObj));
2819
+ }
2820
+ for (var rule of this.rules) {
2821
+ css.push(renderCss({
2822
+ [rule.selector]: rule.rule
2823
+ }));
2824
+ }
2825
+ for (var conditionalRuleset of this.conditionalRulesets) {
2826
+ for (var conditionalRule of conditionalRuleset.renderToArray()) {
2827
+ css.push(renderCss(conditionalRule));
2828
+ }
2829
+ }
2830
+ return css.filter(Boolean);
2831
+ }
2832
+ };
2833
+ function renderCss(v) {
2834
+ var indent = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
2835
+ var rules = [];
2836
+ var _loop2 = function _loop22(key2) {
2837
+ var value = v[key2];
2838
+ if (value && Array.isArray(value)) {
2839
+ rules.push(...value.map((v2) => renderCss({
2840
+ [key2]: v2
2841
+ }, indent)));
2842
+ } else if (value && typeof value === "object") {
2843
+ var isEmpty2 = Object.keys(value).length === 0;
2844
+ if (!isEmpty2) {
2845
+ rules.push("".concat(indent).concat(key2, " {\n").concat(renderCss(value, indent + DOUBLE_SPACE), "\n").concat(indent, "}"));
2846
+ }
2847
+ } else if (value === DECLARATION) {
2848
+ rules.push("".concat(indent).concat(key2, ";"));
2849
+ } else {
2850
+ rules.push("".concat(indent).concat(key2.startsWith("--") ? key2 : dashify(key2), ": ").concat(value, ";"));
2851
+ }
2852
+ };
2853
+ for (var key of Object.keys(v)) {
2854
+ _loop2(key);
2855
+ }
2856
+ return rules.join("\n");
2857
+ }
2858
+ function transformCss(_ref5) {
2859
+ var {
2860
+ localClassNames: localClassNames2,
2861
+ cssObjs,
2862
+ composedClassLists: composedClassLists2
2863
+ } = _ref5;
2864
+ var stylesheet = new Stylesheet(localClassNames2, composedClassLists2);
2865
+ for (var root of cssObjs) {
2866
+ stylesheet.processCssObj(root);
2867
+ }
2868
+ return stylesheet.toCss();
2869
+ }
2870
+
2871
+ // node_modules/.pnpm/@emotion+hash@0.9.2/node_modules/@emotion/hash/dist/emotion-hash.esm.js
2872
+ function murmur2(str) {
2873
+ var h = 0;
2874
+ var k, i = 0, len = str.length;
2875
+ for (; len >= 4; ++i, len -= 4) {
2876
+ k = str.charCodeAt(i) & 255 | (str.charCodeAt(++i) & 255) << 8 | (str.charCodeAt(++i) & 255) << 16 | (str.charCodeAt(++i) & 255) << 24;
2877
+ k = /* Math.imul(k, m): */
2878
+ (k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16);
2879
+ k ^= /* k >>> r: */
2880
+ k >>> 24;
2881
+ h = /* Math.imul(k, m): */
2882
+ (k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
2883
+ (h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
2884
+ }
2885
+ switch (len) {
2886
+ case 3:
2887
+ h ^= (str.charCodeAt(i + 2) & 255) << 16;
2888
+ case 2:
2889
+ h ^= (str.charCodeAt(i + 1) & 255) << 8;
2890
+ case 1:
2891
+ h ^= str.charCodeAt(i) & 255;
2892
+ h = /* Math.imul(h, m): */
2893
+ (h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
2894
+ }
2895
+ h ^= h >>> 13;
2896
+ h = /* Math.imul(h, m): */
2897
+ (h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
2898
+ return ((h ^ h >>> 15) >>> 0).toString(36);
2899
+ }
2900
+
2901
+ // node_modules/.pnpm/@vanilla-extract+css@1.16.0/node_modules/@vanilla-extract/css/fileScope/dist/vanilla-extract-css-fileScope.esm.js
2902
+ var _templateObject2;
2903
+ var refCounter = 0;
2904
+ var fileScopes = [];
2905
+ function getFileScope() {
2906
+ if (fileScopes.length === 0) {
2907
+ throw new Error(dedent_default(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n Styles were unable to be assigned to a file. This is generally caused by one of the following:\n\n - You may have created styles outside of a '.css.ts' context\n - You may have incorrect configuration. See https://vanilla-extract.style/documentation/getting-started\n "]))));
2908
+ }
2909
+ return fileScopes[0];
2910
+ }
2911
+ function getAndIncrementRefCounter() {
2912
+ return refCounter++;
2913
+ }
2914
+
2915
+ // node_modules/.pnpm/lru-cache@10.4.3/node_modules/lru-cache/dist/esm/index.js
2916
+ var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
2917
+ var warned = /* @__PURE__ */ new Set();
2918
+ var PROCESS = typeof process === "object" && !!process ? process : {};
2919
+ var emitWarning = (msg, type, code, fn) => {
2920
+ typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
2921
+ };
2922
+ var AC = globalThis.AbortController;
2923
+ var AS = globalThis.AbortSignal;
2924
+ if (typeof AC === "undefined") {
2925
+ AS = class AbortSignal {
2926
+ onabort;
2927
+ _onabort = [];
2928
+ reason;
2929
+ aborted = false;
2930
+ addEventListener(_, fn) {
2931
+ this._onabort.push(fn);
2932
+ }
2933
+ };
2934
+ AC = class AbortController {
2935
+ constructor() {
2936
+ warnACPolyfill();
2937
+ }
2938
+ signal = new AS();
2939
+ abort(reason) {
2940
+ if (this.signal.aborted)
2941
+ return;
2942
+ this.signal.reason = reason;
2943
+ this.signal.aborted = true;
2944
+ for (const fn of this.signal._onabort) {
2945
+ fn(reason);
2946
+ }
2947
+ this.signal.onabort?.(reason);
2948
+ }
2949
+ };
2950
+ let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
2951
+ const warnACPolyfill = () => {
2952
+ if (!printACPolyfillWarning)
2953
+ return;
2954
+ printACPolyfillWarning = false;
2955
+ emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", warnACPolyfill);
2956
+ };
2957
+ }
2958
+ var shouldWarn = (code) => !warned.has(code);
2959
+ var TYPE = Symbol("type");
2960
+ var isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
2961
+ var getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
2962
+ var ZeroArray = class extends Array {
2963
+ constructor(size) {
2964
+ super(size);
2965
+ this.fill(0);
2966
+ }
2967
+ };
2968
+ var Stack = class _Stack {
2969
+ heap;
2970
+ length;
2971
+ // private constructor
2972
+ static #constructing = false;
2973
+ static create(max) {
2974
+ const HeapCls = getUintArray(max);
2975
+ if (!HeapCls)
2976
+ return [];
2977
+ _Stack.#constructing = true;
2978
+ const s = new _Stack(max, HeapCls);
2979
+ _Stack.#constructing = false;
2980
+ return s;
2981
+ }
2982
+ constructor(max, HeapCls) {
2983
+ if (!_Stack.#constructing) {
2984
+ throw new TypeError("instantiate Stack using Stack.create(n)");
2985
+ }
2986
+ this.heap = new HeapCls(max);
2987
+ this.length = 0;
2988
+ }
2989
+ push(n) {
2990
+ this.heap[this.length++] = n;
2991
+ }
2992
+ pop() {
2993
+ return this.heap[--this.length];
2994
+ }
2995
+ };
2996
+ var LRUCache = class _LRUCache {
2997
+ // options that cannot be changed without disaster
2998
+ #max;
2999
+ #maxSize;
3000
+ #dispose;
3001
+ #disposeAfter;
3002
+ #fetchMethod;
3003
+ #memoMethod;
3004
+ /**
3005
+ * {@link LRUCache.OptionsBase.ttl}
3006
+ */
3007
+ ttl;
3008
+ /**
3009
+ * {@link LRUCache.OptionsBase.ttlResolution}
3010
+ */
3011
+ ttlResolution;
3012
+ /**
3013
+ * {@link LRUCache.OptionsBase.ttlAutopurge}
3014
+ */
3015
+ ttlAutopurge;
3016
+ /**
3017
+ * {@link LRUCache.OptionsBase.updateAgeOnGet}
3018
+ */
3019
+ updateAgeOnGet;
3020
+ /**
3021
+ * {@link LRUCache.OptionsBase.updateAgeOnHas}
3022
+ */
3023
+ updateAgeOnHas;
3024
+ /**
3025
+ * {@link LRUCache.OptionsBase.allowStale}
3026
+ */
3027
+ allowStale;
3028
+ /**
3029
+ * {@link LRUCache.OptionsBase.noDisposeOnSet}
3030
+ */
3031
+ noDisposeOnSet;
3032
+ /**
3033
+ * {@link LRUCache.OptionsBase.noUpdateTTL}
3034
+ */
3035
+ noUpdateTTL;
3036
+ /**
3037
+ * {@link LRUCache.OptionsBase.maxEntrySize}
3038
+ */
3039
+ maxEntrySize;
3040
+ /**
3041
+ * {@link LRUCache.OptionsBase.sizeCalculation}
3042
+ */
3043
+ sizeCalculation;
3044
+ /**
3045
+ * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
3046
+ */
3047
+ noDeleteOnFetchRejection;
3048
+ /**
3049
+ * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
3050
+ */
3051
+ noDeleteOnStaleGet;
3052
+ /**
3053
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
3054
+ */
3055
+ allowStaleOnFetchAbort;
3056
+ /**
3057
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
3058
+ */
3059
+ allowStaleOnFetchRejection;
3060
+ /**
3061
+ * {@link LRUCache.OptionsBase.ignoreFetchAbort}
3062
+ */
3063
+ ignoreFetchAbort;
3064
+ // computed properties
3065
+ #size;
3066
+ #calculatedSize;
3067
+ #keyMap;
3068
+ #keyList;
3069
+ #valList;
3070
+ #next;
3071
+ #prev;
3072
+ #head;
3073
+ #tail;
3074
+ #free;
3075
+ #disposed;
3076
+ #sizes;
3077
+ #starts;
3078
+ #ttls;
3079
+ #hasDispose;
3080
+ #hasFetchMethod;
3081
+ #hasDisposeAfter;
3082
+ /**
3083
+ * Do not call this method unless you need to inspect the
3084
+ * inner workings of the cache. If anything returned by this
3085
+ * object is modified in any way, strange breakage may occur.
3086
+ *
3087
+ * These fields are private for a reason!
3088
+ *
3089
+ * @internal
3090
+ */
3091
+ static unsafeExposeInternals(c) {
3092
+ return {
3093
+ // properties
3094
+ starts: c.#starts,
3095
+ ttls: c.#ttls,
3096
+ sizes: c.#sizes,
3097
+ keyMap: c.#keyMap,
3098
+ keyList: c.#keyList,
3099
+ valList: c.#valList,
3100
+ next: c.#next,
3101
+ prev: c.#prev,
3102
+ get head() {
3103
+ return c.#head;
3104
+ },
3105
+ get tail() {
3106
+ return c.#tail;
3107
+ },
3108
+ free: c.#free,
3109
+ // methods
3110
+ isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
3111
+ backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
3112
+ moveToTail: (index) => c.#moveToTail(index),
3113
+ indexes: (options) => c.#indexes(options),
3114
+ rindexes: (options) => c.#rindexes(options),
3115
+ isStale: (index) => c.#isStale(index)
3116
+ };
3117
+ }
3118
+ // Protected read-only members
3119
+ /**
3120
+ * {@link LRUCache.OptionsBase.max} (read-only)
3121
+ */
3122
+ get max() {
3123
+ return this.#max;
3124
+ }
3125
+ /**
3126
+ * {@link LRUCache.OptionsBase.maxSize} (read-only)
3127
+ */
3128
+ get maxSize() {
3129
+ return this.#maxSize;
3130
+ }
3131
+ /**
3132
+ * The total computed size of items in the cache (read-only)
3133
+ */
3134
+ get calculatedSize() {
3135
+ return this.#calculatedSize;
3136
+ }
3137
+ /**
3138
+ * The number of items stored in the cache (read-only)
3139
+ */
3140
+ get size() {
3141
+ return this.#size;
3142
+ }
3143
+ /**
3144
+ * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
3145
+ */
3146
+ get fetchMethod() {
3147
+ return this.#fetchMethod;
3148
+ }
3149
+ get memoMethod() {
3150
+ return this.#memoMethod;
3151
+ }
3152
+ /**
3153
+ * {@link LRUCache.OptionsBase.dispose} (read-only)
3154
+ */
3155
+ get dispose() {
3156
+ return this.#dispose;
3157
+ }
3158
+ /**
3159
+ * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
3160
+ */
3161
+ get disposeAfter() {
3162
+ return this.#disposeAfter;
3163
+ }
3164
+ constructor(options) {
3165
+ const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
3166
+ if (max !== 0 && !isPosInt(max)) {
3167
+ throw new TypeError("max option must be a nonnegative integer");
3168
+ }
3169
+ const UintArray = max ? getUintArray(max) : Array;
3170
+ if (!UintArray) {
3171
+ throw new Error("invalid max value: " + max);
3172
+ }
3173
+ this.#max = max;
3174
+ this.#maxSize = maxSize;
3175
+ this.maxEntrySize = maxEntrySize || this.#maxSize;
3176
+ this.sizeCalculation = sizeCalculation;
3177
+ if (this.sizeCalculation) {
3178
+ if (!this.#maxSize && !this.maxEntrySize) {
3179
+ throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
3180
+ }
3181
+ if (typeof this.sizeCalculation !== "function") {
3182
+ throw new TypeError("sizeCalculation set to non-function");
3183
+ }
3184
+ }
3185
+ if (memoMethod !== void 0 && typeof memoMethod !== "function") {
3186
+ throw new TypeError("memoMethod must be a function if defined");
3187
+ }
3188
+ this.#memoMethod = memoMethod;
3189
+ if (fetchMethod !== void 0 && typeof fetchMethod !== "function") {
3190
+ throw new TypeError("fetchMethod must be a function if specified");
3191
+ }
3192
+ this.#fetchMethod = fetchMethod;
3193
+ this.#hasFetchMethod = !!fetchMethod;
3194
+ this.#keyMap = /* @__PURE__ */ new Map();
3195
+ this.#keyList = new Array(max).fill(void 0);
3196
+ this.#valList = new Array(max).fill(void 0);
3197
+ this.#next = new UintArray(max);
3198
+ this.#prev = new UintArray(max);
3199
+ this.#head = 0;
3200
+ this.#tail = 0;
3201
+ this.#free = Stack.create(max);
3202
+ this.#size = 0;
3203
+ this.#calculatedSize = 0;
3204
+ if (typeof dispose === "function") {
3205
+ this.#dispose = dispose;
3206
+ }
3207
+ if (typeof disposeAfter === "function") {
3208
+ this.#disposeAfter = disposeAfter;
3209
+ this.#disposed = [];
3210
+ } else {
3211
+ this.#disposeAfter = void 0;
3212
+ this.#disposed = void 0;
3213
+ }
3214
+ this.#hasDispose = !!this.#dispose;
3215
+ this.#hasDisposeAfter = !!this.#disposeAfter;
3216
+ this.noDisposeOnSet = !!noDisposeOnSet;
3217
+ this.noUpdateTTL = !!noUpdateTTL;
3218
+ this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
3219
+ this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
3220
+ this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
3221
+ this.ignoreFetchAbort = !!ignoreFetchAbort;
3222
+ if (this.maxEntrySize !== 0) {
3223
+ if (this.#maxSize !== 0) {
3224
+ if (!isPosInt(this.#maxSize)) {
3225
+ throw new TypeError("maxSize must be a positive integer if specified");
3226
+ }
3227
+ }
3228
+ if (!isPosInt(this.maxEntrySize)) {
3229
+ throw new TypeError("maxEntrySize must be a positive integer if specified");
3230
+ }
3231
+ this.#initializeSizeTracking();
3232
+ }
3233
+ this.allowStale = !!allowStale;
3234
+ this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
3235
+ this.updateAgeOnGet = !!updateAgeOnGet;
3236
+ this.updateAgeOnHas = !!updateAgeOnHas;
3237
+ this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
3238
+ this.ttlAutopurge = !!ttlAutopurge;
3239
+ this.ttl = ttl || 0;
3240
+ if (this.ttl) {
3241
+ if (!isPosInt(this.ttl)) {
3242
+ throw new TypeError("ttl must be a positive integer if specified");
3243
+ }
3244
+ this.#initializeTTLTracking();
3245
+ }
3246
+ if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
3247
+ throw new TypeError("At least one of max, maxSize, or ttl is required");
3248
+ }
3249
+ if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
3250
+ const code = "LRU_CACHE_UNBOUNDED";
3251
+ if (shouldWarn(code)) {
3252
+ warned.add(code);
3253
+ const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
3254
+ emitWarning(msg, "UnboundedCacheWarning", code, _LRUCache);
3255
+ }
3256
+ }
3257
+ }
3258
+ /**
3259
+ * Return the number of ms left in the item's TTL. If item is not in cache,
3260
+ * returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
3261
+ */
3262
+ getRemainingTTL(key) {
3263
+ return this.#keyMap.has(key) ? Infinity : 0;
3264
+ }
3265
+ #initializeTTLTracking() {
3266
+ const ttls = new ZeroArray(this.#max);
3267
+ const starts = new ZeroArray(this.#max);
3268
+ this.#ttls = ttls;
3269
+ this.#starts = starts;
3270
+ this.#setItemTTL = (index, ttl, start = perf.now()) => {
3271
+ starts[index] = ttl !== 0 ? start : 0;
3272
+ ttls[index] = ttl;
3273
+ if (ttl !== 0 && this.ttlAutopurge) {
3274
+ const t = setTimeout(() => {
3275
+ if (this.#isStale(index)) {
3276
+ this.#delete(this.#keyList[index], "expire");
3277
+ }
3278
+ }, ttl + 1);
3279
+ if (t.unref) {
3280
+ t.unref();
3281
+ }
3282
+ }
3283
+ };
3284
+ this.#updateItemAge = (index) => {
3285
+ starts[index] = ttls[index] !== 0 ? perf.now() : 0;
3286
+ };
3287
+ this.#statusTTL = (status, index) => {
3288
+ if (ttls[index]) {
3289
+ const ttl = ttls[index];
3290
+ const start = starts[index];
3291
+ if (!ttl || !start)
3292
+ return;
3293
+ status.ttl = ttl;
3294
+ status.start = start;
3295
+ status.now = cachedNow || getNow();
3296
+ const age = status.now - start;
3297
+ status.remainingTTL = ttl - age;
3298
+ }
3299
+ };
3300
+ let cachedNow = 0;
3301
+ const getNow = () => {
3302
+ const n = perf.now();
3303
+ if (this.ttlResolution > 0) {
3304
+ cachedNow = n;
3305
+ const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
3306
+ if (t.unref) {
3307
+ t.unref();
3308
+ }
3309
+ }
3310
+ return n;
3311
+ };
3312
+ this.getRemainingTTL = (key) => {
3313
+ const index = this.#keyMap.get(key);
3314
+ if (index === void 0) {
3315
+ return 0;
3316
+ }
3317
+ const ttl = ttls[index];
3318
+ const start = starts[index];
3319
+ if (!ttl || !start) {
3320
+ return Infinity;
3321
+ }
3322
+ const age = (cachedNow || getNow()) - start;
3323
+ return ttl - age;
3324
+ };
3325
+ this.#isStale = (index) => {
3326
+ const s = starts[index];
3327
+ const t = ttls[index];
3328
+ return !!t && !!s && (cachedNow || getNow()) - s > t;
3329
+ };
3330
+ }
3331
+ // conditionally set private methods related to TTL
3332
+ #updateItemAge = () => {
3333
+ };
3334
+ #statusTTL = () => {
3335
+ };
3336
+ #setItemTTL = () => {
3337
+ };
3338
+ /* c8 ignore stop */
3339
+ #isStale = () => false;
3340
+ #initializeSizeTracking() {
3341
+ const sizes = new ZeroArray(this.#max);
3342
+ this.#calculatedSize = 0;
3343
+ this.#sizes = sizes;
3344
+ this.#removeItemSize = (index) => {
3345
+ this.#calculatedSize -= sizes[index];
3346
+ sizes[index] = 0;
3347
+ };
3348
+ this.#requireSize = (k, v, size, sizeCalculation) => {
3349
+ if (this.#isBackgroundFetch(v)) {
3350
+ return 0;
3351
+ }
3352
+ if (!isPosInt(size)) {
3353
+ if (sizeCalculation) {
3354
+ if (typeof sizeCalculation !== "function") {
3355
+ throw new TypeError("sizeCalculation must be a function");
3356
+ }
3357
+ size = sizeCalculation(v, k);
3358
+ if (!isPosInt(size)) {
3359
+ throw new TypeError("sizeCalculation return invalid (expect positive integer)");
3360
+ }
3361
+ } else {
3362
+ throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
3363
+ }
3364
+ }
3365
+ return size;
3366
+ };
3367
+ this.#addItemSize = (index, size, status) => {
3368
+ sizes[index] = size;
3369
+ if (this.#maxSize) {
3370
+ const maxSize = this.#maxSize - sizes[index];
3371
+ while (this.#calculatedSize > maxSize) {
3372
+ this.#evict(true);
3373
+ }
3374
+ }
3375
+ this.#calculatedSize += sizes[index];
3376
+ if (status) {
3377
+ status.entrySize = size;
3378
+ status.totalCalculatedSize = this.#calculatedSize;
3379
+ }
3380
+ };
3381
+ }
3382
+ #removeItemSize = (_i) => {
3383
+ };
3384
+ #addItemSize = (_i, _s, _st) => {
3385
+ };
3386
+ #requireSize = (_k, _v, size, sizeCalculation) => {
3387
+ if (size || sizeCalculation) {
3388
+ throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
3389
+ }
3390
+ return 0;
3391
+ };
3392
+ *#indexes({ allowStale = this.allowStale } = {}) {
3393
+ if (this.#size) {
3394
+ for (let i = this.#tail; true; ) {
3395
+ if (!this.#isValidIndex(i)) {
3396
+ break;
3397
+ }
3398
+ if (allowStale || !this.#isStale(i)) {
3399
+ yield i;
3400
+ }
3401
+ if (i === this.#head) {
3402
+ break;
3403
+ } else {
3404
+ i = this.#prev[i];
3405
+ }
3406
+ }
3407
+ }
3408
+ }
3409
+ *#rindexes({ allowStale = this.allowStale } = {}) {
3410
+ if (this.#size) {
3411
+ for (let i = this.#head; true; ) {
3412
+ if (!this.#isValidIndex(i)) {
3413
+ break;
3414
+ }
3415
+ if (allowStale || !this.#isStale(i)) {
3416
+ yield i;
3417
+ }
3418
+ if (i === this.#tail) {
3419
+ break;
3420
+ } else {
3421
+ i = this.#next[i];
3422
+ }
3423
+ }
3424
+ }
3425
+ }
3426
+ #isValidIndex(index) {
3427
+ return index !== void 0 && this.#keyMap.get(this.#keyList[index]) === index;
3428
+ }
3429
+ /**
3430
+ * Return a generator yielding `[key, value]` pairs,
3431
+ * in order from most recently used to least recently used.
3432
+ */
3433
+ *entries() {
3434
+ for (const i of this.#indexes()) {
3435
+ if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
3436
+ yield [this.#keyList[i], this.#valList[i]];
3437
+ }
3438
+ }
3439
+ }
3440
+ /**
3441
+ * Inverse order version of {@link LRUCache.entries}
3442
+ *
3443
+ * Return a generator yielding `[key, value]` pairs,
3444
+ * in order from least recently used to most recently used.
3445
+ */
3446
+ *rentries() {
3447
+ for (const i of this.#rindexes()) {
3448
+ if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
3449
+ yield [this.#keyList[i], this.#valList[i]];
3450
+ }
3451
+ }
3452
+ }
3453
+ /**
3454
+ * Return a generator yielding the keys in the cache,
3455
+ * in order from most recently used to least recently used.
3456
+ */
3457
+ *keys() {
3458
+ for (const i of this.#indexes()) {
3459
+ const k = this.#keyList[i];
3460
+ if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
3461
+ yield k;
3462
+ }
3463
+ }
3464
+ }
3465
+ /**
3466
+ * Inverse order version of {@link LRUCache.keys}
3467
+ *
3468
+ * Return a generator yielding the keys in the cache,
3469
+ * in order from least recently used to most recently used.
3470
+ */
3471
+ *rkeys() {
3472
+ for (const i of this.#rindexes()) {
3473
+ const k = this.#keyList[i];
3474
+ if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
3475
+ yield k;
3476
+ }
3477
+ }
3478
+ }
3479
+ /**
3480
+ * Return a generator yielding the values in the cache,
3481
+ * in order from most recently used to least recently used.
3482
+ */
3483
+ *values() {
3484
+ for (const i of this.#indexes()) {
3485
+ const v = this.#valList[i];
3486
+ if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
3487
+ yield this.#valList[i];
3488
+ }
3489
+ }
3490
+ }
3491
+ /**
3492
+ * Inverse order version of {@link LRUCache.values}
3493
+ *
3494
+ * Return a generator yielding the values in the cache,
3495
+ * in order from least recently used to most recently used.
3496
+ */
3497
+ *rvalues() {
3498
+ for (const i of this.#rindexes()) {
3499
+ const v = this.#valList[i];
3500
+ if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
3501
+ yield this.#valList[i];
3502
+ }
3503
+ }
3504
+ }
3505
+ /**
3506
+ * Iterating over the cache itself yields the same results as
3507
+ * {@link LRUCache.entries}
3508
+ */
3509
+ [Symbol.iterator]() {
3510
+ return this.entries();
3511
+ }
3512
+ /**
3513
+ * A String value that is used in the creation of the default string
3514
+ * description of an object. Called by the built-in method
3515
+ * `Object.prototype.toString`.
3516
+ */
3517
+ [Symbol.toStringTag] = "LRUCache";
3518
+ /**
3519
+ * Find a value for which the supplied fn method returns a truthy value,
3520
+ * similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
3521
+ */
3522
+ find(fn, getOptions = {}) {
3523
+ for (const i of this.#indexes()) {
3524
+ const v = this.#valList[i];
3525
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
3526
+ if (value === void 0)
3527
+ continue;
3528
+ if (fn(value, this.#keyList[i], this)) {
3529
+ return this.get(this.#keyList[i], getOptions);
3530
+ }
3531
+ }
3532
+ }
3533
+ /**
3534
+ * Call the supplied function on each item in the cache, in order from most
3535
+ * recently used to least recently used.
3536
+ *
3537
+ * `fn` is called as `fn(value, key, cache)`.
3538
+ *
3539
+ * If `thisp` is provided, function will be called in the `this`-context of
3540
+ * the provided object, or the cache if no `thisp` object is provided.
3541
+ *
3542
+ * Does not update age or recenty of use, or iterate over stale values.
3543
+ */
3544
+ forEach(fn, thisp = this) {
3545
+ for (const i of this.#indexes()) {
3546
+ const v = this.#valList[i];
3547
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
3548
+ if (value === void 0)
3549
+ continue;
3550
+ fn.call(thisp, value, this.#keyList[i], this);
3551
+ }
3552
+ }
3553
+ /**
3554
+ * The same as {@link LRUCache.forEach} but items are iterated over in
3555
+ * reverse order. (ie, less recently used items are iterated over first.)
3556
+ */
3557
+ rforEach(fn, thisp = this) {
3558
+ for (const i of this.#rindexes()) {
3559
+ const v = this.#valList[i];
3560
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
3561
+ if (value === void 0)
3562
+ continue;
3563
+ fn.call(thisp, value, this.#keyList[i], this);
3564
+ }
3565
+ }
3566
+ /**
3567
+ * Delete any stale entries. Returns true if anything was removed,
3568
+ * false otherwise.
3569
+ */
3570
+ purgeStale() {
3571
+ let deleted = false;
3572
+ for (const i of this.#rindexes({ allowStale: true })) {
3573
+ if (this.#isStale(i)) {
3574
+ this.#delete(this.#keyList[i], "expire");
3575
+ deleted = true;
3576
+ }
3577
+ }
3578
+ return deleted;
3579
+ }
3580
+ /**
3581
+ * Get the extended info about a given entry, to get its value, size, and
3582
+ * TTL info simultaneously. Returns `undefined` if the key is not present.
3583
+ *
3584
+ * Unlike {@link LRUCache#dump}, which is designed to be portable and survive
3585
+ * serialization, the `start` value is always the current timestamp, and the
3586
+ * `ttl` is a calculated remaining time to live (negative if expired).
3587
+ *
3588
+ * Always returns stale values, if their info is found in the cache, so be
3589
+ * sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
3590
+ * if relevant.
3591
+ */
3592
+ info(key) {
3593
+ const i = this.#keyMap.get(key);
3594
+ if (i === void 0)
3595
+ return void 0;
3596
+ const v = this.#valList[i];
3597
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
3598
+ if (value === void 0)
3599
+ return void 0;
3600
+ const entry = { value };
3601
+ if (this.#ttls && this.#starts) {
3602
+ const ttl = this.#ttls[i];
3603
+ const start = this.#starts[i];
3604
+ if (ttl && start) {
3605
+ const remain = ttl - (perf.now() - start);
3606
+ entry.ttl = remain;
3607
+ entry.start = Date.now();
3608
+ }
3609
+ }
3610
+ if (this.#sizes) {
3611
+ entry.size = this.#sizes[i];
3612
+ }
3613
+ return entry;
3614
+ }
3615
+ /**
3616
+ * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
3617
+ * passed to {@link LRLUCache#load}.
3618
+ *
3619
+ * The `start` fields are calculated relative to a portable `Date.now()`
3620
+ * timestamp, even if `performance.now()` is available.
3621
+ *
3622
+ * Stale entries are always included in the `dump`, even if
3623
+ * {@link LRUCache.OptionsBase.allowStale} is false.
3624
+ *
3625
+ * Note: this returns an actual array, not a generator, so it can be more
3626
+ * easily passed around.
3627
+ */
3628
+ dump() {
3629
+ const arr = [];
3630
+ for (const i of this.#indexes({ allowStale: true })) {
3631
+ const key = this.#keyList[i];
3632
+ const v = this.#valList[i];
3633
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
3634
+ if (value === void 0 || key === void 0)
3635
+ continue;
3636
+ const entry = { value };
3637
+ if (this.#ttls && this.#starts) {
3638
+ entry.ttl = this.#ttls[i];
3639
+ const age = perf.now() - this.#starts[i];
3640
+ entry.start = Math.floor(Date.now() - age);
3641
+ }
3642
+ if (this.#sizes) {
3643
+ entry.size = this.#sizes[i];
3644
+ }
3645
+ arr.unshift([key, entry]);
3646
+ }
3647
+ return arr;
3648
+ }
3649
+ /**
3650
+ * Reset the cache and load in the items in entries in the order listed.
3651
+ *
3652
+ * The shape of the resulting cache may be different if the same options are
3653
+ * not used in both caches.
3654
+ *
3655
+ * The `start` fields are assumed to be calculated relative to a portable
3656
+ * `Date.now()` timestamp, even if `performance.now()` is available.
3657
+ */
3658
+ load(arr) {
3659
+ this.clear();
3660
+ for (const [key, entry] of arr) {
3661
+ if (entry.start) {
3662
+ const age = Date.now() - entry.start;
3663
+ entry.start = perf.now() - age;
3664
+ }
3665
+ this.set(key, entry.value, entry);
3666
+ }
3667
+ }
3668
+ /**
3669
+ * Add a value to the cache.
3670
+ *
3671
+ * Note: if `undefined` is specified as a value, this is an alias for
3672
+ * {@link LRUCache#delete}
3673
+ *
3674
+ * Fields on the {@link LRUCache.SetOptions} options param will override
3675
+ * their corresponding values in the constructor options for the scope
3676
+ * of this single `set()` operation.
3677
+ *
3678
+ * If `start` is provided, then that will set the effective start
3679
+ * time for the TTL calculation. Note that this must be a previous
3680
+ * value of `performance.now()` if supported, or a previous value of
3681
+ * `Date.now()` if not.
3682
+ *
3683
+ * Options object may also include `size`, which will prevent
3684
+ * calling the `sizeCalculation` function and just use the specified
3685
+ * number if it is a positive integer, and `noDisposeOnSet` which
3686
+ * will prevent calling a `dispose` function in the case of
3687
+ * overwrites.
3688
+ *
3689
+ * If the `size` (or return value of `sizeCalculation`) for a given
3690
+ * entry is greater than `maxEntrySize`, then the item will not be
3691
+ * added to the cache.
3692
+ *
3693
+ * Will update the recency of the entry.
3694
+ *
3695
+ * If the value is `undefined`, then this is an alias for
3696
+ * `cache.delete(key)`. `undefined` is never stored in the cache.
3697
+ */
3698
+ set(k, v, setOptions = {}) {
3699
+ if (v === void 0) {
3700
+ this.delete(k);
3701
+ return this;
3702
+ }
3703
+ const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
3704
+ let { noUpdateTTL = this.noUpdateTTL } = setOptions;
3705
+ const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
3706
+ if (this.maxEntrySize && size > this.maxEntrySize) {
3707
+ if (status) {
3708
+ status.set = "miss";
3709
+ status.maxEntrySizeExceeded = true;
3710
+ }
3711
+ this.#delete(k, "set");
3712
+ return this;
3713
+ }
3714
+ let index = this.#size === 0 ? void 0 : this.#keyMap.get(k);
3715
+ if (index === void 0) {
3716
+ index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
3717
+ this.#keyList[index] = k;
3718
+ this.#valList[index] = v;
3719
+ this.#keyMap.set(k, index);
3720
+ this.#next[this.#tail] = index;
3721
+ this.#prev[index] = this.#tail;
3722
+ this.#tail = index;
3723
+ this.#size++;
3724
+ this.#addItemSize(index, size, status);
3725
+ if (status)
3726
+ status.set = "add";
3727
+ noUpdateTTL = false;
3728
+ } else {
3729
+ this.#moveToTail(index);
3730
+ const oldVal = this.#valList[index];
3731
+ if (v !== oldVal) {
3732
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
3733
+ oldVal.__abortController.abort(new Error("replaced"));
3734
+ const { __staleWhileFetching: s } = oldVal;
3735
+ if (s !== void 0 && !noDisposeOnSet) {
3736
+ if (this.#hasDispose) {
3737
+ this.#dispose?.(s, k, "set");
3738
+ }
3739
+ if (this.#hasDisposeAfter) {
3740
+ this.#disposed?.push([s, k, "set"]);
3741
+ }
3742
+ }
3743
+ } else if (!noDisposeOnSet) {
3744
+ if (this.#hasDispose) {
3745
+ this.#dispose?.(oldVal, k, "set");
3746
+ }
3747
+ if (this.#hasDisposeAfter) {
3748
+ this.#disposed?.push([oldVal, k, "set"]);
3749
+ }
3750
+ }
3751
+ this.#removeItemSize(index);
3752
+ this.#addItemSize(index, size, status);
3753
+ this.#valList[index] = v;
3754
+ if (status) {
3755
+ status.set = "replace";
3756
+ const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
3757
+ if (oldValue !== void 0)
3758
+ status.oldValue = oldValue;
3759
+ }
3760
+ } else if (status) {
3761
+ status.set = "update";
3762
+ }
3763
+ }
3764
+ if (ttl !== 0 && !this.#ttls) {
3765
+ this.#initializeTTLTracking();
3766
+ }
3767
+ if (this.#ttls) {
3768
+ if (!noUpdateTTL) {
3769
+ this.#setItemTTL(index, ttl, start);
3770
+ }
3771
+ if (status)
3772
+ this.#statusTTL(status, index);
3773
+ }
3774
+ if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
3775
+ const dt = this.#disposed;
3776
+ let task;
3777
+ while (task = dt?.shift()) {
3778
+ this.#disposeAfter?.(...task);
3779
+ }
3780
+ }
3781
+ return this;
3782
+ }
3783
+ /**
3784
+ * Evict the least recently used item, returning its value or
3785
+ * `undefined` if cache is empty.
3786
+ */
3787
+ pop() {
3788
+ try {
3789
+ while (this.#size) {
3790
+ const val = this.#valList[this.#head];
3791
+ this.#evict(true);
3792
+ if (this.#isBackgroundFetch(val)) {
3793
+ if (val.__staleWhileFetching) {
3794
+ return val.__staleWhileFetching;
3795
+ }
3796
+ } else if (val !== void 0) {
3797
+ return val;
3798
+ }
3799
+ }
3800
+ } finally {
3801
+ if (this.#hasDisposeAfter && this.#disposed) {
3802
+ const dt = this.#disposed;
3803
+ let task;
3804
+ while (task = dt?.shift()) {
3805
+ this.#disposeAfter?.(...task);
3806
+ }
3807
+ }
3808
+ }
3809
+ }
3810
+ #evict(free) {
3811
+ const head = this.#head;
3812
+ const k = this.#keyList[head];
3813
+ const v = this.#valList[head];
3814
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
3815
+ v.__abortController.abort(new Error("evicted"));
3816
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
3817
+ if (this.#hasDispose) {
3818
+ this.#dispose?.(v, k, "evict");
3819
+ }
3820
+ if (this.#hasDisposeAfter) {
3821
+ this.#disposed?.push([v, k, "evict"]);
3822
+ }
3823
+ }
3824
+ this.#removeItemSize(head);
3825
+ if (free) {
3826
+ this.#keyList[head] = void 0;
3827
+ this.#valList[head] = void 0;
3828
+ this.#free.push(head);
3829
+ }
3830
+ if (this.#size === 1) {
3831
+ this.#head = this.#tail = 0;
3832
+ this.#free.length = 0;
3833
+ } else {
3834
+ this.#head = this.#next[head];
3835
+ }
3836
+ this.#keyMap.delete(k);
3837
+ this.#size--;
3838
+ return head;
3839
+ }
3840
+ /**
3841
+ * Check if a key is in the cache, without updating the recency of use.
3842
+ * Will return false if the item is stale, even though it is technically
3843
+ * in the cache.
3844
+ *
3845
+ * Check if a key is in the cache, without updating the recency of
3846
+ * use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
3847
+ * to `true` in either the options or the constructor.
3848
+ *
3849
+ * Will return `false` if the item is stale, even though it is technically in
3850
+ * the cache. The difference can be determined (if it matters) by using a
3851
+ * `status` argument, and inspecting the `has` field.
3852
+ *
3853
+ * Will not update item age unless
3854
+ * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
3855
+ */
3856
+ has(k, hasOptions = {}) {
3857
+ const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
3858
+ const index = this.#keyMap.get(k);
3859
+ if (index !== void 0) {
3860
+ const v = this.#valList[index];
3861
+ if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === void 0) {
3862
+ return false;
3863
+ }
3864
+ if (!this.#isStale(index)) {
3865
+ if (updateAgeOnHas) {
3866
+ this.#updateItemAge(index);
3867
+ }
3868
+ if (status) {
3869
+ status.has = "hit";
3870
+ this.#statusTTL(status, index);
3871
+ }
3872
+ return true;
3873
+ } else if (status) {
3874
+ status.has = "stale";
3875
+ this.#statusTTL(status, index);
3876
+ }
3877
+ } else if (status) {
3878
+ status.has = "miss";
3879
+ }
3880
+ return false;
3881
+ }
3882
+ /**
3883
+ * Like {@link LRUCache#get} but doesn't update recency or delete stale
3884
+ * items.
3885
+ *
3886
+ * Returns `undefined` if the item is stale, unless
3887
+ * {@link LRUCache.OptionsBase.allowStale} is set.
3888
+ */
3889
+ peek(k, peekOptions = {}) {
3890
+ const { allowStale = this.allowStale } = peekOptions;
3891
+ const index = this.#keyMap.get(k);
3892
+ if (index === void 0 || !allowStale && this.#isStale(index)) {
3893
+ return;
3894
+ }
3895
+ const v = this.#valList[index];
3896
+ return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
3897
+ }
3898
+ #backgroundFetch(k, index, options, context) {
3899
+ const v = index === void 0 ? void 0 : this.#valList[index];
3900
+ if (this.#isBackgroundFetch(v)) {
3901
+ return v;
3902
+ }
3903
+ const ac = new AC();
3904
+ const { signal } = options;
3905
+ signal?.addEventListener("abort", () => ac.abort(signal.reason), {
3906
+ signal: ac.signal
3907
+ });
3908
+ const fetchOpts = {
3909
+ signal: ac.signal,
3910
+ options,
3911
+ context
3912
+ };
3913
+ const cb = (v2, updateCache = false) => {
3914
+ const { aborted } = ac.signal;
3915
+ const ignoreAbort = options.ignoreFetchAbort && v2 !== void 0;
3916
+ if (options.status) {
3917
+ if (aborted && !updateCache) {
3918
+ options.status.fetchAborted = true;
3919
+ options.status.fetchError = ac.signal.reason;
3920
+ if (ignoreAbort)
3921
+ options.status.fetchAbortIgnored = true;
3922
+ } else {
3923
+ options.status.fetchResolved = true;
3924
+ }
3925
+ }
3926
+ if (aborted && !ignoreAbort && !updateCache) {
3927
+ return fetchFail(ac.signal.reason);
3928
+ }
3929
+ const bf2 = p;
3930
+ if (this.#valList[index] === p) {
3931
+ if (v2 === void 0) {
3932
+ if (bf2.__staleWhileFetching) {
3933
+ this.#valList[index] = bf2.__staleWhileFetching;
3934
+ } else {
3935
+ this.#delete(k, "fetch");
3936
+ }
3937
+ } else {
3938
+ if (options.status)
3939
+ options.status.fetchUpdated = true;
3940
+ this.set(k, v2, fetchOpts.options);
3941
+ }
3942
+ }
3943
+ return v2;
3944
+ };
3945
+ const eb = (er) => {
3946
+ if (options.status) {
3947
+ options.status.fetchRejected = true;
3948
+ options.status.fetchError = er;
3949
+ }
3950
+ return fetchFail(er);
3951
+ };
3952
+ const fetchFail = (er) => {
3953
+ const { aborted } = ac.signal;
3954
+ const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
3955
+ const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
3956
+ const noDelete = allowStale || options.noDeleteOnFetchRejection;
3957
+ const bf2 = p;
3958
+ if (this.#valList[index] === p) {
3959
+ const del = !noDelete || bf2.__staleWhileFetching === void 0;
3960
+ if (del) {
3961
+ this.#delete(k, "fetch");
3962
+ } else if (!allowStaleAborted) {
3963
+ this.#valList[index] = bf2.__staleWhileFetching;
3964
+ }
3965
+ }
3966
+ if (allowStale) {
3967
+ if (options.status && bf2.__staleWhileFetching !== void 0) {
3968
+ options.status.returnedStale = true;
3969
+ }
3970
+ return bf2.__staleWhileFetching;
3971
+ } else if (bf2.__returned === bf2) {
3972
+ throw er;
3973
+ }
3974
+ };
3975
+ const pcall = (res, rej) => {
3976
+ const fmp = this.#fetchMethod?.(k, v, fetchOpts);
3977
+ if (fmp && fmp instanceof Promise) {
3978
+ fmp.then((v2) => res(v2 === void 0 ? void 0 : v2), rej);
3979
+ }
3980
+ ac.signal.addEventListener("abort", () => {
3981
+ if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
3982
+ res(void 0);
3983
+ if (options.allowStaleOnFetchAbort) {
3984
+ res = (v2) => cb(v2, true);
3985
+ }
3986
+ }
3987
+ });
3988
+ };
3989
+ if (options.status)
3990
+ options.status.fetchDispatched = true;
3991
+ const p = new Promise(pcall).then(cb, eb);
3992
+ const bf = Object.assign(p, {
3993
+ __abortController: ac,
3994
+ __staleWhileFetching: v,
3995
+ __returned: void 0
3996
+ });
3997
+ if (index === void 0) {
3998
+ this.set(k, bf, { ...fetchOpts.options, status: void 0 });
3999
+ index = this.#keyMap.get(k);
4000
+ } else {
4001
+ this.#valList[index] = bf;
4002
+ }
4003
+ return bf;
4004
+ }
4005
+ #isBackgroundFetch(p) {
4006
+ if (!this.#hasFetchMethod)
4007
+ return false;
4008
+ const b = p;
4009
+ return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC;
4010
+ }
4011
+ async fetch(k, fetchOptions = {}) {
4012
+ const {
4013
+ // get options
4014
+ allowStale = this.allowStale,
4015
+ updateAgeOnGet = this.updateAgeOnGet,
4016
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
4017
+ // set options
4018
+ ttl = this.ttl,
4019
+ noDisposeOnSet = this.noDisposeOnSet,
4020
+ size = 0,
4021
+ sizeCalculation = this.sizeCalculation,
4022
+ noUpdateTTL = this.noUpdateTTL,
4023
+ // fetch exclusive options
4024
+ noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
4025
+ allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
4026
+ ignoreFetchAbort = this.ignoreFetchAbort,
4027
+ allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
4028
+ context,
4029
+ forceRefresh = false,
4030
+ status,
4031
+ signal
4032
+ } = fetchOptions;
4033
+ if (!this.#hasFetchMethod) {
4034
+ if (status)
4035
+ status.fetch = "get";
4036
+ return this.get(k, {
4037
+ allowStale,
4038
+ updateAgeOnGet,
4039
+ noDeleteOnStaleGet,
4040
+ status
4041
+ });
4042
+ }
4043
+ const options = {
4044
+ allowStale,
4045
+ updateAgeOnGet,
4046
+ noDeleteOnStaleGet,
4047
+ ttl,
4048
+ noDisposeOnSet,
4049
+ size,
4050
+ sizeCalculation,
4051
+ noUpdateTTL,
4052
+ noDeleteOnFetchRejection,
4053
+ allowStaleOnFetchRejection,
4054
+ allowStaleOnFetchAbort,
4055
+ ignoreFetchAbort,
4056
+ status,
4057
+ signal
4058
+ };
4059
+ let index = this.#keyMap.get(k);
4060
+ if (index === void 0) {
4061
+ if (status)
4062
+ status.fetch = "miss";
4063
+ const p = this.#backgroundFetch(k, index, options, context);
4064
+ return p.__returned = p;
4065
+ } else {
4066
+ const v = this.#valList[index];
4067
+ if (this.#isBackgroundFetch(v)) {
4068
+ const stale = allowStale && v.__staleWhileFetching !== void 0;
4069
+ if (status) {
4070
+ status.fetch = "inflight";
4071
+ if (stale)
4072
+ status.returnedStale = true;
4073
+ }
4074
+ return stale ? v.__staleWhileFetching : v.__returned = v;
4075
+ }
4076
+ const isStale = this.#isStale(index);
4077
+ if (!forceRefresh && !isStale) {
4078
+ if (status)
4079
+ status.fetch = "hit";
4080
+ this.#moveToTail(index);
4081
+ if (updateAgeOnGet) {
4082
+ this.#updateItemAge(index);
4083
+ }
4084
+ if (status)
4085
+ this.#statusTTL(status, index);
4086
+ return v;
4087
+ }
4088
+ const p = this.#backgroundFetch(k, index, options, context);
4089
+ const hasStale = p.__staleWhileFetching !== void 0;
4090
+ const staleVal = hasStale && allowStale;
4091
+ if (status) {
4092
+ status.fetch = isStale ? "stale" : "refresh";
4093
+ if (staleVal && isStale)
4094
+ status.returnedStale = true;
4095
+ }
4096
+ return staleVal ? p.__staleWhileFetching : p.__returned = p;
4097
+ }
4098
+ }
4099
+ async forceFetch(k, fetchOptions = {}) {
4100
+ const v = await this.fetch(k, fetchOptions);
4101
+ if (v === void 0)
4102
+ throw new Error("fetch() returned undefined");
4103
+ return v;
4104
+ }
4105
+ memo(k, memoOptions = {}) {
4106
+ const memoMethod = this.#memoMethod;
4107
+ if (!memoMethod) {
4108
+ throw new Error("no memoMethod provided to constructor");
4109
+ }
4110
+ const { context, forceRefresh, ...options } = memoOptions;
4111
+ const v = this.get(k, options);
4112
+ if (!forceRefresh && v !== void 0)
4113
+ return v;
4114
+ const vv = memoMethod(k, v, {
4115
+ options,
4116
+ context
4117
+ });
4118
+ this.set(k, vv, options);
4119
+ return vv;
4120
+ }
4121
+ /**
4122
+ * Return a value from the cache. Will update the recency of the cache
4123
+ * entry found.
4124
+ *
4125
+ * If the key is not found, get() will return `undefined`.
4126
+ */
4127
+ get(k, getOptions = {}) {
4128
+ const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
4129
+ const index = this.#keyMap.get(k);
4130
+ if (index !== void 0) {
4131
+ const value = this.#valList[index];
4132
+ const fetching = this.#isBackgroundFetch(value);
4133
+ if (status)
4134
+ this.#statusTTL(status, index);
4135
+ if (this.#isStale(index)) {
4136
+ if (status)
4137
+ status.get = "stale";
4138
+ if (!fetching) {
4139
+ if (!noDeleteOnStaleGet) {
4140
+ this.#delete(k, "expire");
4141
+ }
4142
+ if (status && allowStale)
4143
+ status.returnedStale = true;
4144
+ return allowStale ? value : void 0;
4145
+ } else {
4146
+ if (status && allowStale && value.__staleWhileFetching !== void 0) {
4147
+ status.returnedStale = true;
4148
+ }
4149
+ return allowStale ? value.__staleWhileFetching : void 0;
4150
+ }
4151
+ } else {
4152
+ if (status)
4153
+ status.get = "hit";
4154
+ if (fetching) {
4155
+ return value.__staleWhileFetching;
4156
+ }
4157
+ this.#moveToTail(index);
4158
+ if (updateAgeOnGet) {
4159
+ this.#updateItemAge(index);
4160
+ }
4161
+ return value;
4162
+ }
4163
+ } else if (status) {
4164
+ status.get = "miss";
4165
+ }
4166
+ }
4167
+ #connect(p, n) {
4168
+ this.#prev[n] = p;
4169
+ this.#next[p] = n;
4170
+ }
4171
+ #moveToTail(index) {
4172
+ if (index !== this.#tail) {
4173
+ if (index === this.#head) {
4174
+ this.#head = this.#next[index];
4175
+ } else {
4176
+ this.#connect(this.#prev[index], this.#next[index]);
4177
+ }
4178
+ this.#connect(this.#tail, index);
4179
+ this.#tail = index;
4180
+ }
4181
+ }
4182
+ /**
4183
+ * Deletes a key out of the cache.
4184
+ *
4185
+ * Returns true if the key was deleted, false otherwise.
4186
+ */
4187
+ delete(k) {
4188
+ return this.#delete(k, "delete");
4189
+ }
4190
+ #delete(k, reason) {
4191
+ let deleted = false;
4192
+ if (this.#size !== 0) {
4193
+ const index = this.#keyMap.get(k);
4194
+ if (index !== void 0) {
4195
+ deleted = true;
4196
+ if (this.#size === 1) {
4197
+ this.#clear(reason);
4198
+ } else {
4199
+ this.#removeItemSize(index);
4200
+ const v = this.#valList[index];
4201
+ if (this.#isBackgroundFetch(v)) {
4202
+ v.__abortController.abort(new Error("deleted"));
4203
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
4204
+ if (this.#hasDispose) {
4205
+ this.#dispose?.(v, k, reason);
4206
+ }
4207
+ if (this.#hasDisposeAfter) {
4208
+ this.#disposed?.push([v, k, reason]);
4209
+ }
4210
+ }
4211
+ this.#keyMap.delete(k);
4212
+ this.#keyList[index] = void 0;
4213
+ this.#valList[index] = void 0;
4214
+ if (index === this.#tail) {
4215
+ this.#tail = this.#prev[index];
4216
+ } else if (index === this.#head) {
4217
+ this.#head = this.#next[index];
4218
+ } else {
4219
+ const pi = this.#prev[index];
4220
+ this.#next[pi] = this.#next[index];
4221
+ const ni = this.#next[index];
4222
+ this.#prev[ni] = this.#prev[index];
4223
+ }
4224
+ this.#size--;
4225
+ this.#free.push(index);
4226
+ }
4227
+ }
4228
+ }
4229
+ if (this.#hasDisposeAfter && this.#disposed?.length) {
4230
+ const dt = this.#disposed;
4231
+ let task;
4232
+ while (task = dt?.shift()) {
4233
+ this.#disposeAfter?.(...task);
4234
+ }
4235
+ }
4236
+ return deleted;
4237
+ }
4238
+ /**
4239
+ * Clear the cache entirely, throwing away all values.
4240
+ */
4241
+ clear() {
4242
+ return this.#clear("delete");
4243
+ }
4244
+ #clear(reason) {
4245
+ for (const index of this.#rindexes({ allowStale: true })) {
4246
+ const v = this.#valList[index];
4247
+ if (this.#isBackgroundFetch(v)) {
4248
+ v.__abortController.abort(new Error("deleted"));
4249
+ } else {
4250
+ const k = this.#keyList[index];
4251
+ if (this.#hasDispose) {
4252
+ this.#dispose?.(v, k, reason);
4253
+ }
4254
+ if (this.#hasDisposeAfter) {
4255
+ this.#disposed?.push([v, k, reason]);
4256
+ }
4257
+ }
4258
+ }
4259
+ this.#keyMap.clear();
4260
+ this.#valList.fill(void 0);
4261
+ this.#keyList.fill(void 0);
4262
+ if (this.#ttls && this.#starts) {
4263
+ this.#ttls.fill(0);
4264
+ this.#starts.fill(0);
4265
+ }
4266
+ if (this.#sizes) {
4267
+ this.#sizes.fill(0);
4268
+ }
4269
+ this.#head = 0;
4270
+ this.#tail = 0;
4271
+ this.#free.length = 0;
4272
+ this.#calculatedSize = 0;
4273
+ this.#size = 0;
4274
+ if (this.#hasDisposeAfter && this.#disposed) {
4275
+ const dt = this.#disposed;
4276
+ let task;
4277
+ while (task = dt?.shift()) {
4278
+ this.#disposeAfter?.(...task);
4279
+ }
4280
+ }
4281
+ }
4282
+ };
4283
+
4284
+ // node_modules/.pnpm/@vanilla-extract+css@1.16.0/node_modules/@vanilla-extract/css/dist/vanilla-extract-css.esm.js
4285
+ var import_cssesc2 = __toESM(require_cssesc());
4286
+ var import_deepmerge = __toESM(require_cjs());
4287
+ var localClassNames = /* @__PURE__ */ new Set();
4288
+ var composedClassLists = [];
4289
+ var bufferedCSSObjs = [];
4290
+ var browserRuntimeAdapter = {
4291
+ appendCss: (cssObj) => {
4292
+ bufferedCSSObjs.push(cssObj);
4293
+ },
4294
+ registerClassName: (className) => {
4295
+ localClassNames.add(className);
4296
+ },
4297
+ registerComposition: (composition) => {
4298
+ composedClassLists.push(composition);
4299
+ },
4300
+ markCompositionUsed: () => {
4301
+ },
4302
+ onEndFileScope: (fileScope) => {
4303
+ var css = transformCss({
4304
+ localClassNames: Array.from(localClassNames),
4305
+ composedClassLists,
4306
+ cssObjs: bufferedCSSObjs
4307
+ }).join("\n");
4308
+ injectStyles({
4309
+ fileScope,
4310
+ css
4311
+ });
4312
+ bufferedCSSObjs = [];
4313
+ },
4314
+ getIdentOption: () => process.env.NODE_ENV === "production" ? "short" : "debug"
4315
+ };
4316
+ if (typeof window !== "undefined") {
4317
+ setAdapterIfNotSet(browserRuntimeAdapter);
4318
+ }
4319
+ var getLastSlashBeforeIndex = (path, index) => {
4320
+ var pathIndex = index - 1;
4321
+ while (pathIndex >= 0) {
4322
+ if (path[pathIndex] === "/") {
4323
+ return pathIndex;
4324
+ }
4325
+ pathIndex--;
4326
+ }
4327
+ return -1;
4328
+ };
4329
+ var _getDebugFileName = (path) => {
4330
+ var file;
4331
+ var lastIndexOfDotCss = path.lastIndexOf(".css");
4332
+ if (lastIndexOfDotCss === -1) {
4333
+ return "";
4334
+ }
4335
+ var lastSlashIndex = getLastSlashBeforeIndex(path, lastIndexOfDotCss);
4336
+ file = path.slice(lastSlashIndex + 1, lastIndexOfDotCss);
4337
+ if (lastSlashIndex === -1) {
4338
+ return file;
4339
+ }
4340
+ var secondLastSlashIndex = getLastSlashBeforeIndex(path, lastSlashIndex - 1);
4341
+ var dir = path.slice(secondLastSlashIndex + 1, lastSlashIndex);
4342
+ var debugFileName = file !== "index" ? file : dir;
4343
+ return debugFileName;
4344
+ };
4345
+ var memoizedGetDebugFileName = () => {
4346
+ var cache = new LRUCache({
4347
+ max: 500
4348
+ });
4349
+ return (path) => {
4350
+ var cachedResult = cache.get(path);
4351
+ if (cachedResult) {
4352
+ return cachedResult;
4353
+ }
4354
+ var result = _getDebugFileName(path);
4355
+ cache.set(path, result);
4356
+ return result;
4357
+ };
4358
+ };
4359
+ var getDebugFileName = memoizedGetDebugFileName();
4360
+ function getDevPrefix(_ref) {
4361
+ var {
4362
+ debugId,
4363
+ debugFileName
4364
+ } = _ref;
4365
+ var parts = debugId ? [debugId.replace(/\s/g, "_")] : [];
4366
+ if (debugFileName) {
4367
+ var {
4368
+ filePath
4369
+ } = getFileScope();
4370
+ var _debugFileName = getDebugFileName(filePath);
4371
+ if (_debugFileName) {
4372
+ parts.unshift(_debugFileName);
4373
+ }
4374
+ }
4375
+ return parts.join("_");
4376
+ }
4377
+ function normalizeIdentifier(identifier) {
4378
+ return identifier.match(/^[0-9]/) ? "_".concat(identifier) : identifier;
4379
+ }
4380
+ function generateIdentifier(arg) {
4381
+ var identOption = getIdentOption();
4382
+ var {
4383
+ debugId,
4384
+ debugFileName = true
4385
+ } = _objectSpread2(_objectSpread2({}, typeof arg === "string" ? {
4386
+ debugId: arg
4387
+ } : null), typeof arg === "object" ? arg : null);
4388
+ var refCount = getAndIncrementRefCounter().toString(36);
4389
+ var {
4390
+ filePath,
4391
+ packageName
4392
+ } = getFileScope();
4393
+ var fileScopeHash = murmur2(packageName ? "".concat(packageName).concat(filePath) : filePath);
4394
+ var identifier = "".concat(fileScopeHash).concat(refCount);
4395
+ if (identOption === "debug") {
4396
+ var devPrefix = getDevPrefix({
4397
+ debugId,
4398
+ debugFileName
4399
+ });
4400
+ if (devPrefix) {
4401
+ identifier = "".concat(devPrefix, "__").concat(identifier);
4402
+ }
4403
+ return normalizeIdentifier(identifier);
4404
+ }
4405
+ if (typeof identOption === "function") {
4406
+ identifier = identOption({
4407
+ hash: identifier,
4408
+ debugId,
4409
+ filePath,
4410
+ packageName
4411
+ });
4412
+ if (!identifier.match(/^[A-Z_][0-9A-Z_-]+$/i)) {
4413
+ throw new Error('Identifier function returned invalid indentifier: "'.concat(identifier, '"'));
4414
+ }
4415
+ return identifier;
4416
+ }
4417
+ return normalizeIdentifier(identifier);
4418
+ }
4419
+ function composedStyle(rules, debugId) {
4420
+ var className = generateIdentifier(debugId);
4421
+ registerClassName(className, getFileScope());
4422
+ var classList = [];
4423
+ var styleRules = [];
4424
+ for (var rule of rules) {
4425
+ if (typeof rule === "string") {
4426
+ classList.push(rule);
4427
+ } else {
4428
+ styleRules.push(rule);
4429
+ }
4430
+ }
4431
+ var result = className;
4432
+ if (classList.length > 0) {
4433
+ result = "".concat(className, " ").concat(dudupeAndJoinClassList(classList));
4434
+ registerComposition({
4435
+ identifier: className,
4436
+ classList: result
4437
+ }, getFileScope());
4438
+ if (styleRules.length > 0) {
4439
+ markCompositionUsed(className);
4440
+ }
4441
+ }
4442
+ if (styleRules.length > 0) {
4443
+ var _rule = import_deepmerge.default.all(styleRules, {
4444
+ // Replace arrays rather than merging
4445
+ arrayMerge: (_, sourceArray) => sourceArray
4446
+ });
4447
+ appendCss({
4448
+ type: "local",
4449
+ selector: className,
4450
+ rule: _rule
4451
+ }, getFileScope());
4452
+ }
4453
+ return result;
4454
+ }
4455
+ function style(rule, debugId) {
4456
+ if (Array.isArray(rule)) {
4457
+ return composedStyle(rule, debugId);
4458
+ }
4459
+ var className = generateIdentifier(debugId);
4460
+ registerClassName(className, getFileScope());
4461
+ appendCss({
4462
+ type: "local",
4463
+ selector: className,
4464
+ rule
4465
+ }, getFileScope());
4466
+ return className;
4467
+ }
4468
+ function globalStyle(selector, rule) {
4469
+ appendCss({
4470
+ type: "global",
4471
+ selector,
4472
+ rule
4473
+ }, getFileScope());
4474
+ }
4475
+ function styleVariants() {
4476
+ if (typeof (arguments.length <= 1 ? void 0 : arguments[1]) === "function") {
4477
+ var _data = arguments.length <= 0 ? void 0 : arguments[0];
4478
+ var _mapData = arguments.length <= 1 ? void 0 : arguments[1];
4479
+ var _debugId = arguments.length <= 2 ? void 0 : arguments[2];
4480
+ var _classMap = {};
4481
+ for (var _key2 in _data) {
4482
+ _classMap[_key2] = style(_mapData(_data[_key2], _key2), _debugId ? "".concat(_debugId, "_").concat(_key2) : _key2);
4483
+ }
4484
+ return _classMap;
4485
+ }
4486
+ var styleMap = arguments.length <= 0 ? void 0 : arguments[0];
4487
+ var debugId = arguments.length <= 1 ? void 0 : arguments[1];
4488
+ var classMap = {};
4489
+ for (var _key3 in styleMap) {
4490
+ classMap[_key3] = style(styleMap[_key3], debugId ? "".concat(debugId, "_").concat(_key3) : _key3);
4491
+ }
4492
+ return classMap;
4493
+ }
4494
+
4495
+ // node_modules/.pnpm/@vanilla-extract+recipes@0.5.5_@vanilla-extract+css@1.16.0/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js
4496
+ function toPrimitive2(t, r) {
4497
+ if ("object" != typeof t || !t) return t;
4498
+ var e = t[Symbol.toPrimitive];
4499
+ if (void 0 !== e) {
4500
+ var i = e.call(t, r || "default");
4501
+ if ("object" != typeof i) return i;
4502
+ throw new TypeError("@@toPrimitive must return a primitive value.");
4503
+ }
4504
+ return ("string" === r ? String : Number)(t);
4505
+ }
4506
+ function toPropertyKey2(t) {
4507
+ var i = toPrimitive2(t, "string");
4508
+ return "symbol" == typeof i ? i : String(i);
4509
+ }
4510
+ function _defineProperty3(obj, key, value) {
4511
+ key = toPropertyKey2(key);
4512
+ if (key in obj) {
4513
+ Object.defineProperty(obj, key, {
4514
+ value,
4515
+ enumerable: true,
4516
+ configurable: true,
4517
+ writable: true
4518
+ });
4519
+ } else {
4520
+ obj[key] = value;
4521
+ }
4522
+ return obj;
4523
+ }
4524
+ function ownKeys3(e, r) {
4525
+ var t = Object.keys(e);
4526
+ if (Object.getOwnPropertySymbols) {
4527
+ var o = Object.getOwnPropertySymbols(e);
4528
+ r && (o = o.filter(function(r2) {
4529
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
4530
+ })), t.push.apply(t, o);
4531
+ }
4532
+ return t;
4533
+ }
4534
+ function _objectSpread22(e) {
4535
+ for (var r = 1; r < arguments.length; r++) {
4536
+ var t = null != arguments[r] ? arguments[r] : {};
4537
+ r % 2 ? ownKeys3(Object(t), true).forEach(function(r2) {
4538
+ _defineProperty3(e, r2, t[r2]);
4539
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys3(Object(t)).forEach(function(r2) {
4540
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
4541
+ });
4542
+ }
4543
+ return e;
4544
+ }
4545
+ function mapValues(input, fn) {
4546
+ var result = {};
4547
+ for (var _key in input) {
4548
+ result[_key] = fn(input[_key], _key);
4549
+ }
4550
+ return result;
4551
+ }
4552
+ var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
4553
+ for (var key of Object.keys(compoundCheck)) {
4554
+ var _selections$key;
4555
+ if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
4556
+ return false;
4557
+ }
4558
+ }
4559
+ return true;
4560
+ };
4561
+ var createRuntimeFn = (config) => {
4562
+ var runtimeFn = (options) => {
4563
+ var className = config.defaultClassName;
4564
+ var selections = _objectSpread22(_objectSpread22({}, config.defaultVariants), options);
4565
+ for (var variantName in selections) {
4566
+ var _selections$variantNa;
4567
+ var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
4568
+ if (variantSelection != null) {
4569
+ var selection = variantSelection;
4570
+ if (typeof selection === "boolean") {
4571
+ selection = selection === true ? "true" : "false";
4572
+ }
4573
+ var selectionClassName = (
4574
+ // @ts-expect-error
4575
+ config.variantClassNames[variantName][selection]
4576
+ );
4577
+ if (selectionClassName) {
4578
+ className += " " + selectionClassName;
4579
+ }
4580
+ }
4581
+ }
4582
+ for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
4583
+ if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
4584
+ className += " " + compoundClassName;
4585
+ }
4586
+ }
4587
+ return className;
4588
+ };
4589
+ runtimeFn.variants = () => Object.keys(config.variantClassNames);
4590
+ runtimeFn.classNames = {
4591
+ get base() {
4592
+ return config.defaultClassName.split(" ")[0];
4593
+ },
4594
+ get variants() {
4595
+ return mapValues(config.variantClassNames, (classNames) => mapValues(classNames, (className) => className.split(" ")[0]));
4596
+ }
4597
+ };
4598
+ return runtimeFn;
4599
+ };
4600
+
4601
+ // node_modules/.pnpm/@vanilla-extract+recipes@0.5.5_@vanilla-extract+css@1.16.0/node_modules/@vanilla-extract/recipes/dist/vanilla-extract-recipes.esm.js
4602
+ function recipe(options, debugId) {
4603
+ var {
4604
+ variants = {},
4605
+ defaultVariants = {},
4606
+ compoundVariants = [],
4607
+ base
4608
+ } = options;
4609
+ var defaultClassName;
4610
+ if (!base || typeof base === "string") {
4611
+ var baseClassName = style({});
4612
+ defaultClassName = base ? "".concat(baseClassName, " ").concat(base) : baseClassName;
4613
+ } else {
4614
+ defaultClassName = style(base, debugId);
4615
+ }
4616
+ var variantClassNames = mapValues(variants, (variantGroup, variantGroupName) => styleVariants(variantGroup, (styleRule) => typeof styleRule === "string" ? [styleRule] : styleRule, debugId ? "".concat(debugId, "_").concat(variantGroupName) : variantGroupName));
4617
+ var compounds = [];
4618
+ for (var {
4619
+ style: theStyle,
4620
+ variants: _variants
4621
+ } of compoundVariants) {
4622
+ compounds.push([_variants, typeof theStyle === "string" ? theStyle : style(theStyle, "".concat(debugId, "_compound_").concat(compounds.length))]);
4623
+ }
4624
+ var config = {
4625
+ defaultClassName,
4626
+ variantClassNames,
4627
+ defaultVariants,
4628
+ compoundVariants: compounds
4629
+ };
4630
+ return addRecipe(createRuntimeFn(config), {
4631
+ importPath: "@vanilla-extract/recipes/createRuntimeFn",
4632
+ importName: "createRuntimeFn",
4633
+ // @ts-expect-error
4634
+ args: [config]
4635
+ });
4636
+ }
4637
+
4638
+ // src/react/ui/icons/styles.css.ts
4639
+ var iconVariants = recipe({
4640
+ base: {
4641
+ flexShrink: 0
4642
+ },
4643
+ variants: {
4644
+ size: {
4645
+ xs: {
4646
+ height: vars.lineHeights[4],
4647
+ width: vars.lineHeights[4]
4648
+ },
4649
+ sm: {
4650
+ height: vars.lineHeights[5],
4651
+ width: vars.lineHeights[5]
4652
+ },
4653
+ md: {
4654
+ height: vars.lineHeights[6],
4655
+ width: vars.lineHeights[6]
4656
+ },
4657
+ lg: {
4658
+ height: vars.lineHeights[7],
4659
+ width: vars.lineHeights[7]
4660
+ },
4661
+ xl: {
4662
+ height: vars.lineHeights[9],
4663
+ width: vars.lineHeights[9]
4664
+ }
4665
+ }
4666
+ }
4667
+ });
4668
+
4669
+ // src/react/ui/styles/modal.css.ts
4670
+ import { atoms } from "@0xsequence/design-system";
4671
+ var dialogOverlay = style([
4672
+ atoms({
4673
+ background: "backgroundBackdrop",
4674
+ position: "fixed",
4675
+ inset: "0",
4676
+ zIndex: "20"
4677
+ })
4678
+ ]);
4679
+ var dialogContentBase = style([
4680
+ atoms({
4681
+ display: "flex",
4682
+ background: "backgroundPrimary",
4683
+ borderRadius: "lg",
4684
+ position: "fixed",
4685
+ zIndex: "20"
4686
+ }),
4687
+ {
4688
+ top: "50%",
4689
+ left: "50%",
4690
+ transform: "translate(-50%, -50%)",
4691
+ padding: "24px"
4692
+ }
4693
+ ]);
4694
+ var dialogContent = styleVariants({
4695
+ narrow: [
4696
+ dialogContentBase,
4697
+ {
4698
+ width: "360px",
4699
+ "@media": {
4700
+ "screen and (max-width: 360px)": {
4701
+ width: "100%",
4702
+ bottom: "0",
4703
+ transform: "unset",
4704
+ top: "unset",
4705
+ left: "unset",
4706
+ borderBottomLeftRadius: "0 !important",
4707
+ borderBottomRightRadius: "0 !important"
4708
+ }
4709
+ }
4710
+ }
4711
+ ],
4712
+ wide: [
4713
+ dialogContentBase,
4714
+ {
4715
+ width: "540px",
4716
+ "@media": {
4717
+ "screen and (max-width: 540px)": {
4718
+ width: "100%",
4719
+ bottom: "0",
4720
+ transform: "unset",
4721
+ top: "unset",
4722
+ left: "unset",
4723
+ borderBottomLeftRadius: "0 !important",
4724
+ borderBottomRightRadius: "0 !important"
4725
+ }
4726
+ }
4727
+ }
4728
+ ]
4729
+ });
4730
+ var closeButton = style([
4731
+ atoms({
4732
+ position: "absolute",
4733
+ right: "6",
4734
+ top: "6"
4735
+ })
4736
+ ]);
4737
+
4738
+ // src/react/ui/modals/_internal/components/actionModal/styles.css.ts
4739
+ var cta = style({
4740
+ borderRadius: "12px !important"
4741
+ });
4742
+ globalStyle(`${cta} > div`, {
4743
+ justifyContent: "center !important"
4744
+ });
4745
+
4746
+ // src/react/ui/modals/_internal/components/calendarPopover/styles.css.ts
4747
+ var dateSelectButton = style({
4748
+ flex: "3 !important",
4749
+ padding: "10px 8px !important",
4750
+ height: "36px !important",
4751
+ border: "1px solid #4F4F4F !important",
4752
+ borderRadius: "4px !important",
4753
+ fontWeight: "400 !important",
4754
+ fontSize: "12px !important"
4755
+ });
4756
+ var dateSelectPopoverContent = style({
4757
+ zIndex: 20,
4758
+ pointerEvents: "all"
4759
+ });
4760
+
4761
+ // src/react/ui/modals/_internal/components/currencyOptionsSelect/styles.css.ts
4762
+ import { atoms as atoms2 } from "@0xsequence/design-system";
4763
+ var currencySelect = style([
4764
+ atoms2({
4765
+ height: "full"
4766
+ })
4767
+ ]);
4768
+ globalStyle(`${currencySelect} > label`, {
4769
+ height: "100%"
4770
+ });
4771
+ globalStyle(`${currencySelect} > label > button`, {
4772
+ background: "#FFFFFF1A",
4773
+ borderRadius: 30,
4774
+ padding: "12px",
4775
+ marginRight: 8,
4776
+ marginTop: 4,
4777
+ marginBottom: 4,
4778
+ height: 28,
4779
+ border: "none",
4780
+ boxShadow: "none"
4781
+ });
4782
+ globalStyle(`${currencySelect} > label > button > span`, {
4783
+ fontSize: 10
4784
+ });
4785
+ globalStyle(`${currencySelect} > label > button > span > svg`, {
4786
+ width: 16,
4787
+ height: 16
4788
+ });
4789
+
4790
+ // src/react/ui/modals/_internal/components/expirationDateSelect/styles.css.ts
4791
+ var rangeSelect = style({
4792
+ flex: 2
4793
+ });
4794
+ globalStyle(`${rangeSelect} > label > button`, {
4795
+ background: "#FFFFFF1A",
4796
+ borderRadius: 30,
4797
+ padding: "12px",
4798
+ marginTop: 4,
4799
+ marginBottom: 4,
4800
+ height: 28,
4801
+ border: "none",
4802
+ boxShadow: "none"
4803
+ });
4804
+ globalStyle(`${rangeSelect} > label > button > span`, {
4805
+ fontSize: 10
4806
+ });
4807
+ globalStyle(`${rangeSelect} > label > button > span > svg`, {
4808
+ width: 16,
4809
+ height: 16
4810
+ });
4811
+
4812
+ // src/react/ui/modals/_internal/components/priceInput/styles.css.ts
4813
+ var priceInputWrapper = style({
4814
+ display: "flex",
4815
+ flexDirection: "column",
4816
+ width: "100%"
4817
+ });
4818
+ globalStyle(`${priceInputWrapper} > label`, {
4819
+ gap: 2
4820
+ });
4821
+ globalStyle(`${priceInputWrapper} > label > div > div`, {
4822
+ height: 36,
4823
+ fontSize: 12,
4824
+ borderRadius: 4,
4825
+ paddingLeft: 28,
4826
+ paddingRight: 0
4827
+ });
4828
+ globalStyle(`${priceInputWrapper} > label > div > div > input`, {
4829
+ fontSize: 12
4830
+ });
4831
+
4832
+ // src/react/ui/modals/_internal/components/quantityInput/styles.css.ts
4833
+ var quantityInputWrapper = style({
4834
+ display: "flex",
4835
+ flexDirection: "column",
4836
+ width: "100%"
4837
+ });
4838
+ globalStyle(`${quantityInputWrapper} > label`, {
4839
+ gap: 2
4840
+ });
4841
+ globalStyle(`${quantityInputWrapper} > label > div > div`, {
4842
+ height: 36,
4843
+ fontSize: 12,
4844
+ borderRadius: 4,
4845
+ paddingLeft: 12,
4846
+ paddingRight: 0
4847
+ });
4848
+ globalStyle(
4849
+ `${quantityInputWrapper} > label > div > div:has(:disabled) , ${quantityInputWrapper} > label > div > div:has(:disabled):hover`,
4850
+ {
4851
+ opacity: 1
4852
+ }
4853
+ );
4854
+ globalStyle(`${quantityInputWrapper} > label > div > div > input`, {
4855
+ fontSize: 12
4856
+ });
4857
+
4858
+ // src/react/ui/modals/_internal/components/tokenPreview/styles.css.ts
4859
+ import { atoms as atoms3 } from "@0xsequence/design-system";
4860
+ var tokenPreview = style([
4861
+ atoms3({
4862
+ display: "flex",
4863
+ alignItems: "center",
4864
+ width: "full",
4865
+ marginX: "4"
4866
+ })
4867
+ ]);
4868
+
4869
+ // src/react/ui/modals/_internal/components/alertMessage/styles.css.ts
4870
+ import { atoms as atoms4 } from "@0xsequence/design-system";
4871
+ var alertMessageBox = style([
4872
+ atoms4({
4873
+ display: "flex",
4874
+ alignItems: "center",
4875
+ justifyContent: "space-between",
4876
+ gap: "3",
4877
+ padding: "4",
4878
+ borderRadius: "md"
4879
+ })
4880
+ ]);
4881
+ var alertMessageBoxVariants = styleVariants({
4882
+ warning: {
4883
+ background: "hsla(39, 71%, 40%, 0.3)"
4884
+ },
4885
+ info: {
4886
+ background: "hsla(247, 100%, 75%, 0.3)"
4887
+ }
4888
+ });
4889
+
4890
+ // src/react/ui/modals/_internal/components/switchChainModal/styles.css.ts
4891
+ import { atoms as atoms5 } from "@0xsequence/design-system";
4892
+ var switchChainModalContent = style([
4893
+ dialogContent.wide,
4894
+ atoms5({
4895
+ display: "grid",
4896
+ flexDirection: "column",
4897
+ gap: "6",
4898
+ padding: "7"
4899
+ })
4900
+ ]);
4901
+ var switchChainCtaBase = style({
4902
+ width: "147px"
4903
+ });
4904
+ var switchChainCta = styleVariants({
4905
+ default: [switchChainCtaBase],
4906
+ pending: [
4907
+ switchChainCtaBase,
4908
+ {
4909
+ display: "flex",
4910
+ alignItems: "center",
4911
+ justifyContent: "center"
4912
+ }
4913
+ ]
4914
+ });
4915
+ globalStyle(`${switchChainCta.pending} > div`, {
4916
+ justifyContent: "center"
4917
+ });
4918
+
4919
+ // src/react/ui/modals/SuccessfulPurchaseModal/styles.css.ts
4920
+ var collectiblesGrid = style({
4921
+ display: "grid",
4922
+ gridTemplateColumns: "repeat(auto-fill, minmax(150px, 1fr))"
4923
+ });
4924
+ var collectiblesGridItem = style({
4925
+ width: "150px",
4926
+ height: "150px"
4927
+ });
4928
+ globalStyle(
4929
+ `${collectiblesGrid} > ${collectiblesGridItem}:nth-child(1):only-child`,
4930
+ {
4931
+ width: "312px",
4932
+ height: "312px"
4933
+ }
4934
+ );
4935
+ globalStyle(`${collectiblesGrid} > ${collectiblesGridItem}:nth-child(3)`, {
4936
+ gridColumn: "1 / -1",
4937
+ justifySelf: "center"
4938
+ });
4939
+ globalStyle(
4940
+ `${collectiblesGrid}:has(${collectiblesGridItem}:nth-child(4)) > ${collectiblesGridItem}`,
4941
+ {
4942
+ gridColumn: "unset"
4943
+ }
4944
+ );
4945
+ var collectiblesGridImage = style({
4946
+ width: "100%",
4947
+ height: "100%",
4948
+ objectFit: "contain"
4949
+ });
4950
+ var collectiblesGridImagePale = style([
4951
+ collectiblesGridImage,
4952
+ {
4953
+ // opacity:1 is set to inline style of the @0xsequence/design-system Image component, so we need to use !important
4954
+ opacity: "0.4 !important"
4955
+ }
4956
+ ]);
4957
+
4958
+ // src/react/ui/modals/TransferModal/styles.css.ts
4959
+ import { atoms as atoms6 } from "@0xsequence/design-system";
4960
+ var transferModalContent = style([
4961
+ dialogContent.wide,
4962
+ atoms6({
4963
+ padding: "7"
4964
+ }),
4965
+ {
4966
+ width: "540px",
4967
+ "@media": {
4968
+ "screen and (max-width: 540px)": {
4969
+ width: "100%"
4970
+ }
4971
+ }
4972
+ }
4973
+ ]);
4974
+ export {
4975
+ alertMessageBox,
4976
+ alertMessageBoxVariants,
4977
+ closeButton,
4978
+ collectiblesGrid,
4979
+ collectiblesGridImage,
4980
+ collectiblesGridImagePale,
4981
+ collectiblesGridItem,
4982
+ cta,
4983
+ currencySelect,
4984
+ dateSelectButton,
4985
+ dateSelectPopoverContent,
4986
+ dialogContent,
4987
+ dialogOverlay,
4988
+ iconVariants,
4989
+ priceInputWrapper,
4990
+ quantityInputWrapper,
4991
+ rangeSelect,
4992
+ switchChainCta,
4993
+ switchChainModalContent,
4994
+ tokenPreview,
4995
+ transferModalContent
4996
+ };
4997
+ /*! Bundled license information:
4998
+
4999
+ cssesc/cssesc.js:
5000
+ (*! https://mths.be/cssesc v3.0.0 by @mathias *)
5001
+
5002
+ media-query-parser/dist/media-query-parser.esm.js:
5003
+ (*! @license MediaQueryParser - MIT License - Tom Golden (github@tbjgolden.com) *)
5004
+ (*! *****************************************************************************
5005
+ Copyright (c) Microsoft Corporation.
5006
+
5007
+ Permission to use, copy, modify, and/or distribute this software for any
5008
+ purpose with or without fee is hereby granted.
5009
+
5010
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
5011
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
5012
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
5013
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
5014
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
5015
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5016
+ PERFORMANCE OF THIS SOFTWARE.
5017
+ ***************************************************************************** *)
5018
+ */
5019
+ //# sourceMappingURL=index.js.map