@fluixi/utils 1.0.0-alpha.100

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 (364) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +68 -0
  3. package/dist/index.cjs +2858 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +1 -0
  7. package/dist/index.mjs +2838 -0
  8. package/dist/lib/array/advanced.cjs +2227 -0
  9. package/dist/lib/array/advanced.d.ts +1116 -0
  10. package/dist/lib/array/advanced.d.ts.map +1 -0
  11. package/dist/lib/array/advanced.js +2429 -0
  12. package/dist/lib/array/advanced.mjs +2204 -0
  13. package/dist/lib/array/array.cjs +57 -0
  14. package/dist/lib/array/array.d.ts +6 -0
  15. package/dist/lib/array/array.d.ts.map +1 -0
  16. package/dist/lib/array/array.js +31 -0
  17. package/dist/lib/array/array.mjs +36 -0
  18. package/dist/lib/array/index.cjs +2344 -0
  19. package/dist/lib/array/index.d.ts +4 -0
  20. package/dist/lib/array/index.d.ts.map +1 -0
  21. package/dist/lib/array/index.js +3 -0
  22. package/dist/lib/array/index.mjs +2322 -0
  23. package/dist/lib/array/utils.cjs +103 -0
  24. package/dist/lib/array/utils.d.ts +100 -0
  25. package/dist/lib/array/utils.d.ts.map +1 -0
  26. package/dist/lib/array/utils.js +165 -0
  27. package/dist/lib/array/utils.mjs +82 -0
  28. package/dist/lib/color/color.cjs +2190 -0
  29. package/dist/lib/color/color.d.ts +366 -0
  30. package/dist/lib/color/color.d.ts.map +1 -0
  31. package/dist/lib/color/color.js +722 -0
  32. package/dist/lib/color/color.mjs +2167 -0
  33. package/dist/lib/color/constants.cjs +380 -0
  34. package/dist/lib/color/constants.d.ts +361 -0
  35. package/dist/lib/color/constants.d.ts.map +1 -0
  36. package/dist/lib/color/constants.js +358 -0
  37. package/dist/lib/color/constants.mjs +359 -0
  38. package/dist/lib/color/conversions.cjs +629 -0
  39. package/dist/lib/color/conversions.d.ts +166 -0
  40. package/dist/lib/color/conversions.d.ts.map +1 -0
  41. package/dist/lib/color/conversions.js +766 -0
  42. package/dist/lib/color/conversions.mjs +608 -0
  43. package/dist/lib/color/helpers.cjs +2534 -0
  44. package/dist/lib/color/helpers.d.ts +75 -0
  45. package/dist/lib/color/helpers.d.ts.map +1 -0
  46. package/dist/lib/color/helpers.js +419 -0
  47. package/dist/lib/color/helpers.mjs +2511 -0
  48. package/dist/lib/color/index.cjs +2641 -0
  49. package/dist/lib/color/index.d.ts +12 -0
  50. package/dist/lib/color/index.d.ts.map +1 -0
  51. package/dist/lib/color/index.js +15 -0
  52. package/dist/lib/color/index.mjs +2619 -0
  53. package/dist/lib/color/types.cjs +18 -0
  54. package/dist/lib/color/types.d.ts +179 -0
  55. package/dist/lib/color/types.d.ts.map +1 -0
  56. package/dist/lib/color/types.js +1 -0
  57. package/dist/lib/color/types.mjs +0 -0
  58. package/dist/lib/color/utils.cjs +962 -0
  59. package/dist/lib/color/utils.d.ts +199 -0
  60. package/dist/lib/color/utils.d.ts.map +1 -0
  61. package/dist/lib/color/utils.js +858 -0
  62. package/dist/lib/color/utils.mjs +939 -0
  63. package/dist/lib/compare/comparators.cjs +171 -0
  64. package/dist/lib/compare/comparators.d.ts +65 -0
  65. package/dist/lib/compare/comparators.d.ts.map +1 -0
  66. package/dist/lib/compare/comparators.js +210 -0
  67. package/dist/lib/compare/comparators.mjs +150 -0
  68. package/dist/lib/compare/index.cjs +172 -0
  69. package/dist/lib/compare/index.d.ts +2 -0
  70. package/dist/lib/compare/index.d.ts.map +1 -0
  71. package/dist/lib/compare/index.js +1 -0
  72. package/dist/lib/compare/index.mjs +152 -0
  73. package/dist/lib/cookie/codec.cjs +72 -0
  74. package/dist/lib/cookie/codec.d.ts +22 -0
  75. package/dist/lib/cookie/codec.d.ts.map +1 -0
  76. package/dist/lib/cookie/codec.js +67 -0
  77. package/dist/lib/cookie/codec.mjs +51 -0
  78. package/dist/lib/cookie/index.cjs +75 -0
  79. package/dist/lib/cookie/index.d.ts +2 -0
  80. package/dist/lib/cookie/index.d.ts.map +1 -0
  81. package/dist/lib/cookie/index.js +1 -0
  82. package/dist/lib/cookie/index.mjs +53 -0
  83. package/dist/lib/crypto/hash.cjs +83 -0
  84. package/dist/lib/crypto/hash.d.ts +6 -0
  85. package/dist/lib/crypto/hash.d.ts.map +1 -0
  86. package/dist/lib/crypto/hash.js +53 -0
  87. package/dist/lib/crypto/hash.mjs +62 -0
  88. package/dist/lib/crypto/index.cjs +85 -0
  89. package/dist/lib/crypto/index.d.ts +2 -0
  90. package/dist/lib/crypto/index.d.ts.map +1 -0
  91. package/dist/lib/crypto/index.js +1 -0
  92. package/dist/lib/crypto/index.mjs +62 -0
  93. package/dist/lib/dom/events.cjs +40 -0
  94. package/dist/lib/dom/events.d.ts +159 -0
  95. package/dist/lib/dom/events.d.ts.map +1 -0
  96. package/dist/lib/dom/events.js +50 -0
  97. package/dist/lib/dom/events.mjs +19 -0
  98. package/dist/lib/dom/index.cjs +78 -0
  99. package/dist/lib/dom/index.d.ts +3 -0
  100. package/dist/lib/dom/index.d.ts.map +1 -0
  101. package/dist/lib/dom/index.js +2 -0
  102. package/dist/lib/dom/index.mjs +56 -0
  103. package/dist/lib/dom/utils.cjs +57 -0
  104. package/dist/lib/dom/utils.d.ts +6 -0
  105. package/dist/lib/dom/utils.d.ts.map +1 -0
  106. package/dist/lib/dom/utils.js +37 -0
  107. package/dist/lib/dom/utils.mjs +36 -0
  108. package/dist/lib/functions/functions.cjs +366 -0
  109. package/dist/lib/functions/functions.d.ts +329 -0
  110. package/dist/lib/functions/functions.d.ts.map +1 -0
  111. package/dist/lib/functions/functions.js +585 -0
  112. package/dist/lib/functions/functions.mjs +345 -0
  113. package/dist/lib/functions/index.cjs +369 -0
  114. package/dist/lib/functions/index.d.ts +3 -0
  115. package/dist/lib/functions/index.d.ts.map +1 -0
  116. package/dist/lib/functions/index.js +1 -0
  117. package/dist/lib/functions/index.mjs +347 -0
  118. package/dist/lib/functions/types.cjs +18 -0
  119. package/dist/lib/functions/types.d.ts +2 -0
  120. package/dist/lib/functions/types.d.ts.map +1 -0
  121. package/dist/lib/functions/types.js +1 -0
  122. package/dist/lib/functions/types.mjs +0 -0
  123. package/dist/lib/helpers.cjs +78 -0
  124. package/dist/lib/helpers.d.ts +13 -0
  125. package/dist/lib/helpers.d.ts.map +1 -0
  126. package/dist/lib/helpers.js +66 -0
  127. package/dist/lib/helpers.mjs +59 -0
  128. package/dist/lib/index.cjs +2857 -0
  129. package/dist/lib/index.d.ts +6 -0
  130. package/dist/lib/index.d.ts.map +1 -0
  131. package/dist/lib/index.js +8 -0
  132. package/dist/lib/index.mjs +2836 -0
  133. package/dist/lib/maths/constants.cjs +70 -0
  134. package/dist/lib/maths/constants.d.ts +84 -0
  135. package/dist/lib/maths/constants.d.ts.map +1 -0
  136. package/dist/lib/maths/constants.js +79 -0
  137. package/dist/lib/maths/constants.mjs +50 -0
  138. package/dist/lib/maths/fn/advanced.cjs +231 -0
  139. package/dist/lib/maths/fn/advanced.d.ts +149 -0
  140. package/dist/lib/maths/fn/advanced.d.ts.map +1 -0
  141. package/dist/lib/maths/fn/advanced.js +264 -0
  142. package/dist/lib/maths/fn/advanced.mjs +208 -0
  143. package/dist/lib/maths/fn/basic.cjs +212 -0
  144. package/dist/lib/maths/fn/basic.d.ts +182 -0
  145. package/dist/lib/maths/fn/basic.d.ts.map +1 -0
  146. package/dist/lib/maths/fn/basic.js +343 -0
  147. package/dist/lib/maths/fn/basic.mjs +191 -0
  148. package/dist/lib/maths/fn/complex.cjs +268 -0
  149. package/dist/lib/maths/fn/complex.d.ts +153 -0
  150. package/dist/lib/maths/fn/complex.d.ts.map +1 -0
  151. package/dist/lib/maths/fn/complex.js +383 -0
  152. package/dist/lib/maths/fn/complex.mjs +247 -0
  153. package/dist/lib/maths/fn/index.cjs +877 -0
  154. package/dist/lib/maths/fn/index.d.ts +10 -0
  155. package/dist/lib/maths/fn/index.d.ts.map +1 -0
  156. package/dist/lib/maths/fn/index.js +9 -0
  157. package/dist/lib/maths/fn/index.mjs +855 -0
  158. package/dist/lib/maths/fn/trigo.cjs +179 -0
  159. package/dist/lib/maths/fn/trigo.d.ts +147 -0
  160. package/dist/lib/maths/fn/trigo.d.ts.map +1 -0
  161. package/dist/lib/maths/fn/trigo.js +227 -0
  162. package/dist/lib/maths/fn/trigo.mjs +156 -0
  163. package/dist/lib/maths/fn/vector.cjs +728 -0
  164. package/dist/lib/maths/fn/vector.d.ts +512 -0
  165. package/dist/lib/maths/fn/vector.d.ts.map +1 -0
  166. package/dist/lib/maths/fn/vector.js +1136 -0
  167. package/dist/lib/maths/fn/vector.mjs +707 -0
  168. package/dist/lib/maths/formatter.cjs +61 -0
  169. package/dist/lib/maths/formatter.d.ts +35 -0
  170. package/dist/lib/maths/formatter.d.ts.map +1 -0
  171. package/dist/lib/maths/formatter.js +56 -0
  172. package/dist/lib/maths/formatter.mjs +40 -0
  173. package/dist/lib/maths/guards.cjs +164 -0
  174. package/dist/lib/maths/guards.d.ts +166 -0
  175. package/dist/lib/maths/guards.d.ts.map +1 -0
  176. package/dist/lib/maths/guards.js +315 -0
  177. package/dist/lib/maths/guards.mjs +144 -0
  178. package/dist/lib/maths/index.cjs +1152 -0
  179. package/dist/lib/maths/index.d.ts +24 -0
  180. package/dist/lib/maths/index.d.ts.map +1 -0
  181. package/dist/lib/maths/index.js +29 -0
  182. package/dist/lib/maths/index.mjs +1130 -0
  183. package/dist/lib/maths/parser.cjs +75 -0
  184. package/dist/lib/maths/parser.d.ts +20 -0
  185. package/dist/lib/maths/parser.d.ts.map +1 -0
  186. package/dist/lib/maths/parser.js +78 -0
  187. package/dist/lib/maths/parser.mjs +54 -0
  188. package/dist/lib/maths/random.cjs +49 -0
  189. package/dist/lib/maths/random.d.ts +27 -0
  190. package/dist/lib/maths/random.d.ts.map +1 -0
  191. package/dist/lib/maths/random.js +49 -0
  192. package/dist/lib/maths/random.mjs +28 -0
  193. package/dist/lib/maths/types/advanced.cjs +18 -0
  194. package/dist/lib/maths/types/advanced.d.ts +357 -0
  195. package/dist/lib/maths/types/advanced.d.ts.map +1 -0
  196. package/dist/lib/maths/types/advanced.js +5 -0
  197. package/dist/lib/maths/types/advanced.mjs +0 -0
  198. package/dist/lib/maths/types/basic.cjs +18 -0
  199. package/dist/lib/maths/types/basic.d.ts +95 -0
  200. package/dist/lib/maths/types/basic.d.ts.map +1 -0
  201. package/dist/lib/maths/types/basic.js +5 -0
  202. package/dist/lib/maths/types/basic.mjs +0 -0
  203. package/dist/lib/maths/types/index.cjs +19 -0
  204. package/dist/lib/maths/types/index.d.ts +4 -0
  205. package/dist/lib/maths/types/index.d.ts.map +1 -0
  206. package/dist/lib/maths/types/index.js +3 -0
  207. package/dist/lib/maths/types/index.mjs +1 -0
  208. package/dist/lib/maths/types/negative.cjs +18 -0
  209. package/dist/lib/maths/types/negative.d.ts +51 -0
  210. package/dist/lib/maths/types/negative.d.ts.map +1 -0
  211. package/dist/lib/maths/types/negative.js +5 -0
  212. package/dist/lib/maths/types/negative.mjs +0 -0
  213. package/dist/lib/maths/types/operations.cjs +18 -0
  214. package/dist/lib/maths/types/operations.d.ts +188 -0
  215. package/dist/lib/maths/types/operations.d.ts.map +1 -0
  216. package/dist/lib/maths/types/operations.js +6 -0
  217. package/dist/lib/maths/types/operations.mjs +0 -0
  218. package/dist/lib/object/clone.cjs +88 -0
  219. package/dist/lib/object/clone.d.ts +46 -0
  220. package/dist/lib/object/clone.d.ts.map +1 -0
  221. package/dist/lib/object/clone.js +104 -0
  222. package/dist/lib/object/clone.mjs +65 -0
  223. package/dist/lib/object/diff.cjs +573 -0
  224. package/dist/lib/object/diff.d.ts +203 -0
  225. package/dist/lib/object/diff.d.ts.map +1 -0
  226. package/dist/lib/object/diff.js +805 -0
  227. package/dist/lib/object/diff.mjs +550 -0
  228. package/dist/lib/object/getter-setter.cjs +2351 -0
  229. package/dist/lib/object/getter-setter.d.ts +361 -0
  230. package/dist/lib/object/getter-setter.d.ts.map +1 -0
  231. package/dist/lib/object/getter-setter.js +1771 -0
  232. package/dist/lib/object/getter-setter.mjs +2330 -0
  233. package/dist/lib/object/index.cjs +3956 -0
  234. package/dist/lib/object/index.d.ts +13 -0
  235. package/dist/lib/object/index.d.ts.map +1 -0
  236. package/dist/lib/object/index.js +12 -0
  237. package/dist/lib/object/index.mjs +3936 -0
  238. package/dist/lib/object/merge.cjs +1029 -0
  239. package/dist/lib/object/merge.d.ts +93 -0
  240. package/dist/lib/object/merge.d.ts.map +1 -0
  241. package/dist/lib/object/merge.js +474 -0
  242. package/dist/lib/object/merge.mjs +1006 -0
  243. package/dist/lib/object/object.cjs +280 -0
  244. package/dist/lib/object/object.d.ts +128 -0
  245. package/dist/lib/object/object.d.ts.map +1 -0
  246. package/dist/lib/object/object.js +432 -0
  247. package/dist/lib/object/object.mjs +257 -0
  248. package/dist/lib/object/omit.cjs +2022 -0
  249. package/dist/lib/object/omit.d.ts +351 -0
  250. package/dist/lib/object/omit.d.ts.map +1 -0
  251. package/dist/lib/object/omit.js +656 -0
  252. package/dist/lib/object/omit.mjs +1999 -0
  253. package/dist/lib/object/reconcile.cjs +126 -0
  254. package/dist/lib/object/reconcile.d.ts +7 -0
  255. package/dist/lib/object/reconcile.d.ts.map +1 -0
  256. package/dist/lib/object/reconcile.js +122 -0
  257. package/dist/lib/object/reconcile.mjs +105 -0
  258. package/dist/lib/object/selector.cjs +303 -0
  259. package/dist/lib/object/selector.d.ts +50 -0
  260. package/dist/lib/object/selector.d.ts.map +1 -0
  261. package/dist/lib/object/selector.js +371 -0
  262. package/dist/lib/object/selector.mjs +282 -0
  263. package/dist/lib/object/sort.cjs +209 -0
  264. package/dist/lib/object/sort.d.ts +149 -0
  265. package/dist/lib/object/sort.d.ts.map +1 -0
  266. package/dist/lib/object/sort.js +298 -0
  267. package/dist/lib/object/sort.mjs +186 -0
  268. package/dist/lib/object/transform.cjs +2211 -0
  269. package/dist/lib/object/transform.d.ts +620 -0
  270. package/dist/lib/object/transform.d.ts.map +1 -0
  271. package/dist/lib/object/transform.js +1058 -0
  272. package/dist/lib/object/transform.mjs +2190 -0
  273. package/dist/lib/object/types.cjs +18 -0
  274. package/dist/lib/object/types.d.ts +250 -0
  275. package/dist/lib/object/types.d.ts.map +1 -0
  276. package/dist/lib/object/types.js +1 -0
  277. package/dist/lib/object/types.mjs +0 -0
  278. package/dist/lib/object/utils.cjs +326 -0
  279. package/dist/lib/object/utils.d.ts +165 -0
  280. package/dist/lib/object/utils.d.ts.map +1 -0
  281. package/dist/lib/object/utils.js +444 -0
  282. package/dist/lib/object/utils.mjs +305 -0
  283. package/dist/lib/primitive/boolean/boolean.cjs +407 -0
  284. package/dist/lib/primitive/boolean/boolean.d.ts +276 -0
  285. package/dist/lib/primitive/boolean/boolean.d.ts.map +1 -0
  286. package/dist/lib/primitive/boolean/boolean.js +615 -0
  287. package/dist/lib/primitive/boolean/boolean.mjs +386 -0
  288. package/dist/lib/primitive/boolean/index.cjs +382 -0
  289. package/dist/lib/primitive/boolean/index.d.ts +3 -0
  290. package/dist/lib/primitive/boolean/index.d.ts.map +1 -0
  291. package/dist/lib/primitive/boolean/index.js +2 -0
  292. package/dist/lib/primitive/boolean/index.mjs +359 -0
  293. package/dist/lib/primitive/boolean/types.cjs +18 -0
  294. package/dist/lib/primitive/boolean/types.d.ts +14 -0
  295. package/dist/lib/primitive/boolean/types.d.ts.map +1 -0
  296. package/dist/lib/primitive/boolean/types.js +1 -0
  297. package/dist/lib/primitive/boolean/types.mjs +0 -0
  298. package/dist/lib/primitive/date/date.cjs +1126 -0
  299. package/dist/lib/primitive/date/date.d.ts +641 -0
  300. package/dist/lib/primitive/date/date.d.ts.map +1 -0
  301. package/dist/lib/primitive/date/date.js +1998 -0
  302. package/dist/lib/primitive/date/date.mjs +1105 -0
  303. package/dist/lib/primitive/date/index.cjs +1128 -0
  304. package/dist/lib/primitive/date/index.d.ts +3 -0
  305. package/dist/lib/primitive/date/index.d.ts.map +1 -0
  306. package/dist/lib/primitive/date/index.js +2 -0
  307. package/dist/lib/primitive/date/index.mjs +1105 -0
  308. package/dist/lib/primitive/date/types.cjs +18 -0
  309. package/dist/lib/primitive/date/types.d.ts +205 -0
  310. package/dist/lib/primitive/date/types.d.ts.map +1 -0
  311. package/dist/lib/primitive/date/types.js +7 -0
  312. package/dist/lib/primitive/date/types.mjs +0 -0
  313. package/dist/lib/primitive/index.cjs +2338 -0
  314. package/dist/lib/primitive/index.d.ts +5 -0
  315. package/dist/lib/primitive/index.d.ts.map +1 -0
  316. package/dist/lib/primitive/index.js +4 -0
  317. package/dist/lib/primitive/index.mjs +2316 -0
  318. package/dist/lib/primitive/string/index.cjs +875 -0
  319. package/dist/lib/primitive/string/index.d.ts +3 -0
  320. package/dist/lib/primitive/string/index.d.ts.map +1 -0
  321. package/dist/lib/primitive/string/index.js +2 -0
  322. package/dist/lib/primitive/string/index.mjs +852 -0
  323. package/dist/lib/primitive/string/parser-2.cjs +543 -0
  324. package/dist/lib/primitive/string/parser-2.d.ts +17 -0
  325. package/dist/lib/primitive/string/parser-2.d.ts.map +1 -0
  326. package/dist/lib/primitive/string/parser-2.js +656 -0
  327. package/dist/lib/primitive/string/parser-2.mjs +522 -0
  328. package/dist/lib/primitive/string/parser.cjs +236 -0
  329. package/dist/lib/primitive/string/parser.d.ts +9 -0
  330. package/dist/lib/primitive/string/parser.d.ts.map +1 -0
  331. package/dist/lib/primitive/string/parser.js +775 -0
  332. package/dist/lib/primitive/string/parser.mjs +215 -0
  333. package/dist/lib/primitive/string/string.cjs +926 -0
  334. package/dist/lib/primitive/string/string.d.ts +535 -0
  335. package/dist/lib/primitive/string/string.d.ts.map +1 -0
  336. package/dist/lib/primitive/string/string.js +1301 -0
  337. package/dist/lib/primitive/string/string.mjs +903 -0
  338. package/dist/lib/primitive/string/types.cjs +18 -0
  339. package/dist/lib/primitive/string/types.d.ts +318 -0
  340. package/dist/lib/primitive/string/types.d.ts.map +1 -0
  341. package/dist/lib/primitive/string/types.js +5 -0
  342. package/dist/lib/primitive/string/types.mjs +0 -0
  343. package/dist/lib/primitive/types.cjs +18 -0
  344. package/dist/lib/primitive/types.d.ts +27 -0
  345. package/dist/lib/primitive/types.d.ts.map +1 -0
  346. package/dist/lib/primitive/types.js +1 -0
  347. package/dist/lib/primitive/types.mjs +0 -0
  348. package/dist/lib/url/index.cjs +327 -0
  349. package/dist/lib/url/index.d.ts +3 -0
  350. package/dist/lib/url/index.d.ts.map +1 -0
  351. package/dist/lib/url/index.js +2 -0
  352. package/dist/lib/url/index.mjs +304 -0
  353. package/dist/lib/url/parser.cjs +325 -0
  354. package/dist/lib/url/parser.d.ts +216 -0
  355. package/dist/lib/url/parser.d.ts.map +1 -0
  356. package/dist/lib/url/parser.js +488 -0
  357. package/dist/lib/url/parser.mjs +304 -0
  358. package/dist/lib/url/types.cjs +18 -0
  359. package/dist/lib/url/types.d.ts +18 -0
  360. package/dist/lib/url/types.d.ts.map +1 -0
  361. package/dist/lib/url/types.js +1 -0
  362. package/dist/lib/url/types.mjs +0 -0
  363. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  364. package/package.json +127 -0
@@ -0,0 +1,629 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/lib/color/conversions.ts
21
+ var conversions_exports = {};
22
+ __export(conversions_exports, {
23
+ anyToRgb: () => anyToRgb,
24
+ batchConvert: () => batchConvert,
25
+ cmykToHsl: () => cmykToHsl,
26
+ cmykToHsv: () => cmykToHsv,
27
+ cmykToRgb: () => cmykToRgb,
28
+ convertColor: () => convertColor,
29
+ getConversionPath: () => getConversionPath,
30
+ getSupportedFormats: () => getSupportedFormats,
31
+ hasDirectConversion: () => hasDirectConversion,
32
+ hslToHsv: () => hslToHsv,
33
+ hslToHwb: () => hslToHwb,
34
+ hslToRgb: () => hslToRgb,
35
+ hsvToHsl: () => hsvToHsl,
36
+ hsvToHwb: () => hsvToHwb,
37
+ hsvToRgb: () => hsvToRgb,
38
+ hwbToHsl: () => hwbToHsl,
39
+ hwbToHsv: () => hwbToHsv,
40
+ hwbToRgb: () => hwbToRgb,
41
+ isValidFormat: () => isValidFormat,
42
+ labToLch: () => labToLch,
43
+ labToRgb: () => labToRgb,
44
+ labToXyz: () => labToXyz,
45
+ lchToLab: () => lchToLab,
46
+ lchToRgb: () => lchToRgb,
47
+ lchToXyz: () => lchToXyz,
48
+ oklabToOklch: () => oklabToOklch,
49
+ oklabToRgb: () => oklabToRgb,
50
+ oklchToOklab: () => oklchToOklab,
51
+ oklchToRgb: () => oklchToRgb,
52
+ rgbToCmyk: () => rgbToCmyk,
53
+ rgbToHsl: () => rgbToHsl,
54
+ rgbToHsv: () => rgbToHsv,
55
+ rgbToHwb: () => rgbToHwb,
56
+ rgbToLab: () => rgbToLab,
57
+ rgbToLch: () => rgbToLch,
58
+ rgbToOklab: () => rgbToOklab,
59
+ rgbToOklch: () => rgbToOklch,
60
+ rgbToXyz: () => rgbToXyz,
61
+ xyzToLab: () => xyzToLab,
62
+ xyzToRgb: () => xyzToRgb
63
+ });
64
+ module.exports = __toCommonJS(conversions_exports);
65
+ var D65_WHITE = { x: 0.95047, y: 1, z: 1.08883 };
66
+ var EPSILON = 8856e-6;
67
+ var KAPPA = 903.3;
68
+ function clamp(value, min, max) {
69
+ return Math.max(min, Math.min(max, value));
70
+ }
71
+ function roundToPrecision(value, precision = 2) {
72
+ const multiplier = Math.pow(10, precision);
73
+ return Math.round(value * multiplier) / multiplier;
74
+ }
75
+ function rgbToHsl(rgb) {
76
+ const r = rgb.r / 255;
77
+ const g = rgb.g / 255;
78
+ const b = rgb.b / 255;
79
+ const max = Math.max(r, g, b);
80
+ const min = Math.min(r, g, b);
81
+ const delta = max - min;
82
+ let h = 0;
83
+ let s = 0;
84
+ const l = (max + min) / 2;
85
+ if (delta !== 0) {
86
+ s = l > 0.5 ? delta / (2 - max - min) : delta / (max + min);
87
+ switch (max) {
88
+ case r:
89
+ h = ((g - b) / delta + (g < b ? 6 : 0)) / 6;
90
+ break;
91
+ case g:
92
+ h = ((b - r) / delta + 2) / 6;
93
+ break;
94
+ case b:
95
+ h = ((r - g) / delta + 4) / 6;
96
+ break;
97
+ }
98
+ }
99
+ return {
100
+ h: h * 360,
101
+ s: s * 100,
102
+ l: l * 100,
103
+ a: rgb.a
104
+ };
105
+ }
106
+ function rgbToHsv(rgb) {
107
+ const r = rgb.r / 255;
108
+ const g = rgb.g / 255;
109
+ const b = rgb.b / 255;
110
+ const max = Math.max(r, g, b);
111
+ const min = Math.min(r, g, b);
112
+ const delta = max - min;
113
+ let h = 0;
114
+ const s = max === 0 ? 0 : delta / max;
115
+ const v = max;
116
+ if (delta !== 0) {
117
+ switch (max) {
118
+ case r:
119
+ h = ((g - b) / delta + (g < b ? 6 : 0)) / 6;
120
+ break;
121
+ case g:
122
+ h = ((b - r) / delta + 2) / 6;
123
+ break;
124
+ case b:
125
+ h = ((r - g) / delta + 4) / 6;
126
+ break;
127
+ }
128
+ }
129
+ return {
130
+ h: h * 360,
131
+ s: s * 100,
132
+ v: v * 100,
133
+ a: rgb.a
134
+ };
135
+ }
136
+ function rgbToHwb(rgb) {
137
+ const hsv = rgbToHsv(rgb);
138
+ const w = (100 - hsv.s) * hsv.v / 100;
139
+ const b = 100 - hsv.v;
140
+ return {
141
+ h: hsv.h,
142
+ w,
143
+ b,
144
+ a: rgb.a
145
+ };
146
+ }
147
+ function rgbToCmyk(rgb) {
148
+ const r = rgb.r / 255;
149
+ const g = rgb.g / 255;
150
+ const b = rgb.b / 255;
151
+ const k = 1 - Math.max(r, g, b);
152
+ const c = k === 1 ? 0 : (1 - r - k) / (1 - k);
153
+ const m = k === 1 ? 0 : (1 - g - k) / (1 - k);
154
+ const y = k === 1 ? 0 : (1 - b - k) / (1 - k);
155
+ return {
156
+ c: c * 100,
157
+ m: m * 100,
158
+ y: y * 100,
159
+ k: k * 100,
160
+ a: rgb.a
161
+ };
162
+ }
163
+ function rgbToXyz(rgb) {
164
+ let r = rgb.r / 255;
165
+ let g = rgb.g / 255;
166
+ let b = rgb.b / 255;
167
+ r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
168
+ g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
169
+ b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
170
+ const x = r * 0.4124564 + g * 0.3575761 + b * 0.1804375;
171
+ const y = r * 0.2126729 + g * 0.7151522 + b * 0.072175;
172
+ const z = r * 0.0193339 + g * 0.119192 + b * 0.9503041;
173
+ return {
174
+ x: x * 100,
175
+ y: y * 100,
176
+ z: z * 100,
177
+ alpha: rgb.a
178
+ };
179
+ }
180
+ function rgbToLab(rgb) {
181
+ const xyz = rgbToXyz(rgb);
182
+ return xyzToLab(xyz);
183
+ }
184
+ function rgbToLch(rgb) {
185
+ const lab = rgbToLab(rgb);
186
+ return labToLch(lab);
187
+ }
188
+ function rgbToOklab(rgb) {
189
+ const r = rgb.r / 255;
190
+ const g = rgb.g / 255;
191
+ const b = rgb.b / 255;
192
+ const lr = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
193
+ const lg = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
194
+ const lb = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
195
+ const l = 0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb;
196
+ const m = 0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb;
197
+ const s = 0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb;
198
+ const l_ = Math.cbrt(l);
199
+ const m_ = Math.cbrt(m);
200
+ const s_ = Math.cbrt(s);
201
+ return {
202
+ l: 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_,
203
+ a: 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_,
204
+ b: 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_,
205
+ alpha: rgb.a
206
+ };
207
+ }
208
+ function rgbToOklch(rgb) {
209
+ const oklab = rgbToOklab(rgb);
210
+ return oklabToOklch(oklab);
211
+ }
212
+ function hslToRgb(hsl) {
213
+ const h = hsl.h / 360;
214
+ const s = hsl.s / 100;
215
+ const l = hsl.l / 100;
216
+ let r, g, b;
217
+ if (s === 0) {
218
+ r = g = b = l;
219
+ } else {
220
+ const hue2rgb = (p2, q2, t) => {
221
+ if (t < 0) t += 1;
222
+ if (t > 1) t -= 1;
223
+ if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
224
+ if (t < 1 / 2) return q2;
225
+ if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
226
+ return p2;
227
+ };
228
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
229
+ const p = 2 * l - q;
230
+ r = hue2rgb(p, q, h + 1 / 3);
231
+ g = hue2rgb(p, q, h);
232
+ b = hue2rgb(p, q, h - 1 / 3);
233
+ }
234
+ return {
235
+ r: Math.round(r * 255),
236
+ g: Math.round(g * 255),
237
+ b: Math.round(b * 255),
238
+ a: hsl.a
239
+ };
240
+ }
241
+ function hslToHsv(hsl) {
242
+ const rgb = hslToRgb(hsl);
243
+ return rgbToHsv(rgb);
244
+ }
245
+ function hslToHwb(hsl) {
246
+ const rgb = hslToRgb(hsl);
247
+ return rgbToHwb(rgb);
248
+ }
249
+ function hsvToRgb(hsv) {
250
+ const h = hsv.h / 360;
251
+ const s = hsv.s / 100;
252
+ const v = hsv.v / 100;
253
+ const i = Math.floor(h * 6);
254
+ const f = h * 6 - i;
255
+ const p = v * (1 - s);
256
+ const q = v * (1 - f * s);
257
+ const t = v * (1 - (1 - f) * s);
258
+ let r, g, b;
259
+ switch (i % 6) {
260
+ case 0:
261
+ r = v;
262
+ g = t;
263
+ b = p;
264
+ break;
265
+ case 1:
266
+ r = q;
267
+ g = v;
268
+ b = p;
269
+ break;
270
+ case 2:
271
+ r = p;
272
+ g = v;
273
+ b = t;
274
+ break;
275
+ case 3:
276
+ r = p;
277
+ g = q;
278
+ b = v;
279
+ break;
280
+ case 4:
281
+ r = t;
282
+ g = p;
283
+ b = v;
284
+ break;
285
+ case 5:
286
+ default:
287
+ r = v;
288
+ g = p;
289
+ b = q;
290
+ break;
291
+ }
292
+ return {
293
+ r: Math.round(r * 255),
294
+ g: Math.round(g * 255),
295
+ b: Math.round(b * 255),
296
+ a: hsv.a
297
+ };
298
+ }
299
+ function hsvToHsl(hsv) {
300
+ const rgb = hsvToRgb(hsv);
301
+ return rgbToHsl(rgb);
302
+ }
303
+ function hsvToHwb(hsv) {
304
+ const w = (100 - hsv.s) * hsv.v / 100;
305
+ const b = 100 - hsv.v;
306
+ return {
307
+ h: hsv.h,
308
+ w,
309
+ b,
310
+ a: hsv.a
311
+ };
312
+ }
313
+ function hwbToRgb(hwb) {
314
+ const h = hwb.h;
315
+ let w = hwb.w / 100;
316
+ let b = hwb.b / 100;
317
+ const sum = w + b;
318
+ if (sum > 1) {
319
+ w /= sum;
320
+ b /= sum;
321
+ }
322
+ const v = 1 - b;
323
+ const s = v === 0 ? 0 : 1 - w / v;
324
+ return hsvToRgb({ h, s: s * 100, v: v * 100, a: hwb.a });
325
+ }
326
+ function hwbToHsl(hwb) {
327
+ const rgb = hwbToRgb(hwb);
328
+ return rgbToHsl(rgb);
329
+ }
330
+ function hwbToHsv(hwb) {
331
+ const rgb = hwbToRgb(hwb);
332
+ return rgbToHsv(rgb);
333
+ }
334
+ function cmykToRgb(cmyk) {
335
+ const c = cmyk.c / 100;
336
+ const m = cmyk.m / 100;
337
+ const y = cmyk.y / 100;
338
+ const k = cmyk.k / 100;
339
+ const r = 255 * (1 - c) * (1 - k);
340
+ const g = 255 * (1 - m) * (1 - k);
341
+ const b = 255 * (1 - y) * (1 - k);
342
+ return {
343
+ r: Math.round(r),
344
+ g: Math.round(g),
345
+ b: Math.round(b),
346
+ a: cmyk.a
347
+ };
348
+ }
349
+ function cmykToHsl(cmyk) {
350
+ const rgb = cmykToRgb(cmyk);
351
+ return rgbToHsl(rgb);
352
+ }
353
+ function cmykToHsv(cmyk) {
354
+ const rgb = cmykToRgb(cmyk);
355
+ return rgbToHsv(rgb);
356
+ }
357
+ function xyzToRgb(xyz) {
358
+ const x = xyz.x / 100;
359
+ const y = xyz.y / 100;
360
+ const z = xyz.z / 100;
361
+ let r = x * 3.2404542 + y * -1.5371385 + z * -0.4985314;
362
+ let g = x * -0.969266 + y * 1.8760108 + z * 0.041556;
363
+ let b = x * 0.0556434 + y * -0.2040259 + z * 1.0572252;
364
+ r = r > 31308e-7 ? 1.055 * Math.pow(r, 1 / 2.4) - 0.055 : 12.92 * r;
365
+ g = g > 31308e-7 ? 1.055 * Math.pow(g, 1 / 2.4) - 0.055 : 12.92 * g;
366
+ b = b > 31308e-7 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : 12.92 * b;
367
+ return {
368
+ r: Math.round(clamp(r * 255, 0, 255)),
369
+ g: Math.round(clamp(g * 255, 0, 255)),
370
+ b: Math.round(clamp(b * 255, 0, 255)),
371
+ a: xyz.alpha || 1
372
+ };
373
+ }
374
+ function xyzToLab(xyz) {
375
+ const xr = xyz.x / D65_WHITE.x / 100;
376
+ const yr = xyz.y / D65_WHITE.y / 100;
377
+ const zr = xyz.z / D65_WHITE.z / 100;
378
+ const fx = xr > EPSILON ? Math.cbrt(xr) : (KAPPA * xr + 16) / 116;
379
+ const fy = yr > EPSILON ? Math.cbrt(yr) : (KAPPA * yr + 16) / 116;
380
+ const fz = zr > EPSILON ? Math.cbrt(zr) : (KAPPA * zr + 16) / 116;
381
+ const l = 116 * fy - 16;
382
+ const a = 500 * (fx - fy);
383
+ const b = 200 * (fy - fz);
384
+ return {
385
+ l: clamp(l, 0, 100),
386
+ a,
387
+ b,
388
+ alpha: xyz.alpha
389
+ };
390
+ }
391
+ function labToXyz(lab) {
392
+ const fy = (lab.l + 16) / 116;
393
+ const fx = lab.a / 500 + fy;
394
+ const fz = fy - lab.b / 200;
395
+ const xr = fx * fx * fx > EPSILON ? fx * fx * fx : (116 * fx - 16) / KAPPA;
396
+ const yr = lab.l > KAPPA * EPSILON ? Math.pow((lab.l + 16) / 116, 3) : lab.l / KAPPA;
397
+ const zr = fz * fz * fz > EPSILON ? fz * fz * fz : (116 * fz - 16) / KAPPA;
398
+ return {
399
+ x: xr * D65_WHITE.x * 100,
400
+ y: yr * D65_WHITE.y * 100,
401
+ z: zr * D65_WHITE.z * 100,
402
+ alpha: lab.alpha
403
+ };
404
+ }
405
+ function labToRgb(lab) {
406
+ const xyz = labToXyz(lab);
407
+ return xyzToRgb(xyz);
408
+ }
409
+ function labToLch(lab) {
410
+ const c = Math.sqrt(lab.a * lab.a + lab.b * lab.b);
411
+ let h = Math.atan2(lab.b, lab.a) * 180 / Math.PI;
412
+ if (h < 0) {
413
+ h += 360;
414
+ }
415
+ return {
416
+ l: lab.l,
417
+ c,
418
+ h,
419
+ alpha: lab.alpha
420
+ };
421
+ }
422
+ function lchToLab(lch) {
423
+ const h = lch.h * Math.PI / 180;
424
+ const a = lch.c * Math.cos(h);
425
+ const b = lch.c * Math.sin(h);
426
+ return {
427
+ l: lch.l,
428
+ a,
429
+ b,
430
+ alpha: lch.alpha
431
+ };
432
+ }
433
+ function lchToRgb(lch) {
434
+ const lab = lchToLab(lch);
435
+ return labToRgb(lab);
436
+ }
437
+ function lchToXyz(lch) {
438
+ const lab = lchToLab(lch);
439
+ return labToXyz(lab);
440
+ }
441
+ function oklabToRgb(oklab) {
442
+ const l_ = oklab.l + 0.3963377774 * oklab.a + 0.2158037573 * oklab.b;
443
+ const m_ = oklab.l - 0.1055613458 * oklab.a - 0.0638541728 * oklab.b;
444
+ const s_ = oklab.l - 0.0894841775 * oklab.a - 1.291485548 * oklab.b;
445
+ const l = l_ * l_ * l_;
446
+ const m = m_ * m_ * m_;
447
+ const s = s_ * s_ * s_;
448
+ let lr = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;
449
+ let lg = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;
450
+ let lb = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
451
+ lr = lr > 31308e-7 ? 1.055 * Math.pow(lr, 1 / 2.4) - 0.055 : 12.92 * lr;
452
+ lg = lg > 31308e-7 ? 1.055 * Math.pow(lg, 1 / 2.4) - 0.055 : 12.92 * lg;
453
+ lb = lb > 31308e-7 ? 1.055 * Math.pow(lb, 1 / 2.4) - 0.055 : 12.92 * lb;
454
+ return {
455
+ r: Math.round(clamp(lr * 255, 0, 255)),
456
+ g: Math.round(clamp(lg * 255, 0, 255)),
457
+ b: Math.round(clamp(lb * 255, 0, 255)),
458
+ a: oklab.alpha
459
+ };
460
+ }
461
+ function oklabToOklch(oklab) {
462
+ const c = Math.sqrt(oklab.a * oklab.a + oklab.b * oklab.b);
463
+ let h = Math.atan2(oklab.b, oklab.a) * 180 / Math.PI;
464
+ if (h < 0) {
465
+ h += 360;
466
+ }
467
+ return {
468
+ l: oklab.l,
469
+ c,
470
+ h,
471
+ alpha: oklab.alpha
472
+ };
473
+ }
474
+ function oklchToOklab(oklch) {
475
+ const h = oklch.h * Math.PI / 180;
476
+ const a = oklch.c * Math.cos(h);
477
+ const b = oklch.c * Math.sin(h);
478
+ return {
479
+ l: oklch.l,
480
+ a,
481
+ b,
482
+ alpha: oklch.alpha
483
+ };
484
+ }
485
+ function oklchToRgb(oklch) {
486
+ const oklab = oklchToOklab(oklch);
487
+ return oklabToRgb(oklab);
488
+ }
489
+ function anyToRgb(color) {
490
+ if ("r" in color && "g" in color && "b" in color) {
491
+ return color;
492
+ }
493
+ if ("h" in color && "s" in color && "l" in color) {
494
+ return hslToRgb(color);
495
+ }
496
+ if ("h" in color && "s" in color && "v" in color) {
497
+ return hsvToRgb(color);
498
+ }
499
+ if ("h" in color && "w" in color && "b" in color) {
500
+ return hwbToRgb(color);
501
+ }
502
+ if ("c" in color && "m" in color && "y" in color && "k" in color) {
503
+ return cmykToRgb(color);
504
+ }
505
+ if ("x" in color && "y" in color && "z" in color) {
506
+ return xyzToRgb(color);
507
+ }
508
+ if ("l" in color && "a" in color && "b" in color && !("c" in color) && !("h" in color)) {
509
+ return labToRgb(color);
510
+ }
511
+ if ("l" in color && "c" in color && "h" in color) {
512
+ const lchColor = color;
513
+ if (lchColor.l <= 1) {
514
+ return oklchToRgb(color);
515
+ }
516
+ return lchToRgb(lchColor);
517
+ }
518
+ throw new Error("Unknown color format");
519
+ }
520
+ function convertColor(color, targetFormat, options = {}) {
521
+ const { round = true, precision = 2, preserveAlpha = true } = options;
522
+ const rgb = anyToRgb(color);
523
+ let result;
524
+ switch (targetFormat.toLowerCase()) {
525
+ case "rgb":
526
+ result = rgb;
527
+ break;
528
+ case "hsl":
529
+ result = rgbToHsl(rgb);
530
+ break;
531
+ case "hsv":
532
+ result = rgbToHsv(rgb);
533
+ break;
534
+ case "hwb":
535
+ result = rgbToHwb(rgb);
536
+ break;
537
+ case "cmyk":
538
+ result = rgbToCmyk(rgb);
539
+ break;
540
+ case "xyz":
541
+ result = rgbToXyz(rgb);
542
+ break;
543
+ case "lab":
544
+ result = rgbToLab(rgb);
545
+ break;
546
+ case "lch":
547
+ result = rgbToLch(rgb);
548
+ break;
549
+ case "oklab":
550
+ result = rgbToOklab(rgb);
551
+ break;
552
+ case "oklch":
553
+ result = rgbToOklch(rgb);
554
+ break;
555
+ default:
556
+ result = rgb;
557
+ }
558
+ if (round && result) {
559
+ Object.keys(result).forEach((key) => {
560
+ if (typeof result[key] === "number" && key !== "a" && key !== "alpha") {
561
+ result[key] = roundToPrecision(result[key], precision);
562
+ }
563
+ });
564
+ }
565
+ if (!preserveAlpha) {
566
+ delete result.a;
567
+ delete result.alpha;
568
+ }
569
+ return result;
570
+ }
571
+ function batchConvert(colors, targetFormat, options = {}) {
572
+ return colors.map((color) => convertColor(color, targetFormat, options));
573
+ }
574
+ function getConversionPath(from, to) {
575
+ const directConversions = {
576
+ rgb: ["hsl", "hsv", "hwb", "cmyk", "xyz", "lab", "lch", "oklab", "oklch"],
577
+ hsl: ["rgb", "hsv", "hwb"],
578
+ hsv: ["rgb", "hsl", "hwb"],
579
+ hwb: ["rgb", "hsl", "hsv"],
580
+ cmyk: ["rgb", "hsl", "hsv"],
581
+ xyz: ["rgb", "lab"],
582
+ lab: ["rgb", "xyz", "lch"],
583
+ lch: ["rgb", "lab", "xyz"],
584
+ oklab: ["rgb", "oklch"],
585
+ oklch: ["rgb", "oklab"]
586
+ };
587
+ from = from.toLowerCase();
588
+ to = to.toLowerCase();
589
+ if (from === to) {
590
+ return [from];
591
+ }
592
+ if (directConversions[from]?.includes(to)) {
593
+ return [from, to];
594
+ }
595
+ if (directConversions[from]?.includes("rgb") && directConversions["rgb"]?.includes(to)) {
596
+ return [from, "rgb", to];
597
+ }
598
+ if (["lab", "lch"].includes(from) && ["lab", "lch"].includes(to) && from !== to) {
599
+ return [from, "xyz", to];
600
+ }
601
+ if (["oklab", "oklch"].includes(from) && ["oklab", "oklch"].includes(to) && from !== to) {
602
+ return [from, "oklab", to];
603
+ }
604
+ if (directConversions[from] && directConversions["rgb"]?.includes(to)) {
605
+ return [from, "rgb", to];
606
+ }
607
+ return null;
608
+ }
609
+ function hasDirectConversion(from, to) {
610
+ const path = getConversionPath(from, to);
611
+ return path !== null && path.length <= 2;
612
+ }
613
+ function getSupportedFormats() {
614
+ return [
615
+ "rgb",
616
+ "hsl",
617
+ "hsv",
618
+ "hwb",
619
+ "cmyk",
620
+ "xyz",
621
+ "lab",
622
+ "lch",
623
+ "oklab",
624
+ "oklch"
625
+ ];
626
+ }
627
+ function isValidFormat(format) {
628
+ return getSupportedFormats().includes(format.toLowerCase());
629
+ }