@jesscss/core 2.0.0-alpha.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 (423) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -0
  3. package/lib/context.d.ts +352 -0
  4. package/lib/context.d.ts.map +1 -0
  5. package/lib/context.js +636 -0
  6. package/lib/context.js.map +1 -0
  7. package/lib/conversions.d.ts +73 -0
  8. package/lib/conversions.d.ts.map +1 -0
  9. package/lib/conversions.js +253 -0
  10. package/lib/conversions.js.map +1 -0
  11. package/lib/debug-log.d.ts +2 -0
  12. package/lib/debug-log.d.ts.map +1 -0
  13. package/lib/debug-log.js +27 -0
  14. package/lib/debug-log.js.map +1 -0
  15. package/lib/define-function.d.ts +587 -0
  16. package/lib/define-function.d.ts.map +1 -0
  17. package/lib/define-function.js +726 -0
  18. package/lib/define-function.js.map +1 -0
  19. package/lib/deprecation.d.ts +34 -0
  20. package/lib/deprecation.d.ts.map +1 -0
  21. package/lib/deprecation.js +57 -0
  22. package/lib/deprecation.js.map +1 -0
  23. package/lib/index.d.ts +22 -0
  24. package/lib/index.d.ts.map +1 -0
  25. package/lib/index.js +23 -0
  26. package/lib/index.js.map +1 -0
  27. package/lib/jess-error.d.ts +343 -0
  28. package/lib/jess-error.d.ts.map +1 -0
  29. package/lib/jess-error.js +508 -0
  30. package/lib/jess-error.js.map +1 -0
  31. package/lib/logger/deprecation-processing.d.ts +41 -0
  32. package/lib/logger/deprecation-processing.d.ts.map +1 -0
  33. package/lib/logger/deprecation-processing.js +81 -0
  34. package/lib/logger/deprecation-processing.js.map +1 -0
  35. package/lib/logger.d.ts +10 -0
  36. package/lib/logger.d.ts.map +1 -0
  37. package/lib/logger.js +20 -0
  38. package/lib/logger.js.map +1 -0
  39. package/lib/plugin.d.ts +94 -0
  40. package/lib/plugin.d.ts.map +1 -0
  41. package/lib/plugin.js +174 -0
  42. package/lib/plugin.js.map +1 -0
  43. package/lib/tree/ampersand.d.ts +94 -0
  44. package/lib/tree/ampersand.d.ts.map +1 -0
  45. package/lib/tree/ampersand.js +269 -0
  46. package/lib/tree/ampersand.js.map +1 -0
  47. package/lib/tree/any.d.ts +58 -0
  48. package/lib/tree/any.d.ts.map +1 -0
  49. package/lib/tree/any.js +101 -0
  50. package/lib/tree/any.js.map +1 -0
  51. package/lib/tree/at-rule.d.ts +53 -0
  52. package/lib/tree/at-rule.d.ts.map +1 -0
  53. package/lib/tree/at-rule.js +503 -0
  54. package/lib/tree/at-rule.js.map +1 -0
  55. package/lib/tree/block.d.ts +22 -0
  56. package/lib/tree/block.d.ts.map +1 -0
  57. package/lib/tree/block.js +24 -0
  58. package/lib/tree/block.js.map +1 -0
  59. package/lib/tree/bool.d.ts +17 -0
  60. package/lib/tree/bool.d.ts.map +1 -0
  61. package/lib/tree/bool.js +24 -0
  62. package/lib/tree/bool.js.map +1 -0
  63. package/lib/tree/call.d.ts +66 -0
  64. package/lib/tree/call.d.ts.map +1 -0
  65. package/lib/tree/call.js +306 -0
  66. package/lib/tree/call.js.map +1 -0
  67. package/lib/tree/collection.d.ts +30 -0
  68. package/lib/tree/collection.d.ts.map +1 -0
  69. package/lib/tree/collection.js +37 -0
  70. package/lib/tree/collection.js.map +1 -0
  71. package/lib/tree/color.d.ts +101 -0
  72. package/lib/tree/color.d.ts.map +1 -0
  73. package/lib/tree/color.js +513 -0
  74. package/lib/tree/color.js.map +1 -0
  75. package/lib/tree/combinator.d.ts +12 -0
  76. package/lib/tree/combinator.d.ts.map +1 -0
  77. package/lib/tree/combinator.js +8 -0
  78. package/lib/tree/combinator.js.map +1 -0
  79. package/lib/tree/comment.d.ts +20 -0
  80. package/lib/tree/comment.d.ts.map +1 -0
  81. package/lib/tree/comment.js +18 -0
  82. package/lib/tree/comment.js.map +1 -0
  83. package/lib/tree/condition.d.ts +31 -0
  84. package/lib/tree/condition.d.ts.map +1 -0
  85. package/lib/tree/condition.js +103 -0
  86. package/lib/tree/condition.js.map +1 -0
  87. package/lib/tree/control.d.ts +104 -0
  88. package/lib/tree/control.d.ts.map +1 -0
  89. package/lib/tree/control.js +430 -0
  90. package/lib/tree/control.js.map +1 -0
  91. package/lib/tree/declaration-custom.d.ts +18 -0
  92. package/lib/tree/declaration-custom.d.ts.map +1 -0
  93. package/lib/tree/declaration-custom.js +24 -0
  94. package/lib/tree/declaration-custom.js.map +1 -0
  95. package/lib/tree/declaration-var.d.ts +36 -0
  96. package/lib/tree/declaration-var.d.ts.map +1 -0
  97. package/lib/tree/declaration-var.js +63 -0
  98. package/lib/tree/declaration-var.js.map +1 -0
  99. package/lib/tree/declaration.d.ts +78 -0
  100. package/lib/tree/declaration.d.ts.map +1 -0
  101. package/lib/tree/declaration.js +289 -0
  102. package/lib/tree/declaration.js.map +1 -0
  103. package/lib/tree/default-guard.d.ts +15 -0
  104. package/lib/tree/default-guard.d.ts.map +1 -0
  105. package/lib/tree/default-guard.js +19 -0
  106. package/lib/tree/default-guard.js.map +1 -0
  107. package/lib/tree/dimension.d.ts +33 -0
  108. package/lib/tree/dimension.d.ts.map +1 -0
  109. package/lib/tree/dimension.js +291 -0
  110. package/lib/tree/dimension.js.map +1 -0
  111. package/lib/tree/expression.d.ts +24 -0
  112. package/lib/tree/expression.d.ts.map +1 -0
  113. package/lib/tree/expression.js +28 -0
  114. package/lib/tree/expression.js.map +1 -0
  115. package/lib/tree/extend-list.d.ts +23 -0
  116. package/lib/tree/extend-list.d.ts.map +1 -0
  117. package/lib/tree/extend-list.js +20 -0
  118. package/lib/tree/extend-list.js.map +1 -0
  119. package/lib/tree/extend.d.ts +47 -0
  120. package/lib/tree/extend.d.ts.map +1 -0
  121. package/lib/tree/extend.js +292 -0
  122. package/lib/tree/extend.js.map +1 -0
  123. package/lib/tree/function.d.ts +48 -0
  124. package/lib/tree/function.d.ts.map +1 -0
  125. package/lib/tree/function.js +74 -0
  126. package/lib/tree/function.js.map +1 -0
  127. package/lib/tree/import-js.d.ts +35 -0
  128. package/lib/tree/import-js.d.ts.map +1 -0
  129. package/lib/tree/import-js.js +45 -0
  130. package/lib/tree/import-js.js.map +1 -0
  131. package/lib/tree/import-style.d.ts +156 -0
  132. package/lib/tree/import-style.d.ts.map +1 -0
  133. package/lib/tree/import-style.js +556 -0
  134. package/lib/tree/import-style.js.map +1 -0
  135. package/lib/tree/index.d.ts +71 -0
  136. package/lib/tree/index.d.ts.map +1 -0
  137. package/lib/tree/index.js +95 -0
  138. package/lib/tree/index.js.map +1 -0
  139. package/lib/tree/interpolated-reference.d.ts +24 -0
  140. package/lib/tree/interpolated-reference.d.ts.map +1 -0
  141. package/lib/tree/interpolated-reference.js +37 -0
  142. package/lib/tree/interpolated-reference.js.map +1 -0
  143. package/lib/tree/interpolated.d.ts +62 -0
  144. package/lib/tree/interpolated.d.ts.map +1 -0
  145. package/lib/tree/interpolated.js +204 -0
  146. package/lib/tree/interpolated.js.map +1 -0
  147. package/lib/tree/js-array.d.ts +10 -0
  148. package/lib/tree/js-array.d.ts.map +1 -0
  149. package/lib/tree/js-array.js +10 -0
  150. package/lib/tree/js-array.js.map +1 -0
  151. package/lib/tree/js-expr.d.ts +23 -0
  152. package/lib/tree/js-expr.d.ts.map +1 -0
  153. package/lib/tree/js-expr.js +28 -0
  154. package/lib/tree/js-expr.js.map +1 -0
  155. package/lib/tree/js-function.d.ts +20 -0
  156. package/lib/tree/js-function.d.ts.map +1 -0
  157. package/lib/tree/js-function.js +16 -0
  158. package/lib/tree/js-function.js.map +1 -0
  159. package/lib/tree/js-object.d.ts +10 -0
  160. package/lib/tree/js-object.d.ts.map +1 -0
  161. package/lib/tree/js-object.js +10 -0
  162. package/lib/tree/js-object.js.map +1 -0
  163. package/lib/tree/list.d.ts +38 -0
  164. package/lib/tree/list.d.ts.map +1 -0
  165. package/lib/tree/list.js +83 -0
  166. package/lib/tree/list.js.map +1 -0
  167. package/lib/tree/log.d.ts +29 -0
  168. package/lib/tree/log.d.ts.map +1 -0
  169. package/lib/tree/log.js +56 -0
  170. package/lib/tree/log.js.map +1 -0
  171. package/lib/tree/mixin.d.ts +87 -0
  172. package/lib/tree/mixin.d.ts.map +1 -0
  173. package/lib/tree/mixin.js +112 -0
  174. package/lib/tree/mixin.js.map +1 -0
  175. package/lib/tree/negative.d.ts +17 -0
  176. package/lib/tree/negative.d.ts.map +1 -0
  177. package/lib/tree/negative.js +22 -0
  178. package/lib/tree/negative.js.map +1 -0
  179. package/lib/tree/nil.d.ts +31 -0
  180. package/lib/tree/nil.d.ts.map +1 -0
  181. package/lib/tree/nil.js +36 -0
  182. package/lib/tree/nil.js.map +1 -0
  183. package/lib/tree/node-base.d.ts +359 -0
  184. package/lib/tree/node-base.d.ts.map +1 -0
  185. package/lib/tree/node-base.js +884 -0
  186. package/lib/tree/node-base.js.map +1 -0
  187. package/lib/tree/node.d.ts +10 -0
  188. package/lib/tree/node.d.ts.map +1 -0
  189. package/lib/tree/node.js +45 -0
  190. package/lib/tree/node.js.map +1 -0
  191. package/lib/tree/number.d.ts +21 -0
  192. package/lib/tree/number.d.ts.map +1 -0
  193. package/lib/tree/number.js +27 -0
  194. package/lib/tree/number.js.map +1 -0
  195. package/lib/tree/operation.d.ts +26 -0
  196. package/lib/tree/operation.d.ts.map +1 -0
  197. package/lib/tree/operation.js +103 -0
  198. package/lib/tree/operation.js.map +1 -0
  199. package/lib/tree/paren.d.ts +18 -0
  200. package/lib/tree/paren.d.ts.map +1 -0
  201. package/lib/tree/paren.js +86 -0
  202. package/lib/tree/paren.js.map +1 -0
  203. package/lib/tree/query-condition.d.ts +17 -0
  204. package/lib/tree/query-condition.d.ts.map +1 -0
  205. package/lib/tree/query-condition.js +39 -0
  206. package/lib/tree/query-condition.js.map +1 -0
  207. package/lib/tree/quoted.d.ts +27 -0
  208. package/lib/tree/quoted.d.ts.map +1 -0
  209. package/lib/tree/quoted.js +66 -0
  210. package/lib/tree/quoted.js.map +1 -0
  211. package/lib/tree/range.d.ts +33 -0
  212. package/lib/tree/range.d.ts.map +1 -0
  213. package/lib/tree/range.js +47 -0
  214. package/lib/tree/range.js.map +1 -0
  215. package/lib/tree/reference.d.ts +76 -0
  216. package/lib/tree/reference.d.ts.map +1 -0
  217. package/lib/tree/reference.js +521 -0
  218. package/lib/tree/reference.js.map +1 -0
  219. package/lib/tree/rest.d.ts +15 -0
  220. package/lib/tree/rest.d.ts.map +1 -0
  221. package/lib/tree/rest.js +32 -0
  222. package/lib/tree/rest.js.map +1 -0
  223. package/lib/tree/rules-raw.d.ts +17 -0
  224. package/lib/tree/rules-raw.d.ts.map +1 -0
  225. package/lib/tree/rules-raw.js +37 -0
  226. package/lib/tree/rules-raw.js.map +1 -0
  227. package/lib/tree/rules.d.ts +255 -0
  228. package/lib/tree/rules.d.ts.map +1 -0
  229. package/lib/tree/rules.js +2293 -0
  230. package/lib/tree/rules.js.map +1 -0
  231. package/lib/tree/ruleset.d.ts +91 -0
  232. package/lib/tree/ruleset.d.ts.map +1 -0
  233. package/lib/tree/ruleset.js +506 -0
  234. package/lib/tree/ruleset.js.map +1 -0
  235. package/lib/tree/selector-attr.d.ts +31 -0
  236. package/lib/tree/selector-attr.d.ts.map +1 -0
  237. package/lib/tree/selector-attr.js +99 -0
  238. package/lib/tree/selector-attr.js.map +1 -0
  239. package/lib/tree/selector-basic.d.ts +23 -0
  240. package/lib/tree/selector-basic.d.ts.map +1 -0
  241. package/lib/tree/selector-basic.js +34 -0
  242. package/lib/tree/selector-basic.js.map +1 -0
  243. package/lib/tree/selector-capture.d.ts +23 -0
  244. package/lib/tree/selector-capture.d.ts.map +1 -0
  245. package/lib/tree/selector-capture.js +34 -0
  246. package/lib/tree/selector-capture.js.map +1 -0
  247. package/lib/tree/selector-complex.d.ts +40 -0
  248. package/lib/tree/selector-complex.d.ts.map +1 -0
  249. package/lib/tree/selector-complex.js +143 -0
  250. package/lib/tree/selector-complex.js.map +1 -0
  251. package/lib/tree/selector-compound.d.ts +16 -0
  252. package/lib/tree/selector-compound.d.ts.map +1 -0
  253. package/lib/tree/selector-compound.js +114 -0
  254. package/lib/tree/selector-compound.js.map +1 -0
  255. package/lib/tree/selector-interpolated.d.ts +23 -0
  256. package/lib/tree/selector-interpolated.d.ts.map +1 -0
  257. package/lib/tree/selector-interpolated.js +27 -0
  258. package/lib/tree/selector-interpolated.js.map +1 -0
  259. package/lib/tree/selector-list.d.ts +17 -0
  260. package/lib/tree/selector-list.d.ts.map +1 -0
  261. package/lib/tree/selector-list.js +184 -0
  262. package/lib/tree/selector-list.js.map +1 -0
  263. package/lib/tree/selector-pseudo.d.ts +42 -0
  264. package/lib/tree/selector-pseudo.d.ts.map +1 -0
  265. package/lib/tree/selector-pseudo.js +191 -0
  266. package/lib/tree/selector-pseudo.js.map +1 -0
  267. package/lib/tree/selector-simple.d.ts +5 -0
  268. package/lib/tree/selector-simple.d.ts.map +1 -0
  269. package/lib/tree/selector-simple.js +6 -0
  270. package/lib/tree/selector-simple.js.map +1 -0
  271. package/lib/tree/selector.d.ts +43 -0
  272. package/lib/tree/selector.d.ts.map +1 -0
  273. package/lib/tree/selector.js +56 -0
  274. package/lib/tree/selector.js.map +1 -0
  275. package/lib/tree/sequence.d.ts +43 -0
  276. package/lib/tree/sequence.d.ts.map +1 -0
  277. package/lib/tree/sequence.js +148 -0
  278. package/lib/tree/sequence.js.map +1 -0
  279. package/lib/tree/tree.d.ts +87 -0
  280. package/lib/tree/tree.d.ts.map +1 -0
  281. package/lib/tree/tree.js +2 -0
  282. package/lib/tree/tree.js.map +1 -0
  283. package/lib/tree/url.d.ts +18 -0
  284. package/lib/tree/url.d.ts.map +1 -0
  285. package/lib/tree/url.js +35 -0
  286. package/lib/tree/url.js.map +1 -0
  287. package/lib/tree/util/__tests__/debug-log.d.ts +1 -0
  288. package/lib/tree/util/__tests__/debug-log.d.ts.map +1 -0
  289. package/lib/tree/util/__tests__/debug-log.js +36 -0
  290. package/lib/tree/util/__tests__/debug-log.js.map +1 -0
  291. package/lib/tree/util/calculate.d.ts +3 -0
  292. package/lib/tree/util/calculate.d.ts.map +1 -0
  293. package/lib/tree/util/calculate.js +10 -0
  294. package/lib/tree/util/calculate.js.map +1 -0
  295. package/lib/tree/util/cast.d.ts +10 -0
  296. package/lib/tree/util/cast.d.ts.map +1 -0
  297. package/lib/tree/util/cast.js +87 -0
  298. package/lib/tree/util/cast.js.map +1 -0
  299. package/lib/tree/util/cloning.d.ts +4 -0
  300. package/lib/tree/util/cloning.d.ts.map +1 -0
  301. package/lib/tree/util/cloning.js +8 -0
  302. package/lib/tree/util/cloning.js.map +1 -0
  303. package/lib/tree/util/collections.d.ts +57 -0
  304. package/lib/tree/util/collections.d.ts.map +1 -0
  305. package/lib/tree/util/collections.js +136 -0
  306. package/lib/tree/util/collections.js.map +1 -0
  307. package/lib/tree/util/compare.d.ts +11 -0
  308. package/lib/tree/util/compare.d.ts.map +1 -0
  309. package/lib/tree/util/compare.js +89 -0
  310. package/lib/tree/util/compare.js.map +1 -0
  311. package/lib/tree/util/extend-helpers.d.ts +2 -0
  312. package/lib/tree/util/extend-helpers.d.ts.map +1 -0
  313. package/lib/tree/util/extend-helpers.js +2 -0
  314. package/lib/tree/util/extend-helpers.js.map +1 -0
  315. package/lib/tree/util/extend-roots.d.ts +37 -0
  316. package/lib/tree/util/extend-roots.d.ts.map +1 -0
  317. package/lib/tree/util/extend-roots.js +682 -0
  318. package/lib/tree/util/extend-roots.js.map +1 -0
  319. package/lib/tree/util/extend-roots.old.d.ts +132 -0
  320. package/lib/tree/util/extend-roots.old.d.ts.map +1 -0
  321. package/lib/tree/util/extend-roots.old.js +2272 -0
  322. package/lib/tree/util/extend-roots.old.js.map +1 -0
  323. package/lib/tree/util/extend-trace-debug.d.ts +13 -0
  324. package/lib/tree/util/extend-trace-debug.d.ts.map +1 -0
  325. package/lib/tree/util/extend-trace-debug.js +34 -0
  326. package/lib/tree/util/extend-trace-debug.js.map +1 -0
  327. package/lib/tree/util/extend.d.ts +218 -0
  328. package/lib/tree/util/extend.d.ts.map +1 -0
  329. package/lib/tree/util/extend.js +3033 -0
  330. package/lib/tree/util/extend.js.map +1 -0
  331. package/lib/tree/util/find-extendable-locations.d.ts +2 -0
  332. package/lib/tree/util/find-extendable-locations.d.ts.map +1 -0
  333. package/lib/tree/util/find-extendable-locations.js +2 -0
  334. package/lib/tree/util/find-extendable-locations.js.map +1 -0
  335. package/lib/tree/util/format.d.ts +20 -0
  336. package/lib/tree/util/format.d.ts.map +1 -0
  337. package/lib/tree/util/format.js +67 -0
  338. package/lib/tree/util/format.js.map +1 -0
  339. package/lib/tree/util/is-node.d.ts +13 -0
  340. package/lib/tree/util/is-node.d.ts.map +1 -0
  341. package/lib/tree/util/is-node.js +43 -0
  342. package/lib/tree/util/is-node.js.map +1 -0
  343. package/lib/tree/util/print.d.ts +80 -0
  344. package/lib/tree/util/print.d.ts.map +1 -0
  345. package/lib/tree/util/print.js +205 -0
  346. package/lib/tree/util/print.js.map +1 -0
  347. package/lib/tree/util/process-leading-is.d.ts +25 -0
  348. package/lib/tree/util/process-leading-is.d.ts.map +1 -0
  349. package/lib/tree/util/process-leading-is.js +364 -0
  350. package/lib/tree/util/process-leading-is.js.map +1 -0
  351. package/lib/tree/util/recursion-helper.d.ts +15 -0
  352. package/lib/tree/util/recursion-helper.d.ts.map +1 -0
  353. package/lib/tree/util/recursion-helper.js +43 -0
  354. package/lib/tree/util/recursion-helper.js.map +1 -0
  355. package/lib/tree/util/regex.d.ts +4 -0
  356. package/lib/tree/util/regex.d.ts.map +1 -0
  357. package/lib/tree/util/regex.js +4 -0
  358. package/lib/tree/util/regex.js.map +1 -0
  359. package/lib/tree/util/registry-utils.d.ts +192 -0
  360. package/lib/tree/util/registry-utils.d.ts.map +1 -0
  361. package/lib/tree/util/registry-utils.js +1242 -0
  362. package/lib/tree/util/registry-utils.js.map +1 -0
  363. package/lib/tree/util/ruleset-trace.d.ts +4 -0
  364. package/lib/tree/util/ruleset-trace.d.ts.map +1 -0
  365. package/lib/tree/util/ruleset-trace.js +14 -0
  366. package/lib/tree/util/ruleset-trace.js.map +1 -0
  367. package/lib/tree/util/selector-compare.d.ts +2 -0
  368. package/lib/tree/util/selector-compare.d.ts.map +1 -0
  369. package/lib/tree/util/selector-compare.js +2 -0
  370. package/lib/tree/util/selector-compare.js.map +1 -0
  371. package/lib/tree/util/selector-match-core.d.ts +171 -0
  372. package/lib/tree/util/selector-match-core.d.ts.map +1 -0
  373. package/lib/tree/util/selector-match-core.js +1578 -0
  374. package/lib/tree/util/selector-match-core.js.map +1 -0
  375. package/lib/tree/util/selector-utils.d.ts +30 -0
  376. package/lib/tree/util/selector-utils.d.ts.map +1 -0
  377. package/lib/tree/util/selector-utils.js +100 -0
  378. package/lib/tree/util/selector-utils.js.map +1 -0
  379. package/lib/tree/util/serialize-helper.d.ts +13 -0
  380. package/lib/tree/util/serialize-helper.d.ts.map +1 -0
  381. package/lib/tree/util/serialize-helper.js +387 -0
  382. package/lib/tree/util/serialize-helper.js.map +1 -0
  383. package/lib/tree/util/serialize-types.d.ts +9 -0
  384. package/lib/tree/util/serialize-types.d.ts.map +1 -0
  385. package/lib/tree/util/serialize-types.js +216 -0
  386. package/lib/tree/util/serialize-types.js.map +1 -0
  387. package/lib/tree/util/should-operate.d.ts +23 -0
  388. package/lib/tree/util/should-operate.d.ts.map +1 -0
  389. package/lib/tree/util/should-operate.js +46 -0
  390. package/lib/tree/util/should-operate.js.map +1 -0
  391. package/lib/tree/util/sourcemap.d.ts +7 -0
  392. package/lib/tree/util/sourcemap.d.ts.map +1 -0
  393. package/lib/tree/util/sourcemap.js +25 -0
  394. package/lib/tree/util/sourcemap.js.map +1 -0
  395. package/lib/types/config.d.ts +205 -0
  396. package/lib/types/config.d.ts.map +1 -0
  397. package/lib/types/config.js +2 -0
  398. package/lib/types/config.js.map +1 -0
  399. package/lib/types/index.d.ts +15 -0
  400. package/lib/types/index.d.ts.map +1 -0
  401. package/lib/types/index.js +3 -0
  402. package/lib/types/index.js.map +1 -0
  403. package/lib/types/modes.d.ts +24 -0
  404. package/lib/types/modes.d.ts.map +1 -0
  405. package/lib/types/modes.js +2 -0
  406. package/lib/types/modes.js.map +1 -0
  407. package/lib/types.d.ts +61 -0
  408. package/lib/types.d.ts.map +1 -0
  409. package/lib/types.js +2 -0
  410. package/lib/types.js.map +1 -0
  411. package/lib/use-webpack-resolver.d.ts +9 -0
  412. package/lib/use-webpack-resolver.d.ts.map +1 -0
  413. package/lib/use-webpack-resolver.js +41 -0
  414. package/lib/use-webpack-resolver.js.map +1 -0
  415. package/lib/visitor/index.d.ts +136 -0
  416. package/lib/visitor/index.d.ts.map +1 -0
  417. package/lib/visitor/index.js +135 -0
  418. package/lib/visitor/index.js.map +1 -0
  419. package/lib/visitor/less-visitor.d.ts +7 -0
  420. package/lib/visitor/less-visitor.d.ts.map +1 -0
  421. package/lib/visitor/less-visitor.js +7 -0
  422. package/lib/visitor/less-visitor.js.map +1 -0
  423. package/package.json +66 -0
@@ -0,0 +1,10 @@
1
+ export interface Logger {
2
+ configure?(log: Logger): void;
3
+ log?(...args: any[]): void;
4
+ info?(...args: any[]): void;
5
+ warn?(...args: any[]): void;
6
+ error?(...args: any[]): void;
7
+ }
8
+ /** Configure with custom behavior */
9
+ export declare const logger: Required<Logger>;
10
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,MAAM;IACrB,SAAS,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3B,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CAC9B;AACD,qCAAqC;AACrC,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,MAAM,CAoBnC,CAAC"}
package/lib/logger.js ADDED
@@ -0,0 +1,20 @@
1
+ import chalk from 'chalk';
2
+ /** Configure with custom behavior */
3
+ export const logger = {
4
+ configure(log) {
5
+ Object.assign(logger, log);
6
+ },
7
+ log(...args) {
8
+ console.log(...args);
9
+ },
10
+ info(...args) {
11
+ console.info(...args);
12
+ },
13
+ warn(...args) {
14
+ console.error(chalk.yellow(...args));
15
+ },
16
+ error(...args) {
17
+ console.error(chalk.red(...args));
18
+ }
19
+ };
20
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,qCAAqC;AACrC,MAAM,CAAC,MAAM,MAAM,GAAqB;IACtC,SAAS,CAAC,GAAW;QACnB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,GAAG,CAAC,GAAG,IAAW;QAChB,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,CAAC,GAAG,IAAW;QACjB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,GAAG,IAAW;QACjB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,GAAG,IAAW;QAClB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC;CACF,CAAC"}
@@ -0,0 +1,94 @@
1
+ import type { Rules } from './tree/rules.js';
2
+ import type { Visitor } from './visitor/index.js';
3
+ import { type ErrorDiagnostic, type WarningDiagnostic } from './jess-error.js';
4
+ export type ISafeParseResult = {
5
+ /**
6
+ * The parsed tree, if parsing succeeded
7
+ */
8
+ tree?: Rules;
9
+ /**
10
+ * Normalized errors from parsing.
11
+ * This should include ALL errors from lexing, parsing, and any plugin-level issues.
12
+ * Plugins should convert all errors to normalized ErrorDiagnostic format.
13
+ * Always an array (empty if no errors).
14
+ */
15
+ errors: ErrorDiagnostic[];
16
+ /**
17
+ * Normalized warnings from parsing.
18
+ * This should include ALL warnings from lexing, parsing, and any plugin-level issues.
19
+ * Plugins should convert all warnings to normalized WarningDiagnostic format.
20
+ * Always an array (empty if no warnings).
21
+ */
22
+ warnings: WarningDiagnostic[];
23
+ };
24
+ export interface PluginInterface {
25
+ /**
26
+ * e.g. 'less-plugin'
27
+ */
28
+ name: string;
29
+ /**
30
+ * Queryable filter if we have resolved the extension
31
+ * no dots e.g. `['less', 'scss']`
32
+ */
33
+ supportedExtensions?: string[];
34
+ /**
35
+ * Expand an import path into a set of paths to try.
36
+ * e.g.
37
+ * `@import 'foo'` -> `['./foo.less']`
38
+ * `@import 'foo'` -> `['./foo.scss', './_foo.scss']`
39
+ */
40
+ expandImport?(importPath: string, currentDir: string): string[];
41
+ /**
42
+ * e.g.
43
+ * `./foo` -> `/Users/foo/bar/foo`
44
+ * `@/alias` -> `/Users/foo/bar/src/alias`
45
+ * `one/two` -> `/Users/foo/node_modules/one/two`
46
+ *
47
+ * Does not attempt to check if the path exists.
48
+ * Note: paths may already be absolute.
49
+ *
50
+ * If the plugin has nothing to change, return `null` or return the array as-is.
51
+ *
52
+ * @note - I suppose a plugin doesn't have to resolve to an absolute path, if it's
53
+ * using some other method to handle the resolved paths in `locate()`.
54
+ * To that end, `locate()` shouldn't presume that the paths are absolute.
55
+ */
56
+ resolve?(path: string | string[], currentDir: string, searchPaths: string[]): null | string[] | Promise<null | string[]>;
57
+ /**
58
+ * Pick the first one that exists. Return null to let another plugin handle the path.
59
+ */
60
+ locate?(pathCandidates: string[], currentDir: string): null | string | Promise<string | null>;
61
+ /**
62
+ * Get the source code for the file.
63
+ */
64
+ getSource?(absoluteFilePath: string): Promise<string>;
65
+ /**
66
+ * If we have the extension in `supportedExtensions`, and this method exists,
67
+ * then this plugin is assumed to be able to parse the file.
68
+ */
69
+ parse?(filePath: string, source: string): Rules;
70
+ /** No errors thrown; instead will return errors in the result */
71
+ safeParse?(filePath: string, source: string): ISafeParseResult;
72
+ /** If this method exists, then the plugin can return a JS module / object */
73
+ import?(absoluteFilePath: string): Promise<Record<string, any>>;
74
+ /** Post-parse or post-eval visitor(s) */
75
+ visitor?: Visitor | Visitor[];
76
+ /** Pre-eval visitor(s) - called before node.eval() during the preEval phase */
77
+ preEvalVisitor?: Visitor | Visitor[];
78
+ /** Post-eval visitor(s) - called after node.eval() (alternative to visitor for clarity) */
79
+ postEvalVisitor?: Visitor | Visitor[];
80
+ }
81
+ export declare abstract class AbstractPlugin implements PluginInterface {
82
+ abstract name: string;
83
+ /**
84
+ * Does a basic path resolution. Node resolution is in other plugins.
85
+ */
86
+ resolve(filePath: string | string[], currentDir: string, searchPaths: string[]): string[];
87
+ /** Default source getter */
88
+ getSource(absoluteFilePath: string): Promise<string>;
89
+ /** Gets the first match using from the filesystem that exists */
90
+ locate(pathCandidates: string[], currentDir: string): null | string;
91
+ parse(filePath: string, source: string): Rules;
92
+ }
93
+ export type Plugin = <T extends Record<string, any>>(opts?: T) => PluginInterface;
94
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAI7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAA2B,MAAM,iBAAiB,CAAC;AAE5H,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,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AAO,GAAG,OAAO,EAAE,CAAC;IAC9B,+EAA+E;IAC/E,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;IACrC,2FAA2F;IAC3F,eAAe,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;CACvC;AAID,8BAAsB,cAAe,YAAW,eAAe;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE;IAkB9E,4BAA4B;IACtB,SAAS,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAS1D,iEAAiE;IACjE,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM;IAUnE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK;CAkC/C;AAED,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,eAAe,CAAC"}
package/lib/plugin.js ADDED
@@ -0,0 +1,174 @@
1
+ import { join, isAbsolute, resolve } from 'node:path';
2
+ import { existsSync } from 'node:fs';
3
+ import { readFile } from 'node:fs/promises';
4
+ import { JessError } from './jess-error.js';
5
+ const { isArray } = Array;
6
+ export class AbstractPlugin {
7
+ /**
8
+ * Does a basic path resolution. Node resolution is in other plugins.
9
+ */
10
+ resolve(filePath, currentDir, searchPaths) {
11
+ const bases = [currentDir, ...searchPaths];
12
+ const out = [];
13
+ const seen = new Set();
14
+ filePath = isArray(filePath) ? filePath : [filePath];
15
+ for (const base of bases) {
16
+ const baseDir = isAbsolute(base) ? base : join(currentDir, base);
17
+ for (const path of filePath) {
18
+ const abs = resolve(baseDir, path);
19
+ if (abs && !seen.has(abs)) {
20
+ seen.add(abs);
21
+ out.push(abs);
22
+ }
23
+ }
24
+ }
25
+ return out;
26
+ }
27
+ /** Default source getter */
28
+ async getSource(absoluteFilePath) {
29
+ try {
30
+ const result = await readFile(absoluteFilePath, 'utf8');
31
+ return result;
32
+ }
33
+ catch (error) {
34
+ throw error;
35
+ }
36
+ }
37
+ /** Gets the first match using from the filesystem that exists */
38
+ locate(pathCandidates, currentDir) {
39
+ for (const candidate of pathCandidates) {
40
+ const absolutePath = isAbsolute(candidate) ? candidate : join(currentDir, candidate);
41
+ if (existsSync(absolutePath)) {
42
+ return absolutePath;
43
+ }
44
+ }
45
+ return null;
46
+ }
47
+ parse(filePath, source) {
48
+ const safeParse = this.safeParse;
49
+ if (!safeParse) {
50
+ throw new Error(`Plugin "${this.name}" does not support parsing`);
51
+ }
52
+ const { tree, errors } = safeParse.call(this, filePath, source);
53
+ if (errors.length > 0) {
54
+ const firstError = errors[0];
55
+ throw new JessError({
56
+ code: firstError.code,
57
+ phase: firstError.phase,
58
+ severity: 'error',
59
+ ctx: firstError.file ? { file: firstError.file } : undefined,
60
+ filePath: firstError.filePath,
61
+ source: firstError.file?.source,
62
+ line: firstError.line,
63
+ column: firstError.column,
64
+ reason: firstError.reason,
65
+ fix: firstError.fix,
66
+ note: firstError.note,
67
+ errors: firstError.errors,
68
+ lexerErrors: firstError.lexerErrors
69
+ });
70
+ }
71
+ if (!tree) {
72
+ throw new Error(`Plugin "${this.name}" failed to parse "${filePath}"`);
73
+ }
74
+ return tree;
75
+ }
76
+ }
77
+ // export abstract class FileManager<O extends Record<string, any> = Record<string, any>> {
78
+ // abstract supportedExtensions?: string[];
79
+ // constructor(
80
+ // public opts: Partial<O> = {}
81
+ // ) {}
82
+ // /**
83
+ // * Turns relative paths into absolute paths.
84
+ // * e.g.
85
+ // * `./foo` -> `/Users/foo/bar/foo`
86
+ // * `@/alias` -> `/Users/foo/bar/src/alias`
87
+ // * `one/two` -> `/Users/foo/node_modules/one/two`
88
+ // *
89
+ // * Does not attempt to check if the path exists.
90
+ // * Note: paths may already be absolute.
91
+ // */
92
+ // abstract resolver?(paths: Set<string>, currentDir: string): Set<string>;
93
+ // /**
94
+ // * e.g.
95
+ // * Less file manager: `@import 'foo'` -> `['./foo.less']`
96
+ // * Sass file manager: `@import 'foo'` -> `['./foo.scss', './_foo.scss']`
97
+ // */
98
+ // abstract getPathsToTry?(filePath: string, currentDir: string, paths: string[], options: PathOptions): Set<string>;
99
+ // /**
100
+ // * Get the final resolved path.
101
+ // *
102
+ // * @param filePath Will be a partial path
103
+ // * @param paths The paths to search. This should always contain
104
+ // * the directory context where the file was imported. Can be
105
+ // * a fully-qualified path or a glob. Relative paths
106
+ // * will be resolved relative to process.cwd(). Plugins
107
+ // * may alter the paths array and return false to let another
108
+ // * plugin handle the path resolution.
109
+ // * @param options Determined by the file manager
110
+ // */
111
+ // resolvePath(
112
+ // filePath: string,
113
+ // currentDir: string,
114
+ // paths: string[],
115
+ // options: PathOptions
116
+ // ): string | string[] {
117
+ // filePath = this.opts.resolver(filePath);
118
+ // const pathsTried: string[] = [];
119
+ // if (isAbsolute(filePath)) {
120
+ // pathsTried.push(filePath);
121
+ // if (existsSync(filePath)) {
122
+ // return filePath;
123
+ // }
124
+ // }
125
+ // let isRelative = filePath.startsWith('.');
126
+ // let tryPath: string | undefined;
127
+ // if (options.allowBareRelative || isRelative) {
128
+ // tryPath = join(currentDir, filePath);
129
+ // pathsTried.push(tryPath);
130
+ // if (existsSync(tryPath)) {
131
+ // return tryPath;
132
+ // }
133
+ // }
134
+ // if (!isRelative) {
135
+ // try {
136
+ // tryPath = require.resolve(filePath);
137
+ // if (existsSync(tryPath)) {
138
+ // return tryPath;
139
+ // }
140
+ // } catch (err) {
141
+ // // ignore
142
+ // }
143
+ // }
144
+ // for (let i = 0; i < paths.length; i++) {
145
+ // tryPath = join(paths[i]!, filePath);
146
+ // pathsTried.push(tryPath);
147
+ // if (existsSync(tryPath)) {
148
+ // return tryPath;
149
+ // }
150
+ // }
151
+ // return pathsTried;
152
+ // }
153
+ // async loadFile(fullPath: string) {
154
+ // return await readFile(fullPath, 'utf8');
155
+ // }
156
+ // /**
157
+ // * Can override this instead of `getTree` if we want
158
+ // * to preserve extension-checking logic.
159
+ // */
160
+ // protected async _getTree(fullPath: string, options?: Record<string, any>): Promise<Rules | false> {
161
+ // return false;
162
+ // }
163
+ // /**
164
+ // * @param fullPath The fully resolved path
165
+ // */
166
+ // async getTree(fullPath: string, options?: Record<string, any>): Promise<Rules | false> {
167
+ // const supported = this.supportedExtensions;
168
+ // if (supported && !supported.includes(extname(fullPath))) {
169
+ // return false;
170
+ // }
171
+ // return await this._getTree(fullPath, options);
172
+ // }
173
+ // }
174
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C,OAAO,EAAkF,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA0F5H,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;AAE1B,MAAM,OAAgB,cAAc;IAGlC;;OAEG;IACH,OAAO,CAAC,QAA2B,EAAE,UAAkB,EAAE,WAAqB;QAC5E,MAAM,KAAK,GAAG,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,CAAC;QAC3C,MAAM,GAAG,GAAa,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACrD,KAAK,MAAM,IAAI,IAAI,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;AACrD,MAAM;AACN,IAAI"}
@@ -0,0 +1,94 @@
1
+ import { type NodeOptions, type LocationInfo, type TreeContext, type Node } from './node.js';
2
+ import { Nil } from './nil.js';
3
+ import type { Context } from '../context.js';
4
+ import { SimpleSelector } from './selector-simple.js';
5
+ import { type Selector } from './selector.js';
6
+ import { type PrintOptions } from './util/print.js';
7
+ export type AmpersandValue = {
8
+ /**
9
+ * The only value that may exist is an anonymous value
10
+ * This is represented as &(). Any &() will signal
11
+ * a forced output (as well as an adjacent ident starting with
12
+ * a dash or numbers)
13
+ *
14
+ * @example
15
+ .rule {
16
+ &-foo {
17
+ color: red;
18
+ }
19
+ }
20
+ // output:
21
+ .rule-foo {
22
+ color: red;
23
+ }
24
+
25
+ .rule {
26
+ &(-foo) {
27
+ color: red;
28
+ }
29
+ }
30
+ // output:
31
+ .rule-foo {
32
+ color: red;
33
+ }
34
+
35
+ .rule {
36
+ &.foo {
37
+ color: red;
38
+ }
39
+ }
40
+ // output:
41
+ .rule {
42
+ &.foo {
43
+ color: red;
44
+ }
45
+ }
46
+
47
+ .rule {
48
+ &().foo {
49
+ color: red;
50
+ }
51
+ }
52
+ // output:
53
+ .rule.foo {
54
+ color: red;
55
+ }
56
+
57
+ */
58
+ /** Set to an empty string to hoist to root */
59
+ appendValue?: string;
60
+ /**
61
+ * When set (e.g. by ruleset preEval), returns the current parent ruleset's selector ("pointer").
62
+ * Prefer this over value.selector so extend sees the parent after it has been mutated (e.g. by extend).
63
+ */
64
+ selectorContainer?: {
65
+ selector?: Selector | Nil | undefined;
66
+ };
67
+ };
68
+ /**
69
+ * The '&' selector element
70
+ */
71
+ export declare class Ampersand extends SimpleSelector<{
72
+ appendValue?: string;
73
+ }> {
74
+ type: "Ampersand";
75
+ shortType: "amp";
76
+ private _storedSelector;
77
+ private _selectorContainer;
78
+ constructor(value?: AmpersandValue | string, options?: NodeOptions, location?: LocationInfo, treeContext?: TreeContext);
79
+ get keySet(): Set<string>;
80
+ /** The keys of an ampersand are the keys of the selector it contains */
81
+ protected _computeKeySetAndFastReject(): void;
82
+ /**
83
+ * Returns the current selector from the selector container (live when container is ruleset value).
84
+ * Used by extend, serialization, and matching so nested rules see the parent after extend.
85
+ */
86
+ getResolvedSelector(): Selector | Nil | undefined;
87
+ valueOf(): string;
88
+ toTrimmedString(options?: PrintOptions): string;
89
+ /** Hmm this should never return Extend */
90
+ evalNode(context: Context): Selector | Nil;
91
+ clone(deep?: boolean, cloneFn?: (n: Node) => Node): this;
92
+ }
93
+ export declare const amp: (value?: string | AmpersandValue | undefined, options?: NodeOptions | undefined, location?: LocationInfo | undefined) => Ampersand;
94
+ //# sourceMappingURL=ampersand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ampersand.d.ts","sourceRoot":"","sources":["../../src/tree/ampersand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAqC,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5I,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAKtD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,iBAAiB,CAAC;AAErE,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,iBAAiB,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,GAAG,GAAG,SAAS,CAAA;KAAE,CAAC;CAC/D,CAAC;AAEF;;GAEG;AACH,qBAAa,SAAU,SAAQ,cAAc,CAAC;IAAE,W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