favesalon-embed 0.0.3 → 0.0.5

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 (237) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/_commonjsHelpers-5cfcba41.js +36 -0
  3. package/dist/cjs/chat-button.cjs.entry.js +118 -0
  4. package/dist/cjs/colors-38421769.js +69 -0
  5. package/dist/cjs/favesalon-embed.cjs.js +24 -0
  6. package/dist/cjs/google-map_5.cjs.entry.js +310 -0
  7. package/{cjs/index-7d179a70.js → dist/cjs/index-47c2a5f6.js} +587 -199
  8. package/dist/cjs/index-7f190886.js +4396 -0
  9. package/dist/cjs/loader.cjs.js +23 -0
  10. package/dist/cjs/relativeTime-3721080d.js +9 -0
  11. package/dist/cjs/salon-booking-modal.cjs.entry.js +30 -0
  12. package/dist/cjs/salon-booking.cjs.entry.js +51 -0
  13. package/dist/cjs/salon-gift-card-modal.cjs.entry.js +29 -0
  14. package/dist/cjs/salon-gift-card.cjs.entry.js +51 -0
  15. package/dist/cjs/salon-latest-reviews.cjs.entry.js +97 -0
  16. package/dist/cjs/salon-lookbook.cjs.entry.js +222 -0
  17. package/dist/cjs/salon-ranking.cjs.entry.js +60 -0
  18. package/dist/cjs/salon-reviews.cjs.entry.js +193 -0
  19. package/dist/cjs/salon-services.cjs.entry.js +81 -0
  20. package/dist/cjs/salon-stylists.cjs.entry.js +118 -0
  21. package/dist/cjs/services-125c82d8.js +21492 -0
  22. package/dist/cjs/style-detail.cjs.entry.js +312 -0
  23. package/dist/cjs/user-avatar.cjs.entry.js +45 -0
  24. package/dist/cjs/utils-c5a33b3c.js +23 -0
  25. package/{collection → dist/collection}/collection-manifest.json +5 -4
  26. package/dist/collection/components/chat-button/index.css +122 -0
  27. package/dist/collection/components/chat-button/index.js +218 -0
  28. package/dist/collection/components/chat-conversation/index.js +103 -0
  29. package/dist/collection/components/google-map/assets/map--placeholder.jpeg +0 -0
  30. package/{collection → dist/collection}/components/google-map/index.css +0 -1
  31. package/dist/collection/components/google-map/index.js +90 -0
  32. package/{collection → dist/collection}/components/salon-booking/index.css +11 -20
  33. package/dist/collection/components/salon-booking/index.js +126 -0
  34. package/dist/collection/components/salon-booking/salon-booking-modal.js +92 -0
  35. package/dist/collection/components/salon-gift-card/index.css +30 -0
  36. package/dist/collection/components/salon-gift-card/index.js +126 -0
  37. package/dist/collection/components/salon-gift-card/salon-gift-card-modal.js +73 -0
  38. package/dist/collection/components/salon-info/index.js +77 -0
  39. package/dist/collection/components/salon-latest-reviews/index.js +163 -0
  40. package/dist/collection/components/salon-latest-styles/index.css +12 -0
  41. package/dist/collection/components/salon-latest-styles/index.js +183 -0
  42. package/{collection/components/salon-contact → dist/collection/components/salon-locations}/index.css +7 -4
  43. package/dist/collection/components/salon-locations/index.js +143 -0
  44. package/dist/collection/components/salon-lookbook/index.css +15 -0
  45. package/dist/collection/components/salon-lookbook/index.js +368 -0
  46. package/dist/collection/components/salon-ranking/index.js +117 -0
  47. package/dist/collection/components/salon-reviews/index.css +18 -0
  48. package/dist/collection/components/salon-reviews/index.js +249 -0
  49. package/dist/collection/components/salon-schedules/index.css +18 -0
  50. package/dist/collection/components/salon-schedules/index.js +167 -0
  51. package/dist/collection/components/salon-services/index.css +1 -0
  52. package/dist/collection/components/salon-services/index.js +146 -0
  53. package/dist/collection/components/salon-stylists/index.js +184 -0
  54. package/dist/collection/components/style-detail/index.css +76 -0
  55. package/dist/collection/components/style-detail/index.js +386 -0
  56. package/dist/collection/components/user-avatar/index.js +134 -0
  57. package/dist/collection/constants/colors.js +65 -0
  58. package/dist/collection/mocks/users.js +10 -0
  59. package/dist/collection/services/services.js +295 -0
  60. package/dist/collection/types/chat.js +23 -0
  61. package/dist/collection/types/common.js +11 -0
  62. package/{collection → dist/collection}/types/review.js +9 -5
  63. package/dist/collection/types/salon.js +58 -0
  64. package/dist/collection/types/style.js +128 -0
  65. package/dist/collection/types/stylist.js +30 -0
  66. package/dist/collection/types/user.js +10 -0
  67. package/{custom-elements → dist/custom-elements}/index.d.ts +18 -12
  68. package/dist/custom-elements/index.js +28340 -0
  69. package/dist/esm/_commonjsHelpers-098d5b27.js +32 -0
  70. package/dist/esm/chat-button.entry.js +114 -0
  71. package/dist/esm/colors-ea36347a.js +67 -0
  72. package/dist/esm/favesalon-embed.js +19 -0
  73. package/dist/esm/google-map_5.entry.js +302 -0
  74. package/{esm/index-2160b80b.js → dist/esm/index-3fae868e.js} +586 -200
  75. package/dist/esm/index-80523fec.js +4393 -0
  76. package/dist/esm/index.js +1 -0
  77. package/dist/esm/loader.js +19 -0
  78. package/dist/esm/polyfills/css-shim.js +1 -0
  79. package/dist/esm/relativeTime-cd452e6d.js +7 -0
  80. package/dist/esm/salon-booking-modal.entry.js +26 -0
  81. package/dist/esm/salon-booking.entry.js +47 -0
  82. package/dist/esm/salon-gift-card-modal.entry.js +25 -0
  83. package/dist/esm/salon-gift-card.entry.js +47 -0
  84. package/dist/esm/salon-latest-reviews.entry.js +93 -0
  85. package/dist/esm/salon-lookbook.entry.js +218 -0
  86. package/dist/esm/salon-ranking.entry.js +56 -0
  87. package/dist/esm/salon-reviews.entry.js +189 -0
  88. package/dist/esm/salon-services.entry.js +77 -0
  89. package/dist/esm/salon-stylists.entry.js +114 -0
  90. package/dist/esm/services-40a3e622.js +21485 -0
  91. package/dist/esm/style-detail.entry.js +308 -0
  92. package/dist/esm/user-avatar.entry.js +41 -0
  93. package/dist/esm/utils-e97485e0.js +19 -0
  94. package/dist/favesalon-embed/assets/map--placeholder.jpeg +0 -0
  95. package/{favesalon-embed → dist/favesalon-embed}/favesalon-embed.css +1 -1
  96. package/dist/favesalon-embed/favesalon-embed.esm.js +1 -0
  97. package/dist/favesalon-embed/p-019c5ccd.entry.js +1 -0
  98. package/dist/favesalon-embed/p-083a8821.entry.js +1 -0
  99. package/dist/favesalon-embed/p-0d0ed9ea.entry.js +1 -0
  100. package/dist/favesalon-embed/p-119db8de.entry.js +1 -0
  101. package/dist/favesalon-embed/p-1432c51b.entry.js +1 -0
  102. package/dist/favesalon-embed/p-22093506.entry.js +1 -0
  103. package/dist/favesalon-embed/p-32b314e9.js +2 -0
  104. package/dist/favesalon-embed/p-47e646f8.js +1 -0
  105. package/dist/favesalon-embed/p-4a5eca9a.js +6 -0
  106. package/dist/favesalon-embed/p-58d2e9be.js +1 -0
  107. package/dist/favesalon-embed/p-71404b6a.entry.js +1 -0
  108. package/dist/favesalon-embed/p-857c3a61.entry.js +1 -0
  109. package/dist/favesalon-embed/p-99ec77f7.entry.js +1 -0
  110. package/dist/favesalon-embed/p-a33331cc.js +1 -0
  111. package/dist/favesalon-embed/p-b0c3673a.entry.js +1 -0
  112. package/dist/favesalon-embed/p-b287b1ea.entry.js +1 -0
  113. package/dist/favesalon-embed/p-b3af7842.entry.js +1 -0
  114. package/dist/favesalon-embed/p-b630ae68.js +1580 -0
  115. package/dist/favesalon-embed/p-ce2c1c9a.entry.js +1 -0
  116. package/dist/favesalon-embed/p-d6083940.js +1 -0
  117. package/dist/favesalon-embed/p-d9b7ad58.entry.js +1 -0
  118. package/dist/favesalon-embed/p-fc9a5551.js +6 -0
  119. package/dist/types/components/chat-button/index.d.ts +24 -0
  120. package/dist/types/components/google-map/index.d.ts +5 -0
  121. package/{types → dist/types}/components/salon-booking/salon-booking-modal.d.ts +1 -0
  122. package/{types → dist/types}/components/salon-gift-card/index.d.ts +2 -1
  123. package/{types → dist/types}/components/salon-gift-card/salon-gift-card-modal.d.ts +2 -0
  124. package/{types → dist/types}/components/salon-info/index.d.ts +0 -1
  125. package/{types → dist/types}/components/salon-latest-reviews/index.d.ts +2 -0
  126. package/dist/types/components/salon-latest-styles/index.d.ts +12 -0
  127. package/{types → dist/types}/components/salon-locations/index.d.ts +2 -0
  128. package/{types → dist/types}/components/salon-lookbook/index.d.ts +7 -2
  129. package/dist/types/components/salon-reviews/index.d.ts +24 -0
  130. package/{types → dist/types}/components/salon-schedules/index.d.ts +2 -0
  131. package/{types → dist/types}/components/salon-services/index.d.ts +1 -0
  132. package/{types → dist/types}/components/salon-stylists/index.d.ts +6 -0
  133. package/dist/types/components/style-detail/index.d.ts +24 -0
  134. package/{types → dist/types}/components.d.ts +82 -41
  135. package/dist/types/constants/colors.d.ts +65 -0
  136. package/dist/types/mocks/users.d.ts +10 -0
  137. package/dist/types/services/services.d.ts +75 -0
  138. package/{types → dist/types}/stencil-public-runtime.d.ts +85 -11
  139. package/dist/types/types/chat.d.ts +17 -0
  140. package/dist/types/types/common.d.ts +11 -0
  141. package/{types → dist/types}/types/review.d.ts +4 -0
  142. package/{types → dist/types}/types/salon.d.ts +3 -1
  143. package/dist/types/types/style.d.ts +88 -0
  144. package/{types → dist/types}/types/stylist.d.ts +2 -1
  145. package/{types → dist/types}/types/user.d.ts +2 -2
  146. package/loader/cdn.js +3 -0
  147. package/loader/index.cjs.js +3 -0
  148. package/loader/index.d.ts +21 -0
  149. package/loader/index.es2017.js +3 -0
  150. package/loader/index.js +4 -0
  151. package/loader/package.json +11 -0
  152. package/package.json +19 -14
  153. package/readme.md +25 -2
  154. package/cjs/favesalon-embed.cjs.js +0 -20
  155. package/cjs/google-map_15.cjs.entry.js +0 -6632
  156. package/cjs/loader.cjs.js +0 -22
  157. package/cjs/salon-booking-modal.cjs.entry.js +0 -23
  158. package/cjs/salon-gift-card-modal.cjs.entry.js +0 -20
  159. package/collection/components/google-map/index.js +0 -97
  160. package/collection/components/salon-booking/index.js +0 -103
  161. package/collection/components/salon-booking/salon-booking-modal.js +0 -82
  162. package/collection/components/salon-contact/index.js +0 -88
  163. package/collection/components/salon-gift-card/index.css +0 -25
  164. package/collection/components/salon-gift-card/index.js +0 -83
  165. package/collection/components/salon-gift-card/salon-gift-card-modal.js +0 -43
  166. package/collection/components/salon-info/index.css +0 -3
  167. package/collection/components/salon-info/index.js +0 -97
  168. package/collection/components/salon-latest-reviews/index.js +0 -108
  169. package/collection/components/salon-locations/index.js +0 -80
  170. package/collection/components/salon-lookbook/index.css +0 -12
  171. package/collection/components/salon-lookbook/index.js +0 -303
  172. package/collection/components/salon-ranking/index.js +0 -114
  173. package/collection/components/salon-reviews/index.js +0 -291
  174. package/collection/components/salon-schedules/index.css +0 -14
  175. package/collection/components/salon-schedules/index.js +0 -103
  176. package/collection/components/salon-services/index.css +0 -0
  177. package/collection/components/salon-services/index.js +0 -113
  178. package/collection/components/salon-styles/index.css +0 -23
  179. package/collection/components/salon-styles/index.js +0 -100
  180. package/collection/components/salon-stylists/index.js +0 -96
  181. package/collection/components/user-avatar/index.css +0 -0
  182. package/collection/components/user-avatar/index.js +0 -127
  183. package/collection/constants/colors.js +0 -91
  184. package/collection/services/services.js +0 -203
  185. package/collection/types/common.js +0 -2
  186. package/collection/types/salon.js +0 -52
  187. package/collection/types/style.js +0 -28
  188. package/collection/types/stylist.js +0 -13
  189. package/collection/types/user.js +0 -10
  190. package/custom-elements/index.js +0 -7410
  191. package/esm/favesalon-embed.js +0 -18
  192. package/esm/google-map_15.entry.js +0 -6614
  193. package/esm/loader.js +0 -18
  194. package/esm/polyfills/css-shim.js +0 -1
  195. package/esm/salon-booking-modal.entry.js +0 -19
  196. package/esm/salon-gift-card-modal.entry.js +0 -16
  197. package/favesalon-embed/favesalon-embed.esm.js +0 -1
  198. package/favesalon-embed/p-1432ab16.entry.js +0 -1
  199. package/favesalon-embed/p-2da2ed75.js +0 -1
  200. package/favesalon-embed/p-4a5eca9a.js +0 -6
  201. package/favesalon-embed/p-94a0991e.entry.js +0 -1
  202. package/favesalon-embed/p-f15bcb43.entry.js +0 -1
  203. package/types/components/google-map/index.d.ts +0 -10
  204. package/types/components/salon-contact/index.d.ts +0 -9
  205. package/types/components/salon-reviews/index.d.ts +0 -23
  206. package/types/components/salon-styles/index.d.ts +0 -9
  207. package/types/constants/colors.d.ts +0 -88
  208. package/types/services/services.d.ts +0 -24
  209. package/types/types/common.d.ts +0 -2
  210. package/types/types/style.d.ts +0 -49
  211. package/{cjs → dist/cjs}/global-9073d10e.js +0 -0
  212. package/{cjs → dist/cjs}/index.cjs.js +0 -0
  213. package/{esm/index.js → dist/collection/components/salon-info/index.css} +0 -0
  214. package/{collection → dist/collection}/components/salon-latest-reviews/index.css +0 -0
  215. package/{collection → dist/collection}/components/salon-ranking/index.css +0 -0
  216. package/{collection → dist/collection}/components/salon-stylists/index.css +0 -0
  217. package/{collection/components/salon-locations → dist/collection/components/user-avatar}/index.css +0 -0
  218. package/{collection → dist/collection}/global/global.js +0 -0
  219. package/{collection → dist/collection}/index.js +0 -0
  220. package/{collection → dist/collection}/types/service.js +0 -0
  221. package/{collection → dist/collection}/utils/utils.js +0 -0
  222. package/{esm → dist/esm}/global-e1089ffd.js +0 -0
  223. package/{esm → dist/esm}/polyfills/core-js.js +0 -0
  224. package/{esm → dist/esm}/polyfills/dom.js +0 -0
  225. package/{esm → dist/esm}/polyfills/es5-html-element.js +0 -0
  226. package/{esm → dist/esm}/polyfills/index.js +0 -0
  227. package/{esm → dist/esm}/polyfills/system.js +0 -0
  228. package/{favesalon-embed → dist/favesalon-embed}/index.esm.js +0 -0
  229. package/{index.cjs.js → dist/index.cjs.js} +0 -0
  230. package/{index.js → dist/index.js} +0 -0
  231. package/{collection/components/salon-reviews/index.css → dist/types/components/chat-conversation/index.d.ts} +0 -0
  232. package/{types → dist/types}/components/salon-booking/index.d.ts +1 -1
  233. /package/{types → dist/types}/components/salon-ranking/index.d.ts +0 -0
  234. /package/{types → dist/types}/components/user-avatar/index.d.ts +0 -0
  235. /package/{types → dist/types}/index.d.ts +0 -0
  236. /package/{types → dist/types}/types/service.d.ts +0 -0
  237. /package/{types → dist/types}/utils/utils.d.ts +0 -0
@@ -0,0 +1,4393 @@
1
+ import { a as createCommonjsModule, g as getAugmentedNamespace } from './_commonjsHelpers-098d5b27.js';
2
+
3
+ var colorName = {
4
+ "aliceblue": [240, 248, 255],
5
+ "antiquewhite": [250, 235, 215],
6
+ "aqua": [0, 255, 255],
7
+ "aquamarine": [127, 255, 212],
8
+ "azure": [240, 255, 255],
9
+ "beige": [245, 245, 220],
10
+ "bisque": [255, 228, 196],
11
+ "black": [0, 0, 0],
12
+ "blanchedalmond": [255, 235, 205],
13
+ "blue": [0, 0, 255],
14
+ "blueviolet": [138, 43, 226],
15
+ "brown": [165, 42, 42],
16
+ "burlywood": [222, 184, 135],
17
+ "cadetblue": [95, 158, 160],
18
+ "chartreuse": [127, 255, 0],
19
+ "chocolate": [210, 105, 30],
20
+ "coral": [255, 127, 80],
21
+ "cornflowerblue": [100, 149, 237],
22
+ "cornsilk": [255, 248, 220],
23
+ "crimson": [220, 20, 60],
24
+ "cyan": [0, 255, 255],
25
+ "darkblue": [0, 0, 139],
26
+ "darkcyan": [0, 139, 139],
27
+ "darkgoldenrod": [184, 134, 11],
28
+ "darkgray": [169, 169, 169],
29
+ "darkgreen": [0, 100, 0],
30
+ "darkgrey": [169, 169, 169],
31
+ "darkkhaki": [189, 183, 107],
32
+ "darkmagenta": [139, 0, 139],
33
+ "darkolivegreen": [85, 107, 47],
34
+ "darkorange": [255, 140, 0],
35
+ "darkorchid": [153, 50, 204],
36
+ "darkred": [139, 0, 0],
37
+ "darksalmon": [233, 150, 122],
38
+ "darkseagreen": [143, 188, 143],
39
+ "darkslateblue": [72, 61, 139],
40
+ "darkslategray": [47, 79, 79],
41
+ "darkslategrey": [47, 79, 79],
42
+ "darkturquoise": [0, 206, 209],
43
+ "darkviolet": [148, 0, 211],
44
+ "deeppink": [255, 20, 147],
45
+ "deepskyblue": [0, 191, 255],
46
+ "dimgray": [105, 105, 105],
47
+ "dimgrey": [105, 105, 105],
48
+ "dodgerblue": [30, 144, 255],
49
+ "firebrick": [178, 34, 34],
50
+ "floralwhite": [255, 250, 240],
51
+ "forestgreen": [34, 139, 34],
52
+ "fuchsia": [255, 0, 255],
53
+ "gainsboro": [220, 220, 220],
54
+ "ghostwhite": [248, 248, 255],
55
+ "gold": [255, 215, 0],
56
+ "goldenrod": [218, 165, 32],
57
+ "gray": [128, 128, 128],
58
+ "green": [0, 128, 0],
59
+ "greenyellow": [173, 255, 47],
60
+ "grey": [128, 128, 128],
61
+ "honeydew": [240, 255, 240],
62
+ "hotpink": [255, 105, 180],
63
+ "indianred": [205, 92, 92],
64
+ "indigo": [75, 0, 130],
65
+ "ivory": [255, 255, 240],
66
+ "khaki": [240, 230, 140],
67
+ "lavender": [230, 230, 250],
68
+ "lavenderblush": [255, 240, 245],
69
+ "lawngreen": [124, 252, 0],
70
+ "lemonchiffon": [255, 250, 205],
71
+ "lightblue": [173, 216, 230],
72
+ "lightcoral": [240, 128, 128],
73
+ "lightcyan": [224, 255, 255],
74
+ "lightgoldenrodyellow": [250, 250, 210],
75
+ "lightgray": [211, 211, 211],
76
+ "lightgreen": [144, 238, 144],
77
+ "lightgrey": [211, 211, 211],
78
+ "lightpink": [255, 182, 193],
79
+ "lightsalmon": [255, 160, 122],
80
+ "lightseagreen": [32, 178, 170],
81
+ "lightskyblue": [135, 206, 250],
82
+ "lightslategray": [119, 136, 153],
83
+ "lightslategrey": [119, 136, 153],
84
+ "lightsteelblue": [176, 196, 222],
85
+ "lightyellow": [255, 255, 224],
86
+ "lime": [0, 255, 0],
87
+ "limegreen": [50, 205, 50],
88
+ "linen": [250, 240, 230],
89
+ "magenta": [255, 0, 255],
90
+ "maroon": [128, 0, 0],
91
+ "mediumaquamarine": [102, 205, 170],
92
+ "mediumblue": [0, 0, 205],
93
+ "mediumorchid": [186, 85, 211],
94
+ "mediumpurple": [147, 112, 219],
95
+ "mediumseagreen": [60, 179, 113],
96
+ "mediumslateblue": [123, 104, 238],
97
+ "mediumspringgreen": [0, 250, 154],
98
+ "mediumturquoise": [72, 209, 204],
99
+ "mediumvioletred": [199, 21, 133],
100
+ "midnightblue": [25, 25, 112],
101
+ "mintcream": [245, 255, 250],
102
+ "mistyrose": [255, 228, 225],
103
+ "moccasin": [255, 228, 181],
104
+ "navajowhite": [255, 222, 173],
105
+ "navy": [0, 0, 128],
106
+ "oldlace": [253, 245, 230],
107
+ "olive": [128, 128, 0],
108
+ "olivedrab": [107, 142, 35],
109
+ "orange": [255, 165, 0],
110
+ "orangered": [255, 69, 0],
111
+ "orchid": [218, 112, 214],
112
+ "palegoldenrod": [238, 232, 170],
113
+ "palegreen": [152, 251, 152],
114
+ "paleturquoise": [175, 238, 238],
115
+ "palevioletred": [219, 112, 147],
116
+ "papayawhip": [255, 239, 213],
117
+ "peachpuff": [255, 218, 185],
118
+ "peru": [205, 133, 63],
119
+ "pink": [255, 192, 203],
120
+ "plum": [221, 160, 221],
121
+ "powderblue": [176, 224, 230],
122
+ "purple": [128, 0, 128],
123
+ "rebeccapurple": [102, 51, 153],
124
+ "red": [255, 0, 0],
125
+ "rosybrown": [188, 143, 143],
126
+ "royalblue": [65, 105, 225],
127
+ "saddlebrown": [139, 69, 19],
128
+ "salmon": [250, 128, 114],
129
+ "sandybrown": [244, 164, 96],
130
+ "seagreen": [46, 139, 87],
131
+ "seashell": [255, 245, 238],
132
+ "sienna": [160, 82, 45],
133
+ "silver": [192, 192, 192],
134
+ "skyblue": [135, 206, 235],
135
+ "slateblue": [106, 90, 205],
136
+ "slategray": [112, 128, 144],
137
+ "slategrey": [112, 128, 144],
138
+ "snow": [255, 250, 250],
139
+ "springgreen": [0, 255, 127],
140
+ "steelblue": [70, 130, 180],
141
+ "tan": [210, 180, 140],
142
+ "teal": [0, 128, 128],
143
+ "thistle": [216, 191, 216],
144
+ "tomato": [255, 99, 71],
145
+ "turquoise": [64, 224, 208],
146
+ "violet": [238, 130, 238],
147
+ "wheat": [245, 222, 179],
148
+ "white": [255, 255, 255],
149
+ "whitesmoke": [245, 245, 245],
150
+ "yellow": [255, 255, 0],
151
+ "yellowgreen": [154, 205, 50]
152
+ };
153
+
154
+ var isArrayish = function isArrayish(obj) {
155
+ if (!obj || typeof obj === 'string') {
156
+ return false;
157
+ }
158
+
159
+ return obj instanceof Array || Array.isArray(obj) ||
160
+ (obj.length >= 0 && (obj.splice instanceof Function ||
161
+ (Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
162
+ };
163
+
164
+ var simpleSwizzle = createCommonjsModule(function (module) {
165
+
166
+
167
+
168
+ var concat = Array.prototype.concat;
169
+ var slice = Array.prototype.slice;
170
+
171
+ var swizzle = module.exports = function swizzle(args) {
172
+ var results = [];
173
+
174
+ for (var i = 0, len = args.length; i < len; i++) {
175
+ var arg = args[i];
176
+
177
+ if (isArrayish(arg)) {
178
+ // http://jsperf.com/javascript-array-concat-vs-push/98
179
+ results = concat.call(results, slice.call(arg));
180
+ } else {
181
+ results.push(arg);
182
+ }
183
+ }
184
+
185
+ return results;
186
+ };
187
+
188
+ swizzle.wrap = function (fn) {
189
+ return function () {
190
+ return fn(swizzle(arguments));
191
+ };
192
+ };
193
+ });
194
+
195
+ var colorString = createCommonjsModule(function (module) {
196
+ /* MIT license */
197
+
198
+
199
+
200
+ var reverseNames = {};
201
+
202
+ // create a list of reverse color names
203
+ for (var name in colorName) {
204
+ if (colorName.hasOwnProperty(name)) {
205
+ reverseNames[colorName[name]] = name;
206
+ }
207
+ }
208
+
209
+ var cs = module.exports = {
210
+ to: {},
211
+ get: {}
212
+ };
213
+
214
+ cs.get = function (string) {
215
+ var prefix = string.substring(0, 3).toLowerCase();
216
+ var val;
217
+ var model;
218
+ switch (prefix) {
219
+ case 'hsl':
220
+ val = cs.get.hsl(string);
221
+ model = 'hsl';
222
+ break;
223
+ case 'hwb':
224
+ val = cs.get.hwb(string);
225
+ model = 'hwb';
226
+ break;
227
+ default:
228
+ val = cs.get.rgb(string);
229
+ model = 'rgb';
230
+ break;
231
+ }
232
+
233
+ if (!val) {
234
+ return null;
235
+ }
236
+
237
+ return {model: model, value: val};
238
+ };
239
+
240
+ cs.get.rgb = function (string) {
241
+ if (!string) {
242
+ return null;
243
+ }
244
+
245
+ var abbr = /^#([a-f0-9]{3,4})$/i;
246
+ var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
247
+ var rgba = /^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;
248
+ var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;
249
+ var keyword = /(\D+)/;
250
+
251
+ var rgb = [0, 0, 0, 1];
252
+ var match;
253
+ var i;
254
+ var hexAlpha;
255
+
256
+ if (match = string.match(hex)) {
257
+ hexAlpha = match[2];
258
+ match = match[1];
259
+
260
+ for (i = 0; i < 3; i++) {
261
+ // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
262
+ var i2 = i * 2;
263
+ rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
264
+ }
265
+
266
+ if (hexAlpha) {
267
+ rgb[3] = parseInt(hexAlpha, 16) / 255;
268
+ }
269
+ } else if (match = string.match(abbr)) {
270
+ match = match[1];
271
+ hexAlpha = match[3];
272
+
273
+ for (i = 0; i < 3; i++) {
274
+ rgb[i] = parseInt(match[i] + match[i], 16);
275
+ }
276
+
277
+ if (hexAlpha) {
278
+ rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
279
+ }
280
+ } else if (match = string.match(rgba)) {
281
+ for (i = 0; i < 3; i++) {
282
+ rgb[i] = parseInt(match[i + 1], 0);
283
+ }
284
+
285
+ if (match[4]) {
286
+ rgb[3] = parseFloat(match[4]);
287
+ }
288
+ } else if (match = string.match(per)) {
289
+ for (i = 0; i < 3; i++) {
290
+ rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
291
+ }
292
+
293
+ if (match[4]) {
294
+ rgb[3] = parseFloat(match[4]);
295
+ }
296
+ } else if (match = string.match(keyword)) {
297
+ if (match[1] === 'transparent') {
298
+ return [0, 0, 0, 0];
299
+ }
300
+
301
+ rgb = colorName[match[1]];
302
+
303
+ if (!rgb) {
304
+ return null;
305
+ }
306
+
307
+ rgb[3] = 1;
308
+
309
+ return rgb;
310
+ } else {
311
+ return null;
312
+ }
313
+
314
+ for (i = 0; i < 3; i++) {
315
+ rgb[i] = clamp(rgb[i], 0, 255);
316
+ }
317
+ rgb[3] = clamp(rgb[3], 0, 1);
318
+
319
+ return rgb;
320
+ };
321
+
322
+ cs.get.hsl = function (string) {
323
+ if (!string) {
324
+ return null;
325
+ }
326
+
327
+ var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?[\d\.]+)\s*)?\)$/;
328
+ var match = string.match(hsl);
329
+
330
+ if (match) {
331
+ var alpha = parseFloat(match[4]);
332
+ var h = (parseFloat(match[1]) + 360) % 360;
333
+ var s = clamp(parseFloat(match[2]), 0, 100);
334
+ var l = clamp(parseFloat(match[3]), 0, 100);
335
+ var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
336
+
337
+ return [h, s, l, a];
338
+ }
339
+
340
+ return null;
341
+ };
342
+
343
+ cs.get.hwb = function (string) {
344
+ if (!string) {
345
+ return null;
346
+ }
347
+
348
+ var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;
349
+ var match = string.match(hwb);
350
+
351
+ if (match) {
352
+ var alpha = parseFloat(match[4]);
353
+ var h = ((parseFloat(match[1]) % 360) + 360) % 360;
354
+ var w = clamp(parseFloat(match[2]), 0, 100);
355
+ var b = clamp(parseFloat(match[3]), 0, 100);
356
+ var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
357
+ return [h, w, b, a];
358
+ }
359
+
360
+ return null;
361
+ };
362
+
363
+ cs.to.hex = function () {
364
+ var rgba = simpleSwizzle(arguments);
365
+
366
+ return (
367
+ '#' +
368
+ hexDouble(rgba[0]) +
369
+ hexDouble(rgba[1]) +
370
+ hexDouble(rgba[2]) +
371
+ (rgba[3] < 1
372
+ ? (hexDouble(Math.round(rgba[3] * 255)))
373
+ : '')
374
+ );
375
+ };
376
+
377
+ cs.to.rgb = function () {
378
+ var rgba = simpleSwizzle(arguments);
379
+
380
+ return rgba.length < 4 || rgba[3] === 1
381
+ ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'
382
+ : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
383
+ };
384
+
385
+ cs.to.rgb.percent = function () {
386
+ var rgba = simpleSwizzle(arguments);
387
+
388
+ var r = Math.round(rgba[0] / 255 * 100);
389
+ var g = Math.round(rgba[1] / 255 * 100);
390
+ var b = Math.round(rgba[2] / 255 * 100);
391
+
392
+ return rgba.length < 4 || rgba[3] === 1
393
+ ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'
394
+ : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
395
+ };
396
+
397
+ cs.to.hsl = function () {
398
+ var hsla = simpleSwizzle(arguments);
399
+ return hsla.length < 4 || hsla[3] === 1
400
+ ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'
401
+ : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
402
+ };
403
+
404
+ // hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
405
+ // (hwb have alpha optional & 1 is default value)
406
+ cs.to.hwb = function () {
407
+ var hwba = simpleSwizzle(arguments);
408
+
409
+ var a = '';
410
+ if (hwba.length >= 4 && hwba[3] !== 1) {
411
+ a = ', ' + hwba[3];
412
+ }
413
+
414
+ return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
415
+ };
416
+
417
+ cs.to.keyword = function (rgb) {
418
+ return reverseNames[rgb.slice(0, 3)];
419
+ };
420
+
421
+ // helpers
422
+ function clamp(num, min, max) {
423
+ return Math.min(Math.max(min, num), max);
424
+ }
425
+
426
+ function hexDouble(num) {
427
+ var str = num.toString(16).toUpperCase();
428
+ return (str.length < 2) ? '0' + str : str;
429
+ }
430
+ });
431
+
432
+ /* MIT license */
433
+ /* eslint-disable no-mixed-operators */
434
+
435
+
436
+ // NOTE: conversions should only return primitive values (i.e. arrays, or
437
+ // values that give correct `typeof` results).
438
+ // do not use box values types (i.e. Number(), String(), etc.)
439
+
440
+ const reverseKeywords = {};
441
+ for (const key of Object.keys(colorName)) {
442
+ reverseKeywords[colorName[key]] = key;
443
+ }
444
+
445
+ const convert$1 = {
446
+ rgb: {channels: 3, labels: 'rgb'},
447
+ hsl: {channels: 3, labels: 'hsl'},
448
+ hsv: {channels: 3, labels: 'hsv'},
449
+ hwb: {channels: 3, labels: 'hwb'},
450
+ cmyk: {channels: 4, labels: 'cmyk'},
451
+ xyz: {channels: 3, labels: 'xyz'},
452
+ lab: {channels: 3, labels: 'lab'},
453
+ lch: {channels: 3, labels: 'lch'},
454
+ hex: {channels: 1, labels: ['hex']},
455
+ keyword: {channels: 1, labels: ['keyword']},
456
+ ansi16: {channels: 1, labels: ['ansi16']},
457
+ ansi256: {channels: 1, labels: ['ansi256']},
458
+ hcg: {channels: 3, labels: ['h', 'c', 'g']},
459
+ apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
460
+ gray: {channels: 1, labels: ['gray']}
461
+ };
462
+
463
+ var conversions = convert$1;
464
+
465
+ // Hide .channels and .labels properties
466
+ for (const model of Object.keys(convert$1)) {
467
+ if (!('channels' in convert$1[model])) {
468
+ throw new Error('missing channels property: ' + model);
469
+ }
470
+
471
+ if (!('labels' in convert$1[model])) {
472
+ throw new Error('missing channel labels property: ' + model);
473
+ }
474
+
475
+ if (convert$1[model].labels.length !== convert$1[model].channels) {
476
+ throw new Error('channel and label counts mismatch: ' + model);
477
+ }
478
+
479
+ const {channels, labels} = convert$1[model];
480
+ delete convert$1[model].channels;
481
+ delete convert$1[model].labels;
482
+ Object.defineProperty(convert$1[model], 'channels', {value: channels});
483
+ Object.defineProperty(convert$1[model], 'labels', {value: labels});
484
+ }
485
+
486
+ convert$1.rgb.hsl = function (rgb) {
487
+ const r = rgb[0] / 255;
488
+ const g = rgb[1] / 255;
489
+ const b = rgb[2] / 255;
490
+ const min = Math.min(r, g, b);
491
+ const max = Math.max(r, g, b);
492
+ const delta = max - min;
493
+ let h;
494
+ let s;
495
+
496
+ if (max === min) {
497
+ h = 0;
498
+ } else if (r === max) {
499
+ h = (g - b) / delta;
500
+ } else if (g === max) {
501
+ h = 2 + (b - r) / delta;
502
+ } else if (b === max) {
503
+ h = 4 + (r - g) / delta;
504
+ }
505
+
506
+ h = Math.min(h * 60, 360);
507
+
508
+ if (h < 0) {
509
+ h += 360;
510
+ }
511
+
512
+ const l = (min + max) / 2;
513
+
514
+ if (max === min) {
515
+ s = 0;
516
+ } else if (l <= 0.5) {
517
+ s = delta / (max + min);
518
+ } else {
519
+ s = delta / (2 - max - min);
520
+ }
521
+
522
+ return [h, s * 100, l * 100];
523
+ };
524
+
525
+ convert$1.rgb.hsv = function (rgb) {
526
+ let rdif;
527
+ let gdif;
528
+ let bdif;
529
+ let h;
530
+ let s;
531
+
532
+ const r = rgb[0] / 255;
533
+ const g = rgb[1] / 255;
534
+ const b = rgb[2] / 255;
535
+ const v = Math.max(r, g, b);
536
+ const diff = v - Math.min(r, g, b);
537
+ const diffc = function (c) {
538
+ return (v - c) / 6 / diff + 1 / 2;
539
+ };
540
+
541
+ if (diff === 0) {
542
+ h = 0;
543
+ s = 0;
544
+ } else {
545
+ s = diff / v;
546
+ rdif = diffc(r);
547
+ gdif = diffc(g);
548
+ bdif = diffc(b);
549
+
550
+ if (r === v) {
551
+ h = bdif - gdif;
552
+ } else if (g === v) {
553
+ h = (1 / 3) + rdif - bdif;
554
+ } else if (b === v) {
555
+ h = (2 / 3) + gdif - rdif;
556
+ }
557
+
558
+ if (h < 0) {
559
+ h += 1;
560
+ } else if (h > 1) {
561
+ h -= 1;
562
+ }
563
+ }
564
+
565
+ return [
566
+ h * 360,
567
+ s * 100,
568
+ v * 100
569
+ ];
570
+ };
571
+
572
+ convert$1.rgb.hwb = function (rgb) {
573
+ const r = rgb[0];
574
+ const g = rgb[1];
575
+ let b = rgb[2];
576
+ const h = convert$1.rgb.hsl(rgb)[0];
577
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
578
+
579
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
580
+
581
+ return [h, w * 100, b * 100];
582
+ };
583
+
584
+ convert$1.rgb.cmyk = function (rgb) {
585
+ const r = rgb[0] / 255;
586
+ const g = rgb[1] / 255;
587
+ const b = rgb[2] / 255;
588
+
589
+ const k = Math.min(1 - r, 1 - g, 1 - b);
590
+ const c = (1 - r - k) / (1 - k) || 0;
591
+ const m = (1 - g - k) / (1 - k) || 0;
592
+ const y = (1 - b - k) / (1 - k) || 0;
593
+
594
+ return [c * 100, m * 100, y * 100, k * 100];
595
+ };
596
+
597
+ function comparativeDistance(x, y) {
598
+ /*
599
+ See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
600
+ */
601
+ return (
602
+ ((x[0] - y[0]) ** 2) +
603
+ ((x[1] - y[1]) ** 2) +
604
+ ((x[2] - y[2]) ** 2)
605
+ );
606
+ }
607
+
608
+ convert$1.rgb.keyword = function (rgb) {
609
+ const reversed = reverseKeywords[rgb];
610
+ if (reversed) {
611
+ return reversed;
612
+ }
613
+
614
+ let currentClosestDistance = Infinity;
615
+ let currentClosestKeyword;
616
+
617
+ for (const keyword of Object.keys(colorName)) {
618
+ const value = colorName[keyword];
619
+
620
+ // Compute comparative distance
621
+ const distance = comparativeDistance(rgb, value);
622
+
623
+ // Check if its less, if so set as closest
624
+ if (distance < currentClosestDistance) {
625
+ currentClosestDistance = distance;
626
+ currentClosestKeyword = keyword;
627
+ }
628
+ }
629
+
630
+ return currentClosestKeyword;
631
+ };
632
+
633
+ convert$1.keyword.rgb = function (keyword) {
634
+ return colorName[keyword];
635
+ };
636
+
637
+ convert$1.rgb.xyz = function (rgb) {
638
+ let r = rgb[0] / 255;
639
+ let g = rgb[1] / 255;
640
+ let b = rgb[2] / 255;
641
+
642
+ // Assume sRGB
643
+ r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
644
+ g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
645
+ b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
646
+
647
+ const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
648
+ const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
649
+ const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
650
+
651
+ return [x * 100, y * 100, z * 100];
652
+ };
653
+
654
+ convert$1.rgb.lab = function (rgb) {
655
+ const xyz = convert$1.rgb.xyz(rgb);
656
+ let x = xyz[0];
657
+ let y = xyz[1];
658
+ let z = xyz[2];
659
+
660
+ x /= 95.047;
661
+ y /= 100;
662
+ z /= 108.883;
663
+
664
+ x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
665
+ y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
666
+ z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
667
+
668
+ const l = (116 * y) - 16;
669
+ const a = 500 * (x - y);
670
+ const b = 200 * (y - z);
671
+
672
+ return [l, a, b];
673
+ };
674
+
675
+ convert$1.hsl.rgb = function (hsl) {
676
+ const h = hsl[0] / 360;
677
+ const s = hsl[1] / 100;
678
+ const l = hsl[2] / 100;
679
+ let t2;
680
+ let t3;
681
+ let val;
682
+
683
+ if (s === 0) {
684
+ val = l * 255;
685
+ return [val, val, val];
686
+ }
687
+
688
+ if (l < 0.5) {
689
+ t2 = l * (1 + s);
690
+ } else {
691
+ t2 = l + s - l * s;
692
+ }
693
+
694
+ const t1 = 2 * l - t2;
695
+
696
+ const rgb = [0, 0, 0];
697
+ for (let i = 0; i < 3; i++) {
698
+ t3 = h + 1 / 3 * -(i - 1);
699
+ if (t3 < 0) {
700
+ t3++;
701
+ }
702
+
703
+ if (t3 > 1) {
704
+ t3--;
705
+ }
706
+
707
+ if (6 * t3 < 1) {
708
+ val = t1 + (t2 - t1) * 6 * t3;
709
+ } else if (2 * t3 < 1) {
710
+ val = t2;
711
+ } else if (3 * t3 < 2) {
712
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
713
+ } else {
714
+ val = t1;
715
+ }
716
+
717
+ rgb[i] = val * 255;
718
+ }
719
+
720
+ return rgb;
721
+ };
722
+
723
+ convert$1.hsl.hsv = function (hsl) {
724
+ const h = hsl[0];
725
+ let s = hsl[1] / 100;
726
+ let l = hsl[2] / 100;
727
+ let smin = s;
728
+ const lmin = Math.max(l, 0.01);
729
+
730
+ l *= 2;
731
+ s *= (l <= 1) ? l : 2 - l;
732
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
733
+ const v = (l + s) / 2;
734
+ const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
735
+
736
+ return [h, sv * 100, v * 100];
737
+ };
738
+
739
+ convert$1.hsv.rgb = function (hsv) {
740
+ const h = hsv[0] / 60;
741
+ const s = hsv[1] / 100;
742
+ let v = hsv[2] / 100;
743
+ const hi = Math.floor(h) % 6;
744
+
745
+ const f = h - Math.floor(h);
746
+ const p = 255 * v * (1 - s);
747
+ const q = 255 * v * (1 - (s * f));
748
+ const t = 255 * v * (1 - (s * (1 - f)));
749
+ v *= 255;
750
+
751
+ switch (hi) {
752
+ case 0:
753
+ return [v, t, p];
754
+ case 1:
755
+ return [q, v, p];
756
+ case 2:
757
+ return [p, v, t];
758
+ case 3:
759
+ return [p, q, v];
760
+ case 4:
761
+ return [t, p, v];
762
+ case 5:
763
+ return [v, p, q];
764
+ }
765
+ };
766
+
767
+ convert$1.hsv.hsl = function (hsv) {
768
+ const h = hsv[0];
769
+ const s = hsv[1] / 100;
770
+ const v = hsv[2] / 100;
771
+ const vmin = Math.max(v, 0.01);
772
+ let sl;
773
+ let l;
774
+
775
+ l = (2 - s) * v;
776
+ const lmin = (2 - s) * vmin;
777
+ sl = s * vmin;
778
+ sl /= (lmin <= 1) ? lmin : 2 - lmin;
779
+ sl = sl || 0;
780
+ l /= 2;
781
+
782
+ return [h, sl * 100, l * 100];
783
+ };
784
+
785
+ // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
786
+ convert$1.hwb.rgb = function (hwb) {
787
+ const h = hwb[0] / 360;
788
+ let wh = hwb[1] / 100;
789
+ let bl = hwb[2] / 100;
790
+ const ratio = wh + bl;
791
+ let f;
792
+
793
+ // Wh + bl cant be > 1
794
+ if (ratio > 1) {
795
+ wh /= ratio;
796
+ bl /= ratio;
797
+ }
798
+
799
+ const i = Math.floor(6 * h);
800
+ const v = 1 - bl;
801
+ f = 6 * h - i;
802
+
803
+ if ((i & 0x01) !== 0) {
804
+ f = 1 - f;
805
+ }
806
+
807
+ const n = wh + f * (v - wh); // Linear interpolation
808
+
809
+ let r;
810
+ let g;
811
+ let b;
812
+ /* eslint-disable max-statements-per-line,no-multi-spaces */
813
+ switch (i) {
814
+ default:
815
+ case 6:
816
+ case 0: r = v; g = n; b = wh; break;
817
+ case 1: r = n; g = v; b = wh; break;
818
+ case 2: r = wh; g = v; b = n; break;
819
+ case 3: r = wh; g = n; b = v; break;
820
+ case 4: r = n; g = wh; b = v; break;
821
+ case 5: r = v; g = wh; b = n; break;
822
+ }
823
+ /* eslint-enable max-statements-per-line,no-multi-spaces */
824
+
825
+ return [r * 255, g * 255, b * 255];
826
+ };
827
+
828
+ convert$1.cmyk.rgb = function (cmyk) {
829
+ const c = cmyk[0] / 100;
830
+ const m = cmyk[1] / 100;
831
+ const y = cmyk[2] / 100;
832
+ const k = cmyk[3] / 100;
833
+
834
+ const r = 1 - Math.min(1, c * (1 - k) + k);
835
+ const g = 1 - Math.min(1, m * (1 - k) + k);
836
+ const b = 1 - Math.min(1, y * (1 - k) + k);
837
+
838
+ return [r * 255, g * 255, b * 255];
839
+ };
840
+
841
+ convert$1.xyz.rgb = function (xyz) {
842
+ const x = xyz[0] / 100;
843
+ const y = xyz[1] / 100;
844
+ const z = xyz[2] / 100;
845
+ let r;
846
+ let g;
847
+ let b;
848
+
849
+ r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
850
+ g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
851
+ b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
852
+
853
+ // Assume sRGB
854
+ r = r > 0.0031308
855
+ ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
856
+ : r * 12.92;
857
+
858
+ g = g > 0.0031308
859
+ ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
860
+ : g * 12.92;
861
+
862
+ b = b > 0.0031308
863
+ ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
864
+ : b * 12.92;
865
+
866
+ r = Math.min(Math.max(0, r), 1);
867
+ g = Math.min(Math.max(0, g), 1);
868
+ b = Math.min(Math.max(0, b), 1);
869
+
870
+ return [r * 255, g * 255, b * 255];
871
+ };
872
+
873
+ convert$1.xyz.lab = function (xyz) {
874
+ let x = xyz[0];
875
+ let y = xyz[1];
876
+ let z = xyz[2];
877
+
878
+ x /= 95.047;
879
+ y /= 100;
880
+ z /= 108.883;
881
+
882
+ x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
883
+ y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
884
+ z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
885
+
886
+ const l = (116 * y) - 16;
887
+ const a = 500 * (x - y);
888
+ const b = 200 * (y - z);
889
+
890
+ return [l, a, b];
891
+ };
892
+
893
+ convert$1.lab.xyz = function (lab) {
894
+ const l = lab[0];
895
+ const a = lab[1];
896
+ const b = lab[2];
897
+ let x;
898
+ let y;
899
+ let z;
900
+
901
+ y = (l + 16) / 116;
902
+ x = a / 500 + y;
903
+ z = y - b / 200;
904
+
905
+ const y2 = y ** 3;
906
+ const x2 = x ** 3;
907
+ const z2 = z ** 3;
908
+ y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
909
+ x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
910
+ z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
911
+
912
+ x *= 95.047;
913
+ y *= 100;
914
+ z *= 108.883;
915
+
916
+ return [x, y, z];
917
+ };
918
+
919
+ convert$1.lab.lch = function (lab) {
920
+ const l = lab[0];
921
+ const a = lab[1];
922
+ const b = lab[2];
923
+ let h;
924
+
925
+ const hr = Math.atan2(b, a);
926
+ h = hr * 360 / 2 / Math.PI;
927
+
928
+ if (h < 0) {
929
+ h += 360;
930
+ }
931
+
932
+ const c = Math.sqrt(a * a + b * b);
933
+
934
+ return [l, c, h];
935
+ };
936
+
937
+ convert$1.lch.lab = function (lch) {
938
+ const l = lch[0];
939
+ const c = lch[1];
940
+ const h = lch[2];
941
+
942
+ const hr = h / 360 * 2 * Math.PI;
943
+ const a = c * Math.cos(hr);
944
+ const b = c * Math.sin(hr);
945
+
946
+ return [l, a, b];
947
+ };
948
+
949
+ convert$1.rgb.ansi16 = function (args, saturation = null) {
950
+ const [r, g, b] = args;
951
+ let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
952
+
953
+ value = Math.round(value / 50);
954
+
955
+ if (value === 0) {
956
+ return 30;
957
+ }
958
+
959
+ let ansi = 30
960
+ + ((Math.round(b / 255) << 2)
961
+ | (Math.round(g / 255) << 1)
962
+ | Math.round(r / 255));
963
+
964
+ if (value === 2) {
965
+ ansi += 60;
966
+ }
967
+
968
+ return ansi;
969
+ };
970
+
971
+ convert$1.hsv.ansi16 = function (args) {
972
+ // Optimization here; we already know the value and don't need to get
973
+ // it converted for us.
974
+ return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
975
+ };
976
+
977
+ convert$1.rgb.ansi256 = function (args) {
978
+ const r = args[0];
979
+ const g = args[1];
980
+ const b = args[2];
981
+
982
+ // We use the extended greyscale palette here, with the exception of
983
+ // black and white. normal palette only has 4 greyscale shades.
984
+ if (r === g && g === b) {
985
+ if (r < 8) {
986
+ return 16;
987
+ }
988
+
989
+ if (r > 248) {
990
+ return 231;
991
+ }
992
+
993
+ return Math.round(((r - 8) / 247) * 24) + 232;
994
+ }
995
+
996
+ const ansi = 16
997
+ + (36 * Math.round(r / 255 * 5))
998
+ + (6 * Math.round(g / 255 * 5))
999
+ + Math.round(b / 255 * 5);
1000
+
1001
+ return ansi;
1002
+ };
1003
+
1004
+ convert$1.ansi16.rgb = function (args) {
1005
+ let color = args % 10;
1006
+
1007
+ // Handle greyscale
1008
+ if (color === 0 || color === 7) {
1009
+ if (args > 50) {
1010
+ color += 3.5;
1011
+ }
1012
+
1013
+ color = color / 10.5 * 255;
1014
+
1015
+ return [color, color, color];
1016
+ }
1017
+
1018
+ const mult = (~~(args > 50) + 1) * 0.5;
1019
+ const r = ((color & 1) * mult) * 255;
1020
+ const g = (((color >> 1) & 1) * mult) * 255;
1021
+ const b = (((color >> 2) & 1) * mult) * 255;
1022
+
1023
+ return [r, g, b];
1024
+ };
1025
+
1026
+ convert$1.ansi256.rgb = function (args) {
1027
+ // Handle greyscale
1028
+ if (args >= 232) {
1029
+ const c = (args - 232) * 10 + 8;
1030
+ return [c, c, c];
1031
+ }
1032
+
1033
+ args -= 16;
1034
+
1035
+ let rem;
1036
+ const r = Math.floor(args / 36) / 5 * 255;
1037
+ const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
1038
+ const b = (rem % 6) / 5 * 255;
1039
+
1040
+ return [r, g, b];
1041
+ };
1042
+
1043
+ convert$1.rgb.hex = function (args) {
1044
+ const integer = ((Math.round(args[0]) & 0xFF) << 16)
1045
+ + ((Math.round(args[1]) & 0xFF) << 8)
1046
+ + (Math.round(args[2]) & 0xFF);
1047
+
1048
+ const string = integer.toString(16).toUpperCase();
1049
+ return '000000'.substring(string.length) + string;
1050
+ };
1051
+
1052
+ convert$1.hex.rgb = function (args) {
1053
+ const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
1054
+ if (!match) {
1055
+ return [0, 0, 0];
1056
+ }
1057
+
1058
+ let colorString = match[0];
1059
+
1060
+ if (match[0].length === 3) {
1061
+ colorString = colorString.split('').map(char => {
1062
+ return char + char;
1063
+ }).join('');
1064
+ }
1065
+
1066
+ const integer = parseInt(colorString, 16);
1067
+ const r = (integer >> 16) & 0xFF;
1068
+ const g = (integer >> 8) & 0xFF;
1069
+ const b = integer & 0xFF;
1070
+
1071
+ return [r, g, b];
1072
+ };
1073
+
1074
+ convert$1.rgb.hcg = function (rgb) {
1075
+ const r = rgb[0] / 255;
1076
+ const g = rgb[1] / 255;
1077
+ const b = rgb[2] / 255;
1078
+ const max = Math.max(Math.max(r, g), b);
1079
+ const min = Math.min(Math.min(r, g), b);
1080
+ const chroma = (max - min);
1081
+ let grayscale;
1082
+ let hue;
1083
+
1084
+ if (chroma < 1) {
1085
+ grayscale = min / (1 - chroma);
1086
+ } else {
1087
+ grayscale = 0;
1088
+ }
1089
+
1090
+ if (chroma <= 0) {
1091
+ hue = 0;
1092
+ } else
1093
+ if (max === r) {
1094
+ hue = ((g - b) / chroma) % 6;
1095
+ } else
1096
+ if (max === g) {
1097
+ hue = 2 + (b - r) / chroma;
1098
+ } else {
1099
+ hue = 4 + (r - g) / chroma;
1100
+ }
1101
+
1102
+ hue /= 6;
1103
+ hue %= 1;
1104
+
1105
+ return [hue * 360, chroma * 100, grayscale * 100];
1106
+ };
1107
+
1108
+ convert$1.hsl.hcg = function (hsl) {
1109
+ const s = hsl[1] / 100;
1110
+ const l = hsl[2] / 100;
1111
+
1112
+ const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
1113
+
1114
+ let f = 0;
1115
+ if (c < 1.0) {
1116
+ f = (l - 0.5 * c) / (1.0 - c);
1117
+ }
1118
+
1119
+ return [hsl[0], c * 100, f * 100];
1120
+ };
1121
+
1122
+ convert$1.hsv.hcg = function (hsv) {
1123
+ const s = hsv[1] / 100;
1124
+ const v = hsv[2] / 100;
1125
+
1126
+ const c = s * v;
1127
+ let f = 0;
1128
+
1129
+ if (c < 1.0) {
1130
+ f = (v - c) / (1 - c);
1131
+ }
1132
+
1133
+ return [hsv[0], c * 100, f * 100];
1134
+ };
1135
+
1136
+ convert$1.hcg.rgb = function (hcg) {
1137
+ const h = hcg[0] / 360;
1138
+ const c = hcg[1] / 100;
1139
+ const g = hcg[2] / 100;
1140
+
1141
+ if (c === 0.0) {
1142
+ return [g * 255, g * 255, g * 255];
1143
+ }
1144
+
1145
+ const pure = [0, 0, 0];
1146
+ const hi = (h % 1) * 6;
1147
+ const v = hi % 1;
1148
+ const w = 1 - v;
1149
+ let mg = 0;
1150
+
1151
+ /* eslint-disable max-statements-per-line */
1152
+ switch (Math.floor(hi)) {
1153
+ case 0:
1154
+ pure[0] = 1; pure[1] = v; pure[2] = 0; break;
1155
+ case 1:
1156
+ pure[0] = w; pure[1] = 1; pure[2] = 0; break;
1157
+ case 2:
1158
+ pure[0] = 0; pure[1] = 1; pure[2] = v; break;
1159
+ case 3:
1160
+ pure[0] = 0; pure[1] = w; pure[2] = 1; break;
1161
+ case 4:
1162
+ pure[0] = v; pure[1] = 0; pure[2] = 1; break;
1163
+ default:
1164
+ pure[0] = 1; pure[1] = 0; pure[2] = w;
1165
+ }
1166
+ /* eslint-enable max-statements-per-line */
1167
+
1168
+ mg = (1.0 - c) * g;
1169
+
1170
+ return [
1171
+ (c * pure[0] + mg) * 255,
1172
+ (c * pure[1] + mg) * 255,
1173
+ (c * pure[2] + mg) * 255
1174
+ ];
1175
+ };
1176
+
1177
+ convert$1.hcg.hsv = function (hcg) {
1178
+ const c = hcg[1] / 100;
1179
+ const g = hcg[2] / 100;
1180
+
1181
+ const v = c + g * (1.0 - c);
1182
+ let f = 0;
1183
+
1184
+ if (v > 0.0) {
1185
+ f = c / v;
1186
+ }
1187
+
1188
+ return [hcg[0], f * 100, v * 100];
1189
+ };
1190
+
1191
+ convert$1.hcg.hsl = function (hcg) {
1192
+ const c = hcg[1] / 100;
1193
+ const g = hcg[2] / 100;
1194
+
1195
+ const l = g * (1.0 - c) + 0.5 * c;
1196
+ let s = 0;
1197
+
1198
+ if (l > 0.0 && l < 0.5) {
1199
+ s = c / (2 * l);
1200
+ } else
1201
+ if (l >= 0.5 && l < 1.0) {
1202
+ s = c / (2 * (1 - l));
1203
+ }
1204
+
1205
+ return [hcg[0], s * 100, l * 100];
1206
+ };
1207
+
1208
+ convert$1.hcg.hwb = function (hcg) {
1209
+ const c = hcg[1] / 100;
1210
+ const g = hcg[2] / 100;
1211
+ const v = c + g * (1.0 - c);
1212
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
1213
+ };
1214
+
1215
+ convert$1.hwb.hcg = function (hwb) {
1216
+ const w = hwb[1] / 100;
1217
+ const b = hwb[2] / 100;
1218
+ const v = 1 - b;
1219
+ const c = v - w;
1220
+ let g = 0;
1221
+
1222
+ if (c < 1) {
1223
+ g = (v - c) / (1 - c);
1224
+ }
1225
+
1226
+ return [hwb[0], c * 100, g * 100];
1227
+ };
1228
+
1229
+ convert$1.apple.rgb = function (apple) {
1230
+ return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
1231
+ };
1232
+
1233
+ convert$1.rgb.apple = function (rgb) {
1234
+ return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
1235
+ };
1236
+
1237
+ convert$1.gray.rgb = function (args) {
1238
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
1239
+ };
1240
+
1241
+ convert$1.gray.hsl = function (args) {
1242
+ return [0, 0, args[0]];
1243
+ };
1244
+
1245
+ convert$1.gray.hsv = convert$1.gray.hsl;
1246
+
1247
+ convert$1.gray.hwb = function (gray) {
1248
+ return [0, 100, gray[0]];
1249
+ };
1250
+
1251
+ convert$1.gray.cmyk = function (gray) {
1252
+ return [0, 0, 0, gray[0]];
1253
+ };
1254
+
1255
+ convert$1.gray.lab = function (gray) {
1256
+ return [gray[0], 0, 0];
1257
+ };
1258
+
1259
+ convert$1.gray.hex = function (gray) {
1260
+ const val = Math.round(gray[0] / 100 * 255) & 0xFF;
1261
+ const integer = (val << 16) + (val << 8) + val;
1262
+
1263
+ const string = integer.toString(16).toUpperCase();
1264
+ return '000000'.substring(string.length) + string;
1265
+ };
1266
+
1267
+ convert$1.rgb.gray = function (rgb) {
1268
+ const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
1269
+ return [val / 255 * 100];
1270
+ };
1271
+
1272
+ /*
1273
+ This function routes a model to all other models.
1274
+
1275
+ all functions that are routed have a property `.conversion` attached
1276
+ to the returned synthetic function. This property is an array
1277
+ of strings, each with the steps in between the 'from' and 'to'
1278
+ color models (inclusive).
1279
+
1280
+ conversions that are not possible simply are not included.
1281
+ */
1282
+
1283
+ function buildGraph() {
1284
+ const graph = {};
1285
+ // https://jsperf.com/object-keys-vs-for-in-with-closure/3
1286
+ const models = Object.keys(conversions);
1287
+
1288
+ for (let len = models.length, i = 0; i < len; i++) {
1289
+ graph[models[i]] = {
1290
+ // http://jsperf.com/1-vs-infinity
1291
+ // micro-opt, but this is simple.
1292
+ distance: -1,
1293
+ parent: null
1294
+ };
1295
+ }
1296
+
1297
+ return graph;
1298
+ }
1299
+
1300
+ // https://en.wikipedia.org/wiki/Breadth-first_search
1301
+ function deriveBFS(fromModel) {
1302
+ const graph = buildGraph();
1303
+ const queue = [fromModel]; // Unshift -> queue -> pop
1304
+
1305
+ graph[fromModel].distance = 0;
1306
+
1307
+ while (queue.length) {
1308
+ const current = queue.pop();
1309
+ const adjacents = Object.keys(conversions[current]);
1310
+
1311
+ for (let len = adjacents.length, i = 0; i < len; i++) {
1312
+ const adjacent = adjacents[i];
1313
+ const node = graph[adjacent];
1314
+
1315
+ if (node.distance === -1) {
1316
+ node.distance = graph[current].distance + 1;
1317
+ node.parent = current;
1318
+ queue.unshift(adjacent);
1319
+ }
1320
+ }
1321
+ }
1322
+
1323
+ return graph;
1324
+ }
1325
+
1326
+ function link(from, to) {
1327
+ return function (args) {
1328
+ return to(from(args));
1329
+ };
1330
+ }
1331
+
1332
+ function wrapConversion(toModel, graph) {
1333
+ const path = [graph[toModel].parent, toModel];
1334
+ let fn = conversions[graph[toModel].parent][toModel];
1335
+
1336
+ let cur = graph[toModel].parent;
1337
+ while (graph[cur].parent) {
1338
+ path.unshift(graph[cur].parent);
1339
+ fn = link(conversions[graph[cur].parent][cur], fn);
1340
+ cur = graph[cur].parent;
1341
+ }
1342
+
1343
+ fn.conversion = path;
1344
+ return fn;
1345
+ }
1346
+
1347
+ var route = function (fromModel) {
1348
+ const graph = deriveBFS(fromModel);
1349
+ const conversion = {};
1350
+
1351
+ const models = Object.keys(graph);
1352
+ for (let len = models.length, i = 0; i < len; i++) {
1353
+ const toModel = models[i];
1354
+ const node = graph[toModel];
1355
+
1356
+ if (node.parent === null) {
1357
+ // No possible conversion, or this node is the source model.
1358
+ continue;
1359
+ }
1360
+
1361
+ conversion[toModel] = wrapConversion(toModel, graph);
1362
+ }
1363
+
1364
+ return conversion;
1365
+ };
1366
+
1367
+ const convert = {};
1368
+
1369
+ const models = Object.keys(conversions);
1370
+
1371
+ function wrapRaw(fn) {
1372
+ const wrappedFn = function (...args) {
1373
+ const arg0 = args[0];
1374
+ if (arg0 === undefined || arg0 === null) {
1375
+ return arg0;
1376
+ }
1377
+
1378
+ if (arg0.length > 1) {
1379
+ args = arg0;
1380
+ }
1381
+
1382
+ return fn(args);
1383
+ };
1384
+
1385
+ // Preserve .conversion property if there is one
1386
+ if ('conversion' in fn) {
1387
+ wrappedFn.conversion = fn.conversion;
1388
+ }
1389
+
1390
+ return wrappedFn;
1391
+ }
1392
+
1393
+ function wrapRounded(fn) {
1394
+ const wrappedFn = function (...args) {
1395
+ const arg0 = args[0];
1396
+
1397
+ if (arg0 === undefined || arg0 === null) {
1398
+ return arg0;
1399
+ }
1400
+
1401
+ if (arg0.length > 1) {
1402
+ args = arg0;
1403
+ }
1404
+
1405
+ const result = fn(args);
1406
+
1407
+ // We're assuming the result is an array here.
1408
+ // see notice in conversions.js; don't use box types
1409
+ // in conversion functions.
1410
+ if (typeof result === 'object') {
1411
+ for (let len = result.length, i = 0; i < len; i++) {
1412
+ result[i] = Math.round(result[i]);
1413
+ }
1414
+ }
1415
+
1416
+ return result;
1417
+ };
1418
+
1419
+ // Preserve .conversion property if there is one
1420
+ if ('conversion' in fn) {
1421
+ wrappedFn.conversion = fn.conversion;
1422
+ }
1423
+
1424
+ return wrappedFn;
1425
+ }
1426
+
1427
+ models.forEach(fromModel => {
1428
+ convert[fromModel] = {};
1429
+
1430
+ Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
1431
+ Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
1432
+
1433
+ const routes = route(fromModel);
1434
+ const routeModels = Object.keys(routes);
1435
+
1436
+ routeModels.forEach(toModel => {
1437
+ const fn = routes[toModel];
1438
+
1439
+ convert[fromModel][toModel] = wrapRounded(fn);
1440
+ convert[fromModel][toModel].raw = wrapRaw(fn);
1441
+ });
1442
+ });
1443
+
1444
+ var colorConvert = convert;
1445
+
1446
+ const _slice = [].slice;
1447
+
1448
+ const skippedModels = [
1449
+ // To be honest, I don't really feel like keyword belongs in color convert, but eh.
1450
+ 'keyword',
1451
+
1452
+ // Gray conflicts with some method names, and has its own method defined.
1453
+ 'gray',
1454
+
1455
+ // Shouldn't really be in color-convert either...
1456
+ 'hex',
1457
+ ];
1458
+
1459
+ const hashedModelKeys = {};
1460
+ for (const model of Object.keys(colorConvert)) {
1461
+ hashedModelKeys[_slice.call(colorConvert[model].labels).sort().join('')] = model;
1462
+ }
1463
+
1464
+ const limiters = {};
1465
+
1466
+ function Color(object, model) {
1467
+ if (!(this instanceof Color)) {
1468
+ return new Color(object, model);
1469
+ }
1470
+
1471
+ if (model && model in skippedModels) {
1472
+ model = null;
1473
+ }
1474
+
1475
+ if (model && !(model in colorConvert)) {
1476
+ throw new Error('Unknown model: ' + model);
1477
+ }
1478
+
1479
+ let i;
1480
+ let channels;
1481
+
1482
+ if (object == null) { // eslint-disable-line no-eq-null,eqeqeq
1483
+ this.model = 'rgb';
1484
+ this.color = [0, 0, 0];
1485
+ this.valpha = 1;
1486
+ } else if (object instanceof Color) {
1487
+ this.model = object.model;
1488
+ this.color = object.color.slice();
1489
+ this.valpha = object.valpha;
1490
+ } else if (typeof object === 'string') {
1491
+ const result = colorString.get(object);
1492
+ if (result === null) {
1493
+ throw new Error('Unable to parse color from string: ' + object);
1494
+ }
1495
+
1496
+ this.model = result.model;
1497
+ channels = colorConvert[this.model].channels;
1498
+ this.color = result.value.slice(0, channels);
1499
+ this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
1500
+ } else if (object.length > 0) {
1501
+ this.model = model || 'rgb';
1502
+ channels = colorConvert[this.model].channels;
1503
+ const newArray = _slice.call(object, 0, channels);
1504
+ this.color = zeroArray(newArray, channels);
1505
+ this.valpha = typeof object[channels] === 'number' ? object[channels] : 1;
1506
+ } else if (typeof object === 'number') {
1507
+ // This is always RGB - can be converted later on.
1508
+ this.model = 'rgb';
1509
+ this.color = [
1510
+ (object >> 16) & 0xFF,
1511
+ (object >> 8) & 0xFF,
1512
+ object & 0xFF,
1513
+ ];
1514
+ this.valpha = 1;
1515
+ } else {
1516
+ this.valpha = 1;
1517
+
1518
+ const keys = Object.keys(object);
1519
+ if ('alpha' in object) {
1520
+ keys.splice(keys.indexOf('alpha'), 1);
1521
+ this.valpha = typeof object.alpha === 'number' ? object.alpha : 0;
1522
+ }
1523
+
1524
+ const hashedKeys = keys.sort().join('');
1525
+ if (!(hashedKeys in hashedModelKeys)) {
1526
+ throw new Error('Unable to parse color from object: ' + JSON.stringify(object));
1527
+ }
1528
+
1529
+ this.model = hashedModelKeys[hashedKeys];
1530
+
1531
+ const labels = colorConvert[this.model].labels;
1532
+ const color = [];
1533
+ for (i = 0; i < labels.length; i++) {
1534
+ color.push(object[labels[i]]);
1535
+ }
1536
+
1537
+ this.color = zeroArray(color);
1538
+ }
1539
+
1540
+ // Perform limitations (clamping, etc.)
1541
+ if (limiters[this.model]) {
1542
+ channels = colorConvert[this.model].channels;
1543
+ for (i = 0; i < channels; i++) {
1544
+ const limit = limiters[this.model][i];
1545
+ if (limit) {
1546
+ this.color[i] = limit(this.color[i]);
1547
+ }
1548
+ }
1549
+ }
1550
+
1551
+ this.valpha = Math.max(0, Math.min(1, this.valpha));
1552
+
1553
+ if (Object.freeze) {
1554
+ Object.freeze(this);
1555
+ }
1556
+ }
1557
+
1558
+ Color.prototype = {
1559
+ toString() {
1560
+ return this.string();
1561
+ },
1562
+
1563
+ toJSON() {
1564
+ return this[this.model]();
1565
+ },
1566
+
1567
+ string(places) {
1568
+ let self = this.model in colorString.to ? this : this.rgb();
1569
+ self = self.round(typeof places === 'number' ? places : 1);
1570
+ const args = self.valpha === 1 ? self.color : self.color.concat(this.valpha);
1571
+ return colorString.to[self.model](args);
1572
+ },
1573
+
1574
+ percentString(places) {
1575
+ const self = this.rgb().round(typeof places === 'number' ? places : 1);
1576
+ const args = self.valpha === 1 ? self.color : self.color.concat(this.valpha);
1577
+ return colorString.to.rgb.percent(args);
1578
+ },
1579
+
1580
+ array() {
1581
+ return this.valpha === 1 ? this.color.slice() : this.color.concat(this.valpha);
1582
+ },
1583
+
1584
+ object() {
1585
+ const result = {};
1586
+ const channels = colorConvert[this.model].channels;
1587
+ const labels = colorConvert[this.model].labels;
1588
+
1589
+ for (let i = 0; i < channels; i++) {
1590
+ result[labels[i]] = this.color[i];
1591
+ }
1592
+
1593
+ if (this.valpha !== 1) {
1594
+ result.alpha = this.valpha;
1595
+ }
1596
+
1597
+ return result;
1598
+ },
1599
+
1600
+ unitArray() {
1601
+ const rgb = this.rgb().color;
1602
+ rgb[0] /= 255;
1603
+ rgb[1] /= 255;
1604
+ rgb[2] /= 255;
1605
+
1606
+ if (this.valpha !== 1) {
1607
+ rgb.push(this.valpha);
1608
+ }
1609
+
1610
+ return rgb;
1611
+ },
1612
+
1613
+ unitObject() {
1614
+ const rgb = this.rgb().object();
1615
+ rgb.r /= 255;
1616
+ rgb.g /= 255;
1617
+ rgb.b /= 255;
1618
+
1619
+ if (this.valpha !== 1) {
1620
+ rgb.alpha = this.valpha;
1621
+ }
1622
+
1623
+ return rgb;
1624
+ },
1625
+
1626
+ round(places) {
1627
+ places = Math.max(places || 0, 0);
1628
+ return new Color(this.color.map(roundToPlace(places)).concat(this.valpha), this.model);
1629
+ },
1630
+
1631
+ alpha(value) {
1632
+ if (arguments.length > 0) {
1633
+ return new Color(this.color.concat(Math.max(0, Math.min(1, value))), this.model);
1634
+ }
1635
+
1636
+ return this.valpha;
1637
+ },
1638
+
1639
+ // Rgb
1640
+ red: getset('rgb', 0, maxfn(255)),
1641
+ green: getset('rgb', 1, maxfn(255)),
1642
+ blue: getset('rgb', 2, maxfn(255)),
1643
+
1644
+ hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360),
1645
+
1646
+ saturationl: getset('hsl', 1, maxfn(100)),
1647
+ lightness: getset('hsl', 2, maxfn(100)),
1648
+
1649
+ saturationv: getset('hsv', 1, maxfn(100)),
1650
+ value: getset('hsv', 2, maxfn(100)),
1651
+
1652
+ chroma: getset('hcg', 1, maxfn(100)),
1653
+ gray: getset('hcg', 2, maxfn(100)),
1654
+
1655
+ white: getset('hwb', 1, maxfn(100)),
1656
+ wblack: getset('hwb', 2, maxfn(100)),
1657
+
1658
+ cyan: getset('cmyk', 0, maxfn(100)),
1659
+ magenta: getset('cmyk', 1, maxfn(100)),
1660
+ yellow: getset('cmyk', 2, maxfn(100)),
1661
+ black: getset('cmyk', 3, maxfn(100)),
1662
+
1663
+ x: getset('xyz', 0, maxfn(100)),
1664
+ y: getset('xyz', 1, maxfn(100)),
1665
+ z: getset('xyz', 2, maxfn(100)),
1666
+
1667
+ l: getset('lab', 0, maxfn(100)),
1668
+ a: getset('lab', 1),
1669
+ b: getset('lab', 2),
1670
+
1671
+ keyword(value) {
1672
+ if (arguments.length > 0) {
1673
+ return new Color(value);
1674
+ }
1675
+
1676
+ return colorConvert[this.model].keyword(this.color);
1677
+ },
1678
+
1679
+ hex(value) {
1680
+ if (arguments.length > 0) {
1681
+ return new Color(value);
1682
+ }
1683
+
1684
+ return colorString.to.hex(this.rgb().round().color);
1685
+ },
1686
+
1687
+ rgbNumber() {
1688
+ const rgb = this.rgb().color;
1689
+ return ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);
1690
+ },
1691
+
1692
+ luminosity() {
1693
+ // http://www.w3.org/TR/WCAG20/#relativeluminancedef
1694
+ const rgb = this.rgb().color;
1695
+
1696
+ const lum = [];
1697
+ for (const [i, element] of rgb.entries()) {
1698
+ const chan = element / 255;
1699
+ lum[i] = (chan <= 0.039_28) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
1700
+ }
1701
+
1702
+ return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
1703
+ },
1704
+
1705
+ contrast(color2) {
1706
+ // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
1707
+ const lum1 = this.luminosity();
1708
+ const lum2 = color2.luminosity();
1709
+
1710
+ if (lum1 > lum2) {
1711
+ return (lum1 + 0.05) / (lum2 + 0.05);
1712
+ }
1713
+
1714
+ return (lum2 + 0.05) / (lum1 + 0.05);
1715
+ },
1716
+
1717
+ level(color2) {
1718
+ const contrastRatio = this.contrast(color2);
1719
+ if (contrastRatio >= 7.1) {
1720
+ return 'AAA';
1721
+ }
1722
+
1723
+ return (contrastRatio >= 4.5) ? 'AA' : '';
1724
+ },
1725
+
1726
+ isDark() {
1727
+ // YIQ equation from http://24ways.org/2010/calculating-color-contrast
1728
+ const rgb = this.rgb().color;
1729
+ const yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
1730
+ return yiq < 128;
1731
+ },
1732
+
1733
+ isLight() {
1734
+ return !this.isDark();
1735
+ },
1736
+
1737
+ negate() {
1738
+ const rgb = this.rgb();
1739
+ for (let i = 0; i < 3; i++) {
1740
+ rgb.color[i] = 255 - rgb.color[i];
1741
+ }
1742
+
1743
+ return rgb;
1744
+ },
1745
+
1746
+ lighten(ratio) {
1747
+ const hsl = this.hsl();
1748
+ hsl.color[2] += hsl.color[2] * ratio;
1749
+ return hsl;
1750
+ },
1751
+
1752
+ darken(ratio) {
1753
+ const hsl = this.hsl();
1754
+ hsl.color[2] -= hsl.color[2] * ratio;
1755
+ return hsl;
1756
+ },
1757
+
1758
+ saturate(ratio) {
1759
+ const hsl = this.hsl();
1760
+ hsl.color[1] += hsl.color[1] * ratio;
1761
+ return hsl;
1762
+ },
1763
+
1764
+ desaturate(ratio) {
1765
+ const hsl = this.hsl();
1766
+ hsl.color[1] -= hsl.color[1] * ratio;
1767
+ return hsl;
1768
+ },
1769
+
1770
+ whiten(ratio) {
1771
+ const hwb = this.hwb();
1772
+ hwb.color[1] += hwb.color[1] * ratio;
1773
+ return hwb;
1774
+ },
1775
+
1776
+ blacken(ratio) {
1777
+ const hwb = this.hwb();
1778
+ hwb.color[2] += hwb.color[2] * ratio;
1779
+ return hwb;
1780
+ },
1781
+
1782
+ grayscale() {
1783
+ // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
1784
+ const rgb = this.rgb().color;
1785
+ const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
1786
+ return Color.rgb(value, value, value);
1787
+ },
1788
+
1789
+ fade(ratio) {
1790
+ return this.alpha(this.valpha - (this.valpha * ratio));
1791
+ },
1792
+
1793
+ opaquer(ratio) {
1794
+ return this.alpha(this.valpha + (this.valpha * ratio));
1795
+ },
1796
+
1797
+ rotate(degrees) {
1798
+ const hsl = this.hsl();
1799
+ let hue = hsl.color[0];
1800
+ hue = (hue + degrees) % 360;
1801
+ hue = hue < 0 ? 360 + hue : hue;
1802
+ hsl.color[0] = hue;
1803
+ return hsl;
1804
+ },
1805
+
1806
+ mix(mixinColor, weight) {
1807
+ // Ported from sass implementation in C
1808
+ // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
1809
+ if (!mixinColor || !mixinColor.rgb) {
1810
+ throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
1811
+ }
1812
+
1813
+ const color1 = mixinColor.rgb();
1814
+ const color2 = this.rgb();
1815
+ const p = weight === undefined ? 0.5 : weight;
1816
+
1817
+ const w = 2 * p - 1;
1818
+ const a = color1.alpha() - color2.alpha();
1819
+
1820
+ const w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2;
1821
+ const w2 = 1 - w1;
1822
+
1823
+ return Color.rgb(
1824
+ w1 * color1.red() + w2 * color2.red(),
1825
+ w1 * color1.green() + w2 * color2.green(),
1826
+ w1 * color1.blue() + w2 * color2.blue(),
1827
+ color1.alpha() * p + color2.alpha() * (1 - p));
1828
+ },
1829
+ };
1830
+
1831
+ // Model conversion methods and static constructors
1832
+ for (const model of Object.keys(colorConvert)) {
1833
+ if (skippedModels.includes(model)) {
1834
+ continue;
1835
+ }
1836
+
1837
+ const channels = colorConvert[model].channels;
1838
+
1839
+ // Conversion methods
1840
+ Color.prototype[model] = function () {
1841
+ if (this.model === model) {
1842
+ return new Color(this);
1843
+ }
1844
+
1845
+ if (arguments.length > 0) {
1846
+ return new Color(arguments, model);
1847
+ }
1848
+
1849
+ const newAlpha = typeof arguments[channels] === 'number' ? channels : this.valpha;
1850
+ return new Color(assertArray(colorConvert[this.model][model].raw(this.color)).concat(newAlpha), model);
1851
+ };
1852
+
1853
+ // 'static' construction methods
1854
+ Color[model] = function (color) {
1855
+ if (typeof color === 'number') {
1856
+ color = zeroArray(_slice.call(arguments), channels);
1857
+ }
1858
+
1859
+ return new Color(color, model);
1860
+ };
1861
+ }
1862
+
1863
+ function roundTo(number, places) {
1864
+ return Number(number.toFixed(places));
1865
+ }
1866
+
1867
+ function roundToPlace(places) {
1868
+ return function (number) {
1869
+ return roundTo(number, places);
1870
+ };
1871
+ }
1872
+
1873
+ function getset(model, channel, modifier) {
1874
+ model = Array.isArray(model) ? model : [model];
1875
+
1876
+ for (const m of model) {
1877
+ (limiters[m] || (limiters[m] = []))[channel] = modifier;
1878
+ }
1879
+
1880
+ model = model[0];
1881
+
1882
+ return function (value) {
1883
+ let result;
1884
+
1885
+ if (arguments.length > 0) {
1886
+ if (modifier) {
1887
+ value = modifier(value);
1888
+ }
1889
+
1890
+ result = this[model]();
1891
+ result.color[channel] = value;
1892
+ return result;
1893
+ }
1894
+
1895
+ result = this[model]().color[channel];
1896
+ if (modifier) {
1897
+ result = modifier(result);
1898
+ }
1899
+
1900
+ return result;
1901
+ };
1902
+ }
1903
+
1904
+ function maxfn(max) {
1905
+ return function (v) {
1906
+ return Math.max(0, Math.min(max, v));
1907
+ };
1908
+ }
1909
+
1910
+ function assertArray(value) {
1911
+ return Array.isArray(value) ? value : [value];
1912
+ }
1913
+
1914
+ function zeroArray(array, length) {
1915
+ for (let i = 0; i < length; i++) {
1916
+ if (typeof array[i] !== 'number') {
1917
+ array[i] = 0;
1918
+ }
1919
+ }
1920
+
1921
+ return array;
1922
+ }
1923
+
1924
+ var color = Color;
1925
+
1926
+ /*
1927
+ object-assign
1928
+ (c) Sindre Sorhus
1929
+ @license MIT
1930
+ */
1931
+ /* eslint-disable no-unused-vars */
1932
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
1933
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1934
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
1935
+
1936
+ function toObject(val) {
1937
+ if (val === null || val === undefined) {
1938
+ throw new TypeError('Object.assign cannot be called with null or undefined');
1939
+ }
1940
+
1941
+ return Object(val);
1942
+ }
1943
+
1944
+ function shouldUseNative() {
1945
+ try {
1946
+ if (!Object.assign) {
1947
+ return false;
1948
+ }
1949
+
1950
+ // Detect buggy property enumeration order in older V8 versions.
1951
+
1952
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
1953
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
1954
+ test1[5] = 'de';
1955
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
1956
+ return false;
1957
+ }
1958
+
1959
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1960
+ var test2 = {};
1961
+ for (var i = 0; i < 10; i++) {
1962
+ test2['_' + String.fromCharCode(i)] = i;
1963
+ }
1964
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
1965
+ return test2[n];
1966
+ });
1967
+ if (order2.join('') !== '0123456789') {
1968
+ return false;
1969
+ }
1970
+
1971
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1972
+ var test3 = {};
1973
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
1974
+ test3[letter] = letter;
1975
+ });
1976
+ if (Object.keys(Object.assign({}, test3)).join('') !==
1977
+ 'abcdefghijklmnopqrst') {
1978
+ return false;
1979
+ }
1980
+
1981
+ return true;
1982
+ } catch (err) {
1983
+ // We don't expect any of the above to throw, but better to be safe.
1984
+ return false;
1985
+ }
1986
+ }
1987
+
1988
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
1989
+ var from;
1990
+ var to = toObject(target);
1991
+ var symbols;
1992
+
1993
+ for (var s = 1; s < arguments.length; s++) {
1994
+ from = Object(arguments[s]);
1995
+
1996
+ for (var key in from) {
1997
+ if (hasOwnProperty.call(from, key)) {
1998
+ to[key] = from[key];
1999
+ }
2000
+ }
2001
+
2002
+ if (getOwnPropertySymbols) {
2003
+ symbols = getOwnPropertySymbols(from);
2004
+ for (var i = 0; i < symbols.length; i++) {
2005
+ if (propIsEnumerable.call(from, symbols[i])) {
2006
+ to[symbols[i]] = from[symbols[i]];
2007
+ }
2008
+ }
2009
+ }
2010
+ }
2011
+
2012
+ return to;
2013
+ };
2014
+
2015
+ var sheet = createCommonjsModule(function (module, exports) {
2016
+
2017
+ Object.defineProperty(exports, "__esModule", {
2018
+ value: true
2019
+ });
2020
+ exports.StyleSheet = StyleSheet;
2021
+
2022
+
2023
+
2024
+ var _objectAssign2 = _interopRequireDefault(objectAssign);
2025
+
2026
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2027
+
2028
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
2029
+
2030
+ /*
2031
+
2032
+ high performance StyleSheet for css-in-js systems
2033
+
2034
+ - uses multiple style tags behind the scenes for millions of rules
2035
+ - uses `insertRule` for appending in production for *much* faster performance
2036
+ - 'polyfills' on server side
2037
+
2038
+
2039
+ // usage
2040
+
2041
+ import StyleSheet from 'glamor/lib/sheet'
2042
+ let styleSheet = new StyleSheet()
2043
+
2044
+ styleSheet.inject()
2045
+ - 'injects' the stylesheet into the page (or into memory if on server)
2046
+
2047
+ styleSheet.insert('#box { border: 1px solid red; }')
2048
+ - appends a css rule into the stylesheet
2049
+
2050
+ styleSheet.flush()
2051
+ - empties the stylesheet of all its contents
2052
+
2053
+
2054
+ */
2055
+
2056
+ function last(arr) {
2057
+ return arr[arr.length - 1];
2058
+ }
2059
+
2060
+ function sheetForTag(tag) {
2061
+ if (tag.sheet) {
2062
+ return tag.sheet;
2063
+ }
2064
+
2065
+ // this weirdness brought to you by firefox
2066
+ for (var i = 0; i < document.styleSheets.length; i++) {
2067
+ if (document.styleSheets[i].ownerNode === tag) {
2068
+ return document.styleSheets[i];
2069
+ }
2070
+ }
2071
+ }
2072
+
2073
+ var isBrowser = typeof window !== 'undefined';
2074
+ var isTest = "production" === 'test';
2075
+
2076
+ var oldIE = function () {
2077
+ if (isBrowser) {
2078
+ var div = document.createElement('div');
2079
+ div.innerHTML = '<!--[if lt IE 10]><i></i><![endif]-->';
2080
+ return div.getElementsByTagName('i').length === 1;
2081
+ }
2082
+ }();
2083
+
2084
+ function makeStyleTag() {
2085
+ var tag = document.createElement('style');
2086
+ tag.type = 'text/css';
2087
+ tag.setAttribute('data-glamor', '');
2088
+ tag.appendChild(document.createTextNode(''));
2089
+ (document.head || document.getElementsByTagName('head')[0]).appendChild(tag);
2090
+ return tag;
2091
+ }
2092
+
2093
+ function StyleSheet() {
2094
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2095
+ _ref$speedy = _ref.speedy,
2096
+ speedy = _ref$speedy === undefined ? !isTest : _ref$speedy,
2097
+ _ref$maxLength = _ref.maxLength,
2098
+ maxLength = _ref$maxLength === undefined ? isBrowser && oldIE ? 4000 : 65000 : _ref$maxLength;
2099
+
2100
+ this.isSpeedy = speedy; // the big drawback here is that the css won't be editable in devtools
2101
+ this.sheet = undefined;
2102
+ this.tags = [];
2103
+ this.maxLength = maxLength;
2104
+ this.ctr = 0;
2105
+ }
2106
+
2107
+ (0, _objectAssign2.default)(StyleSheet.prototype, {
2108
+ getSheet: function getSheet() {
2109
+ return sheetForTag(last(this.tags));
2110
+ },
2111
+ inject: function inject() {
2112
+ var _this = this;
2113
+
2114
+ if (this.injected) {
2115
+ throw new Error('already injected stylesheet!');
2116
+ }
2117
+ if (isBrowser) {
2118
+ this.tags[0] = makeStyleTag();
2119
+ } else {
2120
+ // server side 'polyfill'. just enough behavior to be useful.
2121
+ this.sheet = {
2122
+ cssRules: [],
2123
+ insertRule: function insertRule(rule) {
2124
+ // enough 'spec compliance' to be able to extract the rules later
2125
+ // in other words, just the cssText field
2126
+ _this.sheet.cssRules.push({ cssText: rule });
2127
+ }
2128
+ };
2129
+ }
2130
+ this.injected = true;
2131
+ },
2132
+ speedy: function speedy(bool) {
2133
+ if (this.ctr !== 0) {
2134
+ throw new Error('cannot change speedy mode after inserting any rule to sheet. Either call speedy(' + bool + ') earlier in your app, or call flush() before speedy(' + bool + ')');
2135
+ }
2136
+ this.isSpeedy = !!bool;
2137
+ },
2138
+ _insert: function _insert(rule) {
2139
+ // this weirdness for perf, and chrome's weird bug
2140
+ // https://stackoverflow.com/questions/20007992/chrome-suddenly-stopped-accepting-insertrule
2141
+ try {
2142
+ var sheet = this.getSheet();
2143
+ sheet.insertRule(rule, rule.indexOf('@import') !== -1 ? 0 : sheet.cssRules.length);
2144
+ } catch (e) {
2145
+ }
2146
+ },
2147
+ insert: function insert(rule) {
2148
+
2149
+ if (isBrowser) {
2150
+ // this is the ultrafast version, works across browsers
2151
+ if (this.isSpeedy && this.getSheet().insertRule) {
2152
+ this._insert(rule);
2153
+ }
2154
+ // more browser weirdness. I don't even know
2155
+ // else if(this.tags.length > 0 && this.tags::last().styleSheet) {
2156
+ // this.tags::last().styleSheet.cssText+= rule
2157
+ // }
2158
+ else {
2159
+ if (rule.indexOf('@import') !== -1) {
2160
+ var tag = last(this.tags);
2161
+ tag.insertBefore(document.createTextNode(rule), tag.firstChild);
2162
+ } else {
2163
+ last(this.tags).appendChild(document.createTextNode(rule));
2164
+ }
2165
+ }
2166
+ } else {
2167
+ // server side is pretty simple
2168
+ this.sheet.insertRule(rule, rule.indexOf('@import') !== -1 ? 0 : this.sheet.cssRules.length);
2169
+ }
2170
+
2171
+ this.ctr++;
2172
+ if (isBrowser && this.ctr % this.maxLength === 0) {
2173
+ this.tags.push(makeStyleTag());
2174
+ }
2175
+ return this.ctr - 1;
2176
+ },
2177
+
2178
+ // commenting this out till we decide on v3's decision
2179
+ // _replace(index, rule) {
2180
+ // // this weirdness for perf, and chrome's weird bug
2181
+ // // https://stackoverflow.com/questions/20007992/chrome-suddenly-stopped-accepting-insertrule
2182
+ // try {
2183
+ // let sheet = this.getSheet()
2184
+ // sheet.deleteRule(index) // todo - correct index here
2185
+ // sheet.insertRule(rule, index)
2186
+ // }
2187
+ // catch(e) {
2188
+ // if(isDev) {
2189
+ // // might need beter dx for this
2190
+ // console.warn('whoops, problem replacing rule', rule) //eslint-disable-line no-console
2191
+ // }
2192
+ // }
2193
+
2194
+ // }
2195
+ // replace(index, rule) {
2196
+ // if(isBrowser) {
2197
+ // if(this.isSpeedy && this.getSheet().insertRule) {
2198
+ // this._replace(index, rule)
2199
+ // }
2200
+ // else {
2201
+ // let _slot = Math.floor((index + this.maxLength) / this.maxLength) - 1
2202
+ // let _index = (index % this.maxLength) + 1
2203
+ // let tag = this.tags[_slot]
2204
+ // tag.replaceChild(document.createTextNode(rule), tag.childNodes[_index])
2205
+ // }
2206
+ // }
2207
+ // else {
2208
+ // let rules = this.sheet.cssRules
2209
+ // this.sheet.cssRules = [ ...rules.slice(0, index), { cssText: rule }, ...rules.slice(index + 1) ]
2210
+ // }
2211
+ // }
2212
+ delete: function _delete(index) {
2213
+ // we insert a blank rule when 'deleting' so previously returned indexes remain stable
2214
+ return this.replace(index, '');
2215
+ },
2216
+ flush: function flush() {
2217
+ if (isBrowser) {
2218
+ this.tags.forEach(function (tag) {
2219
+ return tag.parentNode.removeChild(tag);
2220
+ });
2221
+ this.tags = [];
2222
+ this.sheet = null;
2223
+ this.ctr = 0;
2224
+ // todo - look for remnants in document.styleSheets
2225
+ } else {
2226
+ // simpler on server
2227
+ this.sheet.cssRules = [];
2228
+ }
2229
+ this.injected = false;
2230
+ },
2231
+ rules: function rules() {
2232
+ if (!isBrowser) {
2233
+ return this.sheet.cssRules;
2234
+ }
2235
+ var arr = [];
2236
+ this.tags.forEach(function (tag) {
2237
+ return arr.splice.apply(arr, [arr.length, 0].concat(_toConsumableArray(Array.from(sheetForTag(tag).cssRules))));
2238
+ });
2239
+ return arr;
2240
+ }
2241
+ });
2242
+ });
2243
+
2244
+ var CSSProperty_1 = createCommonjsModule(function (module, exports) {
2245
+
2246
+ Object.defineProperty(exports, "__esModule", {
2247
+ value: true
2248
+ });
2249
+ /**
2250
+ * Copyright 2013-present, Facebook, Inc.
2251
+ * All rights reserved.
2252
+ *
2253
+ * This source code is licensed under the BSD-style license found in the
2254
+ * LICENSE file in the root directory of this source tree. An additional grant
2255
+ * of patent rights can be found in the PATENTS file in the same directory.
2256
+ *
2257
+ * @providesModule CSSProperty
2258
+ */
2259
+
2260
+ /**
2261
+ * CSS properties which accept numbers but are not in units of "px".
2262
+ */
2263
+
2264
+ var isUnitlessNumber = {
2265
+ animationIterationCount: true,
2266
+ borderImageOutset: true,
2267
+ borderImageSlice: true,
2268
+ borderImageWidth: true,
2269
+ boxFlex: true,
2270
+ boxFlexGroup: true,
2271
+ boxOrdinalGroup: true,
2272
+ columnCount: true,
2273
+ flex: true,
2274
+ flexGrow: true,
2275
+ flexPositive: true,
2276
+ flexShrink: true,
2277
+ flexNegative: true,
2278
+ flexOrder: true,
2279
+ gridRow: true,
2280
+ gridRowStart: true,
2281
+ gridRowEnd: true,
2282
+ gridColumn: true,
2283
+ gridColumnStart: true,
2284
+ gridColumnEnd: true,
2285
+ fontWeight: true,
2286
+ lineClamp: true,
2287
+ lineHeight: true,
2288
+ opacity: true,
2289
+ order: true,
2290
+ orphans: true,
2291
+ tabSize: true,
2292
+ widows: true,
2293
+ zIndex: true,
2294
+ zoom: true,
2295
+
2296
+ // SVG-related properties
2297
+ fillOpacity: true,
2298
+ floodOpacity: true,
2299
+ stopOpacity: true,
2300
+ strokeDasharray: true,
2301
+ strokeDashoffset: true,
2302
+ strokeMiterlimit: true,
2303
+ strokeOpacity: true,
2304
+ strokeWidth: true
2305
+
2306
+ /**
2307
+ * @param {string} prefix vendor-specific prefix, eg: Webkit
2308
+ * @param {string} key style name, eg: transitionDuration
2309
+ * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
2310
+ * WebkitTransitionDuration
2311
+ */
2312
+ };function prefixKey(prefix, key) {
2313
+ return prefix + key.charAt(0).toUpperCase() + key.substring(1);
2314
+ }
2315
+
2316
+ /**
2317
+ * Support style names that may come passed in prefixed by adding permutations
2318
+ * of vendor prefixes.
2319
+ */
2320
+ var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
2321
+
2322
+ // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
2323
+ // infinite loop, because it iterates over the newly added props too.
2324
+ Object.keys(isUnitlessNumber).forEach(function (prop) {
2325
+ prefixes.forEach(function (prefix) {
2326
+ isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
2327
+ });
2328
+ });
2329
+
2330
+ /**
2331
+ * Most style properties can be unset by doing .style[prop] = '' but IE8
2332
+ * doesn't like doing that with shorthand properties so for the properties that
2333
+ * IE8 breaks on, which are listed here, we instead unset each of the
2334
+ * individual properties. See http://bugs.jquery.com/ticket/12385.
2335
+ * The 4-value 'clock' properties like margin, padding, border-width seem to
2336
+ * behave without any problems. Curiously, list-style works too without any
2337
+ * special prodding.
2338
+ */
2339
+ var shorthandPropertyExpansions = {
2340
+ background: {
2341
+ backgroundAttachment: true,
2342
+ backgroundColor: true,
2343
+ backgroundImage: true,
2344
+ backgroundPositionX: true,
2345
+ backgroundPositionY: true,
2346
+ backgroundRepeat: true
2347
+ },
2348
+ backgroundPosition: {
2349
+ backgroundPositionX: true,
2350
+ backgroundPositionY: true
2351
+ },
2352
+ border: {
2353
+ borderWidth: true,
2354
+ borderStyle: true,
2355
+ borderColor: true
2356
+ },
2357
+ borderBottom: {
2358
+ borderBottomWidth: true,
2359
+ borderBottomStyle: true,
2360
+ borderBottomColor: true
2361
+ },
2362
+ borderLeft: {
2363
+ borderLeftWidth: true,
2364
+ borderLeftStyle: true,
2365
+ borderLeftColor: true
2366
+ },
2367
+ borderRight: {
2368
+ borderRightWidth: true,
2369
+ borderRightStyle: true,
2370
+ borderRightColor: true
2371
+ },
2372
+ borderTop: {
2373
+ borderTopWidth: true,
2374
+ borderTopStyle: true,
2375
+ borderTopColor: true
2376
+ },
2377
+ font: {
2378
+ fontStyle: true,
2379
+ fontVariant: true,
2380
+ fontWeight: true,
2381
+ fontSize: true,
2382
+ lineHeight: true,
2383
+ fontFamily: true
2384
+ },
2385
+ outline: {
2386
+ outlineWidth: true,
2387
+ outlineStyle: true,
2388
+ outlineColor: true
2389
+ }
2390
+ };
2391
+
2392
+ var CSSProperty = {
2393
+ isUnitlessNumber: isUnitlessNumber,
2394
+ shorthandPropertyExpansions: shorthandPropertyExpansions
2395
+ };
2396
+
2397
+ exports.default = CSSProperty;
2398
+ });
2399
+
2400
+ var dangerousStyleValue_1 = createCommonjsModule(function (module, exports) {
2401
+
2402
+ Object.defineProperty(exports, "__esModule", {
2403
+ value: true
2404
+ });
2405
+
2406
+
2407
+
2408
+ var _CSSProperty2 = _interopRequireDefault(CSSProperty_1);
2409
+
2410
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2411
+
2412
+ /**
2413
+ * Copyright 2013-present, Facebook, Inc.
2414
+ * All rights reserved.
2415
+ *
2416
+ * This source code is licensed under the BSD-style license found in the
2417
+ * LICENSE file in the root directory of this source tree. An additional grant
2418
+ * of patent rights can be found in the PATENTS file in the same directory.
2419
+ *
2420
+ * @providesModule dangerousStyleValue
2421
+ */
2422
+
2423
+ var isUnitlessNumber = _CSSProperty2.default.isUnitlessNumber;
2424
+
2425
+ /**
2426
+ * Convert a value into the proper css writable value. The style name `name`
2427
+ * should be logical (no hyphens), as specified
2428
+ * in `CSSProperty.isUnitlessNumber`.
2429
+ *
2430
+ * @param {string} name CSS property name such as `topMargin`.
2431
+ * @param {*} value CSS property value such as `10px`.
2432
+ * @param {ReactDOMComponent} component
2433
+ * @return {string} Normalized style value with dimensions applied.
2434
+ */
2435
+ function dangerousStyleValue(name, value, component) {
2436
+ // Note that we've removed escapeTextForBrowser() calls here since the
2437
+ // whole string will be escaped when the attribute is injected into
2438
+ // the markup. If you provide unsafe user data here they can inject
2439
+ // arbitrary CSS which may be problematic (I couldn't repro this):
2440
+ // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
2441
+ // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
2442
+ // This is not an XSS hole but instead a potential CSS injection issue
2443
+ // which has lead to a greater discussion about how we're going to
2444
+ // trust URLs moving forward. See #2115901
2445
+
2446
+ var isEmpty = value == null || typeof value === 'boolean' || value === '';
2447
+ if (isEmpty) {
2448
+ return '';
2449
+ }
2450
+
2451
+ var isNonNumeric = isNaN(value);
2452
+ if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
2453
+ return '' + value; // cast to string
2454
+ }
2455
+
2456
+ if (typeof value === 'string') {
2457
+ value = value.trim();
2458
+ }
2459
+ return value + 'px';
2460
+ }
2461
+
2462
+ exports.default = dangerousStyleValue;
2463
+ });
2464
+
2465
+ /**
2466
+ * Copyright (c) 2013-present, Facebook, Inc.
2467
+ *
2468
+ * This source code is licensed under the MIT license found in the
2469
+ * LICENSE file in the root directory of this source tree.
2470
+ *
2471
+ * @typechecks
2472
+ */
2473
+
2474
+ var _uppercasePattern = /([A-Z])/g;
2475
+
2476
+ /**
2477
+ * Hyphenates a camelcased string, for example:
2478
+ *
2479
+ * > hyphenate('backgroundColor')
2480
+ * < "background-color"
2481
+ *
2482
+ * For CSS style names, use `hyphenateStyleName` instead which works properly
2483
+ * with all vendor prefixes, including `ms`.
2484
+ *
2485
+ * @param {string} string
2486
+ * @return {string}
2487
+ */
2488
+ function hyphenate(string) {
2489
+ return string.replace(_uppercasePattern, '-$1').toLowerCase();
2490
+ }
2491
+
2492
+ var hyphenate_1 = hyphenate;
2493
+
2494
+ var msPattern$1 = /^ms-/;
2495
+
2496
+ /**
2497
+ * Hyphenates a camelcased CSS property name, for example:
2498
+ *
2499
+ * > hyphenateStyleName('backgroundColor')
2500
+ * < "background-color"
2501
+ * > hyphenateStyleName('MozTransition')
2502
+ * < "-moz-transition"
2503
+ * > hyphenateStyleName('msTransition')
2504
+ * < "-ms-transition"
2505
+ *
2506
+ * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
2507
+ * is converted to `-ms-`.
2508
+ *
2509
+ * @param {string} string
2510
+ * @return {string}
2511
+ */
2512
+ function hyphenateStyleName$2(string) {
2513
+ return hyphenate_1(string).replace(msPattern$1, '-ms-');
2514
+ }
2515
+
2516
+ var hyphenateStyleName_1 = hyphenateStyleName$2;
2517
+
2518
+ /**
2519
+ * Copyright (c) 2013-present, Facebook, Inc.
2520
+ *
2521
+ * This source code is licensed under the MIT license found in the
2522
+ * LICENSE file in the root directory of this source tree.
2523
+ *
2524
+ *
2525
+ * @typechecks static-only
2526
+ */
2527
+
2528
+ /**
2529
+ * Memoizes the return value of a function that accepts one string argument.
2530
+ */
2531
+
2532
+ function memoizeStringOnly(callback) {
2533
+ var cache = {};
2534
+ return function (string) {
2535
+ if (!cache.hasOwnProperty(string)) {
2536
+ cache[string] = callback.call(this, string);
2537
+ }
2538
+ return cache[string];
2539
+ };
2540
+ }
2541
+
2542
+ var memoizeStringOnly_1 = memoizeStringOnly;
2543
+
2544
+ var CSSPropertyOperations = createCommonjsModule(function (module, exports) {
2545
+
2546
+ Object.defineProperty(exports, "__esModule", {
2547
+ value: true
2548
+ });
2549
+ exports.processStyleName = undefined;
2550
+ exports.createMarkupForStyles = createMarkupForStyles;
2551
+
2552
+
2553
+
2554
+ var _dangerousStyleValue2 = _interopRequireDefault(dangerousStyleValue_1);
2555
+
2556
+
2557
+
2558
+ var _hyphenateStyleName2 = _interopRequireDefault(hyphenateStyleName_1);
2559
+
2560
+
2561
+
2562
+ var _memoizeStringOnly2 = _interopRequireDefault(memoizeStringOnly_1);
2563
+
2564
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2565
+
2566
+ var processStyleName = exports.processStyleName = (0, _memoizeStringOnly2.default)(_hyphenateStyleName2.default); /**
2567
+ * Copyright 2013-present, Facebook, Inc.
2568
+ * All rights reserved.
2569
+ *
2570
+ * This source code is licensed under the BSD-style license found in the
2571
+ * LICENSE file in the root directory of this source tree. An additional grant
2572
+ * of patent rights can be found in the PATENTS file in the same directory.
2573
+ *
2574
+ * @providesModule CSSPropertyOperations
2575
+ */
2576
+
2577
+ /**
2578
+ * Serializes a mapping of style properties for use as inline styles:
2579
+ *
2580
+ * > createMarkupForStyles({width: '200px', height: 0})
2581
+ * "width:200px;height:0;"
2582
+ *
2583
+ * Undefined values are ignored so that declarative programming is easier.
2584
+ * The result should be HTML-escaped before insertion into the DOM.
2585
+ *
2586
+ * @param {object} styles
2587
+ * @param {ReactDOMComponent} component
2588
+ * @return {?string}
2589
+ */
2590
+
2591
+ function createMarkupForStyles(styles, component) {
2592
+ var serialized = '';
2593
+ for (var styleName in styles) {
2594
+ var isCustomProp = styleName.indexOf('--') === 0;
2595
+ if (!styles.hasOwnProperty(styleName)) {
2596
+ continue;
2597
+ }
2598
+ if (styleName === 'label') {
2599
+ continue;
2600
+ }
2601
+ var styleValue = styles[styleName];
2602
+ if (styleValue != null) {
2603
+ if (isCustomProp) {
2604
+ serialized += styleName + ':' + styleValue + ';';
2605
+ } else {
2606
+ serialized += processStyleName(styleName) + ':';
2607
+ serialized += (0, _dangerousStyleValue2.default)(styleName, styleValue, component) + ';';
2608
+ }
2609
+ }
2610
+ }
2611
+ return serialized || null;
2612
+ }
2613
+ });
2614
+
2615
+ var clean_1 = createCommonjsModule(function (module, exports) {
2616
+
2617
+ Object.defineProperty(exports, "__esModule", {
2618
+ value: true
2619
+ });
2620
+
2621
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
2622
+
2623
+ exports.default = clean;
2624
+ // Returns true for null, false, undefined and {}
2625
+ function isFalsy(value) {
2626
+ return value === null || value === undefined || value === false || (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && Object.keys(value).length === 0;
2627
+ }
2628
+
2629
+ function cleanObject(object) {
2630
+ if (isFalsy(object)) return null;
2631
+ if ((typeof object === 'undefined' ? 'undefined' : _typeof(object)) !== 'object') return object;
2632
+
2633
+ var acc = {},
2634
+ keys = Object.keys(object),
2635
+ hasFalsy = false;
2636
+ for (var i = 0; i < keys.length; i++) {
2637
+ var value = object[keys[i]];
2638
+ var filteredValue = clean(value);
2639
+ if (filteredValue === null || filteredValue !== value) {
2640
+ hasFalsy = true;
2641
+ }
2642
+ if (filteredValue !== null) {
2643
+ acc[keys[i]] = filteredValue;
2644
+ }
2645
+ }
2646
+ return Object.keys(acc).length === 0 ? null : hasFalsy ? acc : object;
2647
+ }
2648
+
2649
+ function cleanArray(rules) {
2650
+ var hasFalsy = false;
2651
+ var filtered = [];
2652
+ rules.forEach(function (rule) {
2653
+ var filteredRule = clean(rule);
2654
+ if (filteredRule === null || filteredRule !== rule) {
2655
+ hasFalsy = true;
2656
+ }
2657
+ if (filteredRule !== null) {
2658
+ filtered.push(filteredRule);
2659
+ }
2660
+ });
2661
+ return filtered.length == 0 ? null : hasFalsy ? filtered : rules;
2662
+ }
2663
+
2664
+ // Takes style array or object provided by user and clears all the falsy data
2665
+ // If there is no styles left after filtration returns null
2666
+ function clean(input) {
2667
+ return Array.isArray(input) ? cleanArray(input) : cleanObject(input);
2668
+ }
2669
+ });
2670
+
2671
+ var staticData = createCommonjsModule(function (module, exports) {
2672
+
2673
+ Object.defineProperty(exports, "__esModule", {
2674
+ value: true
2675
+ });
2676
+
2677
+ var w = ["Webkit"];
2678
+ var m = ["Moz"];
2679
+ var ms = ["ms"];
2680
+ var wm = ["Webkit", "Moz"];
2681
+ var wms = ["Webkit", "ms"];
2682
+ var wmms = ["Webkit", "Moz", "ms"];
2683
+
2684
+ exports.default = {
2685
+ plugins: [],
2686
+ prefixMap: { "appearance": wm, "userSelect": wmms, "textEmphasisPosition": w, "textEmphasis": w, "textEmphasisStyle": w, "textEmphasisColor": w, "boxDecorationBreak": w, "clipPath": w, "maskImage": w, "maskMode": w, "maskRepeat": w, "maskPosition": w, "maskClip": w, "maskOrigin": w, "maskSize": w, "maskComposite": w, "mask": w, "maskBorderSource": w, "maskBorderMode": w, "maskBorderSlice": w, "maskBorderWidth": w, "maskBorderOutset": w, "maskBorderRepeat": w, "maskBorder": w, "maskType": w, "textDecorationStyle": w, "textDecorationSkip": w, "textDecorationLine": w, "textDecorationColor": w, "filter": w, "fontFeatureSettings": w, "breakAfter": wmms, "breakBefore": wmms, "breakInside": wmms, "columnCount": wm, "columnFill": wm, "columnGap": wm, "columnRule": wm, "columnRuleColor": wm, "columnRuleStyle": wm, "columnRuleWidth": wm, "columns": wm, "columnSpan": wm, "columnWidth": wm, "writingMode": wms, "flex": w, "flexBasis": w, "flexDirection": w, "flexGrow": w, "flexFlow": w, "flexShrink": w, "flexWrap": w, "alignContent": w, "alignItems": w, "alignSelf": w, "justifyContent": w, "order": w, "transform": w, "transformOrigin": w, "transformOriginX": w, "transformOriginY": w, "backfaceVisibility": w, "perspective": w, "perspectiveOrigin": w, "transformStyle": w, "transformOriginZ": w, "animation": w, "animationDelay": w, "animationDirection": w, "animationFillMode": w, "animationDuration": w, "animationIterationCount": w, "animationName": w, "animationPlayState": w, "animationTimingFunction": w, "backdropFilter": w, "fontKerning": w, "scrollSnapType": wms, "scrollSnapPointsX": wms, "scrollSnapPointsY": wms, "scrollSnapDestination": wms, "scrollSnapCoordinate": wms, "shapeImageThreshold": w, "shapeImageMargin": w, "shapeImageOutside": w, "hyphens": wmms, "flowInto": wms, "flowFrom": wms, "regionFragment": wms, "textAlignLast": m, "tabSize": m, "wrapFlow": ms, "wrapThrough": ms, "wrapMargin": ms, "gridTemplateColumns": ms, "gridTemplateRows": ms, "gridTemplateAreas": ms, "gridTemplate": ms, "gridAutoColumns": ms, "gridAutoRows": ms, "gridAutoFlow": ms, "grid": ms, "gridRowStart": ms, "gridColumnStart": ms, "gridRowEnd": ms, "gridRow": ms, "gridColumn": ms, "gridColumnEnd": ms, "gridColumnGap": ms, "gridRowGap": ms, "gridArea": ms, "gridGap": ms, "textSizeAdjust": wms, "borderImage": w, "borderImageOutset": w, "borderImageRepeat": w, "borderImageSlice": w, "borderImageSource": w, "borderImageWidth": w, "transitionDelay": w, "transitionDuration": w, "transitionProperty": w, "transitionTimingFunction": w }
2687
+ };
2688
+ module.exports = exports["default"];
2689
+ });
2690
+
2691
+ var capitalizeString_1 = createCommonjsModule(function (module, exports) {
2692
+
2693
+ Object.defineProperty(exports, "__esModule", {
2694
+ value: true
2695
+ });
2696
+ exports.default = capitalizeString;
2697
+ function capitalizeString(str) {
2698
+ return str.charAt(0).toUpperCase() + str.slice(1);
2699
+ }
2700
+ module.exports = exports["default"];
2701
+ });
2702
+
2703
+ var prefixProperty_1 = createCommonjsModule(function (module, exports) {
2704
+
2705
+ Object.defineProperty(exports, "__esModule", {
2706
+ value: true
2707
+ });
2708
+ exports.default = prefixProperty;
2709
+
2710
+
2711
+
2712
+ var _capitalizeString2 = _interopRequireDefault(capitalizeString_1);
2713
+
2714
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2715
+
2716
+ function prefixProperty(prefixProperties, property, style) {
2717
+ if (prefixProperties.hasOwnProperty(property)) {
2718
+ var requiredPrefixes = prefixProperties[property];
2719
+ for (var i = 0, len = requiredPrefixes.length; i < len; ++i) {
2720
+ style[requiredPrefixes[i] + (0, _capitalizeString2.default)(property)] = style[property];
2721
+ }
2722
+ }
2723
+ }
2724
+ module.exports = exports['default'];
2725
+ });
2726
+
2727
+ var prefixValue_1 = createCommonjsModule(function (module, exports) {
2728
+
2729
+ Object.defineProperty(exports, "__esModule", {
2730
+ value: true
2731
+ });
2732
+ exports.default = prefixValue;
2733
+ function prefixValue(plugins, property, value, style, metaData) {
2734
+ for (var i = 0, len = plugins.length; i < len; ++i) {
2735
+ var processedValue = plugins[i](property, value, style, metaData);
2736
+
2737
+ // we can stop processing if a value is returned
2738
+ // as all plugin criteria are unique
2739
+ if (processedValue) {
2740
+ return processedValue;
2741
+ }
2742
+ }
2743
+ }
2744
+ module.exports = exports["default"];
2745
+ });
2746
+
2747
+ var cursor_1 = createCommonjsModule(function (module, exports) {
2748
+
2749
+ Object.defineProperty(exports, "__esModule", {
2750
+ value: true
2751
+ });
2752
+ exports.default = cursor;
2753
+ var prefixes = ['-webkit-', '-moz-', ''];
2754
+
2755
+ var values = {
2756
+ 'zoom-in': true,
2757
+ 'zoom-out': true,
2758
+ grab: true,
2759
+ grabbing: true
2760
+ };
2761
+
2762
+ function cursor(property, value) {
2763
+ if (property === 'cursor' && values.hasOwnProperty(value)) {
2764
+ return prefixes.map(function (prefix) {
2765
+ return prefix + value;
2766
+ });
2767
+ }
2768
+ }
2769
+ module.exports = exports['default'];
2770
+ });
2771
+
2772
+ var isPrefixedValue_1 = createCommonjsModule(function (module, exports) {
2773
+
2774
+ Object.defineProperty(exports, "__esModule", {
2775
+ value: true
2776
+ });
2777
+ exports.default = isPrefixedValue;
2778
+ var regex = /-webkit-|-moz-|-ms-/;
2779
+
2780
+ function isPrefixedValue(value) {
2781
+ return typeof value === 'string' && regex.test(value);
2782
+ }
2783
+ module.exports = exports['default'];
2784
+ });
2785
+
2786
+ var crossFade_1 = createCommonjsModule(function (module, exports) {
2787
+
2788
+ Object.defineProperty(exports, "__esModule", {
2789
+ value: true
2790
+ });
2791
+ exports.default = crossFade;
2792
+
2793
+
2794
+
2795
+ var _isPrefixedValue2 = _interopRequireDefault(isPrefixedValue_1);
2796
+
2797
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2798
+
2799
+ // http://caniuse.com/#search=cross-fade
2800
+ var prefixes = ['-webkit-', ''];
2801
+ function crossFade(property, value) {
2802
+ if (typeof value === 'string' && !(0, _isPrefixedValue2.default)(value) && value.indexOf('cross-fade(') > -1) {
2803
+ return prefixes.map(function (prefix) {
2804
+ return value.replace(/cross-fade\(/g, prefix + 'cross-fade(');
2805
+ });
2806
+ }
2807
+ }
2808
+ module.exports = exports['default'];
2809
+ });
2810
+
2811
+ var filter_1 = createCommonjsModule(function (module, exports) {
2812
+
2813
+ Object.defineProperty(exports, "__esModule", {
2814
+ value: true
2815
+ });
2816
+ exports.default = filter;
2817
+
2818
+
2819
+
2820
+ var _isPrefixedValue2 = _interopRequireDefault(isPrefixedValue_1);
2821
+
2822
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2823
+
2824
+ // http://caniuse.com/#feat=css-filter-function
2825
+ var prefixes = ['-webkit-', ''];
2826
+ function filter(property, value) {
2827
+ if (typeof value === 'string' && !(0, _isPrefixedValue2.default)(value) && value.indexOf('filter(') > -1) {
2828
+ return prefixes.map(function (prefix) {
2829
+ return value.replace(/filter\(/g, prefix + 'filter(');
2830
+ });
2831
+ }
2832
+ }
2833
+ module.exports = exports['default'];
2834
+ });
2835
+
2836
+ var flex_1 = createCommonjsModule(function (module, exports) {
2837
+
2838
+ Object.defineProperty(exports, "__esModule", {
2839
+ value: true
2840
+ });
2841
+ exports.default = flex;
2842
+ var values = {
2843
+ flex: ['-webkit-box', '-moz-box', '-ms-flexbox', '-webkit-flex', 'flex'],
2844
+ 'inline-flex': ['-webkit-inline-box', '-moz-inline-box', '-ms-inline-flexbox', '-webkit-inline-flex', 'inline-flex']
2845
+ };
2846
+
2847
+ function flex(property, value) {
2848
+ if (property === 'display' && values.hasOwnProperty(value)) {
2849
+ return values[value];
2850
+ }
2851
+ }
2852
+ module.exports = exports['default'];
2853
+ });
2854
+
2855
+ var flexboxOld_1 = createCommonjsModule(function (module, exports) {
2856
+
2857
+ Object.defineProperty(exports, "__esModule", {
2858
+ value: true
2859
+ });
2860
+ exports.default = flexboxOld;
2861
+ var alternativeValues = {
2862
+ 'space-around': 'justify',
2863
+ 'space-between': 'justify',
2864
+ 'flex-start': 'start',
2865
+ 'flex-end': 'end',
2866
+ 'wrap-reverse': 'multiple',
2867
+ wrap: 'multiple'
2868
+ };
2869
+
2870
+ var alternativeProps = {
2871
+ alignItems: 'WebkitBoxAlign',
2872
+ justifyContent: 'WebkitBoxPack',
2873
+ flexWrap: 'WebkitBoxLines'
2874
+ };
2875
+
2876
+ function flexboxOld(property, value, style) {
2877
+ if (property === 'flexDirection' && typeof value === 'string') {
2878
+ if (value.indexOf('column') > -1) {
2879
+ style.WebkitBoxOrient = 'vertical';
2880
+ } else {
2881
+ style.WebkitBoxOrient = 'horizontal';
2882
+ }
2883
+ if (value.indexOf('reverse') > -1) {
2884
+ style.WebkitBoxDirection = 'reverse';
2885
+ } else {
2886
+ style.WebkitBoxDirection = 'normal';
2887
+ }
2888
+ }
2889
+ if (alternativeProps.hasOwnProperty(property)) {
2890
+ style[alternativeProps[property]] = alternativeValues[value] || value;
2891
+ }
2892
+ }
2893
+ module.exports = exports['default'];
2894
+ });
2895
+
2896
+ var gradient_1 = createCommonjsModule(function (module, exports) {
2897
+
2898
+ Object.defineProperty(exports, "__esModule", {
2899
+ value: true
2900
+ });
2901
+ exports.default = gradient;
2902
+
2903
+
2904
+
2905
+ var _isPrefixedValue2 = _interopRequireDefault(isPrefixedValue_1);
2906
+
2907
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2908
+
2909
+ var prefixes = ['-webkit-', '-moz-', ''];
2910
+
2911
+ var values = /linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;
2912
+
2913
+ function gradient(property, value) {
2914
+ if (typeof value === 'string' && !(0, _isPrefixedValue2.default)(value) && values.test(value)) {
2915
+ return prefixes.map(function (prefix) {
2916
+ return prefix + value;
2917
+ });
2918
+ }
2919
+ }
2920
+ module.exports = exports['default'];
2921
+ });
2922
+
2923
+ var imageSet_1 = createCommonjsModule(function (module, exports) {
2924
+
2925
+ Object.defineProperty(exports, "__esModule", {
2926
+ value: true
2927
+ });
2928
+ exports.default = imageSet;
2929
+
2930
+
2931
+
2932
+ var _isPrefixedValue2 = _interopRequireDefault(isPrefixedValue_1);
2933
+
2934
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2935
+
2936
+ // http://caniuse.com/#feat=css-image-set
2937
+ var prefixes = ['-webkit-', ''];
2938
+ function imageSet(property, value) {
2939
+ if (typeof value === 'string' && !(0, _isPrefixedValue2.default)(value) && value.indexOf('image-set(') > -1) {
2940
+ return prefixes.map(function (prefix) {
2941
+ return value.replace(/image-set\(/g, prefix + 'image-set(');
2942
+ });
2943
+ }
2944
+ }
2945
+ module.exports = exports['default'];
2946
+ });
2947
+
2948
+ var position_1 = createCommonjsModule(function (module, exports) {
2949
+
2950
+ Object.defineProperty(exports, "__esModule", {
2951
+ value: true
2952
+ });
2953
+ exports.default = position;
2954
+ function position(property, value) {
2955
+ if (property === 'position' && value === 'sticky') {
2956
+ return ['-webkit-sticky', 'sticky'];
2957
+ }
2958
+ }
2959
+ module.exports = exports['default'];
2960
+ });
2961
+
2962
+ var sizing_1 = createCommonjsModule(function (module, exports) {
2963
+
2964
+ Object.defineProperty(exports, "__esModule", {
2965
+ value: true
2966
+ });
2967
+ exports.default = sizing;
2968
+ var prefixes = ['-webkit-', '-moz-', ''];
2969
+
2970
+ var properties = {
2971
+ maxHeight: true,
2972
+ maxWidth: true,
2973
+ width: true,
2974
+ height: true,
2975
+ columnWidth: true,
2976
+ minWidth: true,
2977
+ minHeight: true
2978
+ };
2979
+ var values = {
2980
+ 'min-content': true,
2981
+ 'max-content': true,
2982
+ 'fill-available': true,
2983
+ 'fit-content': true,
2984
+ 'contain-floats': true
2985
+ };
2986
+
2987
+ function sizing(property, value) {
2988
+ if (properties.hasOwnProperty(property) && values.hasOwnProperty(value)) {
2989
+ return prefixes.map(function (prefix) {
2990
+ return prefix + value;
2991
+ });
2992
+ }
2993
+ }
2994
+ module.exports = exports['default'];
2995
+ });
2996
+
2997
+ /* eslint-disable no-var, prefer-template */
2998
+ var uppercasePattern = /[A-Z]/g;
2999
+ var msPattern = /^ms-/;
3000
+ var cache = {};
3001
+
3002
+ function toHyphenLower(match) {
3003
+ return '-' + match.toLowerCase()
3004
+ }
3005
+
3006
+ function hyphenateStyleName(name) {
3007
+ if (cache.hasOwnProperty(name)) {
3008
+ return cache[name]
3009
+ }
3010
+
3011
+ var hName = name.replace(uppercasePattern, toHyphenLower);
3012
+ return (cache[name] = msPattern.test(hName) ? '-' + hName : hName)
3013
+ }
3014
+
3015
+ const hyphenateStyleName$1 = /*#__PURE__*/Object.freeze({
3016
+ __proto__: null,
3017
+ 'default': hyphenateStyleName
3018
+ });
3019
+
3020
+ const _hyphenateStyleName = /*@__PURE__*/getAugmentedNamespace(hyphenateStyleName$1);
3021
+
3022
+ var hyphenateProperty_1 = createCommonjsModule(function (module, exports) {
3023
+
3024
+ Object.defineProperty(exports, "__esModule", {
3025
+ value: true
3026
+ });
3027
+ exports.default = hyphenateProperty;
3028
+
3029
+
3030
+
3031
+ var _hyphenateStyleName2 = _interopRequireDefault(_hyphenateStyleName);
3032
+
3033
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3034
+
3035
+ function hyphenateProperty(property) {
3036
+ return (0, _hyphenateStyleName2.default)(property);
3037
+ }
3038
+ module.exports = exports['default'];
3039
+ });
3040
+
3041
+ var transition_1 = createCommonjsModule(function (module, exports) {
3042
+
3043
+ Object.defineProperty(exports, "__esModule", {
3044
+ value: true
3045
+ });
3046
+ exports.default = transition;
3047
+
3048
+
3049
+
3050
+ var _hyphenateProperty2 = _interopRequireDefault(hyphenateProperty_1);
3051
+
3052
+
3053
+
3054
+ var _isPrefixedValue2 = _interopRequireDefault(isPrefixedValue_1);
3055
+
3056
+
3057
+
3058
+ var _capitalizeString2 = _interopRequireDefault(capitalizeString_1);
3059
+
3060
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3061
+
3062
+ var properties = {
3063
+ transition: true,
3064
+ transitionProperty: true,
3065
+ WebkitTransition: true,
3066
+ WebkitTransitionProperty: true,
3067
+ MozTransition: true,
3068
+ MozTransitionProperty: true
3069
+ };
3070
+
3071
+
3072
+ var prefixMapping = {
3073
+ Webkit: '-webkit-',
3074
+ Moz: '-moz-',
3075
+ ms: '-ms-'
3076
+ };
3077
+
3078
+ function prefixValue(value, propertyPrefixMap) {
3079
+ if ((0, _isPrefixedValue2.default)(value)) {
3080
+ return value;
3081
+ }
3082
+
3083
+ // only split multi values, not cubic beziers
3084
+ var multipleValues = value.split(/,(?![^()]*(?:\([^()]*\))?\))/g);
3085
+
3086
+ for (var i = 0, len = multipleValues.length; i < len; ++i) {
3087
+ var singleValue = multipleValues[i];
3088
+ var values = [singleValue];
3089
+ for (var property in propertyPrefixMap) {
3090
+ var dashCaseProperty = (0, _hyphenateProperty2.default)(property);
3091
+
3092
+ if (singleValue.indexOf(dashCaseProperty) > -1 && dashCaseProperty !== 'order') {
3093
+ var prefixes = propertyPrefixMap[property];
3094
+ for (var j = 0, pLen = prefixes.length; j < pLen; ++j) {
3095
+ // join all prefixes and create a new value
3096
+ values.unshift(singleValue.replace(dashCaseProperty, prefixMapping[prefixes[j]] + dashCaseProperty));
3097
+ }
3098
+ }
3099
+ }
3100
+
3101
+ multipleValues[i] = values.join(',');
3102
+ }
3103
+
3104
+ return multipleValues.join(',');
3105
+ }
3106
+
3107
+ function transition(property, value, style, propertyPrefixMap) {
3108
+ // also check for already prefixed transitions
3109
+ if (typeof value === 'string' && properties.hasOwnProperty(property)) {
3110
+ var outputValue = prefixValue(value, propertyPrefixMap);
3111
+ // if the property is already prefixed
3112
+ var webkitOutput = outputValue.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function (val) {
3113
+ return !/-moz-|-ms-/.test(val);
3114
+ }).join(',');
3115
+
3116
+ if (property.indexOf('Webkit') > -1) {
3117
+ return webkitOutput;
3118
+ }
3119
+
3120
+ var mozOutput = outputValue.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function (val) {
3121
+ return !/-webkit-|-ms-/.test(val);
3122
+ }).join(',');
3123
+
3124
+ if (property.indexOf('Moz') > -1) {
3125
+ return mozOutput;
3126
+ }
3127
+
3128
+ style['Webkit' + (0, _capitalizeString2.default)(property)] = webkitOutput;
3129
+ style['Moz' + (0, _capitalizeString2.default)(property)] = mozOutput;
3130
+ return outputValue;
3131
+ }
3132
+ }
3133
+ module.exports = exports['default'];
3134
+ });
3135
+
3136
+ var prefixer_1 = createCommonjsModule(function (module, exports) {
3137
+
3138
+ Object.defineProperty(exports, "__esModule", {
3139
+ value: true
3140
+ });
3141
+ exports.default = prefixer;
3142
+
3143
+
3144
+
3145
+ var _staticData2 = _interopRequireDefault(staticData);
3146
+
3147
+
3148
+
3149
+ var _prefixProperty2 = _interopRequireDefault(prefixProperty_1);
3150
+
3151
+
3152
+
3153
+ var _prefixValue2 = _interopRequireDefault(prefixValue_1);
3154
+
3155
+
3156
+
3157
+ var _cursor2 = _interopRequireDefault(cursor_1);
3158
+
3159
+
3160
+
3161
+ var _crossFade2 = _interopRequireDefault(crossFade_1);
3162
+
3163
+
3164
+
3165
+ var _filter2 = _interopRequireDefault(filter_1);
3166
+
3167
+
3168
+
3169
+ var _flex2 = _interopRequireDefault(flex_1);
3170
+
3171
+
3172
+
3173
+ var _flexboxOld2 = _interopRequireDefault(flexboxOld_1);
3174
+
3175
+
3176
+
3177
+ var _gradient2 = _interopRequireDefault(gradient_1);
3178
+
3179
+
3180
+
3181
+ var _imageSet2 = _interopRequireDefault(imageSet_1);
3182
+
3183
+
3184
+
3185
+ var _position2 = _interopRequireDefault(position_1);
3186
+
3187
+
3188
+
3189
+ var _sizing2 = _interopRequireDefault(sizing_1);
3190
+
3191
+
3192
+
3193
+ var _transition2 = _interopRequireDefault(transition_1);
3194
+
3195
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3196
+
3197
+ var plugins = [_crossFade2.default, _cursor2.default, _filter2.default, _flexboxOld2.default, _gradient2.default, _imageSet2.default, _position2.default, _sizing2.default, _transition2.default, _flex2.default]; // custom facade for inline-style-prefixer
3198
+
3199
+ var prefixMap = _staticData2.default.prefixMap;
3200
+
3201
+ function prefixer(style) {
3202
+ for (var property in style) {
3203
+ var value = style[property];
3204
+
3205
+ var processedValue = (0, _prefixValue2.default)(plugins, property, value, style, prefixMap);
3206
+
3207
+ // only modify the value if it was touched
3208
+ // by any plugin to prevent unnecessary mutations
3209
+ if (processedValue) {
3210
+ style[property] = processedValue;
3211
+ }
3212
+
3213
+ (0, _prefixProperty2.default)(prefixMap, property, style);
3214
+ }
3215
+ return style;
3216
+ }
3217
+ });
3218
+
3219
+ var plugins = createCommonjsModule(function (module, exports) {
3220
+
3221
+ Object.defineProperty(exports, "__esModule", {
3222
+ value: true
3223
+ });
3224
+
3225
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
3226
+
3227
+ exports.PluginSet = PluginSet;
3228
+ exports.fallbacks = fallbacks;
3229
+ exports.contentWrap = contentWrap;
3230
+ exports.prefixes = prefixes;
3231
+
3232
+
3233
+
3234
+ var _objectAssign2 = _interopRequireDefault(objectAssign);
3235
+
3236
+
3237
+
3238
+
3239
+
3240
+ var _prefixer2 = _interopRequireDefault(prefixer_1);
3241
+
3242
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3243
+
3244
+ var isDev = function (x) {
3245
+ return x === 'development' || !x;
3246
+ }("production");
3247
+
3248
+ function PluginSet(initial) {
3249
+ this.fns = initial || [];
3250
+ }
3251
+
3252
+ (0, _objectAssign2.default)(PluginSet.prototype, {
3253
+ add: function add() {
3254
+ var _this = this;
3255
+
3256
+ for (var _len = arguments.length, fns = Array(_len), _key = 0; _key < _len; _key++) {
3257
+ fns[_key] = arguments[_key];
3258
+ }
3259
+
3260
+ fns.forEach(function (fn) {
3261
+ if (_this.fns.indexOf(fn) >= 0) {
3262
+ if (isDev) {
3263
+ console.warn('adding the same plugin again, ignoring'); //eslint-disable-line no-console
3264
+ }
3265
+ } else {
3266
+ _this.fns = [fn].concat(_this.fns);
3267
+ }
3268
+ });
3269
+ },
3270
+ remove: function remove(fn) {
3271
+ this.fns = this.fns.filter(function (x) {
3272
+ return x !== fn;
3273
+ });
3274
+ },
3275
+ clear: function clear() {
3276
+ this.fns = [];
3277
+ },
3278
+ transform: function transform(o) {
3279
+ return this.fns.reduce(function (o, fn) {
3280
+ return fn(o);
3281
+ }, o);
3282
+ }
3283
+ });
3284
+
3285
+ function fallbacks(node) {
3286
+ var hasArray = Object.keys(node.style).map(function (x) {
3287
+ return Array.isArray(node.style[x]);
3288
+ }).indexOf(true) >= 0;
3289
+ if (hasArray) {
3290
+ var style = node.style;
3291
+
3292
+ var flattened = Object.keys(style).reduce(function (o, key) {
3293
+ o[key] = Array.isArray(style[key]) ? style[key].join('; ' + (0, CSSPropertyOperations.processStyleName)(key) + ': ') : style[key];
3294
+ return o;
3295
+ }, {});
3296
+ // todo -
3297
+ // flatten arrays which haven't been flattened yet
3298
+ return (0, _objectAssign2.default)({}, node, { style: flattened });
3299
+ }
3300
+ return node;
3301
+ }
3302
+
3303
+ var contentValues = ['normal', 'none', 'counter', 'open-quote', 'close-quote', 'no-open-quote', 'no-close-quote', 'initial', 'inherit'];
3304
+
3305
+ function contentWrap(node) {
3306
+ if (node.style.content) {
3307
+ var cont = node.style.content;
3308
+ if (contentValues.indexOf(cont) >= 0) {
3309
+ return node;
3310
+ }
3311
+ if (/^(attr|calc|counters?|url)\(/.test(cont)) {
3312
+ return node;
3313
+ }
3314
+ if (cont.charAt(0) === cont.charAt(cont.length - 1) && (cont.charAt(0) === '"' || cont.charAt(0) === "'")) {
3315
+ return node;
3316
+ }
3317
+ return _extends({}, node, { style: _extends({}, node.style, { content: '"' + cont + '"' }) });
3318
+ }
3319
+ return node;
3320
+ }
3321
+
3322
+ function prefixes(node) {
3323
+ return (0, _objectAssign2.default)({}, node, { style: (0, _prefixer2.default)(_extends({}, node.style)) });
3324
+ }
3325
+ });
3326
+
3327
+ var hash = createCommonjsModule(function (module, exports) {
3328
+
3329
+ Object.defineProperty(exports, "__esModule", {
3330
+ value: true
3331
+ });
3332
+ exports.default = doHash;
3333
+ // murmurhash2 via https://gist.github.com/raycmorgan/588423
3334
+
3335
+ function doHash(str, seed) {
3336
+ var m = 0x5bd1e995;
3337
+ var r = 24;
3338
+ var h = seed ^ str.length;
3339
+ var length = str.length;
3340
+ var currentIndex = 0;
3341
+
3342
+ while (length >= 4) {
3343
+ var k = UInt32(str, currentIndex);
3344
+
3345
+ k = Umul32(k, m);
3346
+ k ^= k >>> r;
3347
+ k = Umul32(k, m);
3348
+
3349
+ h = Umul32(h, m);
3350
+ h ^= k;
3351
+
3352
+ currentIndex += 4;
3353
+ length -= 4;
3354
+ }
3355
+
3356
+ switch (length) {
3357
+ case 3:
3358
+ h ^= UInt16(str, currentIndex);
3359
+ h ^= str.charCodeAt(currentIndex + 2) << 16;
3360
+ h = Umul32(h, m);
3361
+ break;
3362
+
3363
+ case 2:
3364
+ h ^= UInt16(str, currentIndex);
3365
+ h = Umul32(h, m);
3366
+ break;
3367
+
3368
+ case 1:
3369
+ h ^= str.charCodeAt(currentIndex);
3370
+ h = Umul32(h, m);
3371
+ break;
3372
+ }
3373
+
3374
+ h ^= h >>> 13;
3375
+ h = Umul32(h, m);
3376
+ h ^= h >>> 15;
3377
+
3378
+ return h >>> 0;
3379
+ }
3380
+
3381
+ function UInt32(str, pos) {
3382
+ return str.charCodeAt(pos++) + (str.charCodeAt(pos++) << 8) + (str.charCodeAt(pos++) << 16) + (str.charCodeAt(pos) << 24);
3383
+ }
3384
+
3385
+ function UInt16(str, pos) {
3386
+ return str.charCodeAt(pos++) + (str.charCodeAt(pos++) << 8);
3387
+ }
3388
+
3389
+ function Umul32(n, m) {
3390
+ n = n | 0;
3391
+ m = m | 0;
3392
+ var nlo = n & 0xffff;
3393
+ var nhi = n >>> 16;
3394
+ var res = nlo * m + ((nhi * m & 0xffff) << 16) | 0;
3395
+ return res;
3396
+ }
3397
+ });
3398
+
3399
+ var lib = createCommonjsModule(function (module, exports) {
3400
+
3401
+ Object.defineProperty(exports, "__esModule", {
3402
+ value: true
3403
+ });
3404
+ exports.compose = exports.merge = exports.$ = exports.style = exports.presets = exports.keyframes = exports.fontFace = exports.insertGlobal = exports.insertRule = exports.plugins = exports.styleSheet = undefined;
3405
+ exports.speedy = speedy;
3406
+ exports.simulations = simulations;
3407
+ exports.simulate = simulate;
3408
+ exports.cssLabels = cssLabels;
3409
+ exports.isLikeRule = isLikeRule;
3410
+ exports.idFor = idFor;
3411
+ exports.css = css;
3412
+ exports.rehydrate = rehydrate;
3413
+ exports.flush = flush;
3414
+ exports.select = select;
3415
+ exports.parent = parent;
3416
+ exports.media = media;
3417
+ exports.pseudo = pseudo;
3418
+ exports.active = active;
3419
+ exports.any = any;
3420
+ exports.checked = checked;
3421
+ exports.disabled = disabled;
3422
+ exports.empty = empty;
3423
+ exports.enabled = enabled;
3424
+ exports._default = _default;
3425
+ exports.first = first;
3426
+ exports.firstChild = firstChild;
3427
+ exports.firstOfType = firstOfType;
3428
+ exports.fullscreen = fullscreen;
3429
+ exports.focus = focus;
3430
+ exports.hover = hover;
3431
+ exports.indeterminate = indeterminate;
3432
+ exports.inRange = inRange;
3433
+ exports.invalid = invalid;
3434
+ exports.lastChild = lastChild;
3435
+ exports.lastOfType = lastOfType;
3436
+ exports.left = left;
3437
+ exports.link = link;
3438
+ exports.onlyChild = onlyChild;
3439
+ exports.onlyOfType = onlyOfType;
3440
+ exports.optional = optional;
3441
+ exports.outOfRange = outOfRange;
3442
+ exports.readOnly = readOnly;
3443
+ exports.readWrite = readWrite;
3444
+ exports.required = required;
3445
+ exports.right = right;
3446
+ exports.root = root;
3447
+ exports.scope = scope;
3448
+ exports.target = target;
3449
+ exports.valid = valid;
3450
+ exports.visited = visited;
3451
+ exports.dir = dir;
3452
+ exports.lang = lang;
3453
+ exports.not = not;
3454
+ exports.nthChild = nthChild;
3455
+ exports.nthLastChild = nthLastChild;
3456
+ exports.nthLastOfType = nthLastOfType;
3457
+ exports.nthOfType = nthOfType;
3458
+ exports.after = after;
3459
+ exports.before = before;
3460
+ exports.firstLetter = firstLetter;
3461
+ exports.firstLine = firstLine;
3462
+ exports.selection = selection;
3463
+ exports.backdrop = backdrop;
3464
+ exports.placeholder = placeholder;
3465
+ exports.cssFor = cssFor;
3466
+ exports.attribsFor = attribsFor;
3467
+
3468
+
3469
+
3470
+ var _objectAssign2 = _interopRequireDefault(objectAssign);
3471
+
3472
+
3473
+
3474
+
3475
+
3476
+
3477
+
3478
+ var _clean2 = _interopRequireDefault(clean_1);
3479
+
3480
+
3481
+
3482
+
3483
+
3484
+ var _hash2 = _interopRequireDefault(hash);
3485
+
3486
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3487
+
3488
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3489
+ /* stylesheet */
3490
+
3491
+
3492
+ var styleSheet = exports.styleSheet = new sheet.StyleSheet();
3493
+ // an isomorphic StyleSheet shim. hides all the nitty gritty.
3494
+
3495
+ // /**************** LIFTOFF IN 3... 2... 1... ****************/
3496
+ styleSheet.inject(); //eslint-disable-line indent
3497
+ // /**************** TO THE MOOOOOOON ****************/
3498
+
3499
+ // convenience function to toggle speedy
3500
+ function speedy(bool) {
3501
+ return styleSheet.speedy(bool);
3502
+ }
3503
+
3504
+ // plugins
3505
+ // we include these by default
3506
+ var plugins$1 = exports.plugins = styleSheet.plugins = new plugins.PluginSet([plugins.prefixes, plugins.contentWrap, plugins.fallbacks]);
3507
+ plugins$1.media = new plugins.PluginSet(); // neat! media, font-face, keyframes
3508
+ plugins$1.fontFace = new plugins.PluginSet();
3509
+ plugins$1.keyframes = new plugins.PluginSet([plugins.prefixes, plugins.fallbacks]);
3510
+
3511
+ // define some constants
3512
+
3513
+ var isDev = !"production";
3514
+ var isBrowser = typeof window !== 'undefined';
3515
+
3516
+ /**** simulations ****/
3517
+
3518
+ // a flag to enable simulation meta tags on dom nodes
3519
+ // defaults to true in dev mode. recommend *not* to
3520
+ // toggle often.
3521
+ var canSimulate = isDev;
3522
+
3523
+ // we use these flags for issuing warnings when simulate is called
3524
+ // in prod / in incorrect order
3525
+ var warned1 = false,
3526
+ warned2 = false;
3527
+
3528
+ // toggles simulation activity. shouldn't be needed in most cases
3529
+ function simulations() {
3530
+ var bool = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
3531
+
3532
+ canSimulate = !!bool;
3533
+ }
3534
+
3535
+ // use this on dom nodes to 'simulate' pseudoclasses
3536
+ // <div {...hover({ color: 'red' })} {...simulate('hover', 'visited')}>...</div>
3537
+ // you can even send in some weird ones, as long as it's in simple format
3538
+ // and matches an existing rule on the element
3539
+ // eg simulate('nthChild2', ':hover:active') etc
3540
+ function simulate() {
3541
+ for (var _len = arguments.length, pseudos = Array(_len), _key = 0; _key < _len; _key++) {
3542
+ pseudos[_key] = arguments[_key];
3543
+ }
3544
+
3545
+ pseudos = (0, _clean2.default)(pseudos);
3546
+ if (!pseudos) return {};
3547
+ if (!canSimulate) {
3548
+ if (!warned1) {
3549
+ console.warn('can\'t simulate without once calling simulations(true)'); //eslint-disable-line no-console
3550
+ warned1 = true;
3551
+ }
3552
+ if (!warned2) {
3553
+ console.warn('don\'t use simulation outside dev'); //eslint-disable-line no-console
3554
+ warned2 = true;
3555
+ }
3556
+ return {};
3557
+ }
3558
+ return pseudos.reduce(function (o, p) {
3559
+ return o['data-simulate-' + simple(p)] = '', o;
3560
+ }, {});
3561
+ }
3562
+
3563
+ /**** labels ****/
3564
+ // toggle for debug labels.
3565
+ // *shouldn't* have to mess with this manually
3566
+ var hasLabels = isDev;
3567
+
3568
+ function cssLabels(bool) {
3569
+ hasLabels = !!bool;
3570
+ }
3571
+
3572
+ // takes a string, converts to lowercase, strips out nonalphanumeric.
3573
+ function simple(str) {
3574
+ var char = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
3575
+
3576
+ return str.toLowerCase().replace(/[^a-z0-9]/g, char);
3577
+ }
3578
+
3579
+ // hashes a string to something 'unique'
3580
+ // we use this to generate ids for styles
3581
+
3582
+
3583
+ function hashify(obj) {
3584
+ var str = JSON.stringify(obj);
3585
+ var toRet = (0, _hash2.default)(str).toString(36);
3586
+ if (obj.label && obj.label.length > 0 && isDev) {
3587
+ return simple(obj.label.join('.'), '-') + '-' + toRet;
3588
+ }
3589
+ return toRet;
3590
+ }
3591
+
3592
+ // of shape { 'data-css-<id>': '' }
3593
+ function isLikeRule(rule) {
3594
+ var keys = Object.keys(rule).filter(function (x) {
3595
+ return x !== 'toString';
3596
+ });
3597
+ if (keys.length !== 1) {
3598
+ return false;
3599
+ }
3600
+ return !!/data\-css\-([a-zA-Z0-9\-_]+)/.exec(keys[0]);
3601
+ }
3602
+
3603
+ // extracts id from a { 'data-css-<id>': ''} like object
3604
+ function idFor(rule) {
3605
+ var keys = Object.keys(rule).filter(function (x) {
3606
+ return x !== 'toString';
3607
+ });
3608
+ if (keys.length !== 1) throw new Error('not a rule');
3609
+ var regex = /data\-css\-([a-zA-Z0-9\-_]+)/;
3610
+ var match = regex.exec(keys[0]);
3611
+ if (!match) throw new Error('not a rule');
3612
+ return match[1];
3613
+ }
3614
+
3615
+ // from https://github.com/j2css/j2c/blob/5d381c2d721d04b54fabe6a165d587247c3087cb/src/helpers.js#L28-L61
3616
+
3617
+ // "Tokenizes" the selectors into parts relevant for the next function.
3618
+ // Strings and comments are matched, but ignored afterwards.
3619
+ // This is not a full tokenizers. It only recognizes comas, parentheses,
3620
+ // strings and comments.
3621
+ // regexp generated by scripts/regexps.js then trimmed by hand
3622
+ var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g;
3623
+
3624
+ /**
3625
+ * This will split a coma-separated selector list into individual selectors,
3626
+ * ignoring comas in strings, comments and in :pseudo-selectors(parameter, lists).
3627
+ *
3628
+ * @param {string} selector
3629
+ * @return {string[]}
3630
+ */
3631
+
3632
+ function splitSelector(selector) {
3633
+ if (selector.indexOf(',') === -1) {
3634
+ return [selector];
3635
+ }
3636
+
3637
+ var indices = [],
3638
+ res = [],
3639
+ inParen = 0,
3640
+ o;
3641
+ /*eslint-disable no-cond-assign*/
3642
+ while (o = selectorTokenizer.exec(selector)) {
3643
+ /*eslint-enable no-cond-assign*/
3644
+ switch (o[0]) {
3645
+ case '(':
3646
+ inParen++;break;
3647
+ case ')':
3648
+ inParen--;break;
3649
+ case ',':
3650
+ if (inParen) break;indices.push(o.index);
3651
+ }
3652
+ }
3653
+ for (o = indices.length; o--;) {
3654
+ res.unshift(selector.slice(indices[o] + 1));
3655
+ selector = selector.slice(0, indices[o]);
3656
+ }
3657
+ res.unshift(selector);
3658
+ return res;
3659
+ }
3660
+
3661
+ function selector(id, path) {
3662
+ if (!id) {
3663
+ return path.replace(/\&/g, '');
3664
+ }
3665
+ if (!path) return '.css-' + id + ',[data-css-' + id + ']';
3666
+
3667
+ var x = splitSelector(path).map(function (x) {
3668
+ return x.indexOf('&') >= 0 ? [x.replace(/\&/mg, '.css-' + id), x.replace(/\&/mg, '[data-css-' + id + ']')].join(',') // todo - make sure each sub selector has an &
3669
+ : '.css-' + id + x + ',[data-css-' + id + ']' + x;
3670
+ }).join(',');
3671
+
3672
+ if (canSimulate && /^\&\:/.exec(path) && !/\s/.exec(path)) {
3673
+ x += ',.css-' + id + '[data-simulate-' + simple(path) + '],[data-css-' + id + '][data-simulate-' + simple(path) + ']';
3674
+ }
3675
+ return x;
3676
+ }
3677
+
3678
+ // end https://github.com/j2css/j2c/blob/5d381c2d721d04b54fabe6a165d587247c3087cb/src/helpers.js#L28-L61
3679
+
3680
+
3681
+ function toCSS(_ref) {
3682
+ var selector = _ref.selector,
3683
+ style = _ref.style;
3684
+
3685
+ var result = plugins$1.transform({ selector: selector, style: style });
3686
+ return result.selector + '{' + (0, CSSPropertyOperations.createMarkupForStyles)(result.style) + '}';
3687
+ }
3688
+
3689
+ function deconstruct(style) {
3690
+ // we can be sure it's not infinitely nested here
3691
+ var plain = void 0,
3692
+ selects = void 0,
3693
+ medias = void 0,
3694
+ supports = void 0;
3695
+ Object.keys(style).forEach(function (key) {
3696
+ if (key.indexOf('&') >= 0) {
3697
+ selects = selects || {};
3698
+ selects[key] = style[key];
3699
+ } else if (key.indexOf('@media') === 0) {
3700
+ medias = medias || {};
3701
+ medias[key] = deconstruct(style[key]);
3702
+ } else if (key.indexOf('@supports') === 0) {
3703
+ supports = supports || {};
3704
+ supports[key] = deconstruct(style[key]);
3705
+ } else if (key === 'label') {
3706
+ if (style.label.length > 0) {
3707
+ plain = plain || {};
3708
+ plain.label = hasLabels ? style.label.join('.') : '';
3709
+ }
3710
+ } else {
3711
+ plain = plain || {};
3712
+ plain[key] = style[key];
3713
+ }
3714
+ });
3715
+ return { plain: plain, selects: selects, medias: medias, supports: supports };
3716
+ }
3717
+
3718
+ function deconstructedStyleToCSS(id, style) {
3719
+ var css = [];
3720
+
3721
+ // plugins here
3722
+ var plain = style.plain,
3723
+ selects = style.selects,
3724
+ medias = style.medias,
3725
+ supports = style.supports;
3726
+
3727
+ if (plain) {
3728
+ css.push(toCSS({ style: plain, selector: selector(id) }));
3729
+ }
3730
+ if (selects) {
3731
+ Object.keys(selects).forEach(function (key) {
3732
+ return css.push(toCSS({ style: selects[key], selector: selector(id, key) }));
3733
+ });
3734
+ }
3735
+ if (medias) {
3736
+ Object.keys(medias).forEach(function (key) {
3737
+ return css.push(key + '{' + deconstructedStyleToCSS(id, medias[key]).join('') + '}');
3738
+ });
3739
+ }
3740
+ if (supports) {
3741
+ Object.keys(supports).forEach(function (key) {
3742
+ return css.push(key + '{' + deconstructedStyleToCSS(id, supports[key]).join('') + '}');
3743
+ });
3744
+ }
3745
+ return css;
3746
+ }
3747
+
3748
+ // this cache to track which rules have
3749
+ // been inserted into the stylesheet
3750
+ var inserted = styleSheet.inserted = {};
3751
+
3752
+ // and helpers to insert rules into said styleSheet
3753
+ function insert(spec) {
3754
+ if (!inserted[spec.id]) {
3755
+ inserted[spec.id] = true;
3756
+ var deconstructed = deconstruct(spec.style);
3757
+ var rules = deconstructedStyleToCSS(spec.id, deconstructed);
3758
+ inserted[spec.id] = isBrowser ? true : rules;
3759
+ rules.forEach(function (cssRule) {
3760
+ return styleSheet.insert(cssRule);
3761
+ });
3762
+ }
3763
+ }
3764
+
3765
+ // a simple cache to store generated rules
3766
+ var registered = styleSheet.registered = {};
3767
+ function register(spec) {
3768
+ if (!registered[spec.id]) {
3769
+ registered[spec.id] = spec;
3770
+ }
3771
+ }
3772
+
3773
+ function _getRegistered(rule) {
3774
+ if (isLikeRule(rule)) {
3775
+ var ret = registered[idFor(rule)];
3776
+ if (ret == null) {
3777
+ throw new Error('[glamor] an unexpected rule cache miss occurred. This is probably a sign of multiple glamor instances in your app. See https://github.com/threepointone/glamor/issues/79');
3778
+ }
3779
+ return ret;
3780
+ }
3781
+ return rule;
3782
+ }
3783
+
3784
+ // todo - perf
3785
+ var ruleCache = {};
3786
+ function toRule(spec) {
3787
+ register(spec);
3788
+ insert(spec);
3789
+
3790
+ if (ruleCache[spec.id]) {
3791
+ return ruleCache[spec.id];
3792
+ }
3793
+
3794
+ var ret = _defineProperty({}, 'data-css-' + spec.id, hasLabels ? spec.label || '' : '');
3795
+ Object.defineProperty(ret, 'toString', {
3796
+ enumerable: false, value: function value() {
3797
+ return 'css-' + spec.id;
3798
+ }
3799
+ });
3800
+ ruleCache[spec.id] = ret;
3801
+ return ret;
3802
+ }
3803
+
3804
+ function isSelector(key) {
3805
+ var possibles = [':', '.', '[', '>', ' '],
3806
+ found = false,
3807
+ ch = key.charAt(0);
3808
+ for (var i = 0; i < possibles.length; i++) {
3809
+ if (ch === possibles[i]) {
3810
+ found = true;
3811
+ break;
3812
+ }
3813
+ }
3814
+ return found || key.indexOf('&') >= 0;
3815
+ }
3816
+
3817
+ function joinSelectors(a, b) {
3818
+ var as = splitSelector(a).map(function (a) {
3819
+ return !(a.indexOf('&') >= 0) ? '&' + a : a;
3820
+ });
3821
+ var bs = splitSelector(b).map(function (b) {
3822
+ return !(b.indexOf('&') >= 0) ? '&' + b : b;
3823
+ });
3824
+
3825
+ return bs.reduce(function (arr, b) {
3826
+ return arr.concat(as.map(function (a) {
3827
+ return b.replace(/\&/g, a);
3828
+ }));
3829
+ }, []).join(',');
3830
+ }
3831
+
3832
+ function joinMediaQueries(a, b) {
3833
+ return a ? '@media ' + a.substring(6) + ' and ' + b.substring(6) : b;
3834
+ }
3835
+
3836
+ function isMediaQuery(key) {
3837
+ return key.indexOf('@media') === 0;
3838
+ }
3839
+
3840
+ function isSupports(key) {
3841
+ return key.indexOf('@supports') === 0;
3842
+ }
3843
+
3844
+ function joinSupports(a, b) {
3845
+ return a ? '@supports ' + a.substring(9) + ' and ' + b.substring(9) : b;
3846
+ }
3847
+
3848
+ // flatten a nested array
3849
+ function flatten(inArr) {
3850
+ var arr = [];
3851
+ for (var i = 0; i < inArr.length; i++) {
3852
+ if (Array.isArray(inArr[i])) arr = arr.concat(flatten(inArr[i]));else arr = arr.concat(inArr[i]);
3853
+ }
3854
+ return arr;
3855
+ }
3856
+
3857
+ var prefixedPseudoSelectors = {
3858
+ '::placeholder': ['::-webkit-input-placeholder', '::-moz-placeholder', '::-ms-input-placeholder'],
3859
+ ':fullscreen': [':-webkit-full-screen', ':-moz-full-screen', ':-ms-fullscreen']
3860
+
3861
+ // mutable! modifies dest.
3862
+ };function build(dest, _ref2) {
3863
+ var _ref2$selector = _ref2.selector,
3864
+ selector = _ref2$selector === undefined ? '' : _ref2$selector,
3865
+ _ref2$mq = _ref2.mq,
3866
+ mq = _ref2$mq === undefined ? '' : _ref2$mq,
3867
+ _ref2$supp = _ref2.supp,
3868
+ supp = _ref2$supp === undefined ? '' : _ref2$supp,
3869
+ _ref2$src = _ref2.src,
3870
+ src = _ref2$src === undefined ? {} : _ref2$src;
3871
+
3872
+
3873
+ if (!Array.isArray(src)) {
3874
+ src = [src];
3875
+ }
3876
+ src = flatten(src);
3877
+
3878
+ src.forEach(function (_src) {
3879
+ if (isLikeRule(_src)) {
3880
+ var reg = _getRegistered(_src);
3881
+ if (reg.type !== 'css') {
3882
+ throw new Error('cannot merge this rule');
3883
+ }
3884
+ _src = reg.style;
3885
+ }
3886
+ _src = (0, _clean2.default)(_src);
3887
+ if (_src && _src.composes) {
3888
+ build(dest, { selector: selector, mq: mq, supp: supp, src: _src.composes });
3889
+ }
3890
+ Object.keys(_src || {}).forEach(function (key) {
3891
+ if (isSelector(key)) {
3892
+
3893
+ if (prefixedPseudoSelectors[key]) {
3894
+ prefixedPseudoSelectors[key].forEach(function (p) {
3895
+ return build(dest, { selector: joinSelectors(selector, p), mq: mq, supp: supp, src: _src[key] });
3896
+ });
3897
+ }
3898
+
3899
+ build(dest, { selector: joinSelectors(selector, key), mq: mq, supp: supp, src: _src[key] });
3900
+ } else if (isMediaQuery(key)) {
3901
+ build(dest, { selector: selector, mq: joinMediaQueries(mq, key), supp: supp, src: _src[key] });
3902
+ } else if (isSupports(key)) {
3903
+ build(dest, { selector: selector, mq: mq, supp: joinSupports(supp, key), src: _src[key] });
3904
+ } else if (key === 'composes') ; else {
3905
+ var _dest = dest;
3906
+ if (supp) {
3907
+ _dest[supp] = _dest[supp] || {};
3908
+ _dest = _dest[supp];
3909
+ }
3910
+ if (mq) {
3911
+ _dest[mq] = _dest[mq] || {};
3912
+ _dest = _dest[mq];
3913
+ }
3914
+ if (selector) {
3915
+ _dest[selector] = _dest[selector] || {};
3916
+ _dest = _dest[selector];
3917
+ }
3918
+
3919
+ if (key === 'label') {
3920
+ if (hasLabels) {
3921
+ dest.label = dest.label.concat(_src.label);
3922
+ }
3923
+ } else {
3924
+ _dest[key] = _src[key];
3925
+ }
3926
+ }
3927
+ });
3928
+ });
3929
+ }
3930
+
3931
+ function _css(rules) {
3932
+ var style = { label: [] };
3933
+ build(style, { src: rules }); // mutative! but worth it.
3934
+
3935
+ var spec = {
3936
+ id: hashify(style),
3937
+ style: style, label: hasLabels ? style.label.join('.') : '',
3938
+ type: 'css'
3939
+ };
3940
+ return toRule(spec);
3941
+ }
3942
+
3943
+ var nullrule = {
3944
+ // 'data-css-nil': ''
3945
+ };
3946
+ Object.defineProperty(nullrule, 'toString', {
3947
+ enumerable: false, value: function value() {
3948
+ return 'css-nil';
3949
+ }
3950
+ });
3951
+
3952
+ var inputCaches = typeof WeakMap !== 'undefined' ? [nullrule, new WeakMap(), new WeakMap(), new WeakMap()] : [nullrule];
3953
+ function multiIndexCache(fn) {
3954
+ return function (args) {
3955
+ if (inputCaches[args.length]) {
3956
+ var coi = inputCaches[args.length];
3957
+ var ctr = 0;
3958
+ while (ctr < args.length - 1) {
3959
+ if (!coi.has(args[ctr])) {
3960
+ coi.set(args[ctr], new WeakMap());
3961
+ }
3962
+ coi = coi.get(args[ctr]);
3963
+ ctr++;
3964
+ }
3965
+ if (coi.has(args[args.length - 1])) {
3966
+ var ret = coi.get(args[ctr]);
3967
+
3968
+ if (registered[ret.toString().substring(4)]) {
3969
+ // make sure it hasn't been flushed
3970
+ return ret;
3971
+ }
3972
+ }
3973
+ }
3974
+ var value = fn(args);
3975
+ if (inputCaches[args.length]) {
3976
+ var _ctr = 0,
3977
+ _coi = inputCaches[args.length];
3978
+ while (_ctr < args.length - 1) {
3979
+ _coi = _coi.get(args[_ctr]);
3980
+ _ctr++;
3981
+ }
3982
+ try {
3983
+ _coi.set(args[_ctr], value);
3984
+ } catch (err) {
3985
+ }
3986
+ }
3987
+ return value;
3988
+ };
3989
+ }
3990
+
3991
+ var cachedCss = typeof WeakMap !== 'undefined' ? multiIndexCache(_css) : _css;
3992
+
3993
+ function css() {
3994
+ for (var _len2 = arguments.length, rules = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
3995
+ rules[_key2] = arguments[_key2];
3996
+ }
3997
+
3998
+ if (rules[0] && rules[0].length && rules[0].raw) {
3999
+ throw new Error('you forgot to include glamor/babel in your babel plugins.');
4000
+ }
4001
+
4002
+ rules = (0, _clean2.default)(rules);
4003
+ if (!rules) {
4004
+ return nullrule;
4005
+ }
4006
+
4007
+ return cachedCss(rules);
4008
+ }
4009
+
4010
+ css.insert = function (css) {
4011
+ var spec = {
4012
+ id: hashify(css),
4013
+ css: css,
4014
+ type: 'raw'
4015
+ };
4016
+ register(spec);
4017
+ if (!inserted[spec.id]) {
4018
+ styleSheet.insert(spec.css);
4019
+ inserted[spec.id] = isBrowser ? true : [spec.css];
4020
+ }
4021
+ };
4022
+
4023
+ exports.insertRule = css.insert;
4024
+
4025
+ css.global = function (selector, style) {
4026
+ style = (0, _clean2.default)(style);
4027
+ if (style) {
4028
+ return css.insert(toCSS({ selector: selector, style: style }));
4029
+ }
4030
+ };
4031
+
4032
+ exports.insertGlobal = css.global;
4033
+
4034
+ function insertKeyframe(spec) {
4035
+ if (!inserted[spec.id]) {
4036
+ var inner = Object.keys(spec.keyframes).map(function (kf) {
4037
+ var result = plugins$1.keyframes.transform({ id: spec.id, name: kf, style: spec.keyframes[kf] });
4038
+ return result.name + '{' + (0, CSSPropertyOperations.createMarkupForStyles)(result.style) + '}';
4039
+ }).join('');
4040
+
4041
+ var rules = ['-webkit-', '-moz-', '-o-', ''].map(function (prefix) {
4042
+ return '@' + prefix + 'keyframes ' + (spec.name + '_' + spec.id) + '{' + inner + '}';
4043
+ });
4044
+ rules.forEach(function (rule) {
4045
+ return styleSheet.insert(rule);
4046
+ });
4047
+
4048
+ inserted[spec.id] = isBrowser ? true : rules;
4049
+ }
4050
+ }
4051
+ css.keyframes = function (name, kfs) {
4052
+ if (!kfs) {
4053
+ kfs = name, name = 'animation';
4054
+ }
4055
+
4056
+ // do not ignore empty keyframe definitions for now.
4057
+ kfs = (0, _clean2.default)(kfs) || {};
4058
+ var spec = {
4059
+ id: hashify({ name: name, kfs: kfs }),
4060
+ type: 'keyframes',
4061
+ name: name,
4062
+ keyframes: kfs
4063
+ };
4064
+ register(spec);
4065
+ insertKeyframe(spec);
4066
+ return name + '_' + spec.id;
4067
+ };
4068
+
4069
+ // we don't go all out for fonts as much, giving a simple font loading strategy
4070
+ // use a fancier lib if you need moar power
4071
+ css.fontFace = function (font) {
4072
+ font = (0, _clean2.default)(font);
4073
+ var spec = {
4074
+ id: hashify(font),
4075
+ type: 'font-face',
4076
+ font: font
4077
+ };
4078
+ register(spec);
4079
+ insertFontFace(spec);
4080
+
4081
+ return font.fontFamily;
4082
+ };
4083
+
4084
+ exports.fontFace = css.fontFace;
4085
+ exports.keyframes = css.keyframes;
4086
+
4087
+ function insertFontFace(spec) {
4088
+ if (!inserted[spec.id]) {
4089
+ var rule = '@font-face{' + (0, CSSPropertyOperations.createMarkupForStyles)(spec.font) + '}';
4090
+ styleSheet.insert(rule);
4091
+ inserted[spec.id] = isBrowser ? true : [rule];
4092
+ }
4093
+ }
4094
+
4095
+ // rehydrate the insertion cache with ids sent from
4096
+ // renderStatic / renderStaticOptimized
4097
+ function rehydrate(ids) {
4098
+ // load up ids
4099
+ (0, _objectAssign2.default)(inserted, ids.reduce(function (o, i) {
4100
+ return o[i] = true, o;
4101
+ }, {}));
4102
+ // assume css loaded separately
4103
+ }
4104
+
4105
+ // clears out the cache and empties the stylesheet
4106
+ // best for tests, though there might be some value for SSR.
4107
+
4108
+ function flush() {
4109
+ inserted = styleSheet.inserted = {};
4110
+ registered = styleSheet.registered = {};
4111
+ ruleCache = {};
4112
+ styleSheet.flush();
4113
+ styleSheet.inject();
4114
+ }
4115
+
4116
+ exports.presets = {
4117
+ mobile: '(min-width: 400px)',
4118
+ Mobile: '@media (min-width: 400px)',
4119
+ phablet: '(min-width: 550px)',
4120
+ Phablet: '@media (min-width: 550px)',
4121
+ tablet: '(min-width: 750px)',
4122
+ Tablet: '@media (min-width: 750px)',
4123
+ desktop: '(min-width: 1000px)',
4124
+ Desktop: '@media (min-width: 1000px)',
4125
+ hd: '(min-width: 1200px)',
4126
+ Hd: '@media (min-width: 1200px)'
4127
+ };
4128
+
4129
+ var style = exports.style = css;
4130
+
4131
+ function select(selector) {
4132
+ for (var _len3 = arguments.length, styles = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
4133
+ styles[_key3 - 1] = arguments[_key3];
4134
+ }
4135
+
4136
+ if (!selector) {
4137
+ return style(styles);
4138
+ }
4139
+ return css(_defineProperty({}, selector, styles));
4140
+ }
4141
+ exports.$ = select;
4142
+
4143
+ function parent(selector) {
4144
+ for (var _len4 = arguments.length, styles = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
4145
+ styles[_key4 - 1] = arguments[_key4];
4146
+ }
4147
+
4148
+ return css(_defineProperty({}, selector + ' &', styles));
4149
+ }
4150
+
4151
+ exports.merge = css;
4152
+ exports.compose = css;
4153
+
4154
+ function media(query) {
4155
+ for (var _len5 = arguments.length, rules = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
4156
+ rules[_key5 - 1] = arguments[_key5];
4157
+ }
4158
+
4159
+ return css(_defineProperty({}, '@media ' + query, rules));
4160
+ }
4161
+
4162
+ function pseudo(selector) {
4163
+ for (var _len6 = arguments.length, styles = Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
4164
+ styles[_key6 - 1] = arguments[_key6];
4165
+ }
4166
+
4167
+ return css(_defineProperty({}, selector, styles));
4168
+ }
4169
+
4170
+ // allllll the pseudoclasses
4171
+
4172
+ function active(x) {
4173
+ return pseudo(':active', x);
4174
+ }
4175
+
4176
+ function any(x) {
4177
+ return pseudo(':any', x);
4178
+ }
4179
+
4180
+ function checked(x) {
4181
+ return pseudo(':checked', x);
4182
+ }
4183
+
4184
+ function disabled(x) {
4185
+ return pseudo(':disabled', x);
4186
+ }
4187
+
4188
+ function empty(x) {
4189
+ return pseudo(':empty', x);
4190
+ }
4191
+
4192
+ function enabled(x) {
4193
+ return pseudo(':enabled', x);
4194
+ }
4195
+
4196
+ function _default(x) {
4197
+ return pseudo(':default', x); // note '_default' name
4198
+ }
4199
+
4200
+ function first(x) {
4201
+ return pseudo(':first', x);
4202
+ }
4203
+
4204
+ function firstChild(x) {
4205
+ return pseudo(':first-child', x);
4206
+ }
4207
+
4208
+ function firstOfType(x) {
4209
+ return pseudo(':first-of-type', x);
4210
+ }
4211
+
4212
+ function fullscreen(x) {
4213
+ return pseudo(':fullscreen', x);
4214
+ }
4215
+
4216
+ function focus(x) {
4217
+ return pseudo(':focus', x);
4218
+ }
4219
+
4220
+ function hover(x) {
4221
+ return pseudo(':hover', x);
4222
+ }
4223
+
4224
+ function indeterminate(x) {
4225
+ return pseudo(':indeterminate', x);
4226
+ }
4227
+
4228
+ function inRange(x) {
4229
+ return pseudo(':in-range', x);
4230
+ }
4231
+
4232
+ function invalid(x) {
4233
+ return pseudo(':invalid', x);
4234
+ }
4235
+
4236
+ function lastChild(x) {
4237
+ return pseudo(':last-child', x);
4238
+ }
4239
+
4240
+ function lastOfType(x) {
4241
+ return pseudo(':last-of-type', x);
4242
+ }
4243
+
4244
+ function left(x) {
4245
+ return pseudo(':left', x);
4246
+ }
4247
+
4248
+ function link(x) {
4249
+ return pseudo(':link', x);
4250
+ }
4251
+
4252
+ function onlyChild(x) {
4253
+ return pseudo(':only-child', x);
4254
+ }
4255
+
4256
+ function onlyOfType(x) {
4257
+ return pseudo(':only-of-type', x);
4258
+ }
4259
+
4260
+ function optional(x) {
4261
+ return pseudo(':optional', x);
4262
+ }
4263
+
4264
+ function outOfRange(x) {
4265
+ return pseudo(':out-of-range', x);
4266
+ }
4267
+
4268
+ function readOnly(x) {
4269
+ return pseudo(':read-only', x);
4270
+ }
4271
+
4272
+ function readWrite(x) {
4273
+ return pseudo(':read-write', x);
4274
+ }
4275
+
4276
+ function required(x) {
4277
+ return pseudo(':required', x);
4278
+ }
4279
+
4280
+ function right(x) {
4281
+ return pseudo(':right', x);
4282
+ }
4283
+
4284
+ function root(x) {
4285
+ return pseudo(':root', x);
4286
+ }
4287
+
4288
+ function scope(x) {
4289
+ return pseudo(':scope', x);
4290
+ }
4291
+
4292
+ function target(x) {
4293
+ return pseudo(':target', x);
4294
+ }
4295
+
4296
+ function valid(x) {
4297
+ return pseudo(':valid', x);
4298
+ }
4299
+
4300
+ function visited(x) {
4301
+ return pseudo(':visited', x);
4302
+ }
4303
+
4304
+ // parameterized pseudoclasses
4305
+ function dir(p, x) {
4306
+ return pseudo(':dir(' + p + ')', x);
4307
+ }
4308
+ function lang(p, x) {
4309
+ return pseudo(':lang(' + p + ')', x);
4310
+ }
4311
+ function not(p, x) {
4312
+ // should this be a plugin?
4313
+ var selector = p.split(',').map(function (x) {
4314
+ return x.trim();
4315
+ }).map(function (x) {
4316
+ return ':not(' + x + ')';
4317
+ });
4318
+ if (selector.length === 1) {
4319
+ return pseudo(':not(' + p + ')', x);
4320
+ }
4321
+ return select(selector.join(''), x);
4322
+ }
4323
+ function nthChild(p, x) {
4324
+ return pseudo(':nth-child(' + p + ')', x);
4325
+ }
4326
+ function nthLastChild(p, x) {
4327
+ return pseudo(':nth-last-child(' + p + ')', x);
4328
+ }
4329
+ function nthLastOfType(p, x) {
4330
+ return pseudo(':nth-last-of-type(' + p + ')', x);
4331
+ }
4332
+ function nthOfType(p, x) {
4333
+ return pseudo(':nth-of-type(' + p + ')', x);
4334
+ }
4335
+
4336
+ // pseudoelements
4337
+ function after(x) {
4338
+ return pseudo('::after', x);
4339
+ }
4340
+ function before(x) {
4341
+ return pseudo('::before', x);
4342
+ }
4343
+ function firstLetter(x) {
4344
+ return pseudo('::first-letter', x);
4345
+ }
4346
+ function firstLine(x) {
4347
+ return pseudo('::first-line', x);
4348
+ }
4349
+ function selection(x) {
4350
+ return pseudo('::selection', x);
4351
+ }
4352
+ function backdrop(x) {
4353
+ return pseudo('::backdrop', x);
4354
+ }
4355
+ function placeholder(x) {
4356
+ // https://github.com/threepointone/glamor/issues/14
4357
+ return css({ '::placeholder': x });
4358
+ }
4359
+
4360
+ /*** helpers for web components ***/
4361
+ // https://github.com/threepointone/glamor/issues/16
4362
+
4363
+ function cssFor() {
4364
+ for (var _len7 = arguments.length, rules = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
4365
+ rules[_key7] = arguments[_key7];
4366
+ }
4367
+
4368
+ rules = (0, _clean2.default)(rules);
4369
+ return rules ? rules.map(function (r) {
4370
+ var style = { label: [] };
4371
+ build(style, { src: r }); // mutative! but worth it.
4372
+ return deconstructedStyleToCSS(hashify(style), deconstruct(style)).join('');
4373
+ }).join('') : '';
4374
+ }
4375
+
4376
+ function attribsFor() {
4377
+ for (var _len8 = arguments.length, rules = Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
4378
+ rules[_key8] = arguments[_key8];
4379
+ }
4380
+
4381
+ rules = (0, _clean2.default)(rules);
4382
+ var htmlAttributes = rules ? rules.map(function (rule) {
4383
+ idFor(rule); // throwaway check for rule
4384
+ var key = Object.keys(rule)[0],
4385
+ value = rule[key];
4386
+ return key + '="' + (value || '') + '"';
4387
+ }).join(' ') : '';
4388
+
4389
+ return htmlAttributes;
4390
+ }
4391
+ });
4392
+
4393
+ export { color as c, lib as l };